From 7c3b1b22d781791227fdc9e159cc3f3586c692e7 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Fri, 18 Jun 2021 10:16:15 +1000 Subject: [PATCH] Move attachment options as input bar expands --- .../conversation/v2/ConversationActivityV2.kt | 7 +++++++ .../main/res/layout/activity_conversation_v2.xml | 13 +++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index 8adb21a0da..a601ded293 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -12,6 +12,7 @@ import android.view.Menu import android.view.MenuItem import android.view.MotionEvent import android.widget.RelativeLayout +import androidx.core.view.marginBottom import androidx.loader.app.LoaderManager import androidx.loader.content.Loader import androidx.recyclerview.widget.LinearLayoutManager @@ -154,6 +155,12 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe val recyclerViewLayoutParams = conversationRecyclerView.layoutParams as RelativeLayout.LayoutParams recyclerViewLayoutParams.bottomMargin = newValue conversationRecyclerView.layoutParams = recyclerViewLayoutParams + val attachmentButtonHeight = inputBar.attachmentsButtonContainer.height + val bottomMargin = (newValue - attachmentButtonHeight) / 2 + val margin = toPx(8, resources) + val attachmentOptionsContainerLayoutParams = attachmentOptionsContainer.layoutParams as RelativeLayout.LayoutParams + attachmentOptionsContainerLayoutParams.bottomMargin = bottomMargin + attachmentButtonHeight + margin + attachmentOptionsContainer.layoutParams = attachmentOptionsContainerLayoutParams } override fun toggleAttachmentOptions() { diff --git a/app/src/main/res/layout/activity_conversation_v2.xml b/app/src/main/res/layout/activity_conversation_v2.xml index d5fcbc49f4..240044d57c 100644 --- a/app/src/main/res/layout/activity_conversation_v2.xml +++ b/app/src/main/res/layout/activity_conversation_v2.xml @@ -12,7 +12,14 @@ android:layout_height="match_parent" android:layout_marginBottom="@dimen/input_bar_height" /> + + - -