summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2024-09-14 11:41:37 +0200
committerGitHub <noreply@github.com>2024-09-14 11:41:37 +0200
commitf35e92c112b058c534a134b2314f6bc162d5a142 (patch)
treee9776fb71b69d5a42e412b0ec2ca4d46eabc4d34
parentb06caeadec504ef860654e9aca3813bdfabbc2a7 (diff)
downloadAntennaPod-f35e92c112b058c534a134b2314f6bc162d5a142.zip
Better error message when nextcloud could not be reached (#7403)
-rw-r--r--ui/i18n/src/main/res/values/strings.xml1
-rw-r--r--ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/NextcloudAuthenticationFragment.java16
-rw-r--r--ui/preferences/src/main/res/layout/nextcloud_auth_dialog.xml8
3 files changed, 14 insertions, 11 deletions
diff --git a/ui/i18n/src/main/res/values/strings.xml b/ui/i18n/src/main/res/values/strings.xml
index 751dad918..77214d409 100644
--- a/ui/i18n/src/main/res/values/strings.xml
+++ b/ui/i18n/src/main/res/values/strings.xml
@@ -674,6 +674,7 @@
<string name="gpodnetsync_pref_report_successful">Successful</string>
<string name="gpodnetsync_pref_report_failed">Failed</string>
<string name="gpodnetsync_username_characters_error">Usernames may only contain letters, digits, hyphens and underscores.</string>
+ <string name="nextcloud_login_error_generic"><![CDATA[Unable to log into your Nextcloud.\n\n- Check your network connection.\n- Confirm that you are using the correct server address.\n- Make sure that the gpoddersync Nextcloud plugin is installed.]]></string>
<!-- Directory chooser -->
<string name="choose_data_directory">Choose data folder</string>
diff --git a/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/NextcloudAuthenticationFragment.java b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/NextcloudAuthenticationFragment.java
index 5df85efe2..26cc08a51 100644
--- a/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/NextcloudAuthenticationFragment.java
+++ b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/synchronization/NextcloudAuthenticationFragment.java
@@ -3,6 +3,9 @@ package de.danoeh.antennapod.ui.preferences.screen.synchronization;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.style.ForegroundColorSpan;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -55,7 +58,6 @@ public class NextcloudAuthenticationFragment extends DialogFragment
}
private void startLoginFlow() {
- viewBinding.errorText.setVisibility(View.GONE);
viewBinding.chooseHostButton.setVisibility(View.GONE);
viewBinding.loginProgressContainer.setVisibility(View.VISIBLE);
viewBinding.serverUrlText.setEnabled(false);
@@ -106,9 +108,17 @@ public class NextcloudAuthenticationFragment extends DialogFragment
@Override
public void onNextcloudAuthError(String errorMessage) {
viewBinding.loginProgressContainer.setVisibility(View.GONE);
- viewBinding.errorText.setVisibility(View.VISIBLE);
- viewBinding.errorText.setText(errorMessage);
viewBinding.chooseHostButton.setVisibility(View.VISIBLE);
viewBinding.serverUrlText.setEnabled(true);
+
+ final MaterialAlertDialogBuilder errorDialog = new MaterialAlertDialogBuilder(getContext());
+ errorDialog.setTitle(R.string.error_label);
+ String genericMessage = getString(R.string.nextcloud_login_error_generic);
+ SpannableString combinedMessage = new SpannableString(genericMessage + "\n\n" + errorMessage);
+ combinedMessage.setSpan(new ForegroundColorSpan(0x88888888),
+ genericMessage.length(), combinedMessage.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ errorDialog.setMessage(combinedMessage);
+ errorDialog.setPositiveButton(android.R.string.ok, null);
+ errorDialog.show();
}
}
diff --git a/ui/preferences/src/main/res/layout/nextcloud_auth_dialog.xml b/ui/preferences/src/main/res/layout/nextcloud_auth_dialog.xml
index 0f25a271f..8a8ba6a82 100644
--- a/ui/preferences/src/main/res/layout/nextcloud_auth_dialog.xml
+++ b/ui/preferences/src/main/res/layout/nextcloud_auth_dialog.xml
@@ -56,14 +56,6 @@
</LinearLayout>
- <TextView
- android:id="@+id/errorText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:visibility="gone"
- android:textColor="?attr/icon_red"
- android:layout_marginBottom="16dp" />
-
<Button
android:id="@+id/chooseHostButton"
android:layout_width="match_parent"