diff options
author | Parménides GV <parmegv@sdf.org> | 2013-11-07 10:43:03 +0100 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2013-12-10 18:16:07 +0100 |
commit | 0bcf72490f726825121e355afbeaf5b14636eb4d (patch) | |
tree | 26ede1c88c45a60a8b36c44b745649edd077f1d0 /src/se/leap/bitmaskclient/DownloadFailedDialog.java | |
parent | e89dc12bb93da0a638d9a199af4d91a54aa3556e (diff) |
Retry button on failed downloads.
Next step: remove the provider from the list (big security hole, since all providers present on the list are assumed to be secure).
Diffstat (limited to 'src/se/leap/bitmaskclient/DownloadFailedDialog.java')
-rw-r--r-- | src/se/leap/bitmaskclient/DownloadFailedDialog.java | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/se/leap/bitmaskclient/DownloadFailedDialog.java b/src/se/leap/bitmaskclient/DownloadFailedDialog.java index 3ce101a6..72455b2f 100644 --- a/src/se/leap/bitmaskclient/DownloadFailedDialog.java +++ b/src/se/leap/bitmaskclient/DownloadFailedDialog.java @@ -17,6 +17,8 @@ package se.leap.bitmaskclient; import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.NewProviderDialog.NewProviderDialogInterface; +import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; @@ -47,7 +49,13 @@ public class DownloadFailedDialog extends DialogFragment { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(reason_to_fail) - .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { + .setPositiveButton(R.string.retry, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + interface_with_ConfigurationWizard.retrySetUpProvider(); + } + }) + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } @@ -56,4 +64,21 @@ public class DownloadFailedDialog extends DialogFragment { // Create the AlertDialog object and return it return builder.create(); } + + public interface DownloadFailedDialogInterface { + public void retrySetUpProvider(); + } + + DownloadFailedDialogInterface interface_with_ConfigurationWizard; + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + try { + interface_with_ConfigurationWizard = (DownloadFailedDialogInterface) activity; + } catch (ClassCastException e) { + throw new ClassCastException(activity.toString() + + " must implement NoticeDialogListener"); + } + } } |