From 3576504774c7b4f3fd4c4b6dac449479bcc1ea93 Mon Sep 17 00:00:00 2001 From: chihtinglo Date: Wed, 28 Dec 2022 16:50:46 +0800 Subject: [PATCH] Style the Magnification Window - Window Mode Modifying the design of the magnification window in window mode: 1. We change the window to rounded rectangle with styled border. 2. We change the design of the window border when it is in "Edit" state. 3. We change the design of the drag handle to a solid shape. Bug: 257272333 Test: manual - attach videos with the bug Change-Id: I69310ae7db04cee116021ad951082362efc95fad --- ...bility_window_magnification_background.xml | 34 ++++++++++++++++++ ...window_magnification_background_change.xml | 36 +++++++++++++++++++ ...w_magnification_drag_corner_background.xml | 25 +++++++++++++ ...w_magnification_drag_handle_background.xml | 23 ++++++++++++ .../ic_arrow_top_left_and_bottom_right.xml | 26 ++++++++++++++ .../ic_arrow_top_right_and_bottom_left.xml | 32 +++++++++++++++++ .../res/drawable/ic_move_magnification.xml | 2 +- .../res/layout/window_magnifier_view.xml | 34 +++++++++--------- packages/SystemUI/res/values/colors.xml | 5 +-- packages/SystemUI/res/values/dimens.xml | 10 ++++++ .../WindowMagnificationController.java | 15 ++++++-- 11 files changed, 219 insertions(+), 23 deletions(-) create mode 100644 packages/SystemUI/res/drawable/accessibility_window_magnification_background.xml create mode 100644 packages/SystemUI/res/drawable/accessibility_window_magnification_background_change.xml create mode 100644 packages/SystemUI/res/drawable/accessibility_window_magnification_drag_corner_background.xml create mode 100644 packages/SystemUI/res/drawable/accessibility_window_magnification_drag_handle_background.xml create mode 100644 packages/SystemUI/res/drawable/ic_arrow_top_left_and_bottom_right.xml create mode 100644 packages/SystemUI/res/drawable/ic_arrow_top_right_and_bottom_left.xml diff --git a/packages/SystemUI/res/drawable/accessibility_window_magnification_background.xml b/packages/SystemUI/res/drawable/accessibility_window_magnification_background.xml new file mode 100644 index 0000000000000..58fe368ce4e11 --- /dev/null +++ b/packages/SystemUI/res/drawable/accessibility_window_magnification_background.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/SystemUI/res/drawable/accessibility_window_magnification_background_change.xml b/packages/SystemUI/res/drawable/accessibility_window_magnification_background_change.xml new file mode 100644 index 0000000000000..693545bf8b966 --- /dev/null +++ b/packages/SystemUI/res/drawable/accessibility_window_magnification_background_change.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/SystemUI/res/drawable/accessibility_window_magnification_drag_corner_background.xml b/packages/SystemUI/res/drawable/accessibility_window_magnification_drag_corner_background.xml new file mode 100644 index 0000000000000..c8cd4c9d70c63 --- /dev/null +++ b/packages/SystemUI/res/drawable/accessibility_window_magnification_drag_corner_background.xml @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/packages/SystemUI/res/drawable/accessibility_window_magnification_drag_handle_background.xml b/packages/SystemUI/res/drawable/accessibility_window_magnification_drag_handle_background.xml new file mode 100644 index 0000000000000..a52e8053d8a02 --- /dev/null +++ b/packages/SystemUI/res/drawable/accessibility_window_magnification_drag_handle_background.xml @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/packages/SystemUI/res/drawable/ic_arrow_top_left_and_bottom_right.xml b/packages/SystemUI/res/drawable/ic_arrow_top_left_and_bottom_right.xml new file mode 100644 index 0000000000000..9cac38b9d24fb --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_arrow_top_left_and_bottom_right.xml @@ -0,0 +1,26 @@ + + + + + diff --git a/packages/SystemUI/res/drawable/ic_arrow_top_right_and_bottom_left.xml b/packages/SystemUI/res/drawable/ic_arrow_top_right_and_bottom_left.xml new file mode 100644 index 0000000000000..0a8744184a955 --- /dev/null +++ b/packages/SystemUI/res/drawable/ic_arrow_top_right_and_bottom_left.xml @@ -0,0 +1,32 @@ + + + + + + + + diff --git a/packages/SystemUI/res/drawable/ic_move_magnification.xml b/packages/SystemUI/res/drawable/ic_move_magnification.xml index dfedd288619c0..641bb4381fc8e 100644 --- a/packages/SystemUI/res/drawable/ic_move_magnification.xml +++ b/packages/SystemUI/res/drawable/ic_move_magnification.xml @@ -20,6 +20,6 @@ android:viewportHeight="24" android:tint="?attr/colorControlNormal"> diff --git a/packages/SystemUI/res/layout/window_magnifier_view.xml b/packages/SystemUI/res/layout/window_magnifier_view.xml index 0be732855deeb..a8a048d8c2f6c 100644 --- a/packages/SystemUI/res/layout/window_magnifier_view.xml +++ b/packages/SystemUI/res/layout/window_magnifier_view.xml @@ -16,6 +16,7 @@ --> @@ -24,7 +25,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="@dimen/magnification_outer_border_margin" - android:background="@color/magnification_border_color"/> + android:background="@drawable/accessibility_window_magnification_background"/> + android:src="@drawable/ic_move_magnification" + android:background="@drawable/accessibility_window_magnification_drag_handle_background"/> #FDE293 - #FF9900 - #0000FF + #F29900 #7F000000 + #E5FFFFFF #B3000000 + #111111 #FCFCFC #E0E0E0 #252525 diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 3ae14b28ec592..ebf232ff9c6fb 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1099,6 +1099,7 @@ 15dp 17dp 20dp + 8dp 5dp 25dp 36dp @@ -1111,6 +1112,15 @@ 45dp 45dp 40dp + 30dp + 28dp + 16dp + 18dp + 8dp + 2dp + 20dp + 26dp + 3dp 3dp 300dp diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java b/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java index 0a0a36b111d28..b111e1f72f1d8 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java @@ -49,6 +49,7 @@ import android.provider.Settings; import android.util.Log; import android.util.Range; import android.util.Size; +import android.util.TypedValue; import android.view.Choreographer; import android.view.Display; import android.view.Gravity; @@ -1273,9 +1274,19 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold } private void applyResourcesValues() { - mMirrorBorderView.setBackgroundColor(mResources.getColor(mEditSizeEnable - ? R.color.magnification_border_color_change : R.color.magnification_border_color)); + // Sets the border appearance for the magnifier window + mMirrorBorderView.setBackground(mResources.getDrawable(mEditSizeEnable + ? R.drawable.accessibility_window_magnification_background_change + : R.drawable.accessibility_window_magnification_background)); + // Changes the corner radius of the mMirrorSurfaceView + mMirrorSurfaceView.setCornerRadius( + TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_DIP, + mEditSizeEnable ? 16f : 28f, + mContext.getResources().getDisplayMetrics())); + + // Sets visibility of components for the magnifier window if (mEditSizeEnable) { mDragView.setVisibility(View.GONE); mCloseView.setVisibility(View.VISIBLE);