From 621085292b12730949f8d93ff913d6bd72b81bae Mon Sep 17 00:00:00 2001 From: Lorenz Date: Sat, 10 Feb 2024 21:34:03 +0100 Subject: [PATCH 1/2] #7618 focus subject or content field on external intent --- .../java/com/fsck/k9/activity/MessageCompose.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java index 9c6d7a04ddd..ea248d16201 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java @@ -370,8 +370,8 @@ public void onTextChanged(CharSequence s, int start, int before, int count) { relatedMessageProcessed = savedInstanceState.getBoolean(STATE_KEY_SOURCE_MESSAGE_PROCED, false); } - - if (initFromIntent(intent)) { + boolean startedByExternalIntent = initFromIntent(intent); + if (startedByExternalIntent) { action = Action.COMPOSE; changesMadeSinceLastSave = true; } else { @@ -446,6 +446,13 @@ public void onTextChanged(CharSequence s, int start, int before, int count) { action == Action.EDIT_DRAFT) { //change focus to message body. messageContentView.requestFocus(); + } else if (startedByExternalIntent) { + // If started by external intent, focus "Subject" or content field (Issue #7618) + if(subjectView.getText().length() == 0) { + subjectView.requestFocus(); + } else { + messageContentView.requestFocus(); + } } else { // Explicitly set focus to "To:" input field (see issue 2998) recipientMvpView.requestFocusOnToField(); From 89c7a36028958cfe9bfd42427dfe15d90423b992 Mon Sep 17 00:00:00 2001 From: Lorenz Date: Sun, 11 Feb 2024 10:27:21 +0100 Subject: [PATCH 2/2] fix formatting --- .../src/main/java/com/fsck/k9/activity/MessageCompose.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java index ea248d16201..e64e56d21f3 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageCompose.java @@ -448,7 +448,7 @@ public void onTextChanged(CharSequence s, int start, int before, int count) { messageContentView.requestFocus(); } else if (startedByExternalIntent) { // If started by external intent, focus "Subject" or content field (Issue #7618) - if(subjectView.getText().length() == 0) { + if (subjectView.getText().length() == 0) { subjectView.requestFocus(); } else { messageContentView.requestFocus();