* -> language in which the phrase is written to -> to which
* language shall be translated
*/
- if (intentAction != null && intentAction.equals("com.hughes.action.ACTION_SEARCH_DICT")) {
+ if ("com.hughes.action.ACTION_SEARCH_DICT".equals(intentAction)) {
String query = intent.getStringExtra(SearchManager.QUERY);
String from = intent.getStringExtra("from");
if (from != null)
try {
wordList.getParentFile().mkdirs();
final PrintWriter out = new PrintWriter(new FileWriter(wordList, true));
- out.println(rawText.toString());
+ out.println(rawText);
out.close();
} catch (Exception e) {
Log.e(LOG, "Unable to append to " + wordList.getAbsolutePath(), e);
Log.d(LOG, "searchFinished: " + searchOperation + ", searchResult=" + searchResult);
currentSearchOperation = null;
- uiHandler.postDelayed(new Runnable() {
+ // Note: it's important to post to the ListView, otherwise
+ // the jumpToRow will randomly not work.
+ getListView().post(new Runnable() {
@Override
public void run() {
if (currentSearchOperation == null) {
Log.d(LOG, "More coming, waiting for currentSearchOperation.");
}
}
- }, 20);
+ });
}
- private final void jumpToRow(final int row) {
+ private void jumpToRow(final int row) {
Log.d(LOG, "jumpToRow: " + row + ", refocusSearchText=" + false);
// getListView().requestFocusFromTouch();
getListView().setSelectionFromTop(row, 0);
}
public String toString() {
- return String.format("SearchOperation(%s,%s)", searchText, interrupted.toString());
+ return String.format("SearchOperation(%s,%s)", searchText, interrupted);
}
@Override