diff options
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/settings/wifi/WifiConfigUiForSetupWizardXL.java | 31 | ||||
-rw-r--r-- | src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java | 2 |
2 files changed, 21 insertions, 12 deletions
diff --git a/src/com/android/settings/wifi/WifiConfigUiForSetupWizardXL.java b/src/com/android/settings/wifi/WifiConfigUiForSetupWizardXL.java index 61e59d9..4de7ef5 100644 --- a/src/com/android/settings/wifi/WifiConfigUiForSetupWizardXL.java +++ b/src/com/android/settings/wifi/WifiConfigUiForSetupWizardXL.java @@ -70,17 +70,26 @@ public class WifiConfigUiForSetupWizardXL implements WifiConfigUiBase, OnFocusCh mView = mInflater.inflate(R.layout.wifi_config_ui_for_setup_wizard, parent, true); mController = new WifiConfigController(this, mView, mAccessPoint, edit); - // Set Focus to password View. - final View viewToBeFocused = mView.findViewById(R.id.password); - if (viewToBeFocused != null && viewToBeFocused.getVisibility() == View.VISIBLE && - viewToBeFocused instanceof EditText) { - // After acquiring the focus, we show software keyboard. - viewToBeFocused.setOnFocusChangeListener(this); - final boolean requestFocusResult = viewToBeFocused.requestFocus(); - Log.i(TAG, String.format("Focus request %s.", - (requestFocusResult ? "successful" : "failed"))); - if (!requestFocusResult) { - viewToBeFocused.setOnFocusChangeListener(null); + // Assumes R.id.password is inside security_fields. + // TODO: confirm it is ok to assume R.id.password is the only EditText to be focused, and + // R.id.security_fields is the only parent for possible EditTexts. Possibly we need to + // check parentand detect visibility manually. + if (mView.findViewById(R.id.security_fields).getVisibility() == View.VISIBLE) { + // Set Focus to password View. + final View viewToBeFocused = mView.findViewById(R.id.password); + if (viewToBeFocused == null) { + Log.w(TAG, "password field to be focused not found."); + } else if (!(viewToBeFocused instanceof EditText)) { + Log.w(TAG, "password field is not EditText"); + } else { + // After acquiring the focus, we show software keyboard. + viewToBeFocused.setOnFocusChangeListener(this); + final boolean requestFocusResult = viewToBeFocused.requestFocus(); + Log.i(TAG, String.format("Focus request %s.", + (requestFocusResult ? "successful" : "failed"))); + if (!requestFocusResult) { + viewToBeFocused.setOnFocusChangeListener(null); + } } } } diff --git a/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java b/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java index f5a779a..468e5c2 100644 --- a/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java +++ b/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java @@ -163,6 +163,7 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis @Override public void onClick(View view) { + hideSoftwareKeyboard(); if (view == mAddNetworkButton) { onAddNetworkButtonPressed(); } else if (view == mRefreshButton) { @@ -184,7 +185,6 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis } else if (view == mDetailButton) { mWifiSettings.showDialogForSelectedPreference(); } - hideSoftwareKeyboard(); } private void hideSoftwareKeyboard() { |