mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-20 11:15:02 +01:00
added ui
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
parent
498a1274d9
commit
fb9a7b8e04
@ -535,6 +535,16 @@ class ChatActivity :
|
|||||||
private fun initObservers() {
|
private fun initObservers() {
|
||||||
Log.d(TAG, "initObservers Called")
|
Log.d(TAG, "initObservers Called")
|
||||||
|
|
||||||
|
messageInputViewModel.messageQueueFlow.observe(this) { message ->
|
||||||
|
// TODO shouldn't be able save state
|
||||||
|
val temporaryChatMessage = ChatMessage()
|
||||||
|
temporaryChatMessage.jsonMessageId = -3
|
||||||
|
temporaryChatMessage.actorId = "-3"
|
||||||
|
temporaryChatMessage.timestamp = (adapter?.items?.get(0)?.item as ChatMessage).timestamp
|
||||||
|
temporaryChatMessage.message = message
|
||||||
|
adapter?.addToStart(temporaryChatMessage, true)
|
||||||
|
}
|
||||||
|
|
||||||
this.lifecycleScope.launch {
|
this.lifecycleScope.launch {
|
||||||
chatViewModel.getConversationFlow
|
chatViewModel.getConversationFlow
|
||||||
.onEach { conversationModel ->
|
.onEach { conversationModel ->
|
||||||
|
@ -124,6 +124,10 @@ class MessageInputViewModel @Inject constructor(
|
|||||||
val messageQueueSizeFlow: LiveData<Int>
|
val messageQueueSizeFlow: LiveData<Int>
|
||||||
get() = _messageQueueSizeFlow.asLiveData()
|
get() = _messageQueueSizeFlow.asLiveData()
|
||||||
|
|
||||||
|
private val _messageQueueFlow: MutableLiveData<String> = MutableLiveData()
|
||||||
|
val messageQueueFlow: LiveData<String>
|
||||||
|
get() = _messageQueueFlow
|
||||||
|
|
||||||
@Suppress("LongParameterList")
|
@Suppress("LongParameterList")
|
||||||
fun sendChatMessage(
|
fun sendChatMessage(
|
||||||
roomToken: String,
|
roomToken: String,
|
||||||
@ -138,6 +142,7 @@ class MessageInputViewModel @Inject constructor(
|
|||||||
messageQueue.add(QueuedMessage(message, displayName, replyTo, sendWithoutNotification))
|
messageQueue.add(QueuedMessage(message, displayName, replyTo, sendWithoutNotification))
|
||||||
dataStore.saveMessageQueue(roomToken, messageQueue)
|
dataStore.saveMessageQueue(roomToken, messageQueue)
|
||||||
_messageQueueSizeFlow.update { messageQueue.size }
|
_messageQueueSizeFlow.update { messageQueue.size }
|
||||||
|
_messageQueueFlow.postValue(message.toString())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,6 +279,6 @@ class MessageInputViewModel @Inject constructor(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val TAG = MessageInputViewModel::class.java.simpleName
|
private val TAG = MessageInputViewModel::class.java.simpleName
|
||||||
private const val DELAY_BETWEEN_QUEUED_MESSAGES: Long = 100
|
private const val DELAY_BETWEEN_QUEUED_MESSAGES: Long = 500
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,14 @@
|
|||||||
android:layout_marginRight="16dp"
|
android:layout_marginRight="16dp"
|
||||||
android:layout_marginBottom="2dp">
|
android:layout_marginBottom="2dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_signal_wifi_off_white_24dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginLeft="@dimen/standard_margin"
|
||||||
|
app:tint="@color/hwSecurityRed" />
|
||||||
|
|
||||||
<com.google.android.flexbox.FlexboxLayout
|
<com.google.android.flexbox.FlexboxLayout
|
||||||
android:id="@id/bubble"
|
android:id="@id/bubble"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
Loading…
Reference in New Issue
Block a user