Backport #1033 Right-align text block of own DM's

This commit is contained in:
Michel Roux 2020-04-21 12:53:52 +02:00
parent b022c55239
commit 5a2727b823
4 changed files with 39 additions and 25 deletions

View File

@ -86,6 +86,7 @@ subprojects {
AbstractTask : '0.9.5',
Dagger : '2.11',
StethoBeanShellREPL : '0.1',
MessageBubbleView : '3.5',
]
}

View File

@ -21,7 +21,7 @@ buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:${kotlinVersion}"
classpath 'com.github.mariotaku:imgenie-plugin:0.2.5'
classpath 'com.github.mariotaku:imgenie-plugin:0.2.6'
if (enableGoogleVariant) {
// START Non-FOSS component
@ -226,7 +226,7 @@ dependencies {
implementation 'com.commonsware.cwac:layouts:0.4.3'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.pnikosis:materialish-progress:1.7'
implementation 'com.github.mariotaku:MessageBubbleView:1.6'
implementation "com.github.mariotaku:MessageBubbleView:${libVersions['MessageBubbleView']}"
implementation 'com.github.mariotaku:DragSortListView:0.6.1'
implementation 'com.github.uucky:ColorPicker-Android:0.9.7@aar'
implementation "pl.droidsonroids.gif:android-gif-drawable:${libVersions['AndroidGIFDrawable']}"

View File

@ -72,7 +72,10 @@ class MessageViewHolder(itemView: View, adapter: MessagesConversationAdapter) :
}
messageBubble.setOutgoing(message.is_outgoing)
text.setTextColor(ThemeUtils.getColorDependent(messageBubble.bubbleColor.defaultColor))
val bubbleColor = messageBubble.bubbleColor
if (bubbleColor != null) {
text.setTextColor(ThemeUtils.getColorDependent(bubbleColor.defaultColor))
}
// Loop through text and spans to found non-space char count
val hideText = run {
@ -128,7 +131,11 @@ class MessageViewHolder(itemView: View, adapter: MessagesConversationAdapter) :
const val layoutResource = R.layout.list_item_message_conversation_text
fun MessageBubbleView.setOutgoing(outgoing: Boolean) {
setCaretPosition(if (outgoing) MessageBubbleView.TOP_END else MessageBubbleView.BOTTOM_START)
caretPosition = if (outgoing) {
MessageBubbleView.TOP or MessageBubbleView.END
} else {
MessageBubbleView.BOTTOM or MessageBubbleView.START
}
}
}
}

View File

@ -62,35 +62,41 @@
app:caretHeight="@dimen/element_spacing_normal"
app:caretPosition="bottomStart"
app:caretWidth="@dimen/element_spacing_normal"
app:cornerRadius="2dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/mediaPreview"
android:padding="@dimen/element_spacing_normal">
app:cornerRadius="2dp"
app:wrapContentMaxWidthPercent="85%p">
<org.mariotaku.twidere.view.CardMediaContainer
android:id="@+id/mediaPreview"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/element_spacing_normal"
android:visibility="gone">
android:layout_marginLeft="@dimen/element_spacing_normal"
android:layout_marginRight="@dimen/element_spacing_normal"
android:layout_marginTop="@dimen/element_spacing_normal"
android:visibility="gone"
tools:visibility="visible">
<include layout="@layout/layout_card_media_preview"/>
</org.mariotaku.twidere.view.CardMediaContainer>
<android.widget.Space
android:id="@+id/mediaTextSpace"
android:layout_width="wrap_content"
android:layout_height="@dimen/element_spacing_normal"
android:layout_below="@+id/mediaPreview"/>
<org.mariotaku.twidere.view.TimelineContentTextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/mediaPreview"
android:layout_below="@+id/mediaTextSpace"
android:layout_marginBottom="@dimen/element_spacing_normal"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:layout_marginRight="@dimen/element_spacing_normal"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
tools:text="@string/sample_status_text"/>
</RelativeLayout>
</org.mariotaku.messagebubbleview.library.MessageBubbleView>
<org.mariotaku.twidere.view.FixedTextView