]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - src/com/hughes/android/dictionary/DictionaryApplication.java
Move Theme class into DictionaryApplication.
[Dictionary.git] / src / com / hughes / android / dictionary / DictionaryApplication.java
index 5d6bab88580743a77a55a907cc8fabd9b92c465e..98971832183b323e6277e5ee391e6f3809e170c3 100644 (file)
@@ -63,6 +63,41 @@ public class DictionaryApplication extends Application {
     // Unordered.
     static Map<String, DictionaryInfo> DOWNLOADABLE_UNCOMPRESSED_FILENAME_NAME_TO_DICTIONARY_INFO = null;
 
+    enum Theme {
+        DEFAULT(R.style.Theme_Default,
+                R.style.Theme_Default_TokenRow_Fg,
+                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_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_normal_row_bg);
+
+        Theme(final int themeId, final int tokenRowFg,
+              final int tokenRowFgColor,
+              final int tokenRowMainBg, final int tokenRowOtherBg,
+              final int normalRowBg) {
+            this.themeId = themeId;
+            this.tokenRowFg = tokenRowFg;
+            this.tokenRowFgColor = tokenRowFgColor;
+            this.tokenRowMainBg = tokenRowMainBg;
+            this.tokenRowOtherBg = tokenRowOtherBg;
+            this.normalRowBg = normalRowBg;
+        }
+
+        final int themeId;
+        final int tokenRowFg;
+        final int tokenRowFgColor;
+        final int tokenRowMainBg;
+        final int tokenRowOtherBg;
+        final int normalRowBg;
+    }
+
     // Useful:
     // http://www.loc.gov/standards/iso639-2/php/code_list.php
     public static final Map<String, LanguageResources> isoCodeToResources = new LinkedHashMap<String, LanguageResources>();
@@ -379,13 +414,13 @@ public class DictionaryApplication extends Application {
         return new File(file);
     }
 
-    public C.Theme getSelectedTheme() {
+    public Theme getSelectedTheme() {
         final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
         final String theme = prefs.getString(getString(R.string.themeKey), "themeLight");
         if (theme.equals("themeLight")) {
-            return C.Theme.LIGHT;
+            return Theme.LIGHT;
         } else {
-            return C.Theme.DEFAULT;
+            return Theme.DEFAULT;
         }
     }