</head>
<body>
<!-- Don't use links in the text below, it crashes the app. -->
-Thanks for updating to QuickDic 3.1.
+Thanks for updating to QuickDic 3.2.
<p>New features:</p>
<ul>
-<li>Search for multiple words at once (separated by spaces).</li>
-<li>All words are hyperlinks: long-press any word in a dictionary
-to lookup that word.</li>
+<li>Go straight to last-used dictionary on launch.</li>
+
<li>Easier dictionary switching: long-press the switch-language
button.</li>
<li>New English dictionaries: Azeri, Basque, Breton, Burmese,
\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
public class DictionaryManagerActivity extends ListActivity {
static final String LOG = "QuickDic";
- static boolean canAutoLaunch = true;
+ static final long AUTO_LAUNCH_WAIT_MILLIS = 20 * 1000;
+ static long lastAutoLaunchMillis = -1;
+ static boolean blockAutoLaunch = false;
DictionaryApplication application;
Adapter adapter;
// ContextMenu.
registerForContextMenu(getListView());
+ blockAutoLaunch = false;
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
final String thanksForUpdatingLatestVersion = getString(R.string.thanksForUpdatingVersion);
if (!prefs.getString(C.THANKS_FOR_UPDATING_VERSION, "").equals(thanksForUpdatingLatestVersion)) {
- canAutoLaunch = false;
+ blockAutoLaunch = true;
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(false);
final WebView webView = new WebView(getApplicationContext());
alert.getWindow().setAttributes(layoutParams);
prefs.edit().putString(C.THANKS_FOR_UPDATING_VERSION, thanksForUpdatingLatestVersion).commit();
}
-
- if (!getIntent().getBooleanExtra(C.CAN_AUTO_LAUNCH_DICT, true)) {
- canAutoLaunch = false;
- }
}
@Override
startActivity(getIntent());
}
+ final long now = System.currentTimeMillis();
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
- if (canAutoLaunch && prefs.contains(C.DICT_FILE) && prefs.contains(C.INDEX_INDEX)) {
- canAutoLaunch = false; // Only autolaunch once per-process, on startup.
+ if (now - lastAutoLaunchMillis > AUTO_LAUNCH_WAIT_MILLIS &&
+ getIntent().getBooleanExtra(C.CAN_AUTO_LAUNCH_DICT, true) &&
+ prefs.contains(C.DICT_FILE) &&
+ prefs.contains(C.INDEX_INDEX) &&
+ !blockAutoLaunch) {
Log.d(LOG, "Skipping Dictionary List, going straight to dictionary.");
startActivity(DictionaryActivity.getLaunchIntent(new File(prefs.getString(C.DICT_FILE, "")), prefs.getInt(C.INDEX_INDEX, 0), prefs.getString(C.SEARCH_TOKEN, "")));
+ lastAutoLaunchMillis = now;
// Don't finish, so that user can hit back and get here.
//finish();
return;