From 0bcf72490f726825121e355afbeaf5b14636eb4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Thu, 7 Nov 2013 10:43:03 +0100 Subject: 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). --- .../leap/bitmaskclient/DownloadFailedDialog.java | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src/se/leap/bitmaskclient/DownloadFailedDialog.java') 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"); + } + } } -- cgit v1.2.3