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

Commit 57098f45 authored by Stanley Wang's avatar Stanley Wang
Browse files

Use SettingsLib's MainSwitchPreference to replace the Switches which use

LayoutPreference.

Bug: 175181773
Test: Run robotest and apply the widget in Settings and see the ui
Change-Id: I4588d1fc3004970b174e7c5c5d1aa7745f774985
parent adcd4f16
Loading
Loading
Loading
Loading
+0 −39
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2020 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.
  -->

<!-- For use in a LayoutPreference -->
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:importantForAccessibility="no">

    <com.android.settings.widget.SwitchBar
        android:id="@+id/switch_bar"
        android:minHeight="?android:attr/actionBarSize"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:paddingStart="0dp"
        android:theme="?attr/switchBarTheme"/>
    <TextView
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:layout_marginStart="@dimen/actionbar_subsettings_contentInsetStart"
        android:layout_marginVertical="16dp"
        android:text="@string/emergency_gesture_screen_summary"/>
</LinearLayout>
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -12581,4 +12581,8 @@
    <string name="category_name_others">Others</string>
    <!-- General category name [CHAR LIMIT=none] -->
    <string name="category_name_general">General</string>
    <!-- Do not translate. Title for prevent ringing main switch. [CHAR LIMIT=50] -->
    <string name="prevent_ringing_main_switch_title" translatable="false">Use prevent ringing</string>
</resources>
+2 −3
Original line number Diff line number Diff line
@@ -22,9 +22,8 @@
        android:key="pref_app_header"
        android:layout="@layout/settings_entity_header" />

    <com.android.settingslib.widget.LayoutPreference
        android:key="block"
        android:layout="@layout/styled_switch_bar" />
    <com.android.settingslib.widget.MainSwitchPreference
        android:key="block" />

    <com.android.settings.notification.app.NotificationFooterPreference
        android:key="block_desc" />
+7 −5
Original line number Diff line number Diff line
@@ -20,15 +20,17 @@
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:title="@string/emergency_gesture_screen_title">

    <com.android.settingslib.widget.MainSwitchPreference
        android:key="gesture_emergency_button_switch_bar"
        app:controller="com.android.settings.gestures.EmergencyGesturePreferenceController" />

    <com.android.settings.widget.VideoPreference
        android:key="emergency_gesture_screen_video"
        app:animation="@raw/gesture_double_tap"
        app:preview="@drawable/gesture_double_tap"/>

    <com.android.settingslib.widget.LayoutPreference
        android:key="gesture_emergency_button_switch_bar"
        android:layout="@layout/emergency_gesture_switch_bar"
        app:controller="com.android.settings.gestures.EmergencyGesturePreferenceController"
    <com.android.settingslib.widget.TopIntroPreference
        android:title="@string/emergency_gesture_screen_summary"
        app:allowDividerBelow="true" />

    <SwitchPreference
+3 −4
Original line number Diff line number Diff line
@@ -20,16 +20,15 @@
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:title="@string/gesture_prevent_ringing_screen_title">

    <com.android.settingslib.widget.MainSwitchPreference
        android:key="gesture_prevent_ringing_switch" />

    <com.android.settings.widget.VideoPreference
        android:key="gesture_prevent_ringing_video"
        app:animation="@raw/gesture_prevent_ringing"
        app:preview="@drawable/gesture_prevent_ringing"
        app:controller="com.android.settings.widget.VideoPreferenceController" />

    <com.android.settingslib.widget.LayoutPreference
        android:key="gesture_prevent_ringing_switch"
        android:layout="@layout/styled_switch_bar" />

    <PreferenceCategory
        android:key="gesture_prevent_ringing_category"
        android:title="@string/gesture_prevent_ringing_title" />
Loading