Improve UI of WifiSettingsForXL

Change-Id: Idd25251581577246ff3fb6820b9c569454292593
This commit is contained in:
Daisuke Miyakawa
2010-09-29 16:07:02 -07:00
parent d83aaf28bc
commit 3b6aa41cce
3 changed files with 41 additions and 18 deletions

View File

@@ -2703,6 +2703,9 @@ found in the list of installed applications.</string>
Used in Wifi Setup For Setup Wizard with XL screen. --> Used in Wifi Setup For Setup Wizard with XL screen. -->
<string name="wifi_setup_next">Next</string> <string name="wifi_setup_next">Next</string>
<!-- The message shown above available networks when the device is scanning
available networks [CHAR LIMIT=35] -->
<string name="wifi_setup_status_scanning">Scanning networks...</string>
<!-- Message shown above available network when there's no connected network. <!-- Message shown above available network when there's no connected network.
Used in Wifi Setup For Setup Wizard with XL screen. --> Used in Wifi Setup For Setup Wizard with XL screen. -->
<string name="wifi_setup_status_select_network">Touch to select network</string> <string name="wifi_setup_status_select_network">Touch to select network</string>
@@ -2722,15 +2725,14 @@ found in the list of installed applications.</string>
is established. is established.
Used in Wifi Setup For Setup Wizard with XL screen. --> Used in Wifi Setup For Setup Wizard with XL screen. -->
<string name="wifi_setup_status_connecting">Connecting...</string> <string name="wifi_setup_status_connecting">Connecting...</string>
<!-- The message show above available networks when connection is established. <!-- The message shown above available networks when connection is established,
Used in Wifi Setup For Setup Wizard with XL screen. --> letting a user to proceed to the next step of the SetupWizard.
<string name="wifi_setup_status_connected">Connected</string> Used in Wifi Setup For Setup Wizard with XL screen. [CHAR LIMIT=35] -->
<string name="wifi_setup_status_proceed_to_next">Proceed to the next step</string>
<!-- Do not translate. This is a stub which will be removed soon. --> <!-- Do not translate. This is a stub which will be removed soon. -->
<string name="time_zone_auto_stub" translatable="false">Select Time Zone</string> <string name="time_zone_auto_stub" translatable="false">Select Time Zone</string>
<!-- Message when sync is currently failing [CHAR LIMIT=100] --> <!-- Message when sync is currently failing [CHAR LIMIT=100] -->
<string name="sync_is_failing">Sync is currently experiencing problems. It will be back shortly.</string> <string name="sync_is_failing">Sync is currently experiencing problems. It will be back shortly.</string>
<!-- Button label to add an account [CHAR LIMIT=20] --> <!-- Button label to add an account [CHAR LIMIT=20] -->

View File

@@ -688,6 +688,7 @@ public class WifiSettings extends SettingsPreferenceFragment
} }
/* package */ void refreshAccessPoints() { /* package */ void refreshAccessPoints() {
mWifiManager.disconnect();
if (mWifiManager.isWifiEnabled()) { if (mWifiManager.isWifiEnabled()) {
mScanner.resume(); mScanner.resume();
} }

View File

@@ -65,10 +65,15 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
private InputMethodManager mInputMethodManager; private InputMethodManager mInputMethodManager;
// This count reduces every time when there's a notification about WiFi status change. // This count reduces every time when there's a notification about WiFi status change.
// During the term this is >0, The system shows the message "connecting", regardless // During the term this is >0, The system refrains some actions which are not appropriate
// of the actual WiFi status. After this count's becoming 0, the status message correctly // at that timing.
// reflects what WiFi Picker told it. This is a tweak for letting users not confused // - When network is connected at that timing, this screen doesn't call finish().
// with instable WiFi state during the first scan. // This count is set to 0 when being detected (not decremente).
// - When network status is "disconnected", we just show the message "connecting"
// regardless of the actual WiFi status.
// (After this count's becoming 0, the status message correctly reflects what WiFi Picker
// told it)
// This is a tweak for letting users not confused with WiFi state during a first first steps.
private int mIgnoringWifiNotificationCount = 5; private int mIgnoringWifiNotificationCount = 5;
@Override @Override
@@ -84,6 +89,11 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
getIntent().putExtra(WifiSettings.IN_XL_SETUP_WIZARD, true); getIntent().putExtra(WifiSettings.IN_XL_SETUP_WIZARD, true);
mStatusBarManager = (StatusBarManager)getSystemService(Context.STATUS_BAR_SERVICE); mStatusBarManager = (StatusBarManager)getSystemService(Context.STATUS_BAR_SERVICE);
}
@Override
public void onResume() {
super.onResume();
if (mStatusBarManager != null) { if (mStatusBarManager != null) {
mStatusBarManager.disable(StatusBarManager.DISABLE_EXPAND mStatusBarManager.disable(StatusBarManager.DISABLE_EXPAND
| StatusBarManager.DISABLE_NOTIFICATION_ICONS | StatusBarManager.DISABLE_NOTIFICATION_ICONS
@@ -96,21 +106,23 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
} }
@Override @Override
public void onDestroy() { public void onStop() {
if (mStatusBarManager != null) { if (mStatusBarManager != null) {
mStatusBarManager.disable(StatusBarManager.DISABLE_NONE); mStatusBarManager.disable(StatusBarManager.DISABLE_NONE);
} }
super.onDestroy(); super.onStop();
} }
public void setup() { public void setup() {
mProgressText = (TextView)findViewById(R.id.scanning_progress_text); mProgressText = (TextView)findViewById(R.id.scanning_progress_text);
mProgressText.setText(Summary.get(this, DetailedState.SCANNING));
mProgressBar = (ProgressBar)findViewById(R.id.scanning_progress_bar); mProgressBar = (ProgressBar)findViewById(R.id.scanning_progress_bar);
mProgressBar.setMax(2); mProgressBar.setMax(2);
mProgressBar.setIndeterminate(true);
mStatusText = (TextView)findViewById(R.id.wifi_setup_status); mStatusText = (TextView)findViewById(R.id.wifi_setup_status);
mProgressText.setText(Summary.get(this, DetailedState.SCANNING));
mProgressBar.setIndeterminate(true);
mStatusText.setText(R.string.wifi_setup_status_scanning);
((Button)findViewById(R.id.wifi_setup_refresh_list)).setOnClickListener(this); ((Button)findViewById(R.id.wifi_setup_refresh_list)).setOnClickListener(this);
((Button)findViewById(R.id.wifi_setup_add_network)).setOnClickListener(this); ((Button)findViewById(R.id.wifi_setup_add_network)).setOnClickListener(this);
((Button)findViewById(R.id.wifi_setup_skip_or_next)).setOnClickListener(this); ((Button)findViewById(R.id.wifi_setup_skip_or_next)).setOnClickListener(this);
@@ -181,10 +193,18 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
case CONNECTED: { case CONNECTED: {
mProgressBar.setIndeterminate(false); mProgressBar.setIndeterminate(false);
mProgressBar.setProgress(2); mProgressBar.setProgress(2);
mStatusText.setText(R.string.wifi_setup_status_connected);
mProgressText.setText(Summary.get(this, state)); mProgressText.setText(Summary.get(this, state));
setResult(Activity.RESULT_OK); mStatusText.setText(R.string.wifi_setup_status_proceed_to_next);
finish();
if (mIgnoringWifiNotificationCount > 0) {
// The network is already available before doing anything. We avoid skip this
// screen to avoid unnecessary trouble by doing so.
mIgnoringWifiNotificationCount = 0;
} else {
mProgressText.setText(Summary.get(this, state));
setResult(Activity.RESULT_OK);
finish();
}
break; break;
} }
case FAILED: { case FAILED: {
@@ -200,7 +220,6 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
mIgnoringWifiNotificationCount--; mIgnoringWifiNotificationCount--;
mProgressBar.setIndeterminate(true); mProgressBar.setIndeterminate(true);
mProgressText.setText(Summary.get(this, DetailedState.SCANNING)); mProgressText.setText(Summary.get(this, DetailedState.SCANNING));
return;
} else { } else {
mProgressBar.setIndeterminate(false); mProgressBar.setIndeterminate(false);
mProgressBar.setProgress(0); mProgressBar.setProgress(0);
@@ -222,8 +241,9 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
} }
public void onRefreshAccessPoints() { public void onRefreshAccessPoints() {
mIgnoringWifiNotificationCount = 5;
mProgressBar.setIndeterminate(true); mProgressBar.setIndeterminate(true);
mProgressText.setText(Summary.get(this, DetailedState.SCANNING)); mProgressText.setText(Summary.get(this, DetailedState.SCANNING));
mStatusText.setText(Summary.get(this, DetailedState.SCANNING)); mStatusText.setText(R.string.wifi_setup_status_scanning);
} }
} }