Merge "Update drawable state after updating tint list" into lmp-mr1-dev

This commit is contained in:
Alan Viverette
2014-10-29 22:20:17 +00:00
committed by Android (Google) Code Review
7 changed files with 61 additions and 0 deletions

View File

@@ -16302,6 +16302,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
if (tintInfo.mHasTintMode) {
mBackground.setTintMode(tintInfo.mTintMode);
}
// The drawable (or one of its children) may not have been
// stateful before applying the tint, so let's try again.
if (mBackground.isStateful()) {
mBackground.setState(getDrawableState());
}
}
}
}

View File

@@ -267,6 +267,12 @@ public abstract class AbsSeekBar extends ProgressBar {
if (mHasThumbTintMode) {
mThumb.setTintMode(mThumbTintMode);
}
// The drawable (or one of its children) may not have been
// stateful before applying the tint, so let's try again.
if (mThumb.isStateful()) {
mThumb.setState(getDrawableState());
}
}
}

View File

@@ -267,6 +267,12 @@ public class CheckedTextView extends TextView implements Checkable {
if (mHasCheckMarkTintMode) {
mCheckMarkDrawable.setTintMode(mCheckMarkTintMode);
}
// The drawable (or one of its children) may not have been
// stateful before applying the tint, so let's try again.
if (mCheckMarkDrawable.isStateful()) {
mCheckMarkDrawable.setState(getDrawableState());
}
}
}

View File

@@ -315,6 +315,12 @@ public abstract class CompoundButton extends Button implements Checkable {
if (mHasButtonTintMode) {
mButtonDrawable.setTintMode(mButtonTintMode);
}
// The drawable (or one of its children) may not have been
// stateful before applying the tint, so let's try again.
if (mButtonDrawable.isStateful()) {
mButtonDrawable.setState(getDrawableState());
}
}
}

View File

@@ -384,6 +384,12 @@ public class FrameLayout extends ViewGroup {
if (mHasForegroundTintMode) {
mForeground.setTintMode(mForegroundTintMode);
}
// The drawable (or one of its children) may not have been
// stateful before applying the tint, so let's try again.
if (mForeground.isStateful()) {
mForeground.setState(getDrawableState());
}
}
}

View File

@@ -527,6 +527,12 @@ public class ImageView extends View {
if (mHasDrawableTintMode) {
mDrawable.setTintMode(mDrawableTintMode);
}
// The drawable (or one of its children) may not have been
// stateful before applying the tint, so let's try again.
if (mDrawable.isStateful()) {
mDrawable.setState(getDrawableState());
}
}
}
@@ -820,6 +826,7 @@ public class ImageView extends View {
mDrawableHeight = d.getIntrinsicHeight();
applyImageTint();
applyColorMod();
configureBounds();
} else {
mDrawableWidth = mDrawableHeight = -1;

View File

@@ -673,6 +673,12 @@ public class ProgressBar extends View {
if (tintInfo.mHasIndeterminateTintMode) {
mIndeterminateDrawable.setTintMode(tintInfo.mIndeterminateTintMode);
}
// The drawable (or one of its children) may not have been
// stateful before applying the tint, so let's try again.
if (mIndeterminateDrawable.isStateful()) {
mIndeterminateDrawable.setState(getDrawableState());
}
}
}
}
@@ -781,6 +787,12 @@ public class ProgressBar extends View {
if (mProgressTintInfo.mHasProgressTintMode) {
target.setTintMode(mProgressTintInfo.mProgressTintMode);
}
// The drawable (or one of its children) may not have been
// stateful before applying the tint, so let's try again.
if (target.isStateful()) {
target.setState(getDrawableState());
}
}
}
}
@@ -800,6 +812,12 @@ public class ProgressBar extends View {
if (mProgressTintInfo.mHasProgressBackgroundTintMode) {
target.setTintMode(mProgressTintInfo.mProgressBackgroundTintMode);
}
// The drawable (or one of its children) may not have been
// stateful before applying the tint, so let's try again.
if (target.isStateful()) {
target.setState(getDrawableState());
}
}
}
}
@@ -819,6 +837,12 @@ public class ProgressBar extends View {
if (mProgressTintInfo.mHasSecondaryProgressTintMode) {
target.setTintMode(mProgressTintInfo.mSecondaryProgressTintMode);
}
// The drawable (or one of its children) may not have been
// stateful before applying the tint, so let's try again.
if (target.isStateful()) {
target.setState(getDrawableState());
}
}
}
}