I have a GuidedStepFragment as an authentication-type fragment in my leanback application.
How do I keep a "password" GuidedAction from revealing the typed-text when the user presses enter or goes to the next Guided Action?
The issue I'm facing is the password is hidden while the user is typing, but revealed when the user goes to the next GuidedAction.
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
GuidedAction action;
if (getArguments() != null) {
type = getArguments().getInt(ARG_TYPE);
}
if (type == TYPE_EMAIL) {
action = new GuidedAction.Builder(getActivity())
.id(ActionConstants.ACTION_INPUT_EMAIL)
.editable(true)
.description(getString(R.string.email_address_hint))
.editInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS)
.build();
} else {
action = new GuidedAction.Builder(getActivity())
.id(ActionConstants.ACTION_INPUT_PASS)
.editable(true)
.description(getString(R.string.password))
.editInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD)
.build();
}
actions.add(action);
action = new GuidedAction.Builder(getActivity())
.id(ActionConstants.ACTION_CONTINUE)
.title(R.string.next)
.hasNext(true) // Shows the small arrow indicating there's something next...
.build();
actions.add(action);
}
I have tried overriding setupImeOptions to explicitly set the TransformationMethod on the EditText, but that still doesn't keep the user's password hidden after the user goes to the next Action.
@Override
protected void setupImeOptions(ViewHolder vh, GuidedAction action) {
switch ((int) action.getId()) {
case ActionConstants.ACTION_INPUT_PASS :
vh.getEditableDescriptionView().setTransformationMethod(new PasswordTransformationMethod());
vh.getEditableTitleView().setTransformationMethod(new PasswordTransformationMethod());
break;
}
super.setupImeOptions(vh, action);
}
from Password is revealed on Leanback Guided Step Action when clicked
No comments:
Post a Comment