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

Commit f60c99af authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Display network name in status bar"

parents 9138de15 53cfd117
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -73,6 +73,9 @@
    <!-- If the support features are enabled. -->
    <bool name="config_support_enabled">false</bool>

    <!-- Whether to enable "show operator name in the status bar" setting -->
    <bool name="config_showOperatorNameInStatusBar">false</bool>

    <!-- List containing the component names of pre-installed screen reader services. -->
    <string-array name="config_preinstalled_screen_reader_services" translatable="false">
        <!--
+5 −0
Original line number Diff line number Diff line
@@ -9016,6 +9016,11 @@
    <!-- Temporary reboot string, will be removed -->
    <string name="change_theme_reboot" translatable="false">Changing the theme requires a restart.</string>
    <!-- Switch label to show operator name in the status bar [CHAR LIMIT=60] -->
    <string name="show_operator_name_title">Network name</string>
    <!-- Switch summary to show operator name in the status bar [CHAR LIMIT=NONE] -->
    <string name="show_operator_name_summary">Display network name in status bar</string>
    <!-- Indicates if the automatic storage manager is enabled or not. [CHAR_LIMIT=40] -->
    <string name="storage_manager_indicator">Storage Manager: <xliff:g id="status" example="on">^1</xliff:g></string>
+5 −0
Original line number Diff line number Diff line
@@ -84,6 +84,11 @@
        android:fragment="com.android.settings.display.ScreenZoomSettings"
        settings:keywords="@string/screen_zoom_keywords" />

    <SwitchPreference
        android:key="show_operator_name"
        android:title="@string/show_operator_name_title"
        android:summary="@string/show_operator_name_summary" />

    <Preference
        android:key="screensaver"
        android:title="@string/screensaver_settings_title"
+2 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import com.android.settings.display.LiftToWakePreferenceController;
import com.android.settings.display.NightDisplayPreferenceController;
import com.android.settings.display.NightModePreferenceController;
import com.android.settings.display.ScreenSaverPreferenceController;
import com.android.settings.display.ShowOperatorNamePreferenceController;
import com.android.settings.display.TapToWakePreferenceController;
import com.android.settings.display.ThemePreferenceController;
import com.android.settings.display.TimeoutPreferenceController;
@@ -98,6 +99,7 @@ public class DisplaySettings extends DashboardFragment {
        controllers.add(new TapToWakePreferenceController(context));
        controllers.add(new TimeoutPreferenceController(context, KEY_SCREEN_TIMEOUT));
        controllers.add(new VrDisplayPreferenceController(context));
        controllers.add(new ShowOperatorNamePreferenceController(context));
        controllers.add(new WallpaperPreferenceController(context));
        controllers.add(new ThemePreferenceController(context));
        controllers.add(new BrightnessLevelPreferenceController(context, lifecycle));
+57 −0
Original line number Diff line number Diff line
/*
 * 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.
 */
package com.android.settings.display;

import android.content.Context;
import android.provider.Settings;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;

import com.android.settings.R;
import com.android.settingslib.core.AbstractPreferenceController;

public class ShowOperatorNamePreferenceController extends AbstractPreferenceController
        implements Preference.OnPreferenceChangeListener {

    private static final String KEY_SHOW_OPERATOR_NAME = "show_operator_name";

    public ShowOperatorNamePreferenceController(Context context) {
        super(context);
    }

    @Override
    public boolean isAvailable() {
        return mContext.getResources().getBoolean(R.bool.config_showOperatorNameInStatusBar);
    }

    @Override
    public String getPreferenceKey() {
        return KEY_SHOW_OPERATOR_NAME;
    }

    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        boolean value = (Boolean) newValue;
        Settings.Secure.putInt(mContext.getContentResolver(),
                KEY_SHOW_OPERATOR_NAME, value ? 1 : 0);
        return true;
    }

    @Override
    public void updateState(Preference preference) {
        int value = Settings.Secure.getInt(mContext.getContentResolver(),
                KEY_SHOW_OPERATOR_NAME, 1);
        ((SwitchPreference) preference).setChecked(value != 0);
    }
}
Loading