mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-23 00:17:34 +00:00
Fix message clipping
This commit is contained in:
parent
1bb3939930
commit
fc8a92998c
@ -9,9 +9,11 @@ import android.graphics.drawable.ColorDrawable
|
|||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
|
import android.view.Gravity
|
||||||
import android.view.HapticFeedbackConstants
|
import android.view.HapticFeedbackConstants
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.widget.FrameLayout
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.annotation.ColorInt
|
import androidx.annotation.ColorInt
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
@ -114,6 +116,7 @@ class VisibleMessageView : LinearLayout {
|
|||||||
binding.root.disableClipping()
|
binding.root.disableClipping()
|
||||||
binding.mainContainer.disableClipping()
|
binding.mainContainer.disableClipping()
|
||||||
binding.messageInnerContainer.disableClipping()
|
binding.messageInnerContainer.disableClipping()
|
||||||
|
binding.messageInnerLayout.disableClipping()
|
||||||
binding.messageContentView.root.disableClipping()
|
binding.messageContentView.root.disableClipping()
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
@ -342,11 +345,14 @@ class VisibleMessageView : LinearLayout {
|
|||||||
|
|
||||||
private fun updateExpirationTimer(message: MessageRecord) {
|
private fun updateExpirationTimer(message: MessageRecord) {
|
||||||
val container = binding.messageInnerContainer
|
val container = binding.messageInnerContainer
|
||||||
val content = binding.messageContentView.root
|
val layout = binding.messageInnerLayout
|
||||||
val expiration = binding.expirationTimerView
|
|
||||||
container.removeAllViewsInLayout()
|
if (message.isOutgoing) binding.messageContentView.root.bringToFront()
|
||||||
container.addView(if (message.isOutgoing) expiration else content)
|
else binding.expirationTimerView.bringToFront()
|
||||||
container.addView(if (message.isOutgoing) content else expiration)
|
|
||||||
|
layout.layoutParams = layout.layoutParams.let { it as FrameLayout.LayoutParams }
|
||||||
|
.apply { gravity = if (message.isOutgoing) Gravity.END else Gravity.START }
|
||||||
|
|
||||||
val containerParams = container.layoutParams as ConstraintLayout.LayoutParams
|
val containerParams = container.layoutParams as ConstraintLayout.LayoutParams
|
||||||
containerParams.horizontalBias = if (message.isOutgoing) 1f else 0f
|
containerParams.horizontalBias = if (message.isOutgoing) 1f else 0f
|
||||||
container.layoutParams = containerParams
|
container.layoutParams = containerParams
|
||||||
|
@ -107,21 +107,25 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="@tools:sample/full_names" />
|
tools:text="@tools:sample/full_names" />
|
||||||
|
|
||||||
<LinearLayout
|
<FrameLayout
|
||||||
android:id="@+id/messageInnerContainer"
|
android:id="@+id/messageInnerContainer"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/profilePictureView"
|
app:layout_constraintBottom_toBottomOf="@+id/profilePictureView"
|
||||||
app:layout_constraintStart_toEndOf="@+id/profilePictureView"
|
app:layout_constraintStart_toEndOf="@+id/profilePictureView"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/senderNameTextView">
|
app:layout_constraintTop_toBottomOf="@+id/senderNameTextView">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/messageInnerLayout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<include layout="@layout/view_visible_message_content"
|
<include layout="@layout/view_visible_message_content"
|
||||||
android:id="@+id/messageContentView"
|
android:id="@+id/messageContentView"
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content" />
|
||||||
android:layout_weight="1"/>
|
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.conversation.v2.components.ExpirationTimerView
|
<org.thoughtcrime.securesms.conversation.v2.components.ExpirationTimerView
|
||||||
android:id="@+id/expirationTimerView"
|
android:id="@+id/expirationTimerView"
|
||||||
@ -136,6 +140,7 @@
|
|||||||
tools:tint="@color/black"/>
|
tools:tint="@color/black"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<include layout="@layout/view_emoji_reactions"
|
<include layout="@layout/view_emoji_reactions"
|
||||||
android:id="@+id/emojiReactionsView"
|
android:id="@+id/emojiReactionsView"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user