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 dc9d813cc0..76b513509a 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 @@ -5,6 +5,7 @@ import android.os.Bundle import android.view.ActionMode import android.view.Menu import android.view.MenuItem +import android.widget.RelativeLayout import androidx.loader.app.LoaderManager import androidx.loader.content.Loader import androidx.recyclerview.widget.LinearLayoutManager @@ -13,13 +14,14 @@ import kotlinx.android.synthetic.main.activity_conversation_v2_action_bar.* import kotlinx.android.synthetic.main.view_input_bar.view.* import network.loki.messenger.R import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity +import org.thoughtcrime.securesms.conversation.v2.input_bar.InputBarDelegate import org.thoughtcrime.securesms.conversation.v2.menus.ConversationActionModeCallback import org.thoughtcrime.securesms.conversation.v2.menus.ConversationMenuHelper import org.thoughtcrime.securesms.database.DatabaseFactory import org.thoughtcrime.securesms.database.model.MessageRecord import org.thoughtcrime.securesms.mms.GlideApp -class ConversationActivityV2 : PassphraseRequiredActionBarActivity() { +class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDelegate { private var threadID: Long = -1 private var actionMode: ActionMode? = null @@ -64,6 +66,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity() { threadID = intent.getLongExtra(THREAD_ID, -1) setUpRecyclerView() setUpToolBar() + inputBar.delegate = this } private fun setUpRecyclerView() { @@ -103,6 +106,14 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity() { } // endregion + // region Updating + override fun inputBarHeightChanged(newValue: Int) { + val recyclerViewLayoutParams = conversationRecyclerView.layoutParams as RelativeLayout.LayoutParams + recyclerViewLayoutParams.bottomMargin = newValue + conversationRecyclerView.layoutParams = recyclerViewLayoutParams + } + // endregion + // region Interaction override fun onOptionsItemSelected(item: MenuItem): Boolean { // TODO: Implement diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBar.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBar.kt index f28ed92752..8a1ad29f21 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBar.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBar.kt @@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.conversation.v2.input_bar import android.content.Context import android.util.AttributeSet +import android.util.Log import android.view.LayoutInflater import android.widget.LinearLayout import android.widget.RelativeLayout @@ -12,6 +13,7 @@ import org.thoughtcrime.securesms.loki.utilities.toDp import kotlin.math.roundToInt class InputBar : LinearLayout, InputBarEditTextDelegate { + var delegate: InputBarDelegate? = null private val attachmentsButton by lazy { InputBarButton(context, R.drawable.ic_plus_24) } private val microphoneButton by lazy { InputBarButton(context, R.drawable.ic_microphone) } @@ -43,10 +45,17 @@ class InputBar : LinearLayout, InputBarEditTextDelegate { // endregion override fun inputBarEditTextHeightChanged(newValue: Int) { - val vMargin = resources.getDimension(R.dimen.small_spacing).roundToInt() - val layoutParams = this.layoutParams as RelativeLayout.LayoutParams - layoutParams.height = newValue + 2 * vMargin - this.layoutParams = layoutParams + val vMargin = toDp(4, resources) + val layoutParams = inputBarLinearLayout.layoutParams as LayoutParams + val newHeight = newValue + 2 * vMargin + layoutParams.height = newHeight + inputBarLinearLayout.layoutParams = layoutParams + delegate?.inputBarHeightChanged(newHeight) } // endregion +} + +interface InputBarDelegate { + + fun inputBarHeightChanged(newValue: Int) } \ No newline at end of file diff --git a/app/src/main/res/layout/view_input_bar.xml b/app/src/main/res/layout/view_input_bar.xml index 800d83d819..d9044bc5eb 100644 --- a/app/src/main/res/layout/view_input_bar.xml +++ b/app/src/main/res/layout/view_input_bar.xml @@ -1,9 +1,11 @@ + android:orientation="vertical" + android:background="@color/input_bar_background">