\r
application = (DictionaryApplication) getApplication();\r
theme = application.getSelectedTheme();\r
-\r
- // Clear them so that if something goes wrong, we won't relaunch.\r
- clearDictionaryPrefs(this);\r
\r
final Intent intent = getIntent();\r
dictFile = new File(intent.getStringExtra(C.DICT_FILE));\r
prefs.commit();\r
}\r
\r
- private static void clearDictionaryPrefs(final Context context) {\r
- final SharedPreferences.Editor prefs = PreferenceManager.getDefaultSharedPreferences(context).edit();\r
- prefs.remove(C.DICT_FILE);\r
- prefs.remove(C.INDEX_INDEX);\r
- prefs.remove(C.SEARCH_TOKEN);\r
- prefs.commit();\r
- }\r
-\r
-\r
@Override\r
protected void onDestroy() {\r
super.onDestroy();\r
Log.d(LOG, "onUpDownButton, destIndexEntry=" + dest.token);\r
searchText.removeTextChangedListener(searchTextWatcher);\r
searchText.setText(dest.token);\r
- Selection.moveToRightEdge(searchText.getText(), searchText.getLayout());\r
+ if (searchText.getLayout() != null) {\r
+ // Surprising, but this can otherwise crash sometimes...\r
+ Selection.moveToRightEdge(searchText.getText(), searchText.getLayout());\r
+ }\r
jumpToRow(index.sortedIndexEntries.get(destIndexEntry).startRow);\r
searchText.addTextChangedListener(searchTextWatcher);\r
}\r
}\r
if (keyCode == KeyEvent.KEYCODE_BACK) {\r
Log.d(LOG, "Clearing dictionary prefs.");\r
- DictionaryActivity.clearDictionaryPrefs(this);\r
+ // Pretend that we just autolaunched so that we won't do it again.\r
+ DictionaryManagerActivity.lastAutoLaunchMillis = System.currentTimeMillis();\r
}\r
if (keyCode == KeyEvent.KEYCODE_ENTER) {\r
Log.d(LOG, "Trying to hide soft keyboard.");\r