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

Commit 3d71e1f3 authored by Mihai Popa's avatar Mihai Popa Committed by Android (Google) Code Review
Browse files

Merge "[Magnifier-63] Hide it for rotated/scaled textview"

parents 9cb1e613 ddf9fe01
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -14639,9 +14639,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * Recomputes the matrix if necessary.
     * Recomputes the matrix if necessary.
     *
     *
     * @return True if the transform matrix is the identity matrix, false otherwise.
     * @return True if the transform matrix is the identity matrix, false otherwise.
     * @hide
     */
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage
    final boolean hasIdentityMatrix() {
    public final boolean hasIdentityMatrix() {
        return mRenderNode.hasIdentityMatrix();
        return mRenderNode.hasIdentityMatrix();
    }
    }
+20 −0
Original line number Original line Diff line number Diff line
@@ -101,6 +101,7 @@ import android.view.View.OnClickListener;
import android.view.ViewConfiguration;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -4800,6 +4801,24 @@ public class Editor {
            return glyphHeight > magnifierContentHeight;
            return glyphHeight > magnifierContentHeight;
        }
        }


        private boolean viewIsMatrixTransformed() {
            if (mMagnifierAnimator.mMagnifierIsShowing) {
                // Do not check again when the magnifier is currently showing.
                return false;
            }
            if (!mTextView.hasIdentityMatrix()) {
                return true;
            }
            ViewParent viewParent = mTextView.getParent();
            while (viewParent != null) {
                if (viewParent instanceof View && !((View) viewParent).hasIdentityMatrix()) {
                    return true;
                }
                viewParent = viewParent.getParent();
            }
            return false;
        }

        /**
        /**
         * Computes the position where the magnifier should be shown, relative to
         * Computes the position where the magnifier should be shown, relative to
         * {@code mTextView}, and writes them to {@code showPosInView}. Also decides
         * {@code mTextView}, and writes them to {@code showPosInView}. Also decides
@@ -4928,6 +4947,7 @@ public class Editor {


            final PointF showPosInView = new PointF();
            final PointF showPosInView = new PointF();
            final boolean shouldShow = !tooLargeTextForMagnifier()
            final boolean shouldShow = !tooLargeTextForMagnifier()
                    && !viewIsMatrixTransformed()
                    && obtainMagnifierShowCoordinates(event, showPosInView);
                    && obtainMagnifierShowCoordinates(event, showPosInView);
            if (shouldShow) {
            if (shouldShow) {
                // Make the cursor visible and stop blinking.
                // Make the cursor visible and stop blinking.