Bug 1254944 - Move changes to generated ThemedImageButton to generator script. r=grisha, a=ritu

MozReview-Commit-ID: Gsnyf1CYE2e
This commit is contained in:
Chenxia Liu 2016-03-09 10:48:02 -08:00
parent 34205761de
commit f8809c337c
4 changed files with 11 additions and 6 deletions

View File

@ -178,10 +178,9 @@ public class ThemedImageButton extends android.widget.ImageButton
private void setTintedImageDrawable(final Drawable drawable) {
final Drawable tintedDrawable;
if (drawableColors == null || R.id.bookmark == getId()) {
// NB: The bookmarked state uses a blue star, so this is a hack to keep it untinted.
// NB: If we tint a drawable with a null ColorStateList, it will override
// any existing colorFilters and tint... so don't!
// NB: The bookmarked state uses a blue star, so this is a hack to keep it from being tinted.
tintedDrawable = drawable;
} else if (drawable == null) {
tintedDrawable = null;

View File

@ -178,7 +178,7 @@ public class ThemedImageView extends android.widget.ImageView
private void setTintedImageDrawable(final Drawable drawable) {
final Drawable tintedDrawable;
if (drawableColors == null) {
// If we tint a drawable with a null ColorStateList, it will override
// NB: If we tint a drawable with a null ColorStateList, it will override
// any existing colorFilters and tint... so don't!
tintedDrawable = drawable;
} else if (drawable == null) {

View File

@ -183,8 +183,13 @@ public class Themed@VIEW_NAME_SUFFIX@ extends @BASE_TYPE@
private void setTintedImageDrawable(final Drawable drawable) {
final Drawable tintedDrawable;
//#ifdef BOOKMARK_NO_TINT
if (drawableColors == null || R.id.bookmark == getId()) {
// NB: The bookmarked state uses a blue star, so this is a hack to keep it untinted.
//#else
if (drawableColors == null) {
// If we tint a drawable with a null ColorStateList, it will override
//#endif
// NB: If we tint a drawable with a null ColorStateList, it will override
// any existing colorFilters and tint... so don't!
tintedDrawable = drawable;
} else if (drawable == null) {

View File

@ -12,7 +12,7 @@ This script runs the preprocessor on a input template and writes
updated files into the source directory.
To update the themed views, update the input template
(ThemedView.java.frag) and run the script. Use version control to
(ThemedView.java.frag) and run the script using 'mach python <script.py>'. Use version control to
examine the differences, and don't forget to commit the changes to the
template and the outputs.
'''
@ -41,7 +41,8 @@ views = [
dict(VIEW_NAME_SUFFIX='ImageButton',
BASE_TYPE='android.widget.ImageButton',
STYLE_CONSTRUCTOR=1,
TINT_FOREGROUND_DRAWABLE=1),
TINT_FOREGROUND_DRAWABLE=1,
BOOKMARK_NO_TINT=1),
dict(VIEW_NAME_SUFFIX='ImageView',
BASE_TYPE='android.widget.ImageView',
STYLE_CONSTRUCTOR=1,