diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4679163f6..b20d5c56b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1040,6 +1040,9 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
Imported 1 account from %s
Failed to export settings: %s
Failed from import settings from %s:%s
-
+ Export succeeded
+ Export failed
+ Import succeeded
+ Import failed
diff --git a/src/com/fsck/k9/activity/Accounts.java b/src/com/fsck/k9/activity/Accounts.java
index e7a9213ce..c1f81bd4e 100644
--- a/src/com/fsck/k9/activity/Accounts.java
+++ b/src/com/fsck/k9/activity/Accounts.java
@@ -1,6 +1,7 @@
package com.fsck.k9.activity;
+import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ContentResolver;
@@ -815,9 +816,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
public void run()
{
mHandler.progress(false);
- String toastText = Accounts.this.getString(R.string.settings_import_failure, fileName, message );
- Toast toast = Toast.makeText(Accounts.this.getApplication(), toastText, 1);
- toast.show();
+ showDialog(Accounts.this, R.string.settings_import_failed_header, Accounts.this.getString(R.string.settings_import_failure, fileName, message));
}
});
}
@@ -829,12 +828,11 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
public void run()
{
mHandler.progress(false);
- String toastText =
+ String messageText =
numAccounts != 1
? Accounts.this.getString(R.string.settings_import_success_multiple, numAccounts, fileName )
: Accounts.this.getString(R.string.settings_import_success_single, fileName );
- Toast toast = Toast.makeText(Accounts.this.getApplication(), toastText, 1);
- toast.show();
+ showDialog(Accounts.this, R.string.settings_import_success_header, messageText);
refresh();
}
});
@@ -855,6 +853,22 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
toast.show();
}
}
+
+ private static void showDialog(final Activity activity, int headerRes, String message)
+ {
+ final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ builder.setTitle(headerRes);
+ builder.setMessage(message);
+ builder.setPositiveButton(R.string.okay_action,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ }
+ });
+
+ builder.show();
+ }
class AccountsAdapter extends ArrayAdapter {
public AccountsAdapter(BaseAccount[] accounts) {
diff --git a/src/com/fsck/k9/activity/ExportHelper.java b/src/com/fsck/k9/activity/ExportHelper.java
index 864689935..2b39a432f 100644
--- a/src/com/fsck/k9/activity/ExportHelper.java
+++ b/src/com/fsck/k9/activity/ExportHelper.java
@@ -1,6 +1,8 @@
package com.fsck.k9.activity;
import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
import android.widget.Toast;
import com.fsck.k9.Account;
@@ -25,9 +27,7 @@ public class ExportHelper {
activity.runOnUiThread(new Runnable() {
public void run() {
progressable.setProgress(false);
- String toastText = activity.getString(R.string.settings_export_failure, message);
- Toast toast = Toast.makeText(activity.getApplication(), toastText, Toast.LENGTH_LONG);
- toast.show();
+ showDialog(activity, R.string.settings_export_failed_header, activity.getString(R.string.settings_export_failure, message));
}
});
}
@@ -36,9 +36,7 @@ public class ExportHelper {
activity.runOnUiThread(new Runnable() {
public void run() {
progressable.setProgress(false);
- String toastText = activity.getString(R.string.settings_export_success, fileName);
- Toast toast = Toast.makeText(activity.getApplication(), toastText, Toast.LENGTH_LONG);
- toast.show();
+ showDialog(activity, R.string.settings_export_success_header, activity.getString(R.string.settings_export_success, fileName));
}
});
}
@@ -50,5 +48,19 @@ public class ExportHelper {
});
dialog.show();
}
-
+ private static void showDialog(final Activity activity, int headerRes, String message)
+ {
+ final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ builder.setTitle(headerRes);
+ builder.setMessage(message);
+ builder.setPositiveButton(R.string.okay_action,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ }
+ });
+
+ builder.show();
+ }
}