]> gitweb.fperrin.net Git - Dictionary.git/commitdiff
Clean up error messaging.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 27 Sep 2015 16:15:46 +0000 (18:15 +0200)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 27 Sep 2015 16:15:46 +0000 (18:15 +0200)
Do not show error messages as Toast but Alerts.
Also add a button to error message.

src/com/hughes/android/dictionary/DictionaryManagerActivity.java

index 42a99309b815bb6f9e19cfa05b5402d0d8ac410a..d9b1eed447eb87f95940f4e51a97ad7c0a5fb598 100644 (file)
@@ -146,8 +146,7 @@ public class DictionaryManagerActivity extends ActionBarActivity {
                             "Download failed: status=" + status +
                                     ", reason=" + cursor.getString(cursor
                                             .getColumnIndex(DownloadManager.COLUMN_REASON)));
-                    Toast.makeText(context, getString(R.string.downloadFailed, dest),
-                            Toast.LENGTH_LONG).show();
+                    new AlertDialog.Builder(context).setTitle(getString(R.string.error)).setMessage(getString(R.string.downloadFailed, dest)).setNeutralButton("Close", null).show();
                     return;
                 }
 
@@ -174,8 +173,7 @@ public class DictionaryManagerActivity extends ActionBarActivity {
                     Toast.makeText(context, getString(R.string.installationFinished, dest),
                             Toast.LENGTH_LONG).show();
                 } catch (Exception e) {
-                    Toast.makeText(context, getString(R.string.unzippingFailed, dest),
-                            Toast.LENGTH_LONG).show();
+                    new AlertDialog.Builder(context).setTitle(getString(R.string.error)).setMessage(getString(R.string.unzippingFailed, dest)).setNeutralButton("Close", null).show();
                     Log.e(LOG, "Failed to unzip.", e);
                 } finally {
                     localZipFile.delete();
@@ -249,6 +247,7 @@ public class DictionaryManagerActivity extends ActionBarActivity {
                     R.string.unableToReadDictionaryDir,
                     dictDir.getAbsolutePath(),
                     Environment.getExternalStorageDirectory()));
+            builder.setNeutralButton("Close", null);
             builder.create().show();
         }