Loading core/java/android/widget/Editor.java +1 −2 Original line number Diff line number Diff line Loading @@ -165,7 +165,6 @@ public class Editor { private static final int MENU_ITEM_ORDER_PASTE_AS_PLAIN_TEXT = 11; private static final int MENU_ITEM_ORDER_PROCESS_TEXT_INTENT_ACTIONS_START = 100; private static final float MAGNIFIER_ZOOM = 1.25f; @IntDef({MagnifierHandleTrigger.SELECTION_START, MagnifierHandleTrigger.SELECTION_END, MagnifierHandleTrigger.INSERTION}) Loading Loading @@ -4547,7 +4546,7 @@ public class Editor { + mTextView.getTotalPaddingTop() - mTextView.getScrollY(); suspendBlink(); mMagnifier.show(xPosInView, yPosInView, MAGNIFIER_ZOOM); mMagnifier.show(xPosInView, yPosInView); } protected final void dismissMagnifier() { Loading core/java/com/android/internal/widget/Magnifier.java +15 −25 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ public final class Magnifier { // the copy is finished. private final Handler mPixelCopyHandler = Handler.getMain(); // Current magnification scale. private float mScale; private final float mZoomScale; // Timer used to schedule the copy task. private Timer mTimer; Loading @@ -76,11 +76,12 @@ public final class Magnifier { public Magnifier(@NonNull View view) { mView = Preconditions.checkNotNull(view); final Context context = mView.getContext(); final float elevation = context.getResources().getDimension(R.dimen.magnifier_elevation); final View content = LayoutInflater.from(context).inflate(R.layout.magnifier, null); content.findViewById(R.id.magnifier_inner).setClipToOutline(true); mWindowWidth = context.getResources().getDimensionPixelSize(R.dimen.magnifier_width); mWindowHeight = context.getResources().getDimensionPixelSize(R.dimen.magnifier_height); final float elevation = context.getResources().getDimension(R.dimen.magnifier_elevation); mZoomScale = context.getResources().getFloat(R.dimen.magnifier_zoom_scale); mWindow = new PopupWindow(context); mWindow.setContentView(content); Loading @@ -90,7 +91,9 @@ public final class Magnifier { mWindow.setTouchable(false); mWindow.setBackgroundDrawable(null); mBitmap = Bitmap.createBitmap(mWindowWidth, mWindowHeight, Bitmap.Config.ARGB_8888); final int bitmapWidth = (int) (mWindowWidth / mZoomScale); final int bitmapHeight = (int) (mWindowHeight / mZoomScale); mBitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Bitmap.Config.ARGB_8888); getImageView().setImageBitmap(mBitmap); } Loading @@ -101,20 +104,8 @@ public final class Magnifier { * to the view. The lower end is clamped to 0 * @param yPosInView vertical coordinate of the center point of the magnifier source * relative to the view. The lower end is clamped to 0 * @param scale the scale at which the magnifier zooms on the source content. The * lower end is clamped to 1 and the higher end to 4 */ public void show(@FloatRange(from=0) float xPosInView, @FloatRange(from=0) float yPosInView, @FloatRange(from=1, to=4) float scale) { if (scale > 4) { scale = 4; } if (scale < 1) { scale = 1; } public void show(@FloatRange(from=0) float xPosInView, @FloatRange(from=0) float yPosInView) { if (xPosInView < 0) { xPosInView = 0; } Loading @@ -123,10 +114,6 @@ public final class Magnifier { yPosInView = 0; } if (mScale != scale) { resizeBitmap(scale); } mScale = scale; configureCoordinates(xPosInView, yPosInView); if (mTimer == null) { Loading Loading @@ -164,6 +151,7 @@ public final class Magnifier { /** * @return the height of the magnifier window. */ @NonNull public int getHeight() { return mWindowHeight; } Loading @@ -171,15 +159,17 @@ public final class Magnifier { /** * @return the width of the magnifier window. */ @NonNull public int getWidth() { return mWindowWidth; } private void resizeBitmap(float scale) { final int bitmapWidth = (int) (mWindowWidth / scale); final int bitmapHeight = (int) (mWindowHeight / scale); mBitmap.reconfigure(bitmapWidth, bitmapHeight, Bitmap.Config.ARGB_8888); getImageView().setImageBitmap(mBitmap); /** * @return the zoom scale of the magnifier. */ @NonNull public float getZoomScale() { return mZoomScale; } private void configureCoordinates(float xPosInView, float yPosInView) { Loading core/res/res/layout/magnifier.xml +4 −3 Original line number Diff line number Diff line Loading @@ -22,10 +22,11 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/magnifier_inner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_width="@android:dimen/magnifier_width" android:layout_height="@android:dimen/magnifier_height" android:elevation="@android:dimen/magnifier_elevation" android:background="?android:attr/floatingToolbarPopupBackgroundDrawable" android:elevation="@android:dimen/magnifier_elevation"> android:scaleType="fitXY"> <ImageView android:id="@+id/magnifier_image" android:layout_width="match_parent" Loading core/res/res/values/dimens.xml +1 −0 Original line number Diff line number Diff line Loading @@ -525,6 +525,7 @@ <dimen name="magnifier_height">48dp</dimen> <dimen name="magnifier_elevation">2dp</dimen> <dimen name="magnifier_offset">42dp</dimen> <item type="dimen" format="float" name="magnifier_zoom_scale">1.25</item> <dimen name="chooser_grid_padding">0dp</dimen> <!-- Spacing around the background change frome service to non-service --> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2484,6 +2484,7 @@ <java-symbol type="dimen" name="magnifier_width" /> <java-symbol type="dimen" name="magnifier_height" /> <java-symbol type="dimen" name="magnifier_elevation" /> <java-symbol type="dimen" name="magnifier_zoom_scale" /> <java-symbol type="dimen" name="magnifier_offset" /> <java-symbol type="string" name="date_picker_prev_month_button" /> Loading Loading
core/java/android/widget/Editor.java +1 −2 Original line number Diff line number Diff line Loading @@ -165,7 +165,6 @@ public class Editor { private static final int MENU_ITEM_ORDER_PASTE_AS_PLAIN_TEXT = 11; private static final int MENU_ITEM_ORDER_PROCESS_TEXT_INTENT_ACTIONS_START = 100; private static final float MAGNIFIER_ZOOM = 1.25f; @IntDef({MagnifierHandleTrigger.SELECTION_START, MagnifierHandleTrigger.SELECTION_END, MagnifierHandleTrigger.INSERTION}) Loading Loading @@ -4547,7 +4546,7 @@ public class Editor { + mTextView.getTotalPaddingTop() - mTextView.getScrollY(); suspendBlink(); mMagnifier.show(xPosInView, yPosInView, MAGNIFIER_ZOOM); mMagnifier.show(xPosInView, yPosInView); } protected final void dismissMagnifier() { Loading
core/java/com/android/internal/widget/Magnifier.java +15 −25 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ public final class Magnifier { // the copy is finished. private final Handler mPixelCopyHandler = Handler.getMain(); // Current magnification scale. private float mScale; private final float mZoomScale; // Timer used to schedule the copy task. private Timer mTimer; Loading @@ -76,11 +76,12 @@ public final class Magnifier { public Magnifier(@NonNull View view) { mView = Preconditions.checkNotNull(view); final Context context = mView.getContext(); final float elevation = context.getResources().getDimension(R.dimen.magnifier_elevation); final View content = LayoutInflater.from(context).inflate(R.layout.magnifier, null); content.findViewById(R.id.magnifier_inner).setClipToOutline(true); mWindowWidth = context.getResources().getDimensionPixelSize(R.dimen.magnifier_width); mWindowHeight = context.getResources().getDimensionPixelSize(R.dimen.magnifier_height); final float elevation = context.getResources().getDimension(R.dimen.magnifier_elevation); mZoomScale = context.getResources().getFloat(R.dimen.magnifier_zoom_scale); mWindow = new PopupWindow(context); mWindow.setContentView(content); Loading @@ -90,7 +91,9 @@ public final class Magnifier { mWindow.setTouchable(false); mWindow.setBackgroundDrawable(null); mBitmap = Bitmap.createBitmap(mWindowWidth, mWindowHeight, Bitmap.Config.ARGB_8888); final int bitmapWidth = (int) (mWindowWidth / mZoomScale); final int bitmapHeight = (int) (mWindowHeight / mZoomScale); mBitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Bitmap.Config.ARGB_8888); getImageView().setImageBitmap(mBitmap); } Loading @@ -101,20 +104,8 @@ public final class Magnifier { * to the view. The lower end is clamped to 0 * @param yPosInView vertical coordinate of the center point of the magnifier source * relative to the view. The lower end is clamped to 0 * @param scale the scale at which the magnifier zooms on the source content. The * lower end is clamped to 1 and the higher end to 4 */ public void show(@FloatRange(from=0) float xPosInView, @FloatRange(from=0) float yPosInView, @FloatRange(from=1, to=4) float scale) { if (scale > 4) { scale = 4; } if (scale < 1) { scale = 1; } public void show(@FloatRange(from=0) float xPosInView, @FloatRange(from=0) float yPosInView) { if (xPosInView < 0) { xPosInView = 0; } Loading @@ -123,10 +114,6 @@ public final class Magnifier { yPosInView = 0; } if (mScale != scale) { resizeBitmap(scale); } mScale = scale; configureCoordinates(xPosInView, yPosInView); if (mTimer == null) { Loading Loading @@ -164,6 +151,7 @@ public final class Magnifier { /** * @return the height of the magnifier window. */ @NonNull public int getHeight() { return mWindowHeight; } Loading @@ -171,15 +159,17 @@ public final class Magnifier { /** * @return the width of the magnifier window. */ @NonNull public int getWidth() { return mWindowWidth; } private void resizeBitmap(float scale) { final int bitmapWidth = (int) (mWindowWidth / scale); final int bitmapHeight = (int) (mWindowHeight / scale); mBitmap.reconfigure(bitmapWidth, bitmapHeight, Bitmap.Config.ARGB_8888); getImageView().setImageBitmap(mBitmap); /** * @return the zoom scale of the magnifier. */ @NonNull public float getZoomScale() { return mZoomScale; } private void configureCoordinates(float xPosInView, float yPosInView) { Loading
core/res/res/layout/magnifier.xml +4 −3 Original line number Diff line number Diff line Loading @@ -22,10 +22,11 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/magnifier_inner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_width="@android:dimen/magnifier_width" android:layout_height="@android:dimen/magnifier_height" android:elevation="@android:dimen/magnifier_elevation" android:background="?android:attr/floatingToolbarPopupBackgroundDrawable" android:elevation="@android:dimen/magnifier_elevation"> android:scaleType="fitXY"> <ImageView android:id="@+id/magnifier_image" android:layout_width="match_parent" Loading
core/res/res/values/dimens.xml +1 −0 Original line number Diff line number Diff line Loading @@ -525,6 +525,7 @@ <dimen name="magnifier_height">48dp</dimen> <dimen name="magnifier_elevation">2dp</dimen> <dimen name="magnifier_offset">42dp</dimen> <item type="dimen" format="float" name="magnifier_zoom_scale">1.25</item> <dimen name="chooser_grid_padding">0dp</dimen> <!-- Spacing around the background change frome service to non-service --> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2484,6 +2484,7 @@ <java-symbol type="dimen" name="magnifier_width" /> <java-symbol type="dimen" name="magnifier_height" /> <java-symbol type="dimen" name="magnifier_elevation" /> <java-symbol type="dimen" name="magnifier_zoom_scale" /> <java-symbol type="dimen" name="magnifier_offset" /> <java-symbol type="string" name="date_picker_prev_month_button" /> Loading