diff options
author | Daisuke Miyakawa <dmiyakawa@google.com> | 2010-11-12 18:28:23 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-11-12 18:28:23 -0800 |
commit | a79a7ac47a2991f883d1a8a29eb2e63c38afff7b (patch) | |
tree | c7a059f87fd10a716d4b2731ea71011c0006f86d /src | |
parent | 00f3bd885f25592d8cb56d0b960fa886fb3ee276 (diff) | |
parent | fdb9343ef660fc424bb8c29b48d5c06dff0241c1 (diff) | |
download | packages_apps_settings-a79a7ac47a2991f883d1a8a29eb2e63c38afff7b.zip packages_apps_settings-a79a7ac47a2991f883d1a8a29eb2e63c38afff7b.tar.gz packages_apps_settings-a79a7ac47a2991f883d1a8a29eb2e63c38afff7b.tar.bz2 |
Merge "Stop showing software keyboard when appropriate"
Diffstat (limited to 'src')
-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() { |