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

Commit b87ddba6 authored by Stanley Wang's avatar Stanley Wang
Browse files

Use SettingsLib's MainSwitchBar to replace SwitchBar in Settings.

To log Settings metrics, the MainSwitch extends MainSwitchBar and
replace the SwitchBar in SettingsActivity.

Bug: 175181773
Test: Run robotest and apply the widget in Settings and see the ui

Change-Id: I3add3702e9058ad9192b5172c7cf0e2ccfb55a70
parent c61c2fb1
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -25,7 +25,11 @@
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <include layout="@layout/styled_switch_bar"/>
        <com.android.settingslib.widget.MainSwitchBar
            android:id="@+id/main_switch_bar"
            android:visibility="invisible"
            android:layout_height="wrap_content"
            android:layout_width="match_parent" />

        <LinearLayout
            android:id="@+id/history_off"
+29 −0
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.
  -->

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

    <com.android.settings.widget.SettingsMainSwitchBar
        android:id="@+id/main_switch_bar"
        android:visibility="invisible"
        android:layout_height="wrap_content"
        android:layout_width="match_parent" />

</LinearLayout>
+3 −3
Original line number Diff line number Diff line
@@ -22,11 +22,11 @@
              android:layout_height="match_parent"
              android:layout_width="match_parent">

    <com.android.settings.widget.SwitchBar
    <com.android.settings.widget.SettingsMainSwitchBar
        android:id="@+id/switch_bar"
        android:layout_height="?android:attr/actionBarSize"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:theme="?attr/switchBarTheme"/>
        android:layout_height="wrap_content"/>

    <FrameLayout
        android:id="@+id/main_content"
+18 −0
Original line number Diff line number Diff line
@@ -12586,5 +12586,23 @@
    <!-- 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>
    <!-- Do not translate. Title for use wifi hotspot main switch [CHAR LIMIT=50]-->
    <string name="use_wifi_hotsopt_main_switch_title" translatable="false">Use Wi\u2011Fi hotspot</string>
    <!-- Do not translate. Title for bluetooth main switch. [CHAR LIMIT=50] -->
    <string name="bluetooth_main_switch_title" translatable="false">Use bluetooth</string>
    <!-- Do not translate. Title for app pinning main switch. [CHAR LIMIT=50] -->
    <string name="app_pinning_main_switch_title" translatable="false">Use app pinning</string>
    <!-- Do not translate. Title for developer options main switch. [CHAR LIMIT=50] -->
    <string name="developer_options_main_switch_title" translatable="false">Use developer options</string>
    <!-- Do not translate. Title for default print service main switch. [CHAR LIMIT=50] -->
    <string name="default_print_service_main_switch_title" translatable="false">Use default print service</string>
    <!-- Do not translate. Title for multiple users main switch. [CHAR LIMIT=50] -->
    <string name="multiple_users_main_switch_title" translatable="false">Use multiple users</string>
    <!-- Do not translate. Title for wireless debugging main switch. [CHAR LIMIT=50] -->
    <string name="wireless_debugging_main_switch_title" translatable="false">Use wireless debugging</string>
    <!-- Do not translate. Title for graphics driver main switch. [CHAR LIMIT=50] -->
    <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>
</resources>
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
        android:key="pref_app_header"
        android:layout="@layout/settings_entity_header" />

    <com.android.settingslib.widget.MainSwitchPreference
    <com.android.settings.widget.SettingsMainSwitchPreference
        android:key="block" />

    <com.android.settings.notification.app.NotificationFooterPreference
Loading