Merge "Link to "scanning settings" when Wi-Fi is off." into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0c4747401a
@@ -1642,13 +1642,20 @@
|
|||||||
<string name="use_open_wifi_automatically_summary">Automatically connect to high\u2011quality public networks</string>
|
<string name="use_open_wifi_automatically_summary">Automatically connect to high\u2011quality public networks</string>
|
||||||
<!-- Preference title for option to install certificates -->
|
<!-- Preference title for option to install certificates -->
|
||||||
<string name="wifi_install_credentials">Install certificates</string>
|
<string name="wifi_install_credentials">Install certificates</string>
|
||||||
<!-- Message to describe "Wi-Fi scan always available feature" when Wi-Fi is off. The
|
<!-- Message to describe "Wi-Fi scan always available feature" when Wi-Fi is off and Wi-Fi
|
||||||
place-holders "LINK_BEGIN" and "LINK_END" must NOT be translated. They mark a link to bring
|
scanning is on. The place-holders "LINK_BEGIN" and "LINK_END" must NOT be translated. They
|
||||||
the user to "scanning settings" screen. -->
|
mark a link to bring the user to "scanning settings" screen. -->
|
||||||
<string name="wifi_scan_notify_text">To improve location accuracy, system apps and services can
|
<string name="wifi_scan_notify_text">To improve location accuracy, system apps and services can
|
||||||
still scan for Wi\u2011Fi networks. You can change this in
|
still scan for Wi\u2011Fi networks. You can change this in
|
||||||
<xliff:g id="link_begin">LINK_BEGIN</xliff:g>scanning
|
<xliff:g id="link_begin">LINK_BEGIN</xliff:g>scanning
|
||||||
settings<xliff:g id="link_end">LINK_END</xliff:g>.</string>
|
settings<xliff:g id="link_end">LINK_END</xliff:g>.</string>
|
||||||
|
<!-- Message to describe "Wi-Fi scan always available feature" when Wi-Fi is off and Wi-Fi
|
||||||
|
scanning is also off. The place-holders "LINK_BEGIN" and "LINK_END" must NOT be translated.
|
||||||
|
They mark a link to bring the user to "scanning settings" screen. -->
|
||||||
|
<string name="wifi_scan_notify_text_scanning_off">To improve location accuracy,
|
||||||
|
turn on Wi-Fi scanning in
|
||||||
|
<xliff:g id="link_begin">LINK_BEGIN</xliff:g>scanning
|
||||||
|
settings<xliff:g id="link_end">LINK_END</xliff:g>.</string>
|
||||||
<!-- Wifi scan always mode checkbox text -->
|
<!-- Wifi scan always mode checkbox text -->
|
||||||
<string name="wifi_scan_notify_remember_choice">Don\u2019t show again</string>
|
<string name="wifi_scan_notify_remember_choice">Don\u2019t show again</string>
|
||||||
<!-- Setting title for setting the wifi sleep policy. Do we keep Wi-Fi active when the screen turns off? -->
|
<!-- Setting title for setting the wifi sleep policy. Do we keep Wi-Fi active when the screen turns off? -->
|
||||||
|
@@ -843,21 +843,15 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setOffMessage() {
|
private void setOffMessage() {
|
||||||
final CharSequence briefText = getText(R.string.wifi_empty_list_wifi_off);
|
final CharSequence title = getText(R.string.wifi_empty_list_wifi_off);
|
||||||
|
|
||||||
// Don't use WifiManager.isScanAlwaysAvailable() to check the Wi-Fi scanning mode. Instead,
|
// 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
|
// 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".
|
// Wi-Fi scanning mode is on, WifiManager.isScanAlwaysAvailable() still returns "off".
|
||||||
final ContentResolver resolver = getActivity().getContentResolver();
|
final boolean wifiScanningMode = Settings.Global.getInt(getActivity().getContentResolver(),
|
||||||
final boolean wifiScanningMode = Settings.Global.getInt(
|
Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0) == 1;
|
||||||
resolver, Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0) == 1;
|
final CharSequence description = wifiScanningMode ? getText(R.string.wifi_scan_notify_text)
|
||||||
|
: getText(R.string.wifi_scan_notify_text_scanning_off);
|
||||||
if (!wifiScanningMode) {
|
final LinkifyUtils.OnClickListener clickListener = new LinkifyUtils.OnClickListener() {
|
||||||
// Show only the brief text if the user is not allowed to configure scanning settings,
|
|
||||||
// or the scanning mode has been turned off.
|
|
||||||
mStatusMessagePreference.setTitle(briefText);
|
|
||||||
} else {
|
|
||||||
LinkifyUtils.OnClickListener clickListener = new LinkifyUtils.OnClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
final SettingsActivity activity = (SettingsActivity) getActivity();
|
final SettingsActivity activity = (SettingsActivity) getActivity();
|
||||||
@@ -866,9 +860,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
null, R.string.location_scanning_screen_title, null, null, 0);
|
null, R.string.location_scanning_screen_title, null, null, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mStatusMessagePreference.setText(
|
mStatusMessagePreference.setText(title, description, clickListener);
|
||||||
briefText, getText(R.string.wifi_scan_notify_text), clickListener);
|
|
||||||
}
|
|
||||||
removeConnectedAccessPointPreference();
|
removeConnectedAccessPointPreference();
|
||||||
mAccessPointsPreferenceCategory.removeAll();
|
mAccessPointsPreferenceCategory.removeAll();
|
||||||
mAccessPointsPreferenceCategory.addPreference(mStatusMessagePreference);
|
mAccessPointsPreferenceCategory.addPreference(mStatusMessagePreference);
|
||||||
|
Reference in New Issue
Block a user