\r
static final String LOG = "QuickDic";\r
\r
- static final int VIBRATE_MILLIS = 100;\r
-\r
int dictIndex = 0;\r
RandomAccessFile dictRaf = null;\r
Dictionary dictionary = null;\r
});\r
private SearchOperation currentSearchOperation = null;\r
\r
+ C.Theme theme = C.Theme.LIGHT;\r
int fontSizeSp;\r
EditText searchText;\r
Button langButton;\r
@Override\r
public void onCreate(Bundle savedInstanceState) {\r
Log.d(LOG, "onCreate:" + this);\r
- ((DictionaryApplication)getApplication()).applyTheme(this);\r
+ theme = ((DictionaryApplication)getApplication()).getSelectedTheme();\r
super.onCreate(savedInstanceState);\r
\r
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);\r
QuickDicConfig quickDicConfig = PersistentObjectCache.init(\r
this).read(C.DICTIONARY_CONFIGS, QuickDicConfig.class);\r
dictIndex = prefs.getInt(C.DICT_INDEX, 0) ;\r
- final DictionaryInfo dictionaryConfig = quickDicConfig.dictionaryConfigs.get(dictIndex);\r
+ final DictionaryInfo dictionaryConfig = quickDicConfig.dictionaryInfos.get(dictIndex);\r
this.setTitle("QuickDic: " + dictionaryConfig.name);\r
dictRaf = new RandomAccessFile(dictionaryConfig.localFile, "r");\r
dictionary = new Dictionary(dictRaf); \r
for (int r = 0; r < rowCount; ++r) {\r
final TableRow tableRow = new TableRow(result.getContext());\r
\r
- TextView column1 = new TextView(tableRow.getContext());\r
- TextView column2 = new TextView(tableRow.getContext());\r
+ final EditText column1 = new EditText(tableRow.getContext());\r
+ final EditText column2 = new EditText(tableRow.getContext());\r
final TableRow.LayoutParams layoutParams = new TableRow.LayoutParams();\r
layoutParams.weight = 0.5f;\r
\r
\r
column1.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSizeSp);\r
column2.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSizeSp);\r
+ column2.setBackgroundResource(theme.otherLangBg);\r
+ \r
+ column2.setOnLongClickListener(new EditText.OnLongClickListener() {\r
+ @Override\r
+ public boolean onLongClick(View v) {\r
+ final int start = column2.getSelectionStart();\r
+ final int end = column2.getSelectionStart();\r
+ Log.i(LOG, "Long click on: " + column2.getText().toString().substring(start, end));\r
+ return false;\r
+ }\r
+ });\r
\r
result.addView(tableRow);\r
}\r
final Context context = parent.getContext();\r
final TextView textView = new TextView(context);\r
textView.setText(row.getToken());\r
- textView.setBackgroundResource(R.drawable.token_row_drawable);\r
+ textView.setBackgroundResource(row.hasMainEntry ? theme.tokenRowMainBg : theme.tokenRowOtherBg);\r
// Doesn't work:\r
//textView.setTextColor(android.R.color.secondary_text_light);\r
- textView.setTextAppearance(context, R.style.Theme_Light_Token);\r
+ textView.setTextAppearance(context, theme.tokenRowFg);\r
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 5 * fontSizeSp / 4);\r
return textView;\r
}\r