]> gitweb.fperrin.net Git - Dictionary.git/commitdiff
Move Theme class into DictionaryApplication.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Mon, 24 Aug 2015 19:25:02 +0000 (21:25 +0200)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Mon, 24 Aug 2015 19:25:02 +0000 (21:25 +0200)
That is where it is mostly used, and it simplifies
compiling the DictionaryPC part.

src/com/hughes/android/dictionary/C.java
src/com/hughes/android/dictionary/DictionaryActivity.java
src/com/hughes/android/dictionary/DictionaryApplication.java

index 76ce541a4f9df80622f8ffd7bfc209758bf9f53d..904618d222d0b6740f2cbfcfc6454a5912137761 100644 (file)
@@ -26,39 +26,4 @@ public class C {
 
     public static final String THANKS_FOR_UPDATING_VERSION = "thanksForUpdatingVersion";
 
-    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;
-    }
-
 }
index cd238f355eb3a64d04794cc7b24b2f879cb2b4d5..769ce954e3c9e5ca8e014ce6dc72c5da46232dd5 100644 (file)
@@ -143,7 +143,7 @@ public class DictionaryActivity extends ActionBarActivity {
     volatile boolean ttsReady;
 
     Typeface typeface;
-    C.Theme theme = C.Theme.LIGHT;
+    DictionaryApplication.Theme theme = DictionaryApplication.Theme.LIGHT;
     int textColorFg = Color.BLACK;
     int fontSizeSp;
 
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;
         }
     }