Bug 965548 - Part 2.5: Make Themed* processing more robust. r=bnicholson
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 17 Apr 2014 13:34:11 -0700
changeset 179597 8998623049ceccadde6e9c621dc1b5e290fefe4a
parent 179596 ee46cc7283c2e9967a1027b132bd0da80107ac42
child 179598 6a49f6cb358226b712f712b32c0159eb374b4638
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersbnicholson
bugs965548
milestone31.0a1
Bug 965548 - Part 2.5: Make Themed* processing more robust. r=bnicholson
mobile/android/base/widget/ThemedEditText.java.in
mobile/android/base/widget/ThemedImageButton.java.in
mobile/android/base/widget/ThemedImageView.java.in
mobile/android/base/widget/ThemedLinearLayout.java.in
mobile/android/base/widget/ThemedRelativeLayout.java.in
mobile/android/base/widget/ThemedTextSwitcher.java.in
mobile/android/base/widget/ThemedTextView.java.in
mobile/android/base/widget/ThemedView.java.frag
--- a/mobile/android/base/widget/ThemedEditText.java.in
+++ b/mobile/android/base/widget/ThemedEditText.java.in
@@ -1,3 +1,4 @@
 #filter substitution
-#define VIEWTYPE EditText
+#define VIEW_NAME_SUFFIX EditText
+#define BASE_TYPE android.widget.EditText
 #include ThemedView.java.frag
--- a/mobile/android/base/widget/ThemedImageButton.java.in
+++ b/mobile/android/base/widget/ThemedImageButton.java.in
@@ -1,3 +1,4 @@
 #filter substitution
-#define VIEWTYPE ImageButton
+#define VIEW_NAME_SUFFIX ImageButton
+#define BASE_TYPE android.widget.ImageButton
 #include ThemedView.java.frag
--- a/mobile/android/base/widget/ThemedImageView.java.in
+++ b/mobile/android/base/widget/ThemedImageView.java.in
@@ -1,3 +1,4 @@
 #filter substitution
-#define VIEWTYPE ImageView
+#define VIEW_NAME_SUFFIX ImageView
+#define BASE_TYPE android.widget.ImageView
 #include ThemedView.java.frag
--- a/mobile/android/base/widget/ThemedLinearLayout.java.in
+++ b/mobile/android/base/widget/ThemedLinearLayout.java.in
@@ -1,3 +1,4 @@
 #filter substitution
-#define VIEWTYPE LinearLayout
+#define VIEW_NAME_SUFFIX LinearLayout
+#define BASE_TYPE android.widget.LinearLayout
 #include ThemedView.java.frag
--- a/mobile/android/base/widget/ThemedRelativeLayout.java.in
+++ b/mobile/android/base/widget/ThemedRelativeLayout.java.in
@@ -1,3 +1,4 @@
 #filter substitution
-#define VIEWTYPE RelativeLayout
+#define VIEW_NAME_SUFFIX RelativeLayout
+#define BASE_TYPE android.widget.RelativeLayout
 #include ThemedView.java.frag
--- a/mobile/android/base/widget/ThemedTextSwitcher.java.in
+++ b/mobile/android/base/widget/ThemedTextSwitcher.java.in
@@ -1,3 +1,4 @@
 #filter substitution
-#define VIEWTYPE TextSwitcher
+#define VIEW_NAME_SUFFIX TextSwitcher
+#define BASE_TYPE android.widget.TextSwitcher
 #include ThemedView.java.frag
--- a/mobile/android/base/widget/ThemedTextView.java.in
+++ b/mobile/android/base/widget/ThemedTextView.java.in
@@ -1,3 +1,4 @@
 #filter substitution
-#define VIEWTYPE TextView
+#define VIEW_NAME_SUFFIX TextView
+#define BASE_TYPE android.widget.TextView
 #include ThemedView.java.frag
--- a/mobile/android/base/widget/ThemedView.java.frag
+++ b/mobile/android/base/widget/ThemedView.java.frag
@@ -7,36 +7,35 @@ package org.mozilla.gecko.widget;
 import org.mozilla.gecko.GeckoApplication;
 import org.mozilla.gecko.LightweightTheme;
 import org.mozilla.gecko.R;
 
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.graphics.drawable.ColorDrawable;
 import android.util.AttributeSet;
-import android.widget.@VIEWTYPE@;
 
-public class Themed@VIEWTYPE@ extends @VIEWTYPE@
-                              implements LightweightTheme.OnChangeListener {
+public class Themed@VIEW_NAME_SUFFIX@ extends @BASE_TYPE@
+                                     implements LightweightTheme.OnChangeListener {
     private final LightweightTheme mTheme;
 
     private static final int[] STATE_PRIVATE_MODE = { R.attr.state_private };
     private static final int[] STATE_LIGHT = { R.attr.state_light };
     private static final int[] STATE_DARK = { R.attr.state_dark };
 
     protected static final int[] PRIVATE_PRESSED_STATE_SET = { R.attr.state_private, android.R.attr.state_pressed };
     protected static final int[] PRIVATE_FOCUSED_STATE_SET = { R.attr.state_private, android.R.attr.state_focused };
     protected static final int[] PRIVATE_STATE_SET = { R.attr.state_private };
 
     private boolean mIsPrivate = false;
     private boolean mIsLight = false;
     private boolean mIsDark = false;
     private boolean mAutoUpdateTheme = true;
 
-    public Themed@VIEWTYPE@(Context context, AttributeSet attrs) {
+    public Themed@VIEW_NAME_SUFFIX@(Context context, AttributeSet attrs) {
         super(context, attrs);
         mTheme = ((GeckoApplication) context.getApplicationContext()).getLightweightTheme();
 
         TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LightweightTheme);
         mAutoUpdateTheme = a.getBoolean(R.styleable.LightweightTheme_autoUpdateTheme, true);
         a.recycle();
     }