diff options
author | Daisuke Miyakawa <dmiyakawa@google.com> | 2010-10-29 17:53:01 -0700 |
---|---|---|
committer | Daisuke Miyakawa <dmiyakawa@google.com> | 2010-10-29 18:00:36 -0700 |
commit | 1dc3715e3ac5100b1531fb2bdc7232d2c3508846 (patch) | |
tree | 6f695d614489e80cd88cb158ac3598d7409fa0b8 | |
parent | 58524fc53d0a1d5d240a332371c12682ba5b6a3f (diff) | |
download | packages_apps_settings-1dc3715e3ac5100b1531fb2bdc7232d2c3508846.zip packages_apps_settings-1dc3715e3ac5100b1531fb2bdc7232d2c3508846.tar.gz packages_apps_settings-1dc3715e3ac5100b1531fb2bdc7232d2c3508846.tar.bz2 |
Reduce default settings in WifiSetup XL.
We don't want to show every configurations in default, while
we also don't want to complicate basic wifi logics. In order to
achive both goals, we first introduce tweaked xml file
(wifi_config_preference2.xml). It does contain all the
config components but almost all of them are in "gone" visibility.
Those components are still able to act as data storage, but never
be seen as actual UI components.
Change-Id: I4ad3c1b4cbbe77ca2b628b0be25e2b3eb9d645aa
-rw-r--r-- | res/layout-xlarge/wifi_settings_for_setup_wizard_xl.xml | 14 | ||||
-rw-r--r-- | res/layout/wifi_config_preference2.xml | 367 | ||||
-rw-r--r-- | res/values/strings.xml | 6 | ||||
-rw-r--r-- | src/com/android/settings/wifi/WifiConfigPreference.java | 3 | ||||
-rw-r--r-- | src/com/android/settings/wifi/WifiConfigUiBase.java | 2 | ||||
-rw-r--r-- | src/com/android/settings/wifi/WifiSettings.java | 10 | ||||
-rw-r--r-- | src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java | 4 |
7 files changed, 401 insertions, 5 deletions
diff --git a/res/layout-xlarge/wifi_settings_for_setup_wizard_xl.xml b/res/layout-xlarge/wifi_settings_for_setup_wizard_xl.xml index cb6421b..2e96da5 100644 --- a/res/layout-xlarge/wifi_settings_for_setup_wizard_xl.xml +++ b/res/layout-xlarge/wifi_settings_for_setup_wizard_xl.xml @@ -22,7 +22,7 @@ android:paddingTop="60dip" android:paddingLeft="100dip" android:paddingRight="100dip" - android:paddingBottom="100dip"> + android:paddingBottom="40dip"> <TextView android:id="@+id/wifi_setup_title" @@ -139,12 +139,22 @@ android:enabled="false" /> </RelativeLayout> + <Button android:id="@+id/wifi_setup_detail" + android:layout_width="260dip" + android:layout_height="60dip" + android:layout_above="@+id/wifi_setup_cancel" + android:layout_alignLeft="@+id/wifi_setup_cancel" + android:layout_marginBottom="30dip" + android:textSize="24dip" + android:text="@string/wifi_detail" + android:visibility="gone" /> + <Button android:id="@+id/wifi_setup_cancel" android:layout_width="260dip" android:layout_height="60dip" android:layout_alignParentBottom="true" android:layout_toLeftOf="@id/right_buttons" android:textSize="24dip" - android:text="@string/wifi_cancel" + android:text="@string/wifi_back" android:visibility="gone" /> </RelativeLayout> diff --git a/res/layout/wifi_config_preference2.xml b/res/layout/wifi_config_preference2.xml new file mode 100644 index 0000000..29cb585 --- /dev/null +++ b/res/layout/wifi_config_preference2.xml @@ -0,0 +1,367 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2010 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. +--> +<!-- All ids in this layout must be in wifi_dialog.xml --> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + + <!-- UI components that should be shown appropriately --> + <LinearLayout android:id="@+id/wps_fields" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone"> + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_wps_pin" /> + + <EditText android:id="@+id/wps_pin" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:inputType="textPassword" /> + </LinearLayout> + <LinearLayout android:id="@+id/security_fields" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone"> + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_password" /> + + <EditText android:id="@+id/password" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:password="true" /> + + <CheckBox android:id="@+id/show_password" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_show_password" /> + </LinearLayout> + + + <!-- All the views below are "gone". + We want them as data storage, not as UI components. --> + <LinearLayout + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:visibility="gone"> + + <LinearLayout android:id="@+id/info" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical"/> --> + + <LinearLayout android:id="@+id/setup_fields" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone"> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_network_setup" /> + + <Spinner android:id="@+id/network_setup" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:prompt="@string/wifi_network_setup" + android:entries="@array/wifi_network_setup" /> + + </LinearLayout> + + <!-- + <LinearLayout android:id="@+id/wps_fields" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone"> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_wps_pin" /> + + <EditText android:id="@+id/wps_pin" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:inputType="textPassword" /> + </LinearLayout> --> + + <LinearLayout android:id="@+id/type" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone"> + + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_ssid" /> + + <EditText android:id="@+id/ssid" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:inputType="textNoSuggestions" /> + + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_security" /> + + <Spinner android:id="@+id/security" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:prompt="@string/wifi_security" + android:entries="@array/wifi_security" /> + </LinearLayout> <!-- android:id="@+id/type" --> + + <!-- android:id="@+id/security_fields" --> + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone"> + + <LinearLayout android:id="@+id/eap" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone"> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_eap_method" /> + + <Spinner android:id="@+id/method" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:prompt="@string/wifi_eap_method" + android:entries="@array/wifi_eap_method" /> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/please_select_phase2" /> + + <Spinner android:id="@+id/phase2" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:prompt="@string/please_select_phase2" + android:entries="@array/wifi_phase2_entries" /> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_eap_ca_cert" /> + + <Spinner android:id="@+id/ca_cert" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:prompt="@string/wifi_eap_ca_cert" /> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_eap_user_cert" /> + + <Spinner android:id="@+id/user_cert" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:prompt="@string/wifi_eap_user_cert" /> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_eap_identity" /> + + <EditText android:id="@+id/identity" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:inputType="textNoSuggestions" /> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_eap_anonymous" /> + + <EditText android:id="@+id/anonymous" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:inputType="textNoSuggestions" /> + </LinearLayout> <!-- android:id="@+id/eap" --> + + <!-- <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_password" /> + + <EditText android:id="@+id/password" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:password="true" /> + + <CheckBox android:id="@+id/show_password" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_show_password" /> --> + </LinearLayout> <!-- android:id="@+id/security_fields" --> + + <LinearLayout android:id="@+id/ip_fields" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone"> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_ip_settings" /> + + <Spinner android:id="@+id/ip_settings" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:prompt="@string/wifi_ip_settings" + android:entries="@array/wifi_ip_settings" /> + </LinearLayout> + + <LinearLayout android:id="@+id/staticip" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone"> + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_ip_address" /> + + <EditText android:id="@+id/ipaddress" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:inputType="textNoSuggestions" /> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_gateway" /> + + <EditText android:id="@+id/gateway" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:inputType="textNoSuggestions" /> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_network_prefix_length" /> + + <EditText android:id="@+id/network_prefix_length" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:inputType="textNoSuggestions" /> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_dns1" /> + + <EditText android:id="@+id/dns1" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:inputType="textNoSuggestions" /> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_dns2" /> + + <EditText android:id="@+id/dns2" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:inputType="textNoSuggestions" /> + + <LinearLayout android:id="@+id/proxy_settings_fields" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone"> + + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/proxy_settings_title" /> + + <Spinner android:id="@+id/proxy_settings" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:prompt="@string/proxy_settings_title" + android:entries="@array/wifi_proxy_settings" /> + </LinearLayout> + + <LinearLayout android:id="@+id/proxy_fields" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone"> + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/proxy_hostname_label" /> + + <EditText android:id="@+id/proxy_hostname" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:inputType="textNoSuggestions" /> + + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/proxy_port_label" /> + + <EditText android:id="@+id/proxy_port" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:inputType="textNoSuggestions" /> + + <TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/proxy_exclusionlist_label" /> + + <EditText android:id="@+id/proxy_exclusionlist" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:inputType="textNoSuggestions" /> + + </LinearLayout> + </LinearLayout> + + </LinearLayout> +</LinearLayout> diff --git a/res/values/strings.xml b/res/values/strings.xml index da54e9d..d510018 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -989,6 +989,12 @@ <string name="wifi_save">Save</string> <!-- Button label to dismiss the dialog --> <string name="wifi_cancel">Cancel</string> + <!-- Button label to go back to previous screen. Used in SetupWizard for + XLarge screen [CHAR LIMIT=10]--> + <string name="wifi_back">Back</string> + <!-- Button label to show detailed dialog for WiFi settings. + Used in SetupWizard for XLarge screen [CHAR LIMIT=10]--> + <string name="wifi_detail">Detail</string> <!-- Wi-Fi Advanced Settings --> <skip /> <!-- Wi-Fi settings screen, advanced, settings section. This is a header shown above advanced wifi settings. --> diff --git a/src/com/android/settings/wifi/WifiConfigPreference.java b/src/com/android/settings/wifi/WifiConfigPreference.java index 5a09827..c495481 100644 --- a/src/com/android/settings/wifi/WifiConfigPreference.java +++ b/src/com/android/settings/wifi/WifiConfigPreference.java @@ -45,7 +45,8 @@ public class WifiConfigPreference extends Preference implements WifiConfigUiBase AccessPoint accessPoint, boolean edit) { super(wifiSettings.getActivity()); mWifiSettings = wifiSettings; - setLayoutResource(R.layout.wifi_config_preference); + // setLayoutResource(R.layout.wifi_config_preference); + setLayoutResource(R.layout.wifi_config_preference2); mListener = listener; mAccessPoint = accessPoint; mEdit = edit; diff --git a/src/com/android/settings/wifi/WifiConfigUiBase.java b/src/com/android/settings/wifi/WifiConfigUiBase.java index ee56714..d930b58 100644 --- a/src/com/android/settings/wifi/WifiConfigUiBase.java +++ b/src/com/android/settings/wifi/WifiConfigUiBase.java @@ -22,7 +22,7 @@ import android.widget.Button; /** * Foundation interface glues between Activities and UIs like - * {@link WifiDialog} or {@link WifiPreference}. + * {@link WifiDialog} or {@link WifiConfigPreference}. */ public interface WifiConfigUiBase { public Context getContext(); diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java index d8d0a60..efafd59 100644 --- a/src/com/android/settings/wifi/WifiSettings.java +++ b/src/com/android/settings/wifi/WifiSettings.java @@ -94,7 +94,7 @@ public class WifiSettings extends SettingsPreferenceFragment // ListView won't become larger than the screen. // // This constant doesn't affect other contexts other than SetupWizard XL. - private static int MAX_MENU_COUNT_IN_XL = 6; + private static int MAX_MENU_COUNT_IN_XL = 8; private final IntentFilter mFilter; private final BroadcastReceiver mReceiver; @@ -107,6 +107,7 @@ public class WifiSettings extends SettingsPreferenceFragment private Preference mAddNetwork; // An access point being editted is stored here. private AccessPoint mSelectedAccessPoint; + private boolean mEdit; private DetailedState mLastState; private WifiInfo mLastInfo; @@ -365,10 +366,12 @@ public class WifiSettings extends SettingsPreferenceFragment synchronized (this) { mRefrainListUpdate = false; } + mEdit = edit; if (mInXlSetupWizard) { final Activity activity = getActivity(); activity.findViewById(R.id.wifi_setup_connect).setVisibility(View.VISIBLE); activity.findViewById(R.id.wifi_setup_cancel).setVisibility(View.VISIBLE); + activity.findViewById(R.id.wifi_setup_detail).setVisibility(View.VISIBLE); showConfigPreference(accessPoint, edit); } else { showDialog(accessPoint, edit); @@ -400,6 +403,7 @@ public class WifiSettings extends SettingsPreferenceFragment activity.findViewById(R.id.wifi_setup_connect).setVisibility(View.GONE); activity.findViewById(R.id.wifi_setup_forget).setVisibility(View.GONE); activity.findViewById(R.id.wifi_setup_cancel).setVisibility(View.GONE); + activity.findViewById(R.id.wifi_setup_detail).setVisibility(View.GONE); } else { activity.findViewById(R.id.wifi_setup_add_network).setVisibility(View.GONE); activity.findViewById(R.id.wifi_setup_refresh_list).setVisibility(View.GONE); @@ -417,6 +421,10 @@ public class WifiSettings extends SettingsPreferenceFragment mDialog.show(); } + /* package */ void showDialogForSelectedPreference() { + showDialog(mSelectedAccessPoint, mEdit); + } + private boolean requireKeyStore(WifiConfiguration config) { if (WifiConfigController.requireKeyStore(config) && KeyStore.getInstance().test() != KeyStore.NO_ERROR) { diff --git a/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java b/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java index 50e3f4c..0801504 100644 --- a/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java +++ b/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java @@ -103,6 +103,7 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis ((Button)findViewById(R.id.wifi_setup_connect)).setOnClickListener(this); ((Button)findViewById(R.id.wifi_setup_forget)).setOnClickListener(this); ((Button)findViewById(R.id.wifi_setup_cancel)).setOnClickListener(this); + ((Button)findViewById(R.id.wifi_setup_detail)).setOnClickListener(this); } @Override @@ -134,6 +135,9 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis mStatusText.setText(R.string.wifi_setup_status_select_network); mWifiSettings.detachConfigPreference(); break; + case R.id.wifi_setup_detail: + mWifiSettings.showDialogForSelectedPreference(); + break; } hideSoftwareKeyboard(); } |