diff options
author | Jeff Sharkey <jsharkey@android.com> | 2012-05-04 11:15:29 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-05-04 11:15:29 -0700 |
commit | d8a18ad87e930bbcd203ef65563546f13b9bbb8b (patch) | |
tree | b7fc3da969aead6ecc01d31be573823b2d888c2e | |
parent | 8517794f1b097cf5c073d81bc6f73fe0b90d01bd (diff) | |
parent | 37c222fdf07e923e8ec3f20f9e58d27e7c91ad89 (diff) | |
download | packages_apps_settings-d8a18ad87e930bbcd203ef65563546f13b9bbb8b.zip packages_apps_settings-d8a18ad87e930bbcd203ef65563546f13b9bbb8b.tar.gz packages_apps_settings-d8a18ad87e930bbcd203ef65563546f13b9bbb8b.tar.bz2 |
Merge "Better messaging when Wi-Fi disabled." into jb-dev
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | res/xml/data_usage_metered_prefs.xml | 10 | ||||
-rw-r--r-- | src/com/android/settings/net/DataUsageMeteredSettings.java | 9 |
3 files changed, 16 insertions, 5 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 8ee96e4..b119f2a 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -3784,6 +3784,8 @@ <string name="data_usage_metered_mobile">Mobile networks</string> <!-- Header for list of Wi-Fi networks. [CHAR LIMIT=32] --> <string name="data_usage_metered_wifi">Wi-Fi networks</string> + <!-- Body text prompting user to enable Wi-Fi to configure metered networks. [CHAR LIMIT=64] --> + <string name="data_usage_metered_wifi_disabled">To select metered Wi-Fi networks, turn Wi-Fi on.</string> <!-- Button at the bottom of the CryptKeeper screen to make an emergency call. --> <string name="cryptkeeper_emergency_call">Emergency call</string> diff --git a/res/xml/data_usage_metered_prefs.xml b/res/xml/data_usage_metered_prefs.xml index 7ec3059..a0c6df4 100644 --- a/res/xml/data_usage_metered_prefs.xml +++ b/res/xml/data_usage_metered_prefs.xml @@ -29,6 +29,14 @@ <PreferenceCategory android:key="wifi" android:title="@string/data_usage_metered_wifi" - android:persistent="false" /> + android:persistent="false"> + + <Preference + android:key="wifi_disabled" + android:summary="@string/data_usage_metered_wifi_disabled" + android:persistent="false" + android:selectable="false" /> + + </PreferenceCategory> </PreferenceScreen> diff --git a/src/com/android/settings/net/DataUsageMeteredSettings.java b/src/com/android/settings/net/DataUsageMeteredSettings.java index fea8a12..69326bc 100644 --- a/src/com/android/settings/net/DataUsageMeteredSettings.java +++ b/src/com/android/settings/net/DataUsageMeteredSettings.java @@ -48,6 +48,7 @@ public class DataUsageMeteredSettings extends SettingsPreferenceFragment { private PreferenceCategory mMobileCategory; private PreferenceCategory mWifiCategory; + private Preference mWifiDisabled; @Override public void onCreate(Bundle icicle) { @@ -63,9 +64,9 @@ public class DataUsageMeteredSettings extends SettingsPreferenceFragment { addPreferencesFromResource(R.xml.data_usage_metered_prefs); mMobileCategory = (PreferenceCategory) findPreference("mobile"); mWifiCategory = (PreferenceCategory) findPreference("wifi"); + mWifiDisabled = findPreference("wifi_disabled"); updateNetworks(context); - } private void updateNetworks(Context context) { @@ -76,15 +77,15 @@ public class DataUsageMeteredSettings extends SettingsPreferenceFragment { getPreferenceScreen().removePreference(mMobileCategory); } - if (hasWifiRadio(context)) { - mWifiCategory.removeAll(); + mWifiCategory.removeAll(); + if (hasWifiRadio(context) && mWifiManager.isWifiEnabled()) { for (WifiConfiguration config : mWifiManager.getConfiguredNetworks()) { if (config.SSID != null) { mWifiCategory.addPreference(buildWifiPref(context, config)); } } } else { - getPreferenceScreen().removePreference(mWifiCategory); + mWifiCategory.addPreference(mWifiDisabled); } } |