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

Commit 10b7a7d4 authored by Stanley Wang's avatar Stanley Wang
Browse files

Use MainSwitchPreference to replace the button style switches.

Fix: 177967926
Fix: 177968295
Fix: 177967925
Fix: 177968078

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

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeight">

    <Button
        android:id="@+id/dark_ui_turn_on_button"
        style="@style/ActionPrimaryButton"
        android:layout_marginStart="@dimen/screen_margin_sides"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical" />

    <Button
        android:id="@+id/dark_ui_turn_off_button"
        style="@style/ActionSecondaryButton"
        android:layout_marginStart="@dimen/screen_margin_sides"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical" />

</LinearLayout>
 No newline at end of file
+0 −40
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2018 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.
  -->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeight">

    <Button
        android:id="@+id/night_display_turn_on_button"
        style="@style/ActionPrimaryButton"
        android:layout_marginStart="@dimen/screen_margin_sides"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical" />

    <Button
        android:id="@+id/night_display_turn_off_button"
        style="@style/ActionSecondaryButton"
        android:layout_marginStart="@dimen/screen_margin_sides"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical" />

</LinearLayout>
 No newline at end of file
+0 −55
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2017 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.
  -->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:text="@string/zen_mode_settings_summary"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/screen_margin_sides"
        android:layout_marginEnd="@dimen/description_margin_sides"
        android:layout_marginTop="@dimen/zen_mode_settings_button_margin_vertical"/>

    <Button
        android:id="@+id/zen_mode_settings_turn_on_button"
        style="@style/ActionPrimaryButton"
        android:layout_marginStart="@dimen/screen_margin_sides"
        android:layout_marginEnd="@dimen/description_margin_sides"
        android:layout_marginTop="@dimen/zen_mode_settings_button_margin_vertical"
        android:layout_marginBottom="@dimen/zen_mode_settings_button_margin_vertical"
        android:text="@string/zen_mode_button_turn_on"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

    <Button
        android:id="@+id/zen_mode_settings_turn_off_button"
        style="@style/ActionSecondaryButton"
        android:layout_marginStart="@dimen/screen_margin_sides"
        android:layout_marginEnd="@dimen/description_margin_sides"
        android:layout_marginTop="@dimen/zen_mode_settings_button_margin_vertical"
        android:layout_marginBottom="@dimen/zen_mode_settings_button_margin_vertical"
        android:text="@string/zen_mode_button_turn_off"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

</LinearLayout>
 No newline at end of file
+12 −0
Original line number Diff line number Diff line
@@ -12670,6 +12670,18 @@
    <string name="graphics_driver_main_switch_title" translatable="false">Use graphics driver preferences</string>
    <!-- Do not translate. Title for battery saver main switch preferences. [CHAR LIMIT=50] -->
    <string name="battery_saver_main_switch_title" translatable="false">Use battery saver</string>
    <!-- Do not translate. Title for Do Not Disturb main switch preferences. [CHAR LIMIT=50] -->
    <string name="do_not_disturb_main_switch_title" translatable="false">Use Do Not Disturb</string>
    <!-- Do not translate. Title for Dark theme main switch preferences. [CHAR LIMIT=50] -->
    <string name="dark_theme_main_switch_title" translatable="false">Use Dark Theme</string>
    <!-- Do not translate. Title for Night Light main switch preferences. [CHAR LIMIT=50] -->
    <string name="night_light_main_switch_title" translatable="false">Use Night Light</string>
    <!-- Do not translate. Title for NFC main switch preferences. [CHAR LIMIT=50] -->
    <string name="nfc_main_switch_title" translatable="false">Use NFC</string>
    <!-- Do not translate. Title for Adaptive Battery main switch preferences. [CHAR LIMIT=50] -->
    <string name="adaptive_battery_main_switch_title" translatable="false">Use adaptive battery</string>
    <!-- Do not translate. Title for adaptive brightness main switch preferences. [CHAR LIMIT=50] -->
    <string name="adaptive_brightness_main_switch_title" translatable="false">Use adaptive brightness</string>
    <!-- Default preference title for showing all apps on device [CHAR_LIMIT=50]-->
    <string name="default_see_all_apps_title">See all apps</string>
+6 −11
Original line number Diff line number Diff line
@@ -20,6 +20,12 @@
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:title="@string/auto_brightness_title">

    <com.android.settingslib.widget.MainSwitchPreference
        android:key="auto_brightness"
        android:title="@string/adaptive_brightness_main_switch_title"
        settings:keywords="@string/keywords_display_auto_brightness"
        settings:controller="com.android.settings.display.AutoBrightnessDetailPreferenceController"/>

    <com.android.settings.widget.VideoPreference
        android:key="auto_brightness_video"
        android:title="@string/summary_placeholder"
@@ -27,17 +33,6 @@
        settings:preview="@drawable/aab_brightness"
        settings:controller="com.android.settings.widget.VideoPreferenceController"/>

    <!-- Cross-listed item, if you change this, also change it in power_usage_summary.xml -->
    <com.android.settingslib.RestrictedSwitchPreference
        android:key="auto_brightness"
        android:title="@string/auto_brightness_title"
        android:summary="@string/auto_brightness_summary"
        settings:keywords="@string/keywords_display_auto_brightness"
        settings:controller="com.android.settings.display.AutoBrightnessDetailPreferenceController"
        settings:useAdminDisabledSummary="true"
        settings:userRestriction="no_config_brightness"
        settings:allowDividerAbove="true" />

    <com.android.settingslib.widget.FooterPreference
        android:key="auto_brightness_footer"
        android:title="@string/auto_brightness_description"
Loading