-
<LinearLayout android:id="@+id/LinearLayout01"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android">
<ScrollView android:id="@+id/ScrollView01"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
- android:layout_height="wrap_content">
+ android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_weight="1.0"
/>
- <LinearLayout
- android:id="@+id/LinearLayout01"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- <TextView
- android:id="@+id/DictionaryListHeader"
- android:hint="@string/selectADictionary"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:imeOptions="actionSearch|flagNoEnterAction|flagNoExtractUi"
- android:inputType="text"/>
- </LinearLayout>
+ <TextView
+ android:id="@+id/DictionaryListHeader"
+ android:hint="@string/selectADictionary"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:imeOptions="actionSearch|flagNoEnterAction|flagNoExtractUi"
+ android:inputType="text"/>
</LinearLayout>
import android.preference.PreferenceManager;\r
import android.text.ClipboardManager;\r
import android.text.Editable;\r
+import android.text.Selection;\r
import android.text.Spannable;\r
import android.text.TextWatcher;\r
import android.text.style.StyleSpan;\r
\r
@Override\r
public void onCreate(Bundle savedInstanceState) {\r
+ Log.d(LOG, "onCreate:" + this);\r
((DictionaryApplication)getApplication()).applyTheme(this);\r
- \r
super.onCreate(savedInstanceState);\r
- Log.d(LOG, "onCreate:" + this);\r
\r
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);\r
\r
\r
@Override\r
protected void onListItemClick(ListView l, View v, int row, long id) {\r
+ defocusSearchText();\r
+ \r
if (clickOpensContextMenu && dictRaf != null) {\r
openContextMenu(v);\r
}\r
}\r
\r
void onAppendToWordList(final RowBase row) {\r
+ defocusSearchText();\r
+ \r
final StringBuilder rawText = new StringBuilder();\r
rawText.append(\r
new SimpleDateFormat("yyyy.MM.dd HH:mm:ss").format(new Date()))\r
rawText.append(row.getRawText(saveOnlyFirstSubentry));\r
Log.d(LOG, "Writing : " + rawText);\r
\r
- // Request focus so that if we start typing again, it clears the text input.\r
- getListView().requestFocus();\r
-\r
try {\r
wordList.getParentFile().mkdirs();\r
final PrintWriter out = new PrintWriter(\r
}\r
return;\r
}\r
-\r
- void onCopy(final RowBase row) {\r
+ \r
+ /**\r
+ * Called when user clicks outside of search text, so that they can start\r
+ * typing again immediately.\r
+ */\r
+ void defocusSearchText() {\r
+ //Log.d(LOG, "defocusSearchText");\r
// Request focus so that if we start typing again, it clears the text input.\r
getListView().requestFocus();\r
+ \r
+ // Visual indication that a new keystroke will clear the search text.\r
+ searchText.selectAll();\r
+ }\r
+\r
+ void onCopy(final RowBase row) {\r
+ defocusSearchText();\r
\r
Log.d(LOG, "Copy, row=" + row);\r
final StringBuilder result = new StringBuilder();\r
searchText.setText("" + (char) event.getUnicodeChar());\r
onSearchTextChange(searchText.getText().toString());\r
searchText.requestFocus();\r
+ Selection.moveToRightEdge(searchText.getText(), searchText.getLayout());\r
}\r
return true;\r
}\r
int openIndex = 0;
String openWord = "";
+ @Override
+ public String toString() {
+ return name;
+ }
+
+
}
quickDicConfig.currentVersion = QuickDicConfig.LATEST_VERSION;
PersistentObjectCache.init(this).write(C.DICTIONARY_CONFIGS, quickDicConfig);
}
+
+ Log.d(LOG, "DictionaryList: " + quickDicConfig.dictionaryConfigs);
setListAdapter(new Adapter());
-
}
public boolean onCreateOptionsMenu(final Menu menu) {
private static final long serialVersionUID = 6711617368780900979L;
// Just increment this to have them all update...
- static final int LATEST_VERSION = 5;
+ static final int LATEST_VERSION = 6;
final List<DictionaryConfig> dictionaryConfigs = new ArrayList<DictionaryConfig>();
int currentVersion = LATEST_VERSION;
}
static final String BASE_URL = "http://quickdic-dictionary.googlecode.com/files/";
+ static final String VERSION_SUFFIX = "v002";
public void addDefaultDictionaries() {
{
final DictionaryConfig config = new DictionaryConfig();
config.name = "German-English";
- config.downloadUrl = BASE_URL + "DE-EN_chemnitz_enwiktionary.quickdic.zip";
+ config.downloadUrl = String.format("%sDE-EN_chemnitz_enwiktionary.quickdic.%s.zip", BASE_URL, VERSION_SUFFIX);
config.localFile = "/sdcard/quickDic/DE-EN_chemnitz_enwiktionary.quickdic";
addOrReplace(config);
}
}
final DictionaryConfig config = new DictionaryConfig();
config.name = String.format("English-%s", Language.isoCodeToWikiName.get(iso));
- config.downloadUrl = String.format("%sEN-%s_enwiktionary.v002.quickdic.zip", BASE_URL, iso);
+ config.downloadUrl = String.format("%sEN-%s_enwiktionary.quickdic.%s.zip", BASE_URL, iso, VERSION_SUFFIX);
config.localFile = String.format("/sdcard/quickDic/EN-%s_enwiktionary.quickdic", iso);
addOrReplace(config);
}
-
}
private void addOrReplace(final DictionaryConfig dictionaryConfig) {