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

Commit f251bde8 authored by Chris Craik's avatar Chris Craik Committed by Android (Google) Code Review
Browse files

Merge "Tweaks to outline API" into lmp-dev

parents b7fae17a 31ba192d
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -10899,11 +10899,9 @@ package android.graphics {
    ctor public Outline(android.graphics.Outline);
    method public boolean canClip();
    method public boolean isEmpty();
    method public boolean isFilled();
    method public void set(android.graphics.Outline);
    method public void setConvexPath(android.graphics.Path);
    method public void setEmpty();
    method public void setFilled(boolean);
    method public void setOval(int, int, int, int);
    method public void setOval(android.graphics.Rect);
    method public void setRect(int, int, int, int);
@@ -11649,7 +11647,7 @@ package android.graphics.drawable {
    method public int getMinimumHeight();
    method public int getMinimumWidth();
    method public abstract int getOpacity();
    method public boolean getOutline(android.graphics.Outline);
    method public void getOutline(android.graphics.Outline);
    method public boolean getPadding(android.graphics.Rect);
    method public int[] getState();
    method public android.graphics.Region getTransparentRegion();
@@ -11981,7 +11979,7 @@ package android.graphics.drawable.shapes {
    method public android.graphics.drawable.shapes.Shape clone() throws java.lang.CloneNotSupportedException;
    method public abstract void draw(android.graphics.Canvas, android.graphics.Paint);
    method public final float getHeight();
    method public boolean getOutline(android.graphics.Outline);
    method public void getOutline(android.graphics.Outline);
    method public final float getWidth();
    method public boolean hasAlpha();
    method protected void onResize(float, float);
@@ -34136,7 +34134,6 @@ package android.view {
    method public void setOnLongClickListener(android.view.View.OnLongClickListener);
    method public void setOnSystemUiVisibilityChangeListener(android.view.View.OnSystemUiVisibilityChangeListener);
    method public void setOnTouchListener(android.view.View.OnTouchListener);
    method public deprecated void setOutline(android.graphics.Outline);
    method public void setOutlineProvider(android.view.ViewOutlineProvider);
    method public void setOverScrollMode(int);
    method public void setPadding(int, int, int, int);
@@ -34689,7 +34686,7 @@ package android.view {
  public abstract class ViewOutlineProvider {
    ctor public ViewOutlineProvider();
    method public abstract boolean getOutline(android.view.View, android.graphics.Outline);
    method public abstract void getOutline(android.view.View, android.graphics.Outline);
    field public static final android.view.ViewOutlineProvider BACKGROUND;
  }
+7 −11
Original line number Diff line number Diff line
@@ -10762,7 +10762,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        }
    }
    /** Deprecated, pending removal */
    /**
     * Deprecated, pending removal
     *
     * @hide
     */
    @Deprecated
    public void setOutline(@Nullable Outline outline) {}
@@ -10843,16 +10847,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            // no provider, remove outline
            mRenderNode.setOutline(null);
        } else {
            if (mOutlineProvider.getOutline(this, outline)) {
                if (outline.isEmpty()) {
                    throw new IllegalStateException("Outline provider failed to build outline");
                }
                // provider has provided
            mOutlineProvider.getOutline(this, outline);
            mRenderNode.setOutline(outline);
            } else {
                // provider failed to provide
                mRenderNode.setOutline(null);
            }
        }
        notifySubtreeAccessibilityStateChangedIfNeeded();
+4 −8
Original line number Diff line number Diff line
@@ -31,13 +31,11 @@ public abstract class ViewOutlineProvider {
     */
    public static final ViewOutlineProvider BACKGROUND = new ViewOutlineProvider() {
        @Override
        public boolean getOutline(View view, Outline outline) {
        public void getOutline(View view, Outline outline) {
            Drawable background = view.getBackground();
            if (background == null) {
                // no background, no outline
                return false;
            if (background != null) {
                background.getOutline(outline);
            }
            return background.getOutline(outline);
        }
    };

@@ -50,8 +48,6 @@ public abstract class ViewOutlineProvider {
     *
     * @param view The view building the outline.
     * @param outline The empty outline to be populated.
     * @return true if this View should have an outline, else false. The outline must be
     *         populated by this method, and non-empty if true is returned.
     */
    public abstract boolean getOutline(View view, Outline outline);
    public abstract void getOutline(View view, Outline outline);
}
+4 −0
Original line number Diff line number Diff line
@@ -96,6 +96,8 @@ public final class Outline {
     *
     * A filled outline is assumed, by the drawing system, to fully cover content beneath it,
     * meaning content beneath may be optimized away.
     *
     * @hide
     */
    public void setFilled(boolean isFilled) {
        mIsFilled = isFilled;
@@ -103,6 +105,8 @@ public final class Outline {

    /**
     * Returns whether the outline represents a fully opaque area.
     *
     * @hide
     */
    public boolean isFilled() {
        return !isEmpty() && mIsFilled;
+1 −2
Original line number Diff line number Diff line
@@ -869,9 +869,8 @@ public abstract class Drawable {
     *
     * @see android.view.View#setOutlineProvider(android.view.ViewOutlineProvider)
     */
    public boolean getOutline(@NonNull Outline outline) {
    public void getOutline(@NonNull Outline outline) {
        outline.setRect(getBounds());
        return true;
    }

    /**
Loading