Move attachment options as input bar expands

This commit is contained in:
Niels Andriesse 2021-06-18 10:16:15 +10:00
parent a5bf1a3c66
commit 7c3b1b22d7
2 changed files with 14 additions and 6 deletions

View File

@ -12,6 +12,7 @@ import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.view.MotionEvent import android.view.MotionEvent
import android.widget.RelativeLayout import android.widget.RelativeLayout
import androidx.core.view.marginBottom
import androidx.loader.app.LoaderManager import androidx.loader.app.LoaderManager
import androidx.loader.content.Loader import androidx.loader.content.Loader
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
@ -154,6 +155,12 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
val recyclerViewLayoutParams = conversationRecyclerView.layoutParams as RelativeLayout.LayoutParams val recyclerViewLayoutParams = conversationRecyclerView.layoutParams as RelativeLayout.LayoutParams
recyclerViewLayoutParams.bottomMargin = newValue recyclerViewLayoutParams.bottomMargin = newValue
conversationRecyclerView.layoutParams = recyclerViewLayoutParams 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() { override fun toggleAttachmentOptions() {

View File

@ -12,7 +12,14 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="@dimen/input_bar_height" /> android:layout_marginBottom="@dimen/input_bar_height" />
<org.thoughtcrime.securesms.conversation.v2.input_bar.InputBar
android:id="@+id/inputBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
<LinearLayout <LinearLayout
android:id="@+id/attachmentOptionsContainer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/small_spacing" android:layout_marginStart="@dimen/small_spacing"
@ -50,12 +57,6 @@
</LinearLayout> </LinearLayout>
<org.thoughtcrime.securesms.conversation.v2.input_bar.InputBar
android:id="@+id/inputBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
<org.thoughtcrime.securesms.conversation.v2.input_bar.InputBarRecordingView <org.thoughtcrime.securesms.conversation.v2.input_bar.InputBarRecordingView
android:id="@+id/inputBarRecordingView" android:id="@+id/inputBarRecordingView"
android:layout_width="match_parent" android:layout_width="match_parent"