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

Commit 39df5fea authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Vertically center seek bar track and thumb when maxHeight is set"

parents 248ed828 3afd8b0d
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -403,23 +403,26 @@ public abstract class AbsSeekBar extends ProgressBar {
    }

    private void updateThumbAndTrackPos(int w, int h) {
        final int paddedHeight = h - mPaddingTop - mPaddingBottom;
        final Drawable track = getCurrentDrawable();
        final Drawable thumb = mThumb;

        // The max height does not incorporate padding, whereas the height
        // parameter does.
        final int trackHeight = Math.min(mMaxHeight, h - mPaddingTop - mPaddingBottom);
        final int trackHeight = Math.min(mMaxHeight, paddedHeight);
        final int thumbHeight = thumb == null ? 0 : thumb.getIntrinsicHeight();

        // Apply offset to whichever item is taller.
        final int trackOffset;
        final int thumbOffset;
        if (thumbHeight > trackHeight) {
            trackOffset = (thumbHeight - trackHeight) / 2;
            thumbOffset = 0;
            final int offsetHeight = (paddedHeight - thumbHeight) / 2;
            trackOffset = offsetHeight + (thumbHeight - trackHeight) / 2;
            thumbOffset = offsetHeight + 0;
        } else {
            trackOffset = 0;
            thumbOffset = (trackHeight - thumbHeight) / 2;
            final int offsetHeight = (paddedHeight - trackHeight) / 2;
            trackOffset = offsetHeight + 0;
            thumbOffset = offsetHeight + (trackHeight - thumbHeight) / 2;
        }

        if (track != null) {
+0 −18
Original line number Diff line number Diff line
@@ -1235,24 +1235,6 @@ public class ProgressBar extends View {
        }
    }

    private void setDrawableTint(int id, ColorStateList tint, Mode tintMode, boolean fallback) {
        Drawable layer = null;

        // We expect a layer drawable, so try to find the target ID.
        final Drawable d = mCurrentDrawable;
        if (d instanceof LayerDrawable) {
            layer = ((LayerDrawable) d).findDrawableByLayerId(id);
        }

        if (fallback && layer == null) {
            layer = d;
        }

        layer.mutate();
        layer.setTintList(tint);
        layer.setTintMode(tintMode);
    }

    private synchronized void doRefreshProgress(int id, int progress, boolean fromUser,
            boolean callBackToApp) {
        float scale = mMax > 0 ? (float) progress / (float) mMax : 0;