Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87e1938b authored by Alan Viverette's avatar Alan Viverette
Browse files

Replace PNG-based seekbar thumb animation with AVD

Adds optical inset support for VectorDrawable and GradientDrawable.

Bug: 19944181
Change-Id: I9df04d9fe17ad858413e7f93694bf37ee2c43c85
parent 517f3ee4
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -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));
        }

+18 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<set
    xmlns:android="http://schemas.android.com/apk/res/android" >
    <objectAnimator
        android:duration="133"
        android:propertyName="scaleX"
        android:valueFrom="1.5"
        android:valueTo="1.0"
        android:valueType="floatType"
        android:interpolator="@android:interpolator/fast_out_slow_in" />
    <objectAnimator
        android:duration="133"
        android:propertyName="scaleY"
        android:valueFrom="1.5"
        android:valueTo="1.0"
        android:valueType="floatType"
        android:interpolator="@android:interpolator/fast_out_slow_in" />
</set>
+18 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<set
    xmlns:android="http://schemas.android.com/apk/res/android" >
    <objectAnimator
        android:duration="533"
        android:propertyName="scaleX"
        android:valueFrom="1.0"
        android:valueTo="1.5"
        android:valueType="floatType"
        android:interpolator="@android:interpolator/fast_out_slow_in" />
    <objectAnimator
        android:duration="533"
        android:propertyName="scaleY"
        android:valueFrom="1.0"
        android:valueTo="1.5"
        android:valueType="floatType"
        android:interpolator="@android:interpolator/fast_out_slow_in" />
</set>
−615 B
Loading image diff...
−578 B
Loading image diff...
Loading