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);
|
mView = mInflater.inflate(R.layout.wifi_config_ui_for_setup_wizard, parent, true);
|
||||||
mController = new WifiConfigController(this, mView, mAccessPoint, edit);
|
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.
|
// Set Focus to password View.
|
||||||
final View viewToBeFocused = mView.findViewById(R.id.password);
|
final View viewToBeFocused = mView.findViewById(R.id.password);
|
||||||
if (viewToBeFocused != null && viewToBeFocused.getVisibility() == View.VISIBLE &&
|
if (viewToBeFocused == null) {
|
||||||
viewToBeFocused instanceof EditText) {
|
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.
|
// After acquiring the focus, we show software keyboard.
|
||||||
viewToBeFocused.setOnFocusChangeListener(this);
|
viewToBeFocused.setOnFocusChangeListener(this);
|
||||||
final boolean requestFocusResult = viewToBeFocused.requestFocus();
|
final boolean requestFocusResult = viewToBeFocused.requestFocus();
|
||||||
@@ -84,6 +92,7 @@ public class WifiConfigUiForSetupWizardXL implements WifiConfigUiBase, OnFocusCh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public View getView() {
|
public View getView() {
|
||||||
return mView;
|
return mView;
|
||||||
|
@@ -163,6 +163,7 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
hideSoftwareKeyboard();
|
||||||
if (view == mAddNetworkButton) {
|
if (view == mAddNetworkButton) {
|
||||||
onAddNetworkButtonPressed();
|
onAddNetworkButtonPressed();
|
||||||
} else if (view == mRefreshButton) {
|
} else if (view == mRefreshButton) {
|
||||||
@@ -184,7 +185,6 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
|
|||||||
} else if (view == mDetailButton) {
|
} else if (view == mDetailButton) {
|
||||||
mWifiSettings.showDialogForSelectedPreference();
|
mWifiSettings.showDialogForSelectedPreference();
|
||||||
}
|
}
|
||||||
hideSoftwareKeyboard();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideSoftwareKeyboard() {
|
private void hideSoftwareKeyboard() {
|
||||||
|
Reference in New Issue
Block a user