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>
|
@@ -65,6 +65,7 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
*/
|
*/
|
||||||
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;
|
||||||
@@ -117,11 +118,19 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
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();
|
||||||
|
|
||||||
@@ -134,6 +143,7 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
// * this ordering logic is in AccessPointPreference's compareTo
|
// * this ordering logic is in AccessPointPreference's compareTo
|
||||||
mApCategory.setOrderingAsAdded(false);
|
mApCategory.setOrderingAsAdded(false);
|
||||||
|
|
||||||
|
if (!getIntent().getBooleanExtra("only_access_points", false)) {
|
||||||
mWifiEnabled = (CheckBoxPreference) preferenceScreen.findPreference(KEY_WIFI_ENABLED);
|
mWifiEnabled = (CheckBoxPreference) preferenceScreen.findPreference(KEY_WIFI_ENABLED);
|
||||||
mWifiEnabler = new WifiEnabler(this, (WifiManager) getSystemService(WIFI_SERVICE),
|
mWifiEnabler = new WifiEnabler(this, (WifiManager) getSystemService(WIFI_SERVICE),
|
||||||
mWifiEnabled);
|
mWifiEnabled);
|
||||||
@@ -142,6 +152,7 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
.findPreference(KEY_OPEN_NETWORK_NOTIFICATIONS_ENABLED);
|
.findPreference(KEY_OPEN_NETWORK_NOTIFICATIONS_ENABLED);
|
||||||
mOpenNetworkNotificationsEnabled.setChecked(Settings.Secure.getInt(getContentResolver(),
|
mOpenNetworkNotificationsEnabled.setChecked(Settings.Secure.getInt(getContentResolver(),
|
||||||
Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0) == 1);
|
Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0) == 1);
|
||||||
|
}
|
||||||
|
|
||||||
mAddOtherNetwork = preferenceScreen.findPreference(KEY_ADD_OTHER_NETWORK);
|
mAddOtherNetwork = preferenceScreen.findPreference(KEY_ADD_OTHER_NETWORK);
|
||||||
|
|
||||||
@@ -155,7 +166,9 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
mWifiLayer.onResume();
|
mWifiLayer.onResume();
|
||||||
|
if (mWifiEnabler != null) {
|
||||||
mWifiEnabler.resume();
|
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,8 +189,10 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
mWifiLayer.onPause();
|
mWifiLayer.onPause();
|
||||||
|
if (mWifiEnabler != null) {
|
||||||
mWifiEnabler.pause();
|
mWifiEnabler.pause();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
@@ -261,8 +276,7 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
|||||||
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);
|
||||||
|
Reference in New Issue
Block a user