resolved conflicts for merge of e304b9f4
to eclair-mr2
This commit is contained in:
30
res/xml/wifi_access_points.xml
Normal file
30
res/xml/wifi_access_points.xml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:title="@string/wifi_settings_category">
|
||||||
|
|
||||||
|
<com.android.settings.ProgressCategory
|
||||||
|
android:key="access_points"
|
||||||
|
android:title="@string/wifi_access_points"
|
||||||
|
android:persistent="false" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="add_other_network"
|
||||||
|
android:title="@string/wifi_add_other_network"
|
||||||
|
android:persistent="false" />
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
@@ -33,7 +33,7 @@
|
|||||||
<com.android.settings.ProgressCategory
|
<com.android.settings.ProgressCategory
|
||||||
android:key="access_points"
|
android:key="access_points"
|
||||||
android:dependency="wifi_enabled"
|
android:dependency="wifi_enabled"
|
||||||
android:title="@string/wifi_access_points"
|
android:title="@string/wifi_access_points"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
@@ -42,4 +42,4 @@
|
|||||||
android:title="@string/wifi_add_other_network"
|
android:title="@string/wifi_add_other_network"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -51,11 +51,11 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
DialogInterface.OnDismissListener {
|
DialogInterface.OnDismissListener {
|
||||||
|
|
||||||
private static final String TAG = "WifiSettings";
|
private static final String TAG = "WifiSettings";
|
||||||
|
|
||||||
//============================
|
//============================
|
||||||
// Preference/activity member variables
|
// Preference/activity member variables
|
||||||
//============================
|
//============================
|
||||||
|
|
||||||
private static final String INSTANCE_KEY_DIALOG_BUNDLE =
|
private static final String INSTANCE_KEY_DIALOG_BUNDLE =
|
||||||
"com.android.settings.wifi.WifiSettings:dialogBundle";
|
"com.android.settings.wifi.WifiSettings:dialogBundle";
|
||||||
/*
|
/*
|
||||||
@@ -64,43 +64,44 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
* dialog management only creates once.
|
* dialog management only creates once.
|
||||||
*/
|
*/
|
||||||
private Dialog mDialog;
|
private Dialog mDialog;
|
||||||
|
|
||||||
|
private static final String KEY_ONLY_ACCESS_POINTS = "only_access_points";
|
||||||
private static final String KEY_ADD_OTHER_NETWORK = "add_other_network";
|
private static final String KEY_ADD_OTHER_NETWORK = "add_other_network";
|
||||||
|
|
||||||
private static final int CONTEXT_MENU_ID_CONNECT = Menu.FIRST;
|
private static final int CONTEXT_MENU_ID_CONNECT = Menu.FIRST;
|
||||||
private static final int CONTEXT_MENU_ID_FORGET = Menu.FIRST + 1;
|
private static final int CONTEXT_MENU_ID_FORGET = Menu.FIRST + 1;
|
||||||
private static final int CONTEXT_MENU_ID_CHANGE_PASSWORD = Menu.FIRST + 2;
|
private static final int CONTEXT_MENU_ID_CHANGE_PASSWORD = Menu.FIRST + 2;
|
||||||
|
|
||||||
private static final int MENU_ID_SCAN = Menu.FIRST;
|
private static final int MENU_ID_SCAN = Menu.FIRST;
|
||||||
private static final int MENU_ID_ADVANCED = Menu.FIRST + 1;
|
private static final int MENU_ID_ADVANCED = Menu.FIRST + 1;
|
||||||
|
|
||||||
private static final String KEY_WIFI_ENABLED = "wifi_enabled";
|
private static final String KEY_WIFI_ENABLED = "wifi_enabled";
|
||||||
private static final String KEY_OPEN_NETWORK_NOTIFICATIONS_ENABLED =
|
private static final String KEY_OPEN_NETWORK_NOTIFICATIONS_ENABLED =
|
||||||
"open_network_notifications_enabled";
|
"open_network_notifications_enabled";
|
||||||
private static final String KEY_ACCESS_POINTS = "access_points";
|
private static final String KEY_ACCESS_POINTS = "access_points";
|
||||||
|
|
||||||
private ProgressCategory mApCategory;
|
private ProgressCategory mApCategory;
|
||||||
private CheckBoxPreference mWifiEnabled;
|
private CheckBoxPreference mWifiEnabled;
|
||||||
private WifiEnabler mWifiEnabler;
|
private WifiEnabler mWifiEnabler;
|
||||||
private CheckBoxPreference mOpenNetworkNotificationsEnabled;
|
private CheckBoxPreference mOpenNetworkNotificationsEnabled;
|
||||||
private Preference mAddOtherNetwork;
|
private Preference mAddOtherNetwork;
|
||||||
|
|
||||||
private WeakHashMap<AccessPointState, AccessPointPreference> mAps;
|
private WeakHashMap<AccessPointState, AccessPointPreference> mAps;
|
||||||
|
|
||||||
private KeyStore mKeyStore = KeyStore.getInstance();
|
private KeyStore mKeyStore = KeyStore.getInstance();
|
||||||
private AccessPointState mResumeState = null;
|
private AccessPointState mResumeState = null;
|
||||||
private int mResumeMode;
|
private int mResumeMode;
|
||||||
|
|
||||||
//============================
|
//============================
|
||||||
// Wifi member variables
|
// Wifi member variables
|
||||||
//============================
|
//============================
|
||||||
|
|
||||||
private WifiLayer mWifiLayer;
|
private WifiLayer mWifiLayer;
|
||||||
|
|
||||||
//============================
|
//============================
|
||||||
// Activity lifecycle
|
// Activity lifecycle
|
||||||
//============================
|
//============================
|
||||||
|
|
||||||
public WifiSettings() {
|
public WifiSettings() {
|
||||||
mAps = new WeakHashMap<AccessPointState, AccessPointPreference>();
|
mAps = new WeakHashMap<AccessPointState, AccessPointPreference>();
|
||||||
mWifiLayer = new WifiLayer(this, this);
|
mWifiLayer = new WifiLayer(this, this);
|
||||||
@@ -116,15 +117,23 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
onCreatedWifi();
|
onCreatedWifi();
|
||||||
mWifiLayer.onCreatedCallback();
|
mWifiLayer.onCreatedCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getPreferenceResource() {
|
||||||
|
if (getIntent().getBooleanExtra(KEY_ONLY_ACCESS_POINTS, false)) {
|
||||||
|
return R.xml.wifi_access_points;
|
||||||
|
} else {
|
||||||
|
return R.xml.wifi_settings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shouldn't have any dependency on the wifi layer.
|
* Shouldn't have any dependency on the wifi layer.
|
||||||
*/
|
*/
|
||||||
private void onCreatePreferences() {
|
private void onCreatePreferences() {
|
||||||
addPreferencesFromResource(R.xml.wifi_settings);
|
addPreferencesFromResource(getPreferenceResource());
|
||||||
|
|
||||||
final PreferenceScreen preferenceScreen = getPreferenceScreen();
|
final PreferenceScreen preferenceScreen = getPreferenceScreen();
|
||||||
|
|
||||||
mApCategory = (ProgressCategory) preferenceScreen.findPreference(KEY_ACCESS_POINTS);
|
mApCategory = (ProgressCategory) preferenceScreen.findPreference(KEY_ACCESS_POINTS);
|
||||||
// We don't want the ordering to be the order preferences are added,
|
// We don't want the ordering to be the order preferences are added,
|
||||||
// instead we want*:
|
// instead we want*:
|
||||||
@@ -133,29 +142,33 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
// 3) preferred, APs out of range
|
// 3) preferred, APs out of range
|
||||||
// * this ordering logic is in AccessPointPreference's compareTo
|
// * this ordering logic is in AccessPointPreference's compareTo
|
||||||
mApCategory.setOrderingAsAdded(false);
|
mApCategory.setOrderingAsAdded(false);
|
||||||
|
|
||||||
mWifiEnabled = (CheckBoxPreference) preferenceScreen.findPreference(KEY_WIFI_ENABLED);
|
if (!getIntent().getBooleanExtra("only_access_points", false)) {
|
||||||
mWifiEnabler = new WifiEnabler(this, (WifiManager) getSystemService(WIFI_SERVICE),
|
mWifiEnabled = (CheckBoxPreference) preferenceScreen.findPreference(KEY_WIFI_ENABLED);
|
||||||
mWifiEnabled);
|
mWifiEnabler = new WifiEnabler(this, (WifiManager) getSystemService(WIFI_SERVICE),
|
||||||
|
mWifiEnabled);
|
||||||
mOpenNetworkNotificationsEnabled = (CheckBoxPreference) preferenceScreen
|
|
||||||
.findPreference(KEY_OPEN_NETWORK_NOTIFICATIONS_ENABLED);
|
mOpenNetworkNotificationsEnabled = (CheckBoxPreference) preferenceScreen
|
||||||
mOpenNetworkNotificationsEnabled.setChecked(Settings.Secure.getInt(getContentResolver(),
|
.findPreference(KEY_OPEN_NETWORK_NOTIFICATIONS_ENABLED);
|
||||||
Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0) == 1);
|
mOpenNetworkNotificationsEnabled.setChecked(Settings.Secure.getInt(getContentResolver(),
|
||||||
|
Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0) == 1);
|
||||||
|
}
|
||||||
|
|
||||||
mAddOtherNetwork = preferenceScreen.findPreference(KEY_ADD_OTHER_NETWORK);
|
mAddOtherNetwork = preferenceScreen.findPreference(KEY_ADD_OTHER_NETWORK);
|
||||||
|
|
||||||
registerForContextMenu(getListView());
|
registerForContextMenu(getListView());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onCreatedWifi() {
|
private void onCreatedWifi() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
mWifiLayer.onResume();
|
mWifiLayer.onResume();
|
||||||
mWifiEnabler.resume();
|
if (mWifiEnabler != null) {
|
||||||
|
mWifiEnabler.resume();
|
||||||
|
}
|
||||||
// do what we should have after keystore is unlocked.
|
// do what we should have after keystore is unlocked.
|
||||||
if (mResumeState != null) {
|
if (mResumeState != null) {
|
||||||
if (mKeyStore.test() == KeyStore.NO_ERROR) {
|
if (mKeyStore.test() == KeyStore.NO_ERROR) {
|
||||||
@@ -176,13 +189,15 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
mWifiLayer.onPause();
|
mWifiLayer.onPause();
|
||||||
mWifiEnabler.pause();
|
if (mWifiEnabler != null) {
|
||||||
|
mWifiEnabler.pause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
||||||
if (mDialog != null) {
|
if (mDialog != null) {
|
||||||
mDialog.dismiss();
|
mDialog.dismiss();
|
||||||
}
|
}
|
||||||
@@ -191,31 +206,31 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
super.onCreateOptionsMenu(menu);
|
super.onCreateOptionsMenu(menu);
|
||||||
|
|
||||||
menu.add(0, MENU_ID_SCAN, 0, R.string.scan_wifi)
|
menu.add(0, MENU_ID_SCAN, 0, R.string.scan_wifi)
|
||||||
.setIcon(R.drawable.ic_menu_scan_network);
|
.setIcon(R.drawable.ic_menu_scan_network);
|
||||||
|
|
||||||
menu.add(0, MENU_ID_ADVANCED, 0, R.string.wifi_menu_advanced)
|
menu.add(0, MENU_ID_ADVANCED, 0, R.string.wifi_menu_advanced)
|
||||||
.setIcon(android.R.drawable.ic_menu_manage);
|
.setIcon(android.R.drawable.ic_menu_manage);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
super.onOptionsItemSelected(item);
|
super.onOptionsItemSelected(item);
|
||||||
|
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
|
||||||
case MENU_ID_SCAN:
|
case MENU_ID_SCAN:
|
||||||
mWifiLayer.attemptScan();
|
mWifiLayer.attemptScan();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MENU_ID_ADVANCED:
|
case MENU_ID_ADVANCED:
|
||||||
Intent intent = new Intent(this, AdvancedSettings.class);
|
Intent intent = new Intent(this, AdvancedSettings.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -224,7 +239,7 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
|
|
||||||
if (mDialog != null) {
|
if (mDialog != null) {
|
||||||
Bundle dialogBundle = mDialog.onSaveInstanceState();
|
Bundle dialogBundle = mDialog.onSaveInstanceState();
|
||||||
outState.putBundle(INSTANCE_KEY_DIALOG_BUNDLE, dialogBundle);
|
outState.putBundle(INSTANCE_KEY_DIALOG_BUNDLE, dialogBundle);
|
||||||
@@ -234,7 +249,7 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
@Override
|
@Override
|
||||||
protected void onRestoreInstanceState(Bundle state) {
|
protected void onRestoreInstanceState(Bundle state) {
|
||||||
super.onRestoreInstanceState(state);
|
super.onRestoreInstanceState(state);
|
||||||
|
|
||||||
Bundle dialogBundle = state.getBundle(INSTANCE_KEY_DIALOG_BUNDLE);
|
Bundle dialogBundle = state.getBundle(INSTANCE_KEY_DIALOG_BUNDLE);
|
||||||
if (dialogBundle != null) {
|
if (dialogBundle != null) {
|
||||||
mDialog = new AccessPointDialog(this, mWifiLayer);
|
mDialog = new AccessPointDialog(this, mWifiLayer);
|
||||||
@@ -256,21 +271,20 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
@Override
|
@Override
|
||||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||||
super.onCreateContextMenu(menu, v, menuInfo);
|
super.onCreateContextMenu(menu, v, menuInfo);
|
||||||
|
|
||||||
AccessPointState state = getStateFromMenuInfo(menuInfo);
|
AccessPointState state = getStateFromMenuInfo(menuInfo);
|
||||||
if (state == null) {
|
if (state == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
menu.setHeaderTitle(state.getHumanReadableSsid());
|
||||||
menu.setHeaderTitle(state.ssid);
|
|
||||||
|
|
||||||
if (state.isConnectable()) {
|
if (state.isConnectable()) {
|
||||||
menu.add(0, CONTEXT_MENU_ID_CONNECT, 0, R.string.wifi_context_menu_connect);
|
menu.add(0, CONTEXT_MENU_ID_CONNECT, 0, R.string.wifi_context_menu_connect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.isForgetable()) {
|
if (state.isForgetable()) {
|
||||||
menu.add(0, CONTEXT_MENU_ID_FORGET, 1, R.string.wifi_context_menu_forget);
|
menu.add(0, CONTEXT_MENU_ID_FORGET, 1, R.string.wifi_context_menu_forget);
|
||||||
|
|
||||||
if (state.hasPassword()) {
|
if (state.hasPassword()) {
|
||||||
menu.add(0, CONTEXT_MENU_ID_CHANGE_PASSWORD, 2,
|
menu.add(0, CONTEXT_MENU_ID_CHANGE_PASSWORD, 2,
|
||||||
R.string.wifi_context_menu_change_password);
|
R.string.wifi_context_menu_change_password);
|
||||||
@@ -287,19 +301,19 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
|
||||||
case CONTEXT_MENU_ID_CONNECT:
|
case CONTEXT_MENU_ID_CONNECT:
|
||||||
connectToNetwork(state);
|
connectToNetwork(state);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case CONTEXT_MENU_ID_FORGET:
|
case CONTEXT_MENU_ID_FORGET:
|
||||||
mWifiLayer.forgetNetwork(state);
|
mWifiLayer.forgetNetwork(state);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case CONTEXT_MENU_ID_CHANGE_PASSWORD:
|
case CONTEXT_MENU_ID_CHANGE_PASSWORD:
|
||||||
showAccessPointDialog(state, AccessPointDialog.MODE_CONFIGURE);
|
showAccessPointDialog(state, AccessPointDialog.MODE_CONFIGURE);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -317,12 +331,12 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
mWifiLayer.connectToNetwork(state);
|
mWifiLayer.connectToNetwork(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private AccessPointState getStateFromMenuInfo(ContextMenuInfo menuInfo) {
|
private AccessPointState getStateFromMenuInfo(ContextMenuInfo menuInfo) {
|
||||||
if ((menuInfo == null) || !(menuInfo instanceof AdapterContextMenuInfo)) {
|
if ((menuInfo == null) || !(menuInfo instanceof AdapterContextMenuInfo)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
AdapterContextMenuInfo adapterMenuInfo = (AdapterContextMenuInfo) menuInfo;
|
AdapterContextMenuInfo adapterMenuInfo = (AdapterContextMenuInfo) menuInfo;
|
||||||
Preference pref = (Preference) getPreferenceScreen().getRootAdapter().getItem(
|
Preference pref = (Preference) getPreferenceScreen().getRootAdapter().getItem(
|
||||||
adapterMenuInfo.position);
|
adapterMenuInfo.position);
|
||||||
@@ -332,11 +346,11 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
|
|
||||||
return ((AccessPointPreference) pref).getAccessPointState();
|
return ((AccessPointPreference) pref).getAccessPointState();
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================
|
//============================
|
||||||
// Preference callbacks
|
// Preference callbacks
|
||||||
//============================
|
//============================
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
||||||
super.onPreferenceTreeClick(preferenceScreen, preference);
|
super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||||
@@ -351,10 +365,10 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
AccessPointState state = ((AccessPointPreference) preference).getAccessPointState();
|
AccessPointState state = ((AccessPointPreference) preference).getAccessPointState();
|
||||||
showAccessPointDialog(state, AccessPointDialog.MODE_INFO);
|
showAccessPointDialog(state, AccessPointDialog.MODE_INFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================
|
//============================
|
||||||
// Wifi-related
|
// Wifi-related
|
||||||
//============================
|
//============================
|
||||||
@@ -372,7 +386,7 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
mResumeMode = AccessPointDialog.MODE_CONFIGURE;
|
mResumeMode = AccessPointDialog.MODE_CONFIGURE;
|
||||||
showDialog(dialog);
|
showDialog(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showAccessPointDialog(AccessPointState state, int mode) {
|
public void showAccessPointDialog(AccessPointState state, int mode) {
|
||||||
if (state.isEnterprise() && mKeyStore.test() != KeyStore.NO_ERROR) {
|
if (state.isEnterprise() && mKeyStore.test() != KeyStore.NO_ERROR) {
|
||||||
Credentials.getInstance().unlock(this);
|
Credentials.getInstance().unlock(this);
|
||||||
@@ -391,14 +405,14 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
if (mDialog != null) {
|
if (mDialog != null) {
|
||||||
mDialog.dismiss();
|
mDialog.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
mDialog = dialog;
|
mDialog = dialog;
|
||||||
if (dialog != null) {
|
if (dialog != null) {
|
||||||
dialog.setOnDismissListener(this);
|
dialog.setOnDismissListener(this);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================
|
//============================
|
||||||
// Wifi callbacks
|
// Wifi callbacks
|
||||||
//============================
|
//============================
|
||||||
@@ -409,36 +423,36 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
|
|
||||||
public void onScanningStatusChanged(boolean started) {
|
public void onScanningStatusChanged(boolean started) {
|
||||||
mApCategory.setProgress(started);
|
mApCategory.setProgress(started);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onAccessPointSetChanged(AccessPointState ap, boolean added) {
|
public void onAccessPointSetChanged(AccessPointState ap, boolean added) {
|
||||||
|
|
||||||
AccessPointPreference pref = mAps.get(ap);
|
AccessPointPreference pref = mAps.get(ap);
|
||||||
|
|
||||||
if (WifiLayer.LOGV) {
|
if (WifiLayer.LOGV) {
|
||||||
Log.v(TAG, "onAccessPointSetChanged with " + ap + " and "
|
Log.v(TAG, "onAccessPointSetChanged with " + ap + " and "
|
||||||
+ (added ? "added" : "removed") + ", found pref " + pref);
|
+ (added ? "added" : "removed") + ", found pref " + pref);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (added) {
|
if (added) {
|
||||||
|
|
||||||
if (pref == null) {
|
if (pref == null) {
|
||||||
pref = new AccessPointPreference(this, ap);
|
pref = new AccessPointPreference(this, ap);
|
||||||
mAps.put(ap, pref);
|
mAps.put(ap, pref);
|
||||||
} else {
|
} else {
|
||||||
pref.setEnabled(true);
|
pref.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
mApCategory.addPreference(pref);
|
mApCategory.addPreference(pref);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
mAps.remove(ap);
|
mAps.remove(ap);
|
||||||
|
|
||||||
if (pref != null) {
|
if (pref != null) {
|
||||||
mApCategory.removePreference(pref);
|
mApCategory.removePreference(pref);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,8 +473,8 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
// If we're already showing a dialog, ignore this request
|
// If we're already showing a dialog, ignore this request
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
showAccessPointDialog(ap, AccessPointDialog.MODE_RETRY_PASSWORD);
|
showAccessPointDialog(ap, AccessPointDialog.MODE_RETRY_PASSWORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user