request input focus in VerifyActivity

This commit is contained in:
Daniel Gultsch 2021-01-19 13:31:49 +01:00
parent 49d0558da1
commit 87e9b8037e
2 changed files with 7 additions and 1 deletions

View File

@ -246,6 +246,8 @@ public class VerifyActivity extends XmppActivity implements ClipboardManager.OnP
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if (pinEntryWrapper.isEmpty()) { if (pinEntryWrapper.isEmpty()) {
//starting with Android P we need input focus
pinEntryWrapper.requestFocus();
pastePinFromClipboard(); pastePinFromClipboard();
} }
} }

View File

@ -14,7 +14,7 @@ import java.util.regex.Pattern;
public class PinEntryWrapper { public class PinEntryWrapper {
private static Pattern PIN_STRING_PATTERN = Pattern.compile("^[0-9]{6}$"); private static final Pattern PIN_STRING_PATTERN = Pattern.compile("^[0-9]{6}$");
private final List<EditText> digits = new ArrayList<>(); private final List<EditText> digits = new ArrayList<>();
@ -152,4 +152,8 @@ public class PinEntryWrapper {
digits.get(i).getText().clear(); digits.get(i).getText().clear();
} }
} }
public void requestFocus() {
digits.get(0).requestFocus();
}
} }