From 87e9b8037edb105897d9d324f57498dbb67e0120 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 19 Jan 2021 13:31:49 +0100 Subject: [PATCH] request input focus in VerifyActivity --- .../java/eu/siacs/conversations/ui/VerifyActivity.java | 2 ++ .../eu/siacs/conversations/ui/util/PinEntryWrapper.java | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/quicksy/java/eu/siacs/conversations/ui/VerifyActivity.java b/src/quicksy/java/eu/siacs/conversations/ui/VerifyActivity.java index 7e8bab44e..6358e3646 100644 --- a/src/quicksy/java/eu/siacs/conversations/ui/VerifyActivity.java +++ b/src/quicksy/java/eu/siacs/conversations/ui/VerifyActivity.java @@ -246,6 +246,8 @@ public class VerifyActivity extends XmppActivity implements ClipboardManager.OnP public void onResume() { super.onResume(); if (pinEntryWrapper.isEmpty()) { + //starting with Android P we need input focus + pinEntryWrapper.requestFocus(); pastePinFromClipboard(); } } diff --git a/src/quicksy/java/eu/siacs/conversations/ui/util/PinEntryWrapper.java b/src/quicksy/java/eu/siacs/conversations/ui/util/PinEntryWrapper.java index 8e91f659d..b0eef9af6 100644 --- a/src/quicksy/java/eu/siacs/conversations/ui/util/PinEntryWrapper.java +++ b/src/quicksy/java/eu/siacs/conversations/ui/util/PinEntryWrapper.java @@ -14,7 +14,7 @@ import java.util.regex.Pattern; 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 digits = new ArrayList<>(); @@ -152,4 +152,8 @@ public class PinEntryWrapper { digits.get(i).getText().clear(); } } + + public void requestFocus() { + digits.get(0).requestFocus(); + } } \ No newline at end of file