SetupWizard improvement: let users see "scanning"

Current UI shows nothing when there's no connection available, even when
the device is finding some. So user cannot know whether the static
"Not connected" screen means: the device is finding right now, or
actually no network is available.

Change-Id: Ia8ea1c66956e8de819f6a98362bcc9086bda172c
This commit is contained in:
Daisuke Miyakawa
2010-09-13 15:26:43 -07:00
parent 746d913e0b
commit b962d6566c
3 changed files with 29 additions and 8 deletions

View File

@@ -103,7 +103,8 @@
android:theme="@android:style/Theme.NoTitleBar" android:theme="@android:style/Theme.NoTitleBar"
android:clearTaskOnLaunch="true" android:clearTaskOnLaunch="true"
android:screenOrientation="landscape" android:screenOrientation="landscape"
android:exported="true" /> android:exported="true"
android:theme="@android:style/Theme.Holo.NoTitleBar" />
<activity android:name=".wifi.AdvancedSettings" <activity android:name=".wifi.AdvancedSettings"
android:label="@string/wifi_ip_settings_titlebar" android:label="@string/wifi_ip_settings_titlebar"

View File

@@ -667,4 +667,12 @@ public class WifiSettings extends SettingsPreferenceFragment
mSelectedAccessPoint = null; mSelectedAccessPoint = null;
showConfigUi(null, true); showConfigUi(null, true);
} }
/* package */ int getAccessPointsCount() {
if (mAccessPoints != null) {
return mAccessPoints.getPreferenceCount();
} else {
return 0;
}
}
} }

View File

@@ -40,7 +40,7 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
static { static {
stateMap.put(DetailedState.IDLE, DetailedState.DISCONNECTED); stateMap.put(DetailedState.IDLE, DetailedState.DISCONNECTED);
stateMap.put(DetailedState.SCANNING, DetailedState.DISCONNECTED); stateMap.put(DetailedState.SCANNING, DetailedState.SCANNING);
stateMap.put(DetailedState.CONNECTING, DetailedState.CONNECTING); stateMap.put(DetailedState.CONNECTING, DetailedState.CONNECTING);
stateMap.put(DetailedState.AUTHENTICATING, DetailedState.CONNECTING); stateMap.put(DetailedState.AUTHENTICATING, DetailedState.CONNECTING);
stateMap.put(DetailedState.OBTAINING_IPADDR, DetailedState.CONNECTING); stateMap.put(DetailedState.OBTAINING_IPADDR, DetailedState.CONNECTING);
@@ -111,28 +111,40 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
public void updateConnectionState(DetailedState originalState) { public void updateConnectionState(DetailedState originalState) {
final DetailedState state = stateMap.get(originalState); final DetailedState state = stateMap.get(originalState);
final String message;
mProgressBar.setIndeterminate(false);
switch (state) { switch (state) {
case SCANNING: {
// Let users know the device is working correctly though currently there's
// no visible network on the list.
if (mWifiSettings.getAccessPointsCount() == 0) {
mProgressBar.setIndeterminate(true);
mProgressText.setText(Summary.get(this, DetailedState.SCANNING));
} else {
// Users already already connected to a network, or see available networks.
mProgressBar.setIndeterminate(false);
}
break;
}
case CONNECTING: { case CONNECTING: {
message = Summary.get(this, state); mProgressBar.setIndeterminate(false);
mProgressBar.setProgress(1); mProgressBar.setProgress(1);
mStatusText.setText(R.string.wifi_setup_status_connecting); mStatusText.setText(R.string.wifi_setup_status_connecting);
mProgressText.setText(Summary.get(this, state));
break; break;
} }
case CONNECTED: { case CONNECTED: {
message = Summary.get(this, state); mProgressBar.setIndeterminate(false);
mProgressBar.setProgress(2); mProgressBar.setProgress(2);
mStatusText.setText(R.string.wifi_setup_status_connected); mStatusText.setText(R.string.wifi_setup_status_connected);
mProgressText.setText(Summary.get(this, state));
break; break;
} }
default: // Not connected. default: // Not connected.
message = getString(R.string.wifi_setup_not_connected); mProgressBar.setIndeterminate(false);
mProgressBar.setProgress(0); mProgressBar.setProgress(0);
mStatusText.setText(R.string.wifi_setup_status_select_network); mStatusText.setText(R.string.wifi_setup_status_select_network);
mProgressText.setText(getString(R.string.wifi_setup_not_connected));
break; break;
} }
mProgressText.setText(message);
} }
public void onWifiConfigPreferenceAttached(boolean isNewNetwork) { public void onWifiConfigPreferenceAttached(boolean isNewNetwork) {