mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-21 12:35:30 +03:00
git
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
parent
4705469f5f
commit
498a1274d9
4 changed files with 124 additions and 0 deletions
|
@ -3,15 +3,19 @@
|
||||||
<option name="myName" value="ktlint" />
|
<option name="myName" value="ktlint" />
|
||||||
<inspection_tool class="ComposePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
<inspection_tool class="ComposePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
<option name="composableFile" value="true" />
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="ComposePreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
|
<inspection_tool class="ComposePreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
<option name="composableFile" value="true" />
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="ComposePreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
<inspection_tool class="ComposePreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
<option name="composableFile" value="true" />
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="ComposePreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
|
<inspection_tool class="ComposePreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
<option name="composableFile" value="true" />
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="GlancePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
<inspection_tool class="GlancePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
<option name="composableFile" value="true" />
|
<option name="composableFile" value="true" />
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Nextcloud Talk - Android Client
|
||||||
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2024 Your Name <your@email.com>
|
||||||
|
* 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
|
||||||
|
}
|
||||||
|
}
|
|
@ -101,6 +101,7 @@ import com.nextcloud.talk.adapters.messages.PreviewMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.SystemMessageInterface
|
import com.nextcloud.talk.adapters.messages.SystemMessageInterface
|
||||||
import com.nextcloud.talk.adapters.messages.SystemMessageViewHolder
|
import com.nextcloud.talk.adapters.messages.SystemMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.TalkMessagesListAdapter
|
import com.nextcloud.talk.adapters.messages.TalkMessagesListAdapter
|
||||||
|
import com.nextcloud.talk.adapters.messages.TemporaryMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.UnreadNoticeMessageViewHolder
|
import com.nextcloud.talk.adapters.messages.UnreadNoticeMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.VoiceMessageInterface
|
import com.nextcloud.talk.adapters.messages.VoiceMessageInterface
|
||||||
import com.nextcloud.talk.api.NcApi
|
import com.nextcloud.talk.api.NcApi
|
||||||
|
@ -1185,6 +1186,17 @@ class ChatActivity :
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
|
|
||||||
|
messageHolders.registerContentType(
|
||||||
|
CONTENT_TYPE_TEMP,
|
||||||
|
TemporaryMessageViewHolder::class.java,
|
||||||
|
payload,
|
||||||
|
R.layout.item_temporary_message,
|
||||||
|
TemporaryMessageViewHolder::class.java,
|
||||||
|
payload,
|
||||||
|
R.layout.item_temporary_message,
|
||||||
|
this
|
||||||
|
)
|
||||||
|
|
||||||
messageHolders.registerContentType(
|
messageHolders.registerContentType(
|
||||||
CONTENT_TYPE_SYSTEM_MESSAGE,
|
CONTENT_TYPE_SYSTEM_MESSAGE,
|
||||||
SystemMessageViewHolder::class.java,
|
SystemMessageViewHolder::class.java,
|
||||||
|
@ -3467,6 +3479,7 @@ class ChatActivity :
|
||||||
CONTENT_TYPE_SYSTEM_MESSAGE -> !TextUtils.isEmpty(message.systemMessage)
|
CONTENT_TYPE_SYSTEM_MESSAGE -> !TextUtils.isEmpty(message.systemMessage)
|
||||||
CONTENT_TYPE_UNREAD_NOTICE_MESSAGE -> message.id == "-1"
|
CONTENT_TYPE_UNREAD_NOTICE_MESSAGE -> message.id == "-1"
|
||||||
CONTENT_TYPE_CALL_STARTED -> message.id == "-2"
|
CONTENT_TYPE_CALL_STARTED -> message.id == "-2"
|
||||||
|
CONTENT_TYPE_TEMP -> message.id == "-3"
|
||||||
|
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
|
@ -3647,6 +3660,7 @@ class ChatActivity :
|
||||||
private const val CONTENT_TYPE_VOICE_MESSAGE: Byte = 5
|
private const val CONTENT_TYPE_VOICE_MESSAGE: Byte = 5
|
||||||
private const val CONTENT_TYPE_POLL: Byte = 6
|
private const val CONTENT_TYPE_POLL: Byte = 6
|
||||||
private const val CONTENT_TYPE_LINK_PREVIEW: Byte = 7
|
private const val CONTENT_TYPE_LINK_PREVIEW: Byte = 7
|
||||||
|
private const val CONTENT_TYPE_TEMP: Byte = 8
|
||||||
private const val NEW_MESSAGES_POPUP_BUBBLE_DELAY: Long = 200
|
private const val NEW_MESSAGES_POPUP_BUBBLE_DELAY: Long = 200
|
||||||
private const val GET_ROOM_INFO_DELAY_NORMAL: Long = 30000
|
private const val GET_ROOM_INFO_DELAY_NORMAL: Long = 30000
|
||||||
private const val GET_ROOM_INFO_DELAY_LOBBY: Long = 5000
|
private const val GET_ROOM_INFO_DELAY_LOBBY: Long = 5000
|
||||||
|
|
47
app/src/main/res/layout/item_temporary_message.xml
Normal file
47
app/src/main/res/layout/item_temporary_message.xml
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Nextcloud Talk - Android Client
|
||||||
|
~
|
||||||
|
~ SPDX-FileCopyrightText: 2023 Julius Linus <juliuslinus1@gmail.com>
|
||||||
|
~ 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>
|
Loading…
Reference in a new issue