Better error message when nextcloud could not be reached (#7403)
This commit is contained in:
parent
b06caeadec
commit
f35e92c112
|
@ -674,6 +674,7 @@
|
||||||
<string name="gpodnetsync_pref_report_successful">Successful</string>
|
<string name="gpodnetsync_pref_report_successful">Successful</string>
|
||||||
<string name="gpodnetsync_pref_report_failed">Failed</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="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 -->
|
<!-- Directory chooser -->
|
||||||
<string name="choose_data_directory">Choose data folder</string>
|
<string name="choose_data_directory">Choose data folder</string>
|
||||||
|
|
|
@ -3,6 +3,9 @@ package de.danoeh.antennapod.ui.preferences.screen.synchronization;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.Spannable;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.text.style.ForegroundColorSpan;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
@ -55,7 +58,6 @@ public class NextcloudAuthenticationFragment extends DialogFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startLoginFlow() {
|
private void startLoginFlow() {
|
||||||
viewBinding.errorText.setVisibility(View.GONE);
|
|
||||||
viewBinding.chooseHostButton.setVisibility(View.GONE);
|
viewBinding.chooseHostButton.setVisibility(View.GONE);
|
||||||
viewBinding.loginProgressContainer.setVisibility(View.VISIBLE);
|
viewBinding.loginProgressContainer.setVisibility(View.VISIBLE);
|
||||||
viewBinding.serverUrlText.setEnabled(false);
|
viewBinding.serverUrlText.setEnabled(false);
|
||||||
|
@ -106,9 +108,17 @@ public class NextcloudAuthenticationFragment extends DialogFragment
|
||||||
@Override
|
@Override
|
||||||
public void onNextcloudAuthError(String errorMessage) {
|
public void onNextcloudAuthError(String errorMessage) {
|
||||||
viewBinding.loginProgressContainer.setVisibility(View.GONE);
|
viewBinding.loginProgressContainer.setVisibility(View.GONE);
|
||||||
viewBinding.errorText.setVisibility(View.VISIBLE);
|
|
||||||
viewBinding.errorText.setText(errorMessage);
|
|
||||||
viewBinding.chooseHostButton.setVisibility(View.VISIBLE);
|
viewBinding.chooseHostButton.setVisibility(View.VISIBLE);
|
||||||
viewBinding.serverUrlText.setEnabled(true);
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,14 +56,6 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</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
|
<Button
|
||||||
android:id="@+id/chooseHostButton"
|
android:id="@+id/chooseHostButton"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in New Issue