Merge "Stop showing software keyboard when appropriate"
This commit is contained in:
committed by
Android (Google) Code Review
commit
a79a7ac47a
@@ -70,10 +70,18 @@ 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);
|
||||
|
||||
// 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 && viewToBeFocused.getVisibility() == View.VISIBLE &&
|
||||
viewToBeFocused instanceof EditText) {
|
||||
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();
|
||||
@@ -84,6 +92,7 @@ public class WifiConfigUiForSetupWizardXL implements WifiConfigUiBase, OnFocusCh
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public View getView() {
|
||||
return mView;
|
||||
|
@@ -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() {
|
||||
|
Reference in New Issue
Block a user