Remove wifi scan-always dialog.

When wifi is switched off we no longer want a notification dialog
about scan-always, instead using in-panel text.

bug:8907190
Change-Id: I707f306a056068d92f69070873f1e6330b598b1e
This commit is contained in:
Robert Greenwalt
2013-05-13 11:39:08 -07:00
parent 7e554395cb
commit 7e59f73e9c
4 changed files with 21 additions and 176 deletions

View File

@@ -30,6 +30,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.NetworkInfo.DetailedState;
@@ -46,6 +47,7 @@ import android.os.UserManager;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.util.AttributeSet;
import android.util.Log;
@@ -743,11 +745,28 @@ public class WifiSettings extends SettingsPreferenceFragment
break;
case WifiManager.WIFI_STATE_DISABLED:
addMessagePreference(R.string.wifi_empty_list_wifi_off);
setOffMessage();
break;
}
}
private void setOffMessage() {
if (mEmptyView != null) {
mEmptyView.setText(R.string.wifi_empty_list_wifi_off);
mEmptyView.append("\n\n");
int resId;
if (Settings.Secure.isLocationProviderEnabled(getActivity().getContentResolver(),
LocationManager.NETWORK_PROVIDER)) {
resId = R.string.wifi_scan_notify_text_location_on;
} else {
resId = R.string.wifi_scan_notify_text_location_off;
}
CharSequence charSeq = getText(resId);
mEmptyView.append(charSeq);
}
getPreferenceScreen().removeAll();
}
private void addMessagePreference(int messageId) {
if (mEmptyView != null) mEmptyView.setText(messageId);
getPreferenceScreen().removeAll();
@@ -906,7 +925,7 @@ public class WifiSettings extends SettingsPreferenceFragment
break;
case WifiManager.WIFI_STATE_DISABLED:
addMessagePreference(R.string.wifi_empty_list_wifi_off);
setOffMessage();
break;
}