am 46f087c4: Merge "Apply thumbTint and trackTint styles to Switch from xml." into mnc-dev

* commit '46f087c43b0fd3e4740bbb7183601e645a493716':
  Apply thumbTint and trackTint styles to Switch from xml.
This commit is contained in:
Jun Mukai
2015-06-25 18:27:07 +00:00
committed by Android Git Automerger

View File

@@ -242,6 +242,38 @@ public class Switch extends CompoundButton {
com.android.internal.R.styleable.Switch_switchPadding, 0); com.android.internal.R.styleable.Switch_switchPadding, 0);
mSplitTrack = a.getBoolean(com.android.internal.R.styleable.Switch_splitTrack, false); mSplitTrack = a.getBoolean(com.android.internal.R.styleable.Switch_splitTrack, false);
ColorStateList thumbTintList = a.getColorStateList(
com.android.internal.R.styleable.Switch_thumbTint);
if (thumbTintList != null) {
mThumbTintList = thumbTintList;
mHasThumbTint = true;
}
PorterDuff.Mode thumbTintMode = Drawable.parseTintMode(
a.getInt(com.android.internal.R.styleable.Switch_thumbTintMode, -1), null);
if (mThumbTintMode != thumbTintMode) {
mThumbTintMode = thumbTintMode;
mHasThumbTintMode = true;
}
if (mHasThumbTint || mHasThumbTintMode) {
applyThumbTint();
}
ColorStateList trackTintList = a.getColorStateList(
com.android.internal.R.styleable.Switch_trackTint);
if (trackTintList != null) {
mTrackTintList = trackTintList;
mHasTrackTint = true;
}
PorterDuff.Mode trackTintMode = Drawable.parseTintMode(
a.getInt(com.android.internal.R.styleable.Switch_trackTintMode, -1), null);
if (mTrackTintMode != trackTintMode) {
mTrackTintMode = trackTintMode;
mHasTrackTintMode = true;
}
if (mHasTrackTint || mHasTrackTintMode) {
applyTrackTint();
}
final int appearance = a.getResourceId( final int appearance = a.getResourceId(
com.android.internal.R.styleable.Switch_switchTextAppearance, 0); com.android.internal.R.styleable.Switch_switchTextAppearance, 0);
if (appearance != 0) { if (appearance != 0) {