-
-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: rapterjet2004 <[email protected]>
- Loading branch information
1 parent
c6d5d7b
commit 1c55439
Showing
4 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
app/src/main/java/com/nextcloud/talk/adapters/messages/TemporaryMessageViewHolder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Nextcloud Talk - Android Client | ||
* | ||
* SPDX-FileCopyrightText: 2024 Your Name <[email protected]> | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
package com.nextcloud.talk.adapters.messages | ||
|
||
import android.view.View | ||
import androidx.core.content.res.ResourcesCompat | ||
import androidx.core.view.ViewCompat | ||
import autodagger.AutoInjector | ||
import com.nextcloud.talk.R | ||
import com.nextcloud.talk.application.NextcloudTalkApplication | ||
import com.nextcloud.talk.chat.data.model.ChatMessage | ||
import com.nextcloud.talk.databinding.ItemTemporaryMessageBinding | ||
import com.nextcloud.talk.ui.theme.ViewThemeUtils | ||
import com.nextcloud.talk.utils.DisplayUtils | ||
import com.stfalcon.chatkit.messages.MessagesListAdapter | ||
import javax.inject.Inject | ||
|
||
@AutoInjector(NextcloudTalkApplication::class) | ||
class TemporaryMessageViewHolder(outgoingView: View, payload: Any) : | ||
MessagesListAdapter.OutcomingMessageViewHolder<ChatMessage>(outgoingView) { | ||
|
||
private val binding: ItemTemporaryMessageBinding = ItemTemporaryMessageBinding.bind(outgoingView) | ||
|
||
@Inject | ||
lateinit var viewThemeUtils: ViewThemeUtils | ||
|
||
override fun onBind(message: ChatMessage?) { | ||
super.onBind(message) | ||
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this) | ||
|
||
val bgBubbleColor = bubble.resources.getColor(R.color.bg_message_list_incoming_bubble, null) | ||
val layout = R.drawable.shape_outcoming_message | ||
val bubbleDrawable = DisplayUtils.getMessageSelector( | ||
bgBubbleColor, | ||
ResourcesCompat.getColor(bubble.resources, R.color.transparent, null), | ||
bgBubbleColor, | ||
layout | ||
) | ||
ViewCompat.setBackground(bubble, bubbleDrawable) | ||
|
||
} | ||
|
||
override fun viewDetached() { | ||
// unused atm | ||
} | ||
|
||
override fun viewAttached() { | ||
// unused atm | ||
} | ||
|
||
override fun viewRecycled() { | ||
// unused atm | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
~ Nextcloud Talk - Android Client | ||
~ | ||
~ SPDX-FileCopyrightText: 2023 Julius Linus <[email protected]> | ||
~ SPDX-License-Identifier: GPL-3.0-or-later | ||
--> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginLeft="16dp" | ||
android:layout_marginTop="2dp" | ||
android:layout_marginRight="16dp" | ||
android:layout_marginBottom="2dp"> | ||
|
||
<com.google.android.flexbox.FlexboxLayout | ||
android:id="@id/bubble" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentEnd="true" | ||
android:layout_marginStart="@dimen/message_outcoming_bubble_margin_left" | ||
app:alignContent="stretch" | ||
app:alignItems="stretch" | ||
app:flexWrap="wrap" | ||
app:justifyContent="flex_end"> | ||
|
||
<include | ||
android:id="@+id/message_quote" | ||
layout="@layout/item_message_quote" | ||
android:visibility="gone" | ||
tools:visibility="visible"/> | ||
|
||
<androidx.emoji2.widget.EmojiTextView | ||
android:id="@id/messageText" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:lineSpacingMultiplier="1.2" | ||
android:textAlignment="viewStart" | ||
android:textColorHighlight="@color/nc_grey" | ||
android:textIsSelectable="false" | ||
tools:text="Talk to you later!" /> | ||
|
||
|
||
</com.google.android.flexbox.FlexboxLayout> | ||
</RelativeLayout> |