diff options
| author | Lifu Tang <lifu@google.com> | 2015-06-23 17:54:56 -0700 |
|---|---|---|
| committer | Lifu Tang <lifu@google.com> | 2015-06-23 18:54:27 -0700 |
| commit | 55601622d5ddd9d9ef0ace09ade96e999879bff7 (patch) | |
| tree | 9201fecd0c33d6b80693c2fffe2092791ed26de7 /src/com/android | |
| parent | 52e728ab114d37b24a0c50dba58f8d81b4e1ea9b (diff) | |
| download | packages_apps_Settings-55601622d5ddd9d9ef0ace09ade96e999879bff7.tar.gz packages_apps_Settings-55601622d5ddd9d9ef0ace09ade96e999879bff7.tar.bz2 packages_apps_Settings-55601622d5ddd9d9ef0ace09ade96e999879bff7.zip | |
Language Update for Wi-Fi/Bluetooth Scanning
Bug: 22046234
Change-Id: Iea8fa2368d1e568a8e1fdd3edefa8f4fc6053e48
Diffstat (limited to 'src/com/android')
| -rwxr-xr-x | src/com/android/settings/bluetooth/BluetoothSettings.java | 38 | ||||
| -rw-r--r-- | src/com/android/settings/wifi/WifiSettings.java | 13 |
2 files changed, 36 insertions, 15 deletions
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java index 663deef6a..68f47e7a6 100755 --- a/src/com/android/settings/bluetooth/BluetoothSettings.java +++ b/src/com/android/settings/bluetooth/BluetoothSettings.java @@ -21,6 +21,7 @@ import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.content.BroadcastReceiver; +import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; @@ -30,6 +31,7 @@ import android.preference.Preference; import android.preference.PreferenceCategory; import android.preference.PreferenceGroup; import android.preference.PreferenceScreen; +import android.provider.Settings; import android.text.Spannable; import android.text.style.TextAppearanceSpan; import android.util.Log; @@ -381,20 +383,30 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem return; } final CharSequence briefText = getText(R.string.bluetooth_empty_list_bluetooth_off); - final StringBuilder contentBuilder = new StringBuilder(); - contentBuilder.append(briefText); - contentBuilder.append("\n\n"); - contentBuilder.append(getText(R.string.ble_scan_notify_text)); + + final ContentResolver resolver = getActivity().getContentResolver(); + final boolean bleScanningMode = Settings.Global.getInt( + resolver, Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE, 0) == 1; + + if (!bleScanningMode) { + // Show only the brief text if the scanning mode has been turned off. + mEmptyView.setText(briefText, TextView.BufferType.SPANNABLE); + } else { + final StringBuilder contentBuilder = new StringBuilder(); + contentBuilder.append(briefText); + contentBuilder.append("\n\n"); + contentBuilder.append(getText(R.string.ble_scan_notify_text)); + LinkifyUtils.linkify(mEmptyView, contentBuilder, new LinkifyUtils.OnClickListener() { + @Override + public void onClick() { + final SettingsActivity activity = + (SettingsActivity) BluetoothSettings.this.getActivity(); + activity.startPreferencePanel(ScanningSettings.class.getName(), null, + R.string.location_scanning_screen_title, null, null, 0); + } + }); + } getPreferenceScreen().removeAll(); - LinkifyUtils.linkify(mEmptyView, contentBuilder, new LinkifyUtils.OnClickListener() { - @Override - public void onClick() { - final SettingsActivity activity = - (SettingsActivity) BluetoothSettings.this.getActivity(); - activity.startPreferencePanel(ScanningSettings.class.getName(), null, - R.string.location_scanning_screen_title, null, null, 0); - } - }); Spannable boldSpan = (Spannable) mEmptyView.getText(); boldSpan.setSpan( new TextAppearanceSpan(getActivity(), android.R.style.TextAppearance_Medium), 0, diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java index 0ea7da91d..56d1b97d3 100644 --- a/src/com/android/settings/wifi/WifiSettings.java +++ b/src/com/android/settings/wifi/WifiSettings.java @@ -708,8 +708,17 @@ public class WifiSettings extends RestrictedSettingsFragment } final CharSequence briefText = getText(R.string.wifi_empty_list_wifi_off); - if (isUiRestricted()) { - // Show only the brief text if the user is not allowed to configure scanning settings. + + // Don't use WifiManager.isScanAlwaysAvailable() to check the Wi-Fi scanning mode. Instead, + // read the system settings directly. Because when the device is in Airplane mode, even if + // Wi-Fi scanning mode is on, WifiManager.isScanAlwaysAvailable() still returns "off". + final ContentResolver resolver = getActivity().getContentResolver(); + final boolean wifiScanningMode = Settings.Global.getInt( + resolver, Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0) == 1; + + if (isUiRestricted() || !wifiScanningMode) { + // Show only the brief text if the user is not allowed to configure scanning settings, + // or the scanning mode has been turned off. mEmptyView.setText(briefText, BufferType.SPANNABLE); } else { // Append the description of scanning settings with link. |
