From 7707579ea51834a2312201f9c8c129cda8199272 Mon Sep 17 00:00:00 2001 From: Thad Hughes Date: Fri, 27 Dec 2013 15:59:11 -0800 Subject: [PATCH] Fixed background in dark theme. --- ...her_lang_bg.xml => theme_default_normal_row_bg.xml} | 2 +- ...other_lang_bg.xml => theme_light_normal_row_bg.xml} | 2 +- res/values/styles.xml | 4 ++-- src/com/hughes/android/dictionary/C.java | 10 +++++----- .../hughes/android/dictionary/DictionaryActivity.java | 8 +++++++- 5 files changed, 16 insertions(+), 10 deletions(-) rename res/drawable/{theme_default_other_lang_bg.xml => theme_default_normal_row_bg.xml} (68%) rename res/drawable/{theme_light_other_lang_bg.xml => theme_light_normal_row_bg.xml} (67%) diff --git a/res/drawable/theme_default_other_lang_bg.xml b/res/drawable/theme_default_normal_row_bg.xml similarity index 68% rename from res/drawable/theme_default_other_lang_bg.xml rename to res/drawable/theme_default_normal_row_bg.xml index 78bb6b7..ee37a0c 100644 --- a/res/drawable/theme_default_other_lang_bg.xml +++ b/res/drawable/theme_default_normal_row_bg.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/res/drawable/theme_light_other_lang_bg.xml b/res/drawable/theme_light_normal_row_bg.xml similarity index 67% rename from res/drawable/theme_light_other_lang_bg.xml rename to res/drawable/theme_light_normal_row_bg.xml index f43fcaa..95e9963 100644 --- a/res/drawable/theme_light_other_lang_bg.xml +++ b/res/drawable/theme_light_normal_row_bg.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/res/values/styles.xml b/res/values/styles.xml index 069097c..d2ae2c6 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -58,7 +58,7 @@ #FFFFFF #222222 #222222 - #000000 + #000000 @@ -74,7 +74,7 @@ #000000 #EEEEEE #EEEEEE - #FFFFFF + #FFFFFF #777777 diff --git a/src/com/hughes/android/dictionary/C.java b/src/com/hughes/android/dictionary/C.java index dc4bd0a..f60e6f2 100644 --- a/src/com/hughes/android/dictionary/C.java +++ b/src/com/hughes/android/dictionary/C.java @@ -32,25 +32,25 @@ public class C { R.color.theme_default_token_row_fg, R.drawable.theme_default_token_row_main_bg, R.drawable.theme_default_token_row_other_bg, - R.drawable.theme_default_other_lang_bg), + R.drawable.theme_default_normal_row_bg), LIGHT(R.style.Theme_Light, R.style.Theme_Light_TokenRow_Fg, R.color.theme_light_token_row_fg, R.drawable.theme_light_token_row_main_bg, R.drawable.theme_light_token_row_other_bg, - R.drawable.theme_light_other_lang_bg); + R.drawable.theme_light_normal_row_bg); private Theme(final int themeId, final int tokenRowFg, final int tokenRowFgColor, final int tokenRowMainBg, final int tokenRowOtherBg, - final int otherLangBg) { + final int normalRowBg) { this.themeId = themeId; this.tokenRowFg = tokenRowFg; this.tokenRowFgColor = tokenRowFgColor; this.tokenRowMainBg = tokenRowMainBg; this.tokenRowOtherBg = tokenRowOtherBg; - this.otherLangBg = otherLangBg; + this.normalRowBg = normalRowBg; } final int themeId; @@ -58,7 +58,7 @@ public class C { final int tokenRowFgColor; final int tokenRowMainBg; final int tokenRowOtherBg; - final int otherLangBg; + final int normalRowBg; } } diff --git a/src/com/hughes/android/dictionary/DictionaryActivity.java b/src/com/hughes/android/dictionary/DictionaryActivity.java index 0a1ea9a..37a45fa 100644 --- a/src/com/hughes/android/dictionary/DictionaryActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryActivity.java @@ -439,6 +439,9 @@ public class DictionaryActivity extends SherlockListActivity { updateLangButton(); searchView.requestFocus(); + + // http://stackoverflow.com/questions/2833057/background-listview-becomes-black-when-scrolling + getListView().setCacheColorHint(0); } private void onCreateSetupActionBarAndSearchView() { @@ -1365,7 +1368,10 @@ public class DictionaryActivity extends SherlockListActivity { result.setClickable(true); result.setFocusable(true); result.setLongClickable(true); - result.setBackgroundResource(android.R.drawable.menuitem_background); +// result.setBackgroundResource(android.R.drawable.menuitem_background); + + result.setBackgroundResource(theme.normalRowBg); + result.setOnClickListener(new TextView.OnClickListener() { @Override public void onClick(View v) { -- 2.43.0