Bug 1077755 - Part 2: Remove style constructor from unnecessary generated views. r=lucasr

To prevent unintended side-effects.
This commit is contained in:
Michael Comella 2014-10-17 13:01:54 -07:00
parent 05b63bb21f
commit 7a6857e928

View File

@ -15,7 +15,7 @@ import android.util.AttributeSet;
public class Themed@VIEW_NAME_SUFFIX@ extends @BASE_TYPE@
implements LightweightTheme.OnChangeListener {
private final LightweightTheme mTheme;
private LightweightTheme mTheme;
private static final int[] STATE_PRIVATE_MODE = { R.attr.state_private };
private static final int[] STATE_LIGHT = { R.attr.state_light };
@ -31,19 +31,21 @@ public class Themed@VIEW_NAME_SUFFIX@ extends @BASE_TYPE@
private boolean mAutoUpdateTheme = true;
public Themed@VIEW_NAME_SUFFIX@(Context context, AttributeSet attrs) {
this(context, attrs, 0);
super(context, attrs);
initialize(context, attrs);
}
public Themed@VIEW_NAME_SUFFIX@(Context context, AttributeSet attrs, int defStyle) {
//#ifdef STYLE_CONSTRUCTOR
public Themed@VIEW_NAME_SUFFIX@(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
//#else
super(context, attrs);
//#endif
initialize(context, attrs);
}
//#endif
private void initialize(final Context context, final AttributeSet attrs) {
mTheme = ((GeckoApplication) context.getApplicationContext()).getLightweightTheme();
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LightweightTheme);
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LightweightTheme);
mAutoUpdateTheme = a.getBoolean(R.styleable.LightweightTheme_autoUpdateTheme, true);
a.recycle();
}