X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2FDictionaryActivity.java;h=7517441d49c034cce939e2f661c894a4140e44c2;hb=bc9afa81039eaa41cca52d7047df64f46458dc40;hp=b5451a79d1d561c85b3dac2a404b420997761540;hpb=49583e178d3673fd1cade2f306d97303ffbd4a0a;p=Dictionary.git diff --git a/src/com/hughes/android/dictionary/DictionaryActivity.java b/src/com/hughes/android/dictionary/DictionaryActivity.java index b5451a7..7517441 100644 --- a/src/com/hughes/android/dictionary/DictionaryActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryActivity.java @@ -257,7 +257,7 @@ public class DictionaryActivity extends ActionBarActivity { final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); // Don't auto-launch if this fails. - prefs.edit().remove(C.DICT_FILE).commit(); + prefs.edit().remove(C.DICT_FILE).remove(C.INDEX_SHORT_NAME).commit(); setContentView(R.layout.dictionary_activity); @@ -563,7 +563,7 @@ public class DictionaryActivity extends ActionBarActivity { setSearchText(text, true); Log.d(LOG, "Trying to restore searchText=" + text); - setDictionaryPrefs(this, dictFile, index.shortName, searchView.getQuery().toString()); + setDictionaryPrefs(this, dictFile, index.shortName); updateLangButton(); searchView.requestFocus(); @@ -678,14 +678,14 @@ public class DictionaryActivity extends ActionBarActivity { } private static void setDictionaryPrefs(final Context context, final File dictFile, - final String indexShortName, final String searchToken) { + final String indexShortName) { final SharedPreferences.Editor prefs = PreferenceManager.getDefaultSharedPreferences( context).edit(); if (dictFile != null) { prefs.putString(C.DICT_FILE, dictFile.getPath()); prefs.putString(C.INDEX_SHORT_NAME, indexShortName); } - prefs.putString(C.SEARCH_TOKEN, ""); // Don't need to save search token. + prefs.remove(C.SEARCH_TOKEN); // Don't need to save search token. prefs.commit(); } @@ -836,7 +836,7 @@ public class DictionaryActivity extends ActionBarActivity { final LinearLayout result = new LinearLayout(parent.getContext()); - for (int i = 0; i < dictionaryInfo.indexInfos.size(); ++i) { + for (int i = 0; dictionaryInfo.indexInfos != null && i < dictionaryInfo.indexInfos.size(); ++i) { final IndexInfo indexInfo = dictionaryInfo.indexInfos.get(i); final View button = IsoUtils.INSTANCE.createButton(parent.getContext(), dictionaryInfo, indexInfo, application.languageButtonPixels); @@ -1298,7 +1298,7 @@ public class DictionaryActivity extends ActionBarActivity { indexAdapter = new IndexAdapter(index); setListAdapter(indexAdapter); Log.d(LOG, "changingIndex, newLang=" + index.longName); - setDictionaryPrefs(this, dictFile, index.shortName, searchView.getQuery().toString()); + setDictionaryPrefs(this, dictFile, index.shortName); updateLangButton(); } setSearchText(newSearchText, true, hideKeyboard); @@ -1583,16 +1583,13 @@ public class DictionaryActivity extends ActionBarActivity { // Set the columns in the table. if (r > 0) { final TextView bullet = new TextView(tableRow.getContext()); - bullet.setText(" • "); + bullet.setText(" •"); tableRow.addView(bullet); } tableRow.addView(col1, layoutParams); - final TextView margin = new TextView(tableRow.getContext()); - margin.setText(" "); - tableRow.addView(margin); if (r > 0) { final TextView bullet = new TextView(tableRow.getContext()); - bullet.setText(" • "); + bullet.setText(" •"); tableRow.addView(bullet); } tableRow.addView(col2, layoutParams);