am 4e7c562c: Merge "Update drawable state after updating tint list" into lmp-mr1-dev

* commit '4e7c562c43e9014c8fb3e75d02ba98fa4edadbde':
  Update drawable state after updating tint list
This commit is contained in:
Alan Viverette
2014-10-29 22:56:07 +00:00
committed by Android Git Automerger
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) { if (tintInfo.mHasTintMode) {
mBackground.setTintMode(tintInfo.mTintMode); 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) { if (mHasThumbTintMode) {
mThumb.setTintMode(mThumbTintMode); 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) { if (mHasCheckMarkTintMode) {
mCheckMarkDrawable.setTintMode(mCheckMarkTintMode); 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) { if (mHasButtonTintMode) {
mButtonDrawable.setTintMode(mButtonTintMode); 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) { if (mHasForegroundTintMode) {
mForeground.setTintMode(mForegroundTintMode); 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) { if (mHasDrawableTintMode) {
mDrawable.setTintMode(mDrawableTintMode); 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(); mDrawableHeight = d.getIntrinsicHeight();
applyImageTint(); applyImageTint();
applyColorMod(); applyColorMod();
configureBounds(); configureBounds();
} else { } else {
mDrawableWidth = mDrawableHeight = -1; mDrawableWidth = mDrawableHeight = -1;

View File

@@ -673,6 +673,12 @@ public class ProgressBar extends View {
if (tintInfo.mHasIndeterminateTintMode) { if (tintInfo.mHasIndeterminateTintMode) {
mIndeterminateDrawable.setTintMode(tintInfo.mIndeterminateTintMode); 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) { if (mProgressTintInfo.mHasProgressTintMode) {
target.setTintMode(mProgressTintInfo.mProgressTintMode); 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) { if (mProgressTintInfo.mHasProgressBackgroundTintMode) {
target.setTintMode(mProgressTintInfo.mProgressBackgroundTintMode); 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) { if (mProgressTintInfo.mHasSecondaryProgressTintMode) {
target.setTintMode(mProgressTintInfo.mSecondaryProgressTintMode); 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());
}
} }
} }
} }