+// Copyright 2011 Google Inc. All Rights Reserved.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the "License");\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+\r
package com.hughes.android.dictionary;\r
\r
import java.io.File;\r
this).read(C.DICTIONARY_CONFIGS, QuickDicConfig.class);\r
dictIndex = prefs.getInt(C.DICT_INDEX, 0) ;\r
final DictionaryConfig dictionaryConfig = quickDicConfig.dictionaryConfigs.get(dictIndex);\r
+ this.setTitle("QuickDic: " + dictionaryConfig.name);\r
dictRaf = new RandomAccessFile(dictionaryConfig.localFile, "r");\r
dictionary = new Dictionary(dictRaf); \r
} catch (Exception e) {\r
\r
setContentView(R.layout.dictionary_activity);\r
searchText = (EditText) findViewById(R.id.SearchText);\r
+ \r
langButton = (Button) findViewById(R.id.LangButton);\r
\r
searchText.requestFocus();\r
searchText.requestFocus();\r
Log.d(LOG, "Trying to show soft keyboard.");\r
final InputMethodManager manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);\r
- manager.showSoftInput(searchText, InputMethodManager.SHOW_IMPLICIT);\r
+ manager.showSoftInput(searchText, InputMethodManager.SHOW_FORCED);\r
}\r
\r
void updateLangButton() {\r
});\r
}\r
\r
+ {\r
+ final MenuItem about = menu.add(getString(R.string.about));\r
+ about.setOnMenuItemClickListener(new OnMenuItemClickListener() {\r
+ public boolean onMenuItemClick(final MenuItem menuItem) {\r
+ final Intent intent = new Intent().setClassName(AboutActivity.class\r
+ .getPackage().getName(), AboutActivity.class.getCanonicalName());\r
+ startActivity(intent);\r
+ return false;\r
+ }\r
+ });\r
+ }\r
+\r
return true;\r
}\r
\r
rawText.append(row.getTokenRow(true).getToken()).append("\t");\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
\r
void onCopy(final RowBase row) {\r
+ // Request focus so that if we start typing again, it clears the text input.\r
+ getListView().requestFocus();\r
+\r
Log.d(LOG, "Copy, row=" + row);\r
final StringBuilder result = new StringBuilder();\r
result.append(row.getRawText(false));\r
Log.d(LOG, "Clearing dictionary prefs.");\r
DictionaryActivity.clearDictionaryPrefs(this);\r
}\r
+ if (keyCode == KeyEvent.KEYCODE_ENTER) {\r
+// Log.d(LOG, "Trying to hide soft keyboard.");\r
+// final InputMethodManager manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);\r
+// manager.hideSoftInputFromWindow(searchText, InputMethodManager.SHOW_FORCED);\r
+\r
+ }\r
return super.onKeyDown(keyCode, event);\r
}\r
\r