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

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

Merge "Fix switch & slider anim, make View drawable hotspot API public"

parents 9c46e064 8de14945
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -32584,6 +32584,7 @@ package android.view {
    method public void dispatchWindowSystemUiVisiblityChanged(int);
    method public void dispatchWindowVisibilityChanged(int);
    method public void draw(android.graphics.Canvas);
    method public void drawableHotspotChanged(float, float);
    method protected void drawableStateChanged();
    method public android.view.View findFocus();
    method public final android.view.View findViewById(int);
+17 −17
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@ import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Region;
import android.graphics.Shader;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.hardware.display.DisplayManagerGlobal;
@@ -4822,20 +4821,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        final float x = r.exactCenterX();
        final float y = r.exactCenterY();
        setDrawableHotspot(x, y);
    }
    /**
     * Sets the hotspot position for this View's drawables.
     *
     * @param x hotspot x coordinate
     * @param y hotspot y coordinate
     * @hide
     */
    protected void setDrawableHotspot(float x, float y) {
        if (mBackground != null) {
            mBackground.setHotspot(x, y);
        }
        drawableHotspotChanged(x, y);
    }
    /**
@@ -6798,7 +6784,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    private void setPressed(boolean pressed, float x, float y) {
        if (pressed) {
            setDrawableHotspot(x, y);
            drawableHotspotChanged(x, y);
        }
        setPressed(pressed);
@@ -9149,7 +9135,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                    break;
                case MotionEvent.ACTION_MOVE:
                    setDrawableHotspot(x, y);
                    drawableHotspotChanged(x, y);
                    // Be lenient about moving outside of buttons
                    if (!pointInView(x, y, mTouchSlop)) {
@@ -15530,6 +15516,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        }
    }
    /**
     * This function is called whenever the drawable hotspot changes.
     * <p>
     * Be sure to call through to the superclass when overriding this function.
     *
     * @param x hotspot x coordinate
     * @param y hotspot y coordinate
     */
    public void drawableHotspotChanged(float x, float y) {
        if (mBackground != null) {
            mBackground.setHotspot(x, y);
        }
    }
    /**
     * Call this to force a view to update its drawable state. This will cause
     * drawableStateChanged to be called on this view. Views that are interested
+10 −25
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.graphics.Canvas;
import android.graphics.Insets;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.PorterDuff.Mode;
import android.graphics.Region.Op;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@@ -343,7 +342,10 @@ public abstract class AbsSeekBar extends ProgressBar {
    @Override
    public void jumpDrawablesToCurrentState() {
        super.jumpDrawablesToCurrentState();
        if (mThumb != null) mThumb.jumpToCurrentState();

        if (mThumb != null) {
            mThumb.jumpToCurrentState();
        }
    }

    @Override
@@ -361,29 +363,12 @@ public abstract class AbsSeekBar extends ProgressBar {
        }
    }

    /** @hide */
    @Override
    protected void setDrawableHotspot(float x, float y) {
        super.setDrawableHotspot(x, y);

        final Drawable progressDrawable = getProgressDrawable();
        if (progressDrawable != null) {
            progressDrawable.setHotspot(x, y);
        }

        final Drawable thumb = mThumb;
        if (thumb != null) {
            thumb.setHotspot(x, y);
        }
    }

    @Override
    public void invalidateDrawable(Drawable dr) {
        super.invalidateDrawable(dr);
    public void drawableHotspotChanged(float x, float y) {
        super.drawableHotspotChanged(x, y);

        if (dr == mThumb) {
            // Handle changes to thumb width and height.
            requestLayout();
        if (mThumb != null) {
            mThumb.setHotspot(x, y);
        }
    }

@@ -479,7 +464,7 @@ public abstract class AbsSeekBar extends ProgressBar {

        final Drawable background = getBackground();
        if (background != null) {
            final Rect bounds = mThumb.getBounds();
            final Rect bounds = thumb.getBounds();
            final int offsetX = mPaddingLeft - mThumbOffset;
            final int offsetY = mPaddingTop;
            background.setHotspotBounds(left + offsetX, bounds.top + offsetY,
@@ -505,8 +490,8 @@ public abstract class AbsSeekBar extends ProgressBar {
    @Override
    protected synchronized void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        drawThumb(canvas);

    }

    @Override
+2 −3
Original line number Diff line number Diff line
@@ -307,10 +307,9 @@ public class CheckedTextView extends TextView implements Checkable {
        }
    }

    /** @hide */
    @Override
    protected void setDrawableHotspot(float x, float y) {
        super.setDrawableHotspot(x, y);
    public void drawableHotspotChanged(float x, float y) {
        super.drawableHotspotChanged(x, y);

        if (mCheckMarkDrawable != null) {
            mCheckMarkDrawable.setHotspot(x, y);
+2 −4
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
@@ -431,10 +430,9 @@ public abstract class CompoundButton extends Button implements Checkable {
        }
    }

    /** @hide */
    @Override
    protected void setDrawableHotspot(float x, float y) {
        super.setDrawableHotspot(x, y);
    public void drawableHotspotChanged(float x, float y) {
        super.drawableHotspotChanged(x, y);

        if (mButtonDrawable != null) {
            mButtonDrawable.setHotspot(x, y);
Loading