From: Reimar Döffinger Date: Sun, 27 Sep 2015 16:15:46 +0000 (+0200) Subject: Clean up error messaging. X-Git-Url: http://gitweb.fperrin.net/?p=Dictionary.git;a=commitdiff_plain;h=9a73226c5d6769ca7ac50e72a5585f65a6bdc086 Clean up error messaging. Do not show error messages as Toast but Alerts. Also add a button to error message. --- diff --git a/src/com/hughes/android/dictionary/DictionaryManagerActivity.java b/src/com/hughes/android/dictionary/DictionaryManagerActivity.java index 42a9930..d9b1eed 100644 --- a/src/com/hughes/android/dictionary/DictionaryManagerActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryManagerActivity.java @@ -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(); }