From 4b6e230c2bd8a9e6ca5577e5e2a90b7b306493e4 Mon Sep 17 00:00:00 2001 From: Distopico Vegan Date: Mon, 19 Nov 2018 23:27:42 -0500 Subject: [PATCH] fix: focus body on reply message --- .../org/dystopia/email/FragmentCompose.java | 7 ++++++- app/src/main/res/layout/fragment_compose.xml | 18 +++++++++++------- app/src/main/res/values/dimens.xml | 3 +++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/org/dystopia/email/FragmentCompose.java b/app/src/main/java/org/dystopia/email/FragmentCompose.java index bbec2c03..04c0c2c3 100644 --- a/app/src/main/java/org/dystopia/email/FragmentCompose.java +++ b/app/src/main/java/org/dystopia/email/FragmentCompose.java @@ -1443,7 +1443,12 @@ public class FragmentCompose extends FragmentEx { new Runnable() { @Override public void run() { - etTo.requestFocus(); + String etToText = etTo.getText().toString(); + if (etToText != null && etToText.length() > 0) { + etBody.requestFocus(); + } else { + etTo.requestFocus(); + } } }); } diff --git a/app/src/main/res/layout/fragment_compose.xml b/app/src/main/res/layout/fragment_compose.xml index 507cdea3..9678638f 100644 --- a/app/src/main/res/layout/fragment_compose.xml +++ b/app/src/main/res/layout/fragment_compose.xml @@ -7,6 +7,7 @@ @@ -19,7 +20,9 @@ android:id="@+id/spFrom" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginTop="6dp" + android:layout_marginTop="@dimen/content_margin" + android:layout_marginHorizontal="@dimen/content_margin" + android:minHeight="@dimen/input_height" app:layout_constraintEnd_toStartOf="@+id/ivIdentityAdd" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -137,9 +140,9 @@ android:id="@+id/rvAttachment" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="6dp" - android:layout_marginTop="3dp" - android:layout_marginEnd="6dp" + android:layout_marginHorizontal="@dimen/content_margin" + android:layout_marginTop="@dimen/content_margin" + android:padding="@dimen/compose_padding" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/vSeparatorAttachments" /> @@ -148,7 +151,7 @@ android:id="@+id/vSeparator" android:layout_width="match_parent" android:layout_height="1dp" - android:layout_marginTop="6dp" + android:layout_marginTop="@dimen/content_margin" android:background="?attr/colorSeparator" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/rvAttachment" /> @@ -157,8 +160,9 @@ android:id="@+id/etBody" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="6dp" - android:layout_marginEnd="6dp" + android:layout_marginHorizontal="@dimen/content_margin" + android:layout_marginVertical="@dimen/content_margin" + android:padding="@dimen/compose_padding" android:background="@null" android:fontFamily="monospace" android:gravity="top" diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 2f24fc12..750027d0 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -2,4 +2,7 @@ 12dp 6dp + 6dp + 6dp + 40dp