diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-05-29 09:58:58 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-05-29 09:58:58 +0300 |
commit | 9b661cb5e465ec331884d0c656ce09c86143cd55 (patch) | |
tree | 4cdda6dc616886d0ee8eb8ce08a0ab8921cc2072 /app/src/main | |
parent | 0876aaf720b2e7d520cf1ff9445120cfef85a3aa (diff) |
Upgrade to SSO 0.5.1 and enable action buttons for exceptions
Diffstat (limited to 'app/src/main')
3 files changed, 14 insertions, 12 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/exception/ExceptionDialogFragment.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/exception/ExceptionDialogFragment.java index cdc9e11d8..7d2d0c983 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/exception/ExceptionDialogFragment.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/exception/ExceptionDialogFragment.java @@ -32,6 +32,7 @@ import it.niedermann.nextcloud.deck.model.Account; import it.niedermann.nextcloud.deck.ui.exception.tips.TipsAdapter; import it.niedermann.nextcloud.deck.util.ExceptionUtil; +import static android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS; import static it.niedermann.nextcloud.deck.util.ClipboardUtil.copyToClipboard; public class ExceptionDialogFragment extends AppCompatDialogFragment { @@ -76,7 +77,7 @@ public class ExceptionDialogFragment extends AppCompatDialogFragment { if (throwable instanceof TokenMismatchException) { adapter.add(R.string.error_dialog_tip_token_mismatch_retry); adapter.add(R.string.error_dialog_tip_token_mismatch_clear_storage); - Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS) + Intent intent = new Intent(ACTION_APPLICATION_DETAILS_SETTINGS) .setData(Uri.parse("package:" + BuildConfig.APPLICATION_ID)) .putExtra(INTENT_EXTRA_BUTTON_TEXT, R.string.error_action_open_deck_info); adapter.add(R.string.error_dialog_tip_clear_storage, intent); diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/exception/tips/TipsViewHolder.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/exception/tips/TipsViewHolder.java index bb3f8525b..622a32e3b 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/exception/tips/TipsViewHolder.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/exception/tips/TipsViewHolder.java @@ -9,6 +9,8 @@ import androidx.recyclerview.widget.RecyclerView; import it.niedermann.nextcloud.deck.databinding.ItemTipBinding; +import static it.niedermann.nextcloud.deck.ui.exception.ExceptionDialogFragment.INTENT_EXTRA_BUTTON_TEXT; + public class TipsViewHolder extends RecyclerView.ViewHolder { private final ItemTipBinding binding; @@ -20,14 +22,13 @@ public class TipsViewHolder extends RecyclerView.ViewHolder { public void bind(TipsModel tip, Consumer<Intent> actionButtonClickedListener) { binding.tip.setText(tip.getText()); - // TODO Requires https://github.com/nextcloud/Android-SingleSignOn/pull/203 to be merged, released and used, otherwise will crash -// final Intent actionIntent = tip.getActionIntent(); -// if (actionIntent != null && actionIntent.hasExtra(INTENT_EXTRA_BUTTON_TEXT)) { -// binding.actionButton.setVisibility(View.VISIBLE); -// binding.actionButton.setText(actionIntent.getIntExtra(INTENT_EXTRA_BUTTON_TEXT, 0)); -// binding.actionButton.setOnClickListener((v) -> actionButtonClickedListener.accept(actionIntent)); -// } else { - binding.actionButton.setVisibility(View.GONE); -// } + final Intent actionIntent = tip.getActionIntent(); + if (actionIntent != null && actionIntent.hasExtra(INTENT_EXTRA_BUTTON_TEXT)) { + binding.actionButton.setVisibility(View.VISIBLE); + binding.actionButton.setText(actionIntent.getIntExtra(INTENT_EXTRA_BUTTON_TEXT, 0)); + binding.actionButton.setOnClickListener((v) -> actionButtonClickedListener.accept(actionIntent)); + } else { + binding.actionButton.setVisibility(View.GONE); + } } }
\ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e2f4c8084..8474efbf0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -238,12 +238,12 @@ <string name="error_dialog_title">Oh no - What now? 🙁</string> <string name="error_dialog_tip_token_mismatch_retry">Please try to force close the app and restart it again. There might have been an incorrect connection to the Nextcloud app.</string> <string name="error_dialog_tip_token_mismatch_clear_storage">If the issue persists, try to clear the storage of both apps: Nextcloud and Nextcloud Deck to solve this issue.</string> - <string name="error_dialog_tip_clear_storage">You can clear the storage by opening android settings → Apps → Nextcloud / Nextcloud Deck → Storage → Clear storage.</string> + <string name="error_dialog_tip_clear_storage">You can clear the storage by opening the app info and selecting Storage → Clear storage.</string> <string name="error_dialog_tip_files_outdated">Your Nextcloud app seems to be outdated. Please visit the Play Store or F-Droid to get the latest version.</string> <string name="error_dialog_tip_files_force_stop">Something seems to be wrong with your Nextcloud app. Please try to force stop both, the Nextcloud app and the Nextcloud Deck app.</string> <string name="error_dialog_tip_files_delete_storage">If force stopping them does not help, you can try to clear the storage of both apps.</string> <string name="error_dialog_timeout_instance">There wasn\'t a response from your server in the given time. Please make sure your instance is running well.</string> - <string name="error_dialog_timeout_toggle">Check your network connection. Sometime toggling the mobile data or Wi-Fi off and on again can help.</string> + <string name="error_dialog_timeout_toggle">Check your network connection. Sometimes toggling the mobile data or Wi-Fi off and on again can help.</string> <string name="error_dialog_check_server">The response of your server was not correct. Please check whether you can access the Deck app via web interface.</string> <string name="error_dialog_check_server_logs">There is an issue with your Nextcloud setup. Please have a look into the server log files.</string> <string name="error_dialog_check_maintenance">Please check whether your Nextcloud instance is not currently in maintenance mode.</string> |