Show password field when authentication failed.
- add onAuthenticationFailure() method to prepare appropriate UIs. - set "edit" boolean to true so that users can modify password when re-seleting a network. - keep mStatusText shown for simplicity. It has been hidden during "editing" phase, but we don't need to do that any more - modify Connect button handling so that the button hides/appears at appropriate time - manage visibility state of some fields so that we can "reset" the status when authentication failed - show keyboard again when password field re-appears Bug: 3330109 Change-Id: I1cdf0573280ab46882117e21501a43a447e50b40
This commit is contained in:
@@ -75,21 +75,28 @@ public class WifiConfigUiForSetupWizardXL implements WifiConfigUiBase, OnFocusCh
|
||||
// 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);
|
||||
}
|
||||
requestFocusAndShowKeyboard(R.id.password);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param editViewId must be EditView
|
||||
*/
|
||||
public void requestFocusAndShowKeyboard(int editViewId) {
|
||||
// Set Focus to password View.
|
||||
final View viewToBeFocused = mView.findViewById(editViewId);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user