Style panel with Material designs (1/n)
We apply Theme.SystemUI to the window context for WindowMagnificationController to follow the theme color configurations in SystemUI. The following components are styled to follow Material designs in this modification: 1. The background of the settings panel 2. All text titles The margin and padding for coresponding layouts and views are fixed and defined in the file "dimens.xml". Bug: 257272333 Test: manual - attach screenshots with the bug Change-Id: I11646fe5739eaf48d9e12e432a796bec7d97cdd7
This commit is contained in:
@@ -1,27 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2022 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/accessibility_magnifier_bg" />
|
||||
<corners android:radius="24dp" />
|
||||
<stroke
|
||||
android:color="@color/accessibility_magnifier_bg_stroke"
|
||||
android:width="1dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2022 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/magnification_setting_background_corner_radius" />
|
||||
<solid android:color="?androidprv:attr/colorSurface" />
|
||||
</shape>
|
||||
@@ -16,12 +16,13 @@
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/magnifier_panel_view"
|
||||
android:layout_width="@dimen/magnification_max_size"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/accessibility_magnification_setting_view_bg"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/magnification_setting_background_padding">
|
||||
<LinearLayout
|
||||
android:layout_width="@dimen/magnification_max_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
@@ -29,11 +30,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/accessibility_magnifier_size"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:textColor="?android:attr/textColorAlertDialogListItem"
|
||||
android:textAppearance="@style/TextAppearance.MagnificationSetting.Title"
|
||||
android:focusable="true"
|
||||
android:layout_gravity="center_vertical|left"
|
||||
android:layout_marginStart="20dp"/>
|
||||
android:layout_gravity="center_vertical|left" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/magnifier_edit_button"
|
||||
@@ -44,12 +43,11 @@
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:textColor="?android:attr/textColorAlertDialogListItem"
|
||||
android:focusable="true"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginEnd="20dp"/>
|
||||
android:layout_gravity="right" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="@dimen/magnification_max_size"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<ImageButton
|
||||
@@ -58,7 +56,6 @@
|
||||
android:layout_height="56dp"
|
||||
android:scaleType="center"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="12dp"
|
||||
android:background="@drawable/accessibility_magnification_setting_view_btn_bg"
|
||||
android:padding="@dimen/magnification_switch_button_padding"
|
||||
android:src="@drawable/ic_magnification_menu_small"
|
||||
@@ -95,7 +92,6 @@
|
||||
android:layout_height="56dp"
|
||||
android:scaleType="center"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:background="@drawable/accessibility_magnification_setting_view_btn_bg"
|
||||
android:padding="@dimen/magnification_switch_button_padding"
|
||||
android:src="@drawable/ic_open_in_new_fullscreen"
|
||||
@@ -107,68 +103,49 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:paddingStart="20dp"
|
||||
android:layout_marginTop="@dimen/magnification_setting_view_margin"
|
||||
android:layout_marginBottom="@dimen/magnification_setting_view_margin"
|
||||
android:focusable="true">
|
||||
|
||||
<LinearLayout
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/accessibility_allow_diagonal_scrolling"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:textColor="?android:attr/textColorAlertDialogListItem" />
|
||||
</LinearLayout>
|
||||
android:singleLine="true"
|
||||
android:text="@string/accessibility_allow_diagonal_scrolling"
|
||||
android:textAppearance="@style/TextAppearance.MagnificationSetting.Title" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/magnifier_horizontal_lock_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center"
|
||||
android:theme="@android:style/Theme.DeviceDefault.DayNight"/>
|
||||
android:layout_gravity="right" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/accessibility_magnification_zoom"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:textColor="?android:attr/textColorAlertDialogListItem"
|
||||
android:focusable="true"
|
||||
android:layout_marginStart="20dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="10dp"/>
|
||||
android:textAppearance="@style/TextAppearance.MagnificationSetting.Title"
|
||||
android:focusable="true" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/magnifier_zoom_seekbar"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="@dimen/magnification_setting_seekbar_margin"
|
||||
android:progress="0"
|
||||
android:max="6"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:theme="@android:style/Theme.DeviceDefault.DayNight"/>
|
||||
|
||||
android:max="6" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/magnifier_close_button"
|
||||
android:background="@drawable/accessibility_magnification_setting_view_btn_bg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/accessibility_magnification_close"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:textColor="?android:attr/textColorAlertDialogListItem"
|
||||
android:focusable="true"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:paddingBottom="24dp"/>
|
||||
android:layout_marginTop="@dimen/magnification_setting_view_margin"/>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -1104,13 +1104,18 @@
|
||||
<!-- The extra padding to show the whole outer border -->
|
||||
<dimen name="magnifier_drag_handle_padding">3dp</dimen>
|
||||
<dimen name="magnification_max_frame_size">300dp</dimen>
|
||||
<!-- Magnification settings panel -->
|
||||
<dimen name="magnification_setting_view_margin">24dp</dimen>
|
||||
<dimen name="magnification_setting_text_size">18sp</dimen>
|
||||
<dimen name="magnification_setting_background_padding">24dp</dimen>
|
||||
<dimen name="magnification_setting_background_corner_radius">28dp</dimen>
|
||||
<dimen name="magnification_setting_seekbar_margin">16dp</dimen>
|
||||
|
||||
<!-- How far from the right edge of the screen you need to drag the window before the button
|
||||
repositions to the other side. -->
|
||||
<dimen name="magnification_button_reposition_threshold_from_edge">32dp</dimen>
|
||||
|
||||
<dimen name="magnification_drag_size">15dp</dimen>
|
||||
<dimen name="magnification_max_size">360dp</dimen>
|
||||
<dimen name="magnifier_panel_size">265dp</dimen>
|
||||
|
||||
<!-- Home Controls -->
|
||||
|
||||
@@ -1334,4 +1334,13 @@
|
||||
<item name="biometricsEnrollProgressHelp">@color/udfps_enroll_progress_help</item>
|
||||
<item name="biometricsEnrollProgressHelpWithTalkback">@color/udfps_enroll_progress_help_with_talkback</item>
|
||||
</style>
|
||||
|
||||
<!-- Magnification styles -->
|
||||
<style name="TextAppearance.MagnificationSetting" />
|
||||
|
||||
<style name="TextAppearance.MagnificationSetting.Title">
|
||||
<item name="android:fontFamily">google-sans</item>
|
||||
<item name="android:textColor">?androidprv:attr/textColorPrimary</item>
|
||||
<item name="android:textSize">@dimen/magnification_setting_text_size</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
@@ -89,6 +89,7 @@ public class WindowMagnification implements CoreStartable, WindowMagnifierCallba
|
||||
protected WindowMagnificationController createInstance(Display display) {
|
||||
final Context windowContext = mContext.createWindowContext(display,
|
||||
TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY, /* options */ null);
|
||||
windowContext.setTheme(com.android.systemui.R.style.Theme_SystemUI);
|
||||
return new WindowMagnificationController(
|
||||
windowContext,
|
||||
mHandler,
|
||||
|
||||
@@ -428,7 +428,8 @@ class WindowMagnificationSettings implements MagnificationGestureDetector.OnGest
|
||||
}
|
||||
|
||||
void onConfigurationChanged(int configDiff) {
|
||||
if ((configDiff & ActivityInfo.CONFIG_UI_MODE) != 0) {
|
||||
if ((configDiff & ActivityInfo.CONFIG_UI_MODE) != 0
|
||||
|| (configDiff & ActivityInfo.CONFIG_ASSETS_PATHS) != 0) {
|
||||
boolean showSettingPanelAfterThemeChange = mIsVisible;
|
||||
hideSettingPanel(/* resetPosition= */ false);
|
||||
inflateView();
|
||||
|
||||
Reference in New Issue
Block a user