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

Commit 87d120a7 authored by Fan Zhang's avatar Fan Zhang
Browse files

Override switch bar string for wifi/battery saver screen

Bug: 69462439
Test: visual
Change-Id: I18d03ee1664f111222d7b9bb7ee893e4ce0e1343
parent 66898b0c
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -793,6 +793,9 @@
    <string name="Accounts_settings_title">Accounts</string>
    <!-- Main Settings screen setting option title for the item to take you to the location screen -->
    <string name="location_settings_title">Location</string>
    <!-- Used in the location settings to control turning on/off the feature entirely -->
    <string name="location_settings_master_switch_title">Use location</string>
    <!-- Main Settings screen setting option title for the item to take you to the accounts screen [CHAR LIMIT=22] -->
    <string name="account_settings_title">Accounts</string>
    <!-- Main Settings screen setting option title for the item to take you to the security screen -->
@@ -1722,6 +1725,9 @@
    <string name="wifi_quick_toggle_summary">Turn on Wi\u2011Fi</string>
    <!-- Used in the 1st-level settings screen to go to the 2nd-level settings screen  [CHAR LIMIT=20]-->
    <string name="wifi_settings">Wi\u2011Fi</string>
    <!-- Used in the Wi-Fi settings screen to control turning on/off Wi-Fi entirely [CHAR LIMIT=30]-->
    <string name="wifi_settings_master_switch_title">Use Wi\u2011Fi</string>
    <!-- Title of the Wi-fi settings screen -->
    <string name="wifi_settings_category">Wi\u2011Fi settings</string>
    <!-- Title of the Wi-fi settings entry in the left top level menu -->
@@ -4394,6 +4400,12 @@
    <string name="accessibility_autoclick_preference_title">Click after pointer stops moving</string>
    <!-- Title for accessibility preference for configuring amount of time that has to pass after pointer stops moving before click action can be performed (if automatic click after pointer stops moving feature is enabled). [CHAR LIMIT=NONE] -->
    <string name="accessibility_autoclick_delay_preference_title">Delay before click</string>
    <!-- Used in the acessibilty service settings to control turning on/off the service entirely -->
    <string name="accessibility_service_master_switch_title">Use service</string>
    <!-- Used in the Color correction settings screen to control turning on/off the feature entirely -->
    <string name="accessibility_daltonizer_master_switch_title">Use color correction</string>
    <!-- Used in the Captions settings screen to control turning on/off the feature entirely -->
    <string name="accessibility_caption_master_switch_title">Use captions</string>
    <!-- Preference's state when enabled. Note: UPPERCASE -->
    <string name="accessibility_summary_state_enabled">ON</string>
@@ -5049,6 +5061,9 @@
    <!-- [CHAR_LIMIT=40] Battery saver: Label for feature, title + menu item -->
    <string name="battery_saver">Battery Saver</string>
    <!-- Used in the Battery Saver settings screen to control turning on/off the feature entirely -->
    <string name="battery_saver_master_switch_title">Use Battery Saver</string>
    <!-- [CHAR_LIMIT=40] Battery saver: Title for automatic entry option -->
    <string name="battery_saver_turn_on_automatically_title">Turn on automatically</string>
@@ -8720,6 +8735,9 @@
    <!-- Preference title for the automatic storage manager toggle. [CHAR LIMIT=60]-->
    <string name="automatic_storage_manager_preference_title">Storage manager</string>
    <!-- Used in the storage manager settings screen to control turning on/off the feature entirely -->
    <string name="automatic_storage_manager_master_switch_title">Use Storage manager</string>
    <!-- Category title for the automatic settings in the storage manager settings. [CHAR LIMIT=40] -->
    <string name="deletion_helper_automatic_title">Automatic</string>
+2 −0
Original line number Diff line number Diff line
@@ -158,6 +158,8 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
        final boolean enabled = mCaptioningManager.isEnabled();
        SettingsActivity activity = (SettingsActivity) getActivity();
        mSwitchBar = activity.getSwitchBar();
        mSwitchBar.setSwitchBarText(R.string.accessibility_caption_master_switch_title,
                R.string.accessibility_caption_master_switch_title);
        mSwitchBar.setCheckedInternal(enabled);
        mToggleSwitch = mSwitchBar.getSwitch();

+6 −0
Original line number Diff line number Diff line
@@ -93,6 +93,12 @@ public class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePreferenceF
        mSwitchBar.removeOnSwitchChangeListener(this);
    }

    @Override
    protected void updateSwitchBarText(SwitchBar switchBar) {
        switchBar.setSwitchBarText(R.string.accessibility_daltonizer_master_switch_title,
                R.string.accessibility_daltonizer_master_switch_title);
    }

    private void initPreferences() {
        final String value = Integer.toString(
                Settings.Secure.getInt(getContentResolver(), TYPE, DEFAULT_TYPE));
+8 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import android.view.View;

import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.widget.SwitchBar;
@@ -55,6 +56,7 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference

        SettingsActivity activity = (SettingsActivity) getActivity();
        mSwitchBar = activity.getSwitchBar();
        updateSwitchBarText(mSwitchBar);
        mToggleSwitch = mSwitchBar.getSwitch();

        onProcessArguments(getArguments());
@@ -83,6 +85,12 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
        removeActionBarToggleSwitch();
    }

    protected void updateSwitchBarText(SwitchBar switchBar) {
        // Implement this to provide meaningful text in switch bar
        switchBar.setSwitchBarText(R.string.accessibility_service_master_switch_title,
                R.string.accessibility_service_master_switch_title);
    }

    protected abstract void onPreferenceToggled(String preferenceKey, boolean enabled);

    protected void onInstallSwitchBarToggleSwitch() {
+2 −0
Original line number Diff line number Diff line
@@ -81,6 +81,8 @@ public class AutomaticStorageManagerSettings extends DashboardFragment
    private void initializeSwitchBar() {
        final SettingsActivity activity = (SettingsActivity) getActivity();
        mSwitchBar = activity.getSwitchBar();
        mSwitchBar.setSwitchBarText(R.string.automatic_storage_manager_master_switch_title,
                R.string.automatic_storage_manager_master_switch_title);
        mSwitchBar.show();
        mSwitchController =
                new AutomaticStorageManagerSwitchBarController(
Loading