diff options
author | Daisuke Miyakawa <dmiyakawa@google.com> | 2010-12-28 12:06:08 -0800 |
---|---|---|
committer | Daisuke Miyakawa <dmiyakawa@google.com> | 2010-12-28 12:06:08 -0800 |
commit | 0688f251af533c09682c791ae20834ab7854d7d7 (patch) | |
tree | a744dff27b2222e48629e73a86944f0bd523ed04 /src | |
parent | 762d2646582c073152a8774c1c6c49e1dc441d2e (diff) | |
download | packages_apps_settings-0688f251af533c09682c791ae20834ab7854d7d7.zip packages_apps_settings-0688f251af533c09682c791ae20834ab7854d7d7.tar.gz packages_apps_settings-0688f251af533c09682c791ae20834ab7854d7d7.tar.bz2 |
Refresh layouts for SetupWizard.
- DateTimeSettingsSetupWizardXL
- WifiSettingsForSetupWizardXL
Bug: 3308677, 3137755
Change-Id: Ifdf67aa7521de7ef0286fea2b15ce693fbf5d5ce
Diffstat (limited to 'src')
4 files changed, 42 insertions, 15 deletions
diff --git a/src/com/android/settings/DateTimeSettingsSetupWizard.java b/src/com/android/settings/DateTimeSettingsSetupWizard.java index 73cba03..3a97763 100644 --- a/src/com/android/settings/DateTimeSettingsSetupWizard.java +++ b/src/com/android/settings/DateTimeSettingsSetupWizard.java @@ -100,7 +100,8 @@ public class DateTimeSettingsSetupWizard extends Activity mTimeZoneButton.setText(tz.getDisplayName()); // mTimeZoneButton.setText(DateTimeSettings.getTimeZoneText(tz)); mTimeZoneButton.setOnClickListener(this); - mTimeZoneAdapter = ZonePicker.constructTimezoneAdapter(this, false); + mTimeZoneAdapter = ZonePicker.constructTimezoneAdapter(this, false, + R.layout.custom_list_item); final boolean autoDateTimeEnabled; final Intent intent = getIntent(); @@ -110,7 +111,7 @@ public class DateTimeSettingsSetupWizard extends Activity autoDateTimeEnabled = isAutoDateTimeEnabled(); } - mAutoDateTimeButton = (CompoundButton)findViewById(R.id.date_time_auto); + mAutoDateTimeButton = (CompoundButton)findViewById(R.id.date_time_auto_button); mAutoDateTimeButton.setChecked(autoDateTimeEnabled); mAutoDateTimeButton.setText(autoDateTimeEnabled ? R.string.date_time_auto_summaryOn : R.string.date_time_auto_summaryOff); diff --git a/src/com/android/settings/ZonePicker.java b/src/com/android/settings/ZonePicker.java index 83d46cb..652f3b7 100644 --- a/src/com/android/settings/ZonePicker.java +++ b/src/com/android/settings/ZonePicker.java @@ -80,6 +80,17 @@ public class ZonePicker extends ListFragment { */ public static SimpleAdapter constructTimezoneAdapter(Context context, boolean sortedByName) { + return constructTimezoneAdapter(context, sortedByName, + android.R.layout.simple_list_item_2); + } + + /** + * Constructs an adapter with TimeZone list. Sorted by TimeZone in default. + * + * @param sortedByName use Name for sorting the list. + */ + public static SimpleAdapter constructTimezoneAdapter(Context context, + boolean sortedByName, int layoutId) { final String[] from = new String[] {KEY_DISPLAYNAME, KEY_GMT}; final int[] to = new int[] {android.R.id.text1, android.R.id.text2}; @@ -89,7 +100,7 @@ public class ZonePicker extends ListFragment { Collections.sort(sortedList, comparator); final SimpleAdapter adapter = new SimpleAdapter(context, sortedList, - android.R.layout.simple_list_item_2, + layoutId, from, to); diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java index 3a1f767..510292a 100644 --- a/src/com/android/settings/wifi/WifiSettings.java +++ b/src/com/android/settings/wifi/WifiSettings.java @@ -49,10 +49,12 @@ import android.security.Credentials; import android.security.KeyStore; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; +import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; +import android.view.ViewGroup; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.Toast; @@ -107,11 +109,6 @@ public class WifiSettings extends SettingsPreferenceFragment // this boolean extra specifies whether to disable the Next button when not connected private static final String EXTRA_ENABLE_NEXT_ON_CONNECT = "wifi_enable_next_on_connect"; - // Indicates that this fragment is used as a part of Setup Wizard with XL screen settings. - // This fragment should show information which has been shown as Dialog in combined UI - // inside this fragment. - /* package */ static final String IN_XL_SETUP_WIZARD = "in_setup_wizard"; - // should Next button only be enabled when we have a connection? private boolean mEnableNextOnConnection; private boolean mInXlSetupWizard; @@ -140,6 +137,23 @@ public class WifiSettings extends SettingsPreferenceFragment } @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + + mInXlSetupWizard = (activity instanceof WifiSettingsForSetupWizardXL); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + if (mInXlSetupWizard) { + return inflater.inflate(R.layout.custom_preference_list_fragment, container, false); + } else { + return super.onCreateView(inflater, container, savedInstanceState); + } + } + + @Override public void onActivityCreated(Bundle savedInstanceState) { // We don't call super.onActivityCreated() here, since it assumes we already set up // Preference (probably in onCreate()), while WifiSettings exceptionally set it up in @@ -150,11 +164,9 @@ public class WifiSettings extends SettingsPreferenceFragment final Activity activity = getActivity(); final Intent intent = activity.getIntent(); - // if we're supposed to enable/disable the Next button based on our current connection // state, start it off in the right state mEnableNextOnConnection = intent.getBooleanExtra(EXTRA_ENABLE_NEXT_ON_CONNECT, false); - mInXlSetupWizard = intent.getBooleanExtra(IN_XL_SETUP_WIZARD, false); if (mEnableNextOnConnection) { if (mEnableNextOnConnection && hasNextButton()) { diff --git a/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java b/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java index 2ebe87c..5e0b104 100644 --- a/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java +++ b/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java @@ -121,8 +121,6 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis (WifiSettings)getFragmentManager().findFragmentById(R.id.wifi_setup_fragment); mInputMethodManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); setup(); - // XXX: should we use method? - getIntent().putExtra(WifiSettings.IN_XL_SETUP_WIZARD, true); } public void setup() { @@ -243,6 +241,7 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis mProgressBar.setIndeterminate(false); mProgressBar.setProgress(2); mProgressText.setText(Summary.get(this, state)); + mStatusText.setVisibility(View.VISIBLE); mStatusText.setText(R.string.wifi_setup_status_proceed_to_next); mAddNetworkButton.setVisibility(View.GONE); @@ -275,6 +274,7 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis private void showConnectingStatus() { mProgressBar.setIndeterminate(false); mProgressBar.setProgress(1); + mStatusText.setVisibility(View.VISIBLE); mStatusText.setText(R.string.wifi_setup_status_connecting); mProgressText.setText(Summary.get(this, DetailedState.CONNECTING)); } @@ -284,6 +284,7 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis ((Button)findViewById(R.id.wifi_setup_add_network)).setEnabled(false); ((Button)findViewById(R.id.wifi_setup_refresh_list)).setEnabled(false); mProgressText.setText(Summary.get(this, DetailedState.SCANNING)); + mStatusText.setVisibility(View.VISIBLE); mStatusText.setText(R.string.wifi_setup_status_scanning); } @@ -327,14 +328,15 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis } else if (selectedAccessPoint != null && selectedAccessPoint.security == AccessPoint.SECURITY_EAP) { mStatusText.setText(R.string.wifi_setup_status_eap_not_supported); + mConnectButton.setVisibility(View.GONE); } else { - mStatusText.setText(R.string.wifi_setup_status_edit_network); + // mStatusText.setText(R.string.wifi_setup_status_edit_network); + mStatusText.setVisibility(View.GONE); + mConnectButton.setVisibility(View.VISIBLE); } mAddNetworkButton.setVisibility(View.GONE); mRefreshButton.setVisibility(View.GONE); mSkipOrNextButton.setVisibility(View.GONE); - mConnectButton.setVisibility(View.VISIBLE); - mConnectButton.setVisibility(View.VISIBLE); mBackButton.setVisibility(View.VISIBLE); // TODO: remove this after UI fix. // mDetailButton.setVisibility(View.VISIBLE); @@ -400,6 +402,7 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis } else { // During user's Wifi configuration. mWifiSettings.resumeWifiScan(); + mStatusText.setVisibility(View.VISIBLE); mStatusText.setText(R.string.wifi_setup_status_select_network); restoreFirstButtonVisibilityState(); |