Merge "[Magnifier-35] Do not show when text is large" into pi-dev
am: f45b3a1136
Change-Id: I6f050b6dfe847daf8d3ebef29398344d69d8baf5
This commit is contained in:
@@ -4824,13 +4824,23 @@ public class Editor {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean tooLargeTextForMagnifier() {
|
||||
final float magnifierContentHeight = Math.round(
|
||||
mMagnifierAnimator.mMagnifier.getHeight()
|
||||
/ mMagnifierAnimator.mMagnifier.getZoom());
|
||||
final Paint.FontMetrics fontMetrics = mTextView.getPaint().getFontMetrics();
|
||||
final float glyphHeight = fontMetrics.descent - fontMetrics.ascent;
|
||||
return glyphHeight > magnifierContentHeight;
|
||||
}
|
||||
|
||||
protected final void updateMagnifier(@NonNull final MotionEvent event) {
|
||||
if (mMagnifierAnimator == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final PointF showPosInView = new PointF();
|
||||
final boolean shouldShow = obtainMagnifierShowCoordinates(event, showPosInView);
|
||||
final boolean shouldShow = !tooLargeTextForMagnifier()
|
||||
&& obtainMagnifierShowCoordinates(event, showPosInView);
|
||||
if (shouldShow) {
|
||||
// Make the cursor visible and stop blinking.
|
||||
mRenderCursorRegardlessTiming = true;
|
||||
|
||||
Reference in New Issue
Block a user