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

Commit 3ac312ac authored by Andrey Kulikov's avatar Andrey Kulikov
Browse files

Made ImageView.animateTransform(Matrix) public

ImageView.animateTransform(Matrix) is now public so we can use it in AndroidX Transitions without a reflection.
Also I fixed a bug that we forgot to clear mDrawMatrix when we provide null matrix into a method. Before it doesn't work as expected if ImageView already calculated some draw matix and we wan't to override it.

Bug: 117521477
Test: Added new cts tests for both usages with null and not null matrix
Change-Id: I9e25e1f673fabdfeb227fabc0b3635056de0a6fd
parent 1c32bcc7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -54180,6 +54180,7 @@ package android.widget {
    ctor public ImageView(android.content.Context, android.util.AttributeSet);
    ctor public ImageView(android.content.Context, android.util.AttributeSet, int);
    ctor public ImageView(android.content.Context, android.util.AttributeSet, int, int);
    method public void animateTransform(android.graphics.Matrix);
    method public final void clearColorFilter();
    method public boolean getAdjustViewBounds();
    method public boolean getBaselineAlignBottom();
+12 −3
Original line number Diff line number Diff line
@@ -1331,9 +1331,17 @@ public class ImageView extends View {
        }
    }

    /** @hide */
    @UnsupportedAppUsage
    public void animateTransform(Matrix matrix) {
    /**
     * Applies a temporary transformation {@link Matrix} to the view's drawable when it is drawn.
     * Allows custom scaling, translation, and perspective distortion during an animation.
     *
     * This method is a lightweight analogue of {@link ImageView#setImageMatrix(Matrix)} to use
     * only during animations as this matrix will be cleared after the next drawable
     * update or view's bounds change.
     *
     * @param matrix The transformation parameters in matrix form.
     */
    public void animateTransform(@Nullable Matrix matrix) {
        if (mDrawable == null) {
            return;
        }
@@ -1341,6 +1349,7 @@ public class ImageView extends View {
            final int vwidth = getWidth() - mPaddingLeft - mPaddingRight;
            final int vheight = getHeight() - mPaddingTop - mPaddingBottom;
            mDrawable.setBounds(0, 0, vwidth, vheight);
            mDrawMatrix = null;
        } else {
            mDrawable.setBounds(0, 0, mDrawableWidth, mDrawableHeight);
            if (mDrawMatrix == null) {