diff options
author | Alan Viverette <alanv@google.com> | 2015-05-29 22:50:56 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-29 22:51:04 +0000 |
commit | db2911321b1cb0870d10baab370c93da13a91067 (patch) | |
tree | 528d6a3dd2ded15bfe39cb2a28f5cb24888a661c /core/java/android | |
parent | b85e1ecfdf410b6aec7b6f93e3932b0aa32fba06 (diff) | |
parent | 87e1938be8e6c2ac7e6163a63df5dd69633cc836 (diff) | |
download | frameworks_base-db2911321b1cb0870d10baab370c93da13a91067.zip frameworks_base-db2911321b1cb0870d10baab370c93da13a91067.tar.gz frameworks_base-db2911321b1cb0870d10baab370c93da13a91067.tar.bz2 |
Merge "Replace PNG-based seekbar thumb animation with AVD" into mnc-dev
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/widget/AbsSeekBar.java | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java index ff74c60..a4c8d1c 100644 --- a/core/java/android/widget/AbsSeekBar.java +++ b/core/java/android/widget/AbsSeekBar.java @@ -86,10 +86,10 @@ public abstract class AbsSeekBar extends ProgressBar { public AbsSeekBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes( - attrs, com.android.internal.R.styleable.SeekBar, defStyleAttr, defStyleRes); + final TypedArray a = context.obtainStyledAttributes( + attrs, R.styleable.SeekBar, defStyleAttr, defStyleRes); - final Drawable thumb = a.getDrawable(com.android.internal.R.styleable.SeekBar_thumb); + final Drawable thumb = a.getDrawable(R.styleable.SeekBar_thumb); setThumb(thumb); if (a.hasValue(R.styleable.SeekBar_thumbTintMode)) { @@ -103,18 +103,22 @@ public abstract class AbsSeekBar extends ProgressBar { mHasThumbTint = true; } + mSplitTrack = a.getBoolean(R.styleable.SeekBar_splitTrack, false); + // Guess thumb offset if thumb != null, but allow layout to override. - final int thumbOffset = a.getDimensionPixelOffset( - com.android.internal.R.styleable.SeekBar_thumbOffset, getThumbOffset()); + final int thumbOffset = a.getDimensionPixelOffset(R.styleable.SeekBar_thumbOffset, getThumbOffset()); setThumbOffset(thumbOffset); - mSplitTrack = a.getBoolean(com.android.internal.R.styleable.SeekBar_splitTrack, false); + final boolean useDisabledAlpha = a.getBoolean(R.styleable.SeekBar_useDisabledAlpha, true); a.recycle(); - a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.Theme, 0, 0); - mDisabledAlpha = a.getFloat(com.android.internal.R.styleable.Theme_disabledAlpha, 0.5f); - a.recycle(); + if (useDisabledAlpha) { + final TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.Theme, 0, 0); + mDisabledAlpha = ta.getFloat(R.styleable.Theme_disabledAlpha, 0.5f); + ta.recycle(); + } else { + mDisabledAlpha = 1.0f; + } applyThumbTint(); @@ -360,7 +364,7 @@ public abstract class AbsSeekBar extends ProgressBar { super.drawableStateChanged(); final Drawable progressDrawable = getProgressDrawable(); - if (progressDrawable != null) { + if (progressDrawable != null && mDisabledAlpha < 1.0f) { progressDrawable.setAlpha(isEnabled() ? NO_ALPHA : (int) (NO_ALPHA * mDisabledAlpha)); } |