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

Commit 86cc0579 authored by Stanley Wang's avatar Stanley Wang
Browse files

Replace the SwitchBar with MainSwitch.

- Update wi-fi calling switch.
- Update the switches in Accessibility

Fix: 178673860
Fix: 177968565
Test: Run robotest and apply the widget in Settings and see the ui
Change-Id: Id10e6a110f418ea500a2eaf3c54752bef4f36507
parent a9f09035
Loading
Loading
Loading
Loading
+73 −25
Original line number Diff line number Diff line
@@ -2989,6 +2989,54 @@
            column="13"/>
    </issue>

    <issue
        id="HardCodedColor"
        severity="Error"
        message="Avoid using hardcoded color"
        category="Correctness"
        priority="4"
        summary="Using hardcoded color"
        explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
        errorLine1="    &lt;path"
        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
        <location
            file="res/drawable/ic_network_signal_blue.xml"
            line="25"
            column="9"/>
    </issue>

    <issue
        id="HardCodedColor"
        severity="Error"
        message="Avoid using hardcoded color"
        category="Correctness"
        priority="4"
        summary="Using hardcoded color"
        explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
        errorLine1="C6.67,19.26,7.26,18.67,8,18.67z&quot; />"
        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
        <location
            file="res/drawable/ic_network_signal_blue.xml"
            line="32"
            column="9"/>
    </issue>

    <issue
        id="HardCodedColor"
        severity="Error"
        message="Avoid using hardcoded color"
        category="Correctness"
        priority="4"
        summary="Using hardcoded color"
        explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
        errorLine1="        android:pathData=&quot;M16,12h1.33c0.74,0,1.33,0.6,1.33,1.33v12c0,0.74-0.6,1.33-1.33,1.33H16c-0.74,0-1.33-0.6-1.33-1.33v-12"
        errorLine2="^">
        <location
            file="res/drawable/ic_network_signal_blue.xml"
            line="35"
            column="1"/>
    </issue>

    <issue
        id="HardCodedColor"
        severity="Error"
@@ -3525,12 +3573,12 @@
        priority="4"
        summary="Using hardcoded color"
        explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
        errorLine1="    &lt;string name=&quot;sync_plug&quot; msgid=&quot;7956982719077985381&quot;>&quot;&quot;&lt;font fgcolor=&quot;#ffffffff&quot;>&quot;Welcome to Google sync!&quot;&lt;/font>&quot; \nA Google approach to syncing data to allow access to your contacts, appointments, and more from wherever you are.&quot;&lt;/string>"
        errorLine1="    &lt;string name=&quot;sync_plug&quot; msgid=&quot;7956982719077985381&quot;>&lt;font fgcolor=&quot;#ffffffff&quot;>&quot;Welcome to Google sync!&quot;&lt;/font>&quot; \nA Google approach to syncing data to allow access to your contacts, appointments and more from wherever you are.&quot;&lt;/string>"
        errorLine2="                                                               ~~~~~~~~~~~~~~~~~~~">
        <location
            file="res/values-en-rXC/strings.xml"
            line="2816"
            column="170"/>
            file="res/values-en-rAU/strings.xml"
            line="2821"
            column="64"/>
    </issue>

    <issue
@@ -3544,8 +3592,8 @@
        errorLine1="    &lt;string name=&quot;sync_plug&quot; msgid=&quot;7956982719077985381&quot;>&lt;font fgcolor=&quot;#ffffffff&quot;>&quot;Welcome to Google sync!&quot;&lt;/font>&quot; \nA Google approach to syncing data to allow access to your contacts, appointments and more from wherever you are.&quot;&lt;/string>"
        errorLine2="                                                               ~~~~~~~~~~~~~~~~~~~">
        <location
            file="res/values-en-rAU/strings.xml"
            line="2818"
            file="res/values-en-rCA/strings.xml"
            line="2821"
            column="64"/>
    </issue>

@@ -3560,8 +3608,8 @@
        errorLine1="    &lt;string name=&quot;sync_plug&quot; msgid=&quot;7956982719077985381&quot;>&lt;font fgcolor=&quot;#ffffffff&quot;>&quot;Welcome to Google sync!&quot;&lt;/font>&quot; \nA Google approach to syncing data to allow access to your contacts, appointments and more from wherever you are.&quot;&lt;/string>"
        errorLine2="                                                               ~~~~~~~~~~~~~~~~~~~">
        <location
            file="res/values-en-rCA/strings.xml"
            line="2818"
            file="res/values-en-rGB/strings.xml"
            line="2821"
            column="64"/>
    </issue>

@@ -3576,8 +3624,8 @@
        errorLine1="    &lt;string name=&quot;sync_plug&quot; msgid=&quot;7956982719077985381&quot;>&lt;font fgcolor=&quot;#ffffffff&quot;>&quot;Welcome to Google sync!&quot;&lt;/font>&quot; \nA Google approach to syncing data to allow access to your contacts, appointments and more from wherever you are.&quot;&lt;/string>"
        errorLine2="                                                               ~~~~~~~~~~~~~~~~~~~">
        <location
            file="res/values-en-rGB/strings.xml"
            line="2818"
            file="res/values-en-rIN/strings.xml"
            line="2821"
            column="64"/>
    </issue>

@@ -3589,12 +3637,12 @@
        priority="4"
        summary="Using hardcoded color"
        explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
        errorLine1="    &lt;string name=&quot;sync_plug&quot; msgid=&quot;7956982719077985381&quot;>&lt;font fgcolor=&quot;#ffffffff&quot;>&quot;Welcome to Google sync!&quot;&lt;/font>&quot; \nA Google approach to syncing data to allow access to your contacts, appointments and more from wherever you are.&quot;&lt;/string>"
        errorLine1="    &lt;string name=&quot;sync_plug&quot; msgid=&quot;7956982719077985381&quot;>&quot;&quot;&lt;font fgcolor=&quot;#ffffffff&quot;>&quot;Welcome to Google sync!&quot;&lt;/font>&quot; \nA Google approach to syncing data to allow access to your contacts, appointments, and more from wherever you are.&quot;&lt;/string>"
        errorLine2="                                                                                                                                                                         ~~~~~~~~~~~~~~~~~~~">
        <location
            file="res/values-en-rIN/strings.xml"
            line="2818"
            column="64"/>
            file="res/values-en-rXC/strings.xml"
            line="2821"
            column="170"/>
    </issue>

    <issue
@@ -3609,7 +3657,7 @@
        errorLine2="                                   ~~~~~~~~~~~~~~~~~~~">
        <location
            file="res/values/strings.xml"
            line="6537"
            line="6543"
            column="36"/>
    </issue>

@@ -3641,7 +3689,7 @@
        errorLine2="                                           ^">
        <location
            file="res/values/styles.xml"
            line="434"
            line="435"
            column="44"/>
    </issue>

@@ -3657,7 +3705,7 @@
        errorLine2="                                           ^">
        <location
            file="res/values/styles.xml"
            line="440"
            line="441"
            column="44"/>
    </issue>

@@ -3673,7 +3721,7 @@
        errorLine2="                                           ^">
        <location
            file="res/values/styles.xml"
            line="441"
            line="442"
            column="44"/>
    </issue>

@@ -3689,7 +3737,7 @@
        errorLine2="                                 ^">
        <location
            file="res/values/styles.xml"
            line="477"
            line="478"
            column="34"/>
    </issue>

@@ -3801,7 +3849,7 @@
        errorLine2="                                         ^">
        <location
            file="res/values/themes.xml"
            line="273"
            line="272"
            column="42"/>
    </issue>

@@ -3913,7 +3961,7 @@
        errorLine2="                                          ^">
        <location
            file="res/values/themes_suw.xml"
            line="188"
            line="196"
            column="43"/>
    </issue>

@@ -3929,7 +3977,7 @@
        errorLine2="                                         ^">
        <location
            file="res/values/themes_suw.xml"
            line="189"
            line="197"
            column="42"/>
    </issue>

@@ -3945,7 +3993,7 @@
        errorLine2="                                            ^">
        <location
            file="res/values/themes_suw.xml"
            line="190"
            line="198"
            column="45"/>
    </issue>

+4 −4
Original line number Diff line number Diff line
@@ -21,11 +21,11 @@
    android:layout_height="match_parent"
    android:orientation="vertical">

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

    <FrameLayout
        android:id="@android:id/tabcontent"
+2 −0
Original line number Diff line number Diff line
@@ -12753,6 +12753,8 @@
    <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>
    <!-- Do not translate. Title for wifi calling main switch preferences. [CHAR LIMIT=50] -->
    <string name="wifi_calling_main_switch_title" translatable="false">Use Wi-Fi calling</string>
    <!-- Default preference title for showing all apps on device [CHAR_LIMIT=50]-->
    <string name="default_see_all_apps_title">See all apps</string>
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ public class InvisibleToggleAccessibilityServicePreferenceFragment extends
    @Override
    protected void onInstallSwitchPreferenceToggleSwitch() {
        super.onInstallSwitchPreferenceToggleSwitch();
        mToggleServiceDividerSwitchPreference.setVisible(false);
        mToggleServiceSwitchPreference.setVisible(false);
    }

    /**
+4 −15
Original line number Diff line number Diff line
@@ -36,15 +36,14 @@ import android.view.View;
import android.view.accessibility.AccessibilityManager;

import androidx.annotation.Nullable;
import androidx.preference.SwitchPreference;

import com.android.settings.R;
import com.android.settings.widget.SettingsMainSwitchPreference;

import java.util.List;

/** Fragment for providing open activity button. */
public class LaunchAccessibilityActivityPreferenceFragment extends
        ToggleFeaturePreferenceFragment {
public class LaunchAccessibilityActivityPreferenceFragment extends ToggleFeaturePreferenceFragment {
    private static final String TAG = "LaunchA11yActivity";
    private static final String EMPTY_STRING = "";

@@ -52,7 +51,7 @@ public class LaunchAccessibilityActivityPreferenceFragment extends
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        mToggleServiceDividerSwitchPreference.setSwitchVisibility(View.GONE);
        mToggleServiceSwitchPreference.hide();
    }

    @Override
@@ -61,16 +60,6 @@ public class LaunchAccessibilityActivityPreferenceFragment extends
        launchShortcutTargetActivity(getPrefContext().getDisplayId(), mComponentName);
    }

    @Override
    protected void onInstallSwitchPreferenceToggleSwitch() {
        super.onInstallSwitchPreferenceToggleSwitch();
        mToggleServiceDividerSwitchPreference.setOnPreferenceClickListener((preference) -> {
            final boolean checked = ((DividerSwitchPreference) preference).isChecked();
            onPreferenceToggled(mPreferenceKey, checked);
            return false;
        });
    }

    @Override
    protected void onProcessArguments(Bundle arguments) {
        super.onProcessArguments(arguments);
@@ -111,7 +100,7 @@ public class LaunchAccessibilityActivityPreferenceFragment extends
    }

    @Override
    protected void updateToggleServiceTitle(SwitchPreference switchPreference) {
    protected void updateToggleServiceTitle(SettingsMainSwitchPreference switchPreference) {
        final AccessibilityShortcutInfo info = getAccessibilityShortcutInfo();
        final String switchBarText = (info == null) ? EMPTY_STRING : getString(
                R.string.accessibility_service_primary_open_title,
Loading