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

Commit d924db7d authored by Jean Chen's avatar Jean Chen Committed by Android (Google) Code Review
Browse files

Merge changes I19521dfc,Ie6c812bf into main

* changes:
  feat(magnify_ime): Add toggles for Magnify keyboard and Magnify/follow typing in the floating settings panel
  Use Material3 switch to replace Switch in the floating settings panel
parents 9810dda4 cf8b8d66
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -481,6 +481,7 @@ android_library {
        "SystemUI-shared-utils",
        "SystemUI-statsd",
        "SettingsLib",
        "com_android_server_accessibility_flags_lib",
        "com_android_systemui_flags_lib",
        "//frameworks/libs/systemui:com_android_systemui_shared_flags_lib",
        "androidx.core_core-ktx",
@@ -671,6 +672,7 @@ android_library {
        "SystemUI-shared-utils",
        "SystemUI-statsd",
        "SettingsLib",
        "com_android_server_accessibility_flags_lib",
        "com_android_systemui_flags_lib",
        "//frameworks/libs/systemui:com_android_systemui_shared_flags_lib",
        "flag-junit-base",
+70 −7
Original line number Diff line number Diff line
@@ -125,16 +125,79 @@
            android:labelFor="@id/magnifier_horizontal_lock_switch"
            android:layout_gravity="center_vertical" />

        <Switch
        <com.google.android.material.materialswitch.MaterialSwitch
            android:id="@+id/magnifier_horizontal_lock_switch"
            android:switchMinWidth="@dimen/settingslib_switch_track_width"
            android:layout_gravity="right|center_vertical"
            android:layout_width="@dimen/settingslib_switch_track_width"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clickable="true"
            android:focusable="true"
            android:theme="@style/Theme.Material3.DynamicColors.DayNight"
            style="@style/SettingslibSwitchStyle.Expressive" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/magnifier_typing_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="@dimen/magnification_setting_view_margin"
        android:focusable="true"
        android:visibility="gone">

        <TextView
            android:id="@+id/magnifier_typing_title"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_marginEnd="@dimen/magnification_setting_view_item_horizontal_spacing"
            android:text="@string/accessibility_magnify_typing"
            android:textAppearance="@style/TextAppearance.MagnificationSetting.Title"
            android:labelFor="@id/magnifier_horizontal_lock_switch"
            android:layout_gravity="center_vertical" />

        <com.google.android.material.materialswitch.MaterialSwitch
            android:id="@+id/magnifier_typing_switch"
            android:layout_gravity="right|center_vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:track="@drawable/settingslib_track_selector"
            android:thumb="@drawable/settingslib_thumb_selector"
            android:theme="@style/MainSwitch.Settingslib"
            android:minHeight="48dp" />
            android:clickable="true"
            android:focusable="true"
            android:theme="@style/Theme.Material3.DynamicColors.DayNight"
            style="@style/SettingslibSwitchStyle.Expressive" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/magnifier_keyboard_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="@dimen/magnification_setting_view_margin"
        android:focusable="true"
        android:visibility="gone">

        <TextView
            android:id="@+id/magnifier_keyboard_title"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_marginEnd="@dimen/magnification_setting_view_item_horizontal_spacing"
            android:text="@string/accessibility_magnify_keyboard"
            android:textAppearance="@style/TextAppearance.MagnificationSetting.Title"
            android:labelFor="@id/magnifier_horizontal_lock_switch"
            android:layout_gravity="center_vertical" />

        <com.google.android.material.materialswitch.MaterialSwitch
            android:id="@+id/magnifier_keyboard_switch"
            android:layout_gravity="right|center_vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clickable="true"
            android:focusable="true"
            android:theme="@style/Theme.Material3.DynamicColors.DayNight"
            style="@style/SettingslibSwitchStyle.Expressive" />

    </LinearLayout>

+4 −0
Original line number Diff line number Diff line
@@ -3062,6 +3062,10 @@

    <!-- Title of the magnification option button allow diagonal scrolling [CHAR LIMIT=NONE]-->
    <string name="accessibility_allow_diagonal_scrolling">Allow diagonal scrolling</string>
    <!-- Title of the magnification option button allow magnify typing [CHAR LIMIT=NONE]-->
    <string name="accessibility_magnify_typing">Magnify typing</string>
    <!-- Title of the magnification option button allow magnify keyboard [CHAR LIMIT=NONE]-->
    <string name="accessibility_magnify_keyboard">Magnify keyboard</string>
    <!-- Title of the magnification option button Resize [CHAR LIMIT=NONE]-->
    <string name="accessibility_resize">Resize</string>
    <!-- Title of the magnification option button Change type [CHAR LIMIT=NONE]-->
+28 −0
Original line number Diff line number Diff line
@@ -531,6 +531,16 @@ public class MagnificationImpl implements Magnification, CommandQueue.Callbacks
                    mHandler.post(() -> onSetDiagonalScrollingInternal(displayId, enable));
                }

                @Override
                public void onSetMagnifyTyping(int displayId, boolean enable) {
                    mHandler.post(() -> onSetMagnifyTypingInternal(displayId, enable));
                }

                @Override
                public void onSetMagnifyKeyboard(int displayId, boolean enable) {
                    mHandler.post(() -> onSetMagnifyKeyboardInternal(displayId, enable));
                }

                @Override
                public void onEditMagnifierSizeMode(int displayId, boolean enable) {
                    mHandler.post(() -> onEditMagnifierSizeModeInternal(displayId, enable));
@@ -583,6 +593,24 @@ public class MagnificationImpl implements Magnification, CommandQueue.Callbacks
        }
    }

    @MainThread
    private void onSetMagnifyTypingInternal(int displayId, boolean enable) {
        final WindowMagnificationController windowMagnificationController =
                mWindowMagnificationControllerSupplier.get(displayId);
        if (windowMagnificationController != null) {
            windowMagnificationController.setMagnifyTyping(enable);
        }
    }

    @MainThread
    private void onSetMagnifyKeyboardInternal(int displayId, boolean enable) {
        final WindowMagnificationController windowMagnificationController =
                mWindowMagnificationControllerSupplier.get(displayId);
        if (windowMagnificationController != null) {
            windowMagnificationController.setMagnifyKeyboard(enable);
        }
    }

    @MainThread
    private void onEditMagnifierSizeModeInternal(int displayId, boolean enable) {
        final WindowMagnificationController windowMagnificationController =
+27 −1
Original line number Diff line number Diff line
@@ -162,6 +162,22 @@ public class MagnificationSettingsController implements ComponentCallbacks {
         */
        void onSetDiagonalScrolling(int displayId, boolean enable);

        /**
         * Called when set magnify typing.
         *
         * @param displayId The logical display id.
         * @param enable Magnify typing enable value.
         */
        void onSetMagnifyTyping(int displayId, boolean enable);

        /**
         * Called when set magnify keyboard.
         *
         * @param displayId The logical display id.
         * @param enable Magnify keyboard enable value.
         */
        void onSetMagnifyKeyboard(int displayId, boolean enable);

        /**
         * Called when change magnification size on free mode.
         *
@@ -206,6 +222,16 @@ public class MagnificationSettingsController implements ComponentCallbacks {
            mSettingsControllerCallback.onSetDiagonalScrolling(mDisplayId, enable);
        }

        @Override
        public void onSetMagnifyTyping(boolean enable) {
            mSettingsControllerCallback.onSetMagnifyTyping(mDisplayId, enable);
        }

        @Override
        public void onSetMagnifyKeyboard(boolean enable) {
            mSettingsControllerCallback.onSetMagnifyKeyboard(mDisplayId, enable);
        }

        @Override
        public void onModeSwitch(int newMode) {
            mSettingsControllerCallback.onModeSwitch(mDisplayId, newMode);
Loading