forked from GitHub-Mirror/riotX-android
Code Review
This commit is contained in:
parent
cfca4927e2
commit
6bf1deb99b
@ -23,7 +23,7 @@ import im.vector.matrix.android.api.session.room.timeline.TimelineService
|
|||||||
import im.vector.matrix.android.internal.database.model.EventEntity
|
import im.vector.matrix.android.internal.database.model.EventEntity
|
||||||
import im.vector.matrix.android.internal.database.query.where
|
import im.vector.matrix.android.internal.database.query.where
|
||||||
import im.vector.matrix.android.internal.task.TaskExecutor
|
import im.vector.matrix.android.internal.task.TaskExecutor
|
||||||
import im.vector.matrix.android.internal.util.fetchMappedCopied
|
import im.vector.matrix.android.internal.util.fetchCopyMap
|
||||||
|
|
||||||
internal class DefaultTimelineService(private val roomId: String,
|
internal class DefaultTimelineService(private val roomId: String,
|
||||||
private val monarchy: Monarchy,
|
private val monarchy: Monarchy,
|
||||||
@ -38,7 +38,7 @@ internal class DefaultTimelineService(private val roomId: String,
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getTimeLineEvent(eventId: String): TimelineEvent? {
|
override fun getTimeLineEvent(eventId: String): TimelineEvent? {
|
||||||
return monarchy.fetchMappedCopied({
|
return monarchy.fetchCopyMap({
|
||||||
EventEntity.where(it, eventId = eventId).findFirst()
|
EventEntity.where(it, eventId = eventId).findFirst()
|
||||||
}, { entity, realm ->
|
}, { entity, realm ->
|
||||||
timelineEventFactory.create(entity, realm)
|
timelineEventFactory.create(entity, realm)
|
||||||
|
@ -42,7 +42,7 @@ fun <T : RealmModel> Monarchy.fetchCopied(query: (Realm) -> T?): T? {
|
|||||||
return fetch(query, true)
|
return fetch(query, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <U, T : RealmModel> Monarchy.fetchMappedCopied(query: (Realm) -> T?, map: (T, realm: Realm) -> U): U? {
|
fun <U, T : RealmModel> Monarchy.fetchCopyMap(query: (Realm) -> T?, map: (T, realm: Realm) -> U): U? {
|
||||||
val ref = AtomicReference<U?>()
|
val ref = AtomicReference<U?>()
|
||||||
doWithRealm { realm ->
|
doWithRealm { realm ->
|
||||||
val result = query.invoke(realm)?.let {
|
val result = query.invoke(realm)?.let {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package im.vector.riotredesign.core.utils
|
package im.vector.riotredesign.core.utils
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -8,7 +9,7 @@ import android.view.View
|
|||||||
* Safe to use in different views
|
* Safe to use in different views
|
||||||
*/
|
*/
|
||||||
class DebouncedClickListener(val original: View.OnClickListener, private val minimumInterval: Long = 400) : View.OnClickListener {
|
class DebouncedClickListener(val original: View.OnClickListener, private val minimumInterval: Long = 400) : View.OnClickListener {
|
||||||
private val lastClickMap = HashMap<View, Long>()
|
private val lastClickMap = WeakHashMap<View, Long>()
|
||||||
|
|
||||||
override fun onClick(clickedView: View) {
|
override fun onClick(clickedView: View) {
|
||||||
val previousClickTimestamp = lastClickMap[clickedView]
|
val previousClickTimestamp = lastClickMap[clickedView]
|
||||||
|
@ -133,7 +133,7 @@ class RoomDetailFragment :
|
|||||||
|
|
||||||
override fun getLayoutResId() = R.layout.fragment_room_detail
|
override fun getLayoutResId() = R.layout.fragment_room_detail
|
||||||
|
|
||||||
lateinit var actionViewModel: ActionsHandler
|
private lateinit var actionViewModel: ActionsHandler
|
||||||
|
|
||||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||||
super.onActivityCreated(savedInstanceState)
|
super.onActivityCreated(savedInstanceState)
|
||||||
@ -425,11 +425,11 @@ class RoomDetailFragment :
|
|||||||
vectorBaseActivity.notImplemented()
|
vectorBaseActivity.notImplemented()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEventCellClicked(eventId: String, informationData: MessageInformationData, messageContent: MessageContent, view: View) {
|
override fun onEventCellClicked(informationData: MessageInformationData, messageContent: MessageContent, view: View) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEventLongClicked(eventId: String, informationData: MessageInformationData, messageContent: MessageContent, view: View): Boolean {
|
override fun onEventLongClicked(informationData: MessageInformationData, messageContent: MessageContent, view: View): Boolean {
|
||||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
|
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
|
||||||
val roomId = (arguments?.get(MvRx.KEY_ARG) as? RoomDetailArgs)?.roomId
|
val roomId = (arguments?.get(MvRx.KEY_ARG) as? RoomDetailArgs)?.roomId
|
||||||
if (roomId.isNullOrBlank()) {
|
if (roomId.isNullOrBlank()) {
|
||||||
@ -437,7 +437,7 @@ class RoomDetailFragment :
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
MessageActionsBottomSheet
|
MessageActionsBottomSheet
|
||||||
.newInstance(eventId, roomId, informationData)
|
.newInstance(roomId, informationData)
|
||||||
.show(requireActivity().supportFragmentManager, "MESSAGE_CONTEXTUAL_ACTIONS")
|
.show(requireActivity().supportFragmentManager, "MESSAGE_CONTEXTUAL_ACTIONS")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -478,7 +478,7 @@ class RoomDetailFragment :
|
|||||||
|
|
||||||
override fun onSuccess(image: File?) {
|
override fun onSuccess(image: File?) {
|
||||||
if (image != null)
|
if (image != null)
|
||||||
shareMedia(requireContext(), image!!, "image/*")
|
shareMedia(requireContext(), image, "image/*")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFail(error: Exception?) {}
|
override fun onFail(error: Exception?) {}
|
||||||
|
@ -54,8 +54,8 @@ class TimelineEventController(private val dateFormatter: TimelineDateFormatter,
|
|||||||
fun onVideoMessageClicked(messageVideoContent: MessageVideoContent, mediaData: VideoContentRenderer.Data, view: View)
|
fun onVideoMessageClicked(messageVideoContent: MessageVideoContent, mediaData: VideoContentRenderer.Data, view: View)
|
||||||
fun onFileMessageClicked(messageFileContent: MessageFileContent)
|
fun onFileMessageClicked(messageFileContent: MessageFileContent)
|
||||||
fun onAudioMessageClicked(messageAudioContent: MessageAudioContent)
|
fun onAudioMessageClicked(messageAudioContent: MessageAudioContent)
|
||||||
fun onEventCellClicked(eventId: String, informationData: MessageInformationData, messageContent: MessageContent, view: View)
|
fun onEventCellClicked(informationData: MessageInformationData, messageContent: MessageContent, view: View)
|
||||||
fun onEventLongClicked(eventId: String, informationData: MessageInformationData, messageContent: MessageContent, view: View): Boolean
|
fun onEventLongClicked(informationData: MessageInformationData, messageContent: MessageContent, view: View): Boolean
|
||||||
fun onAvatarClicked(informationData: MessageInformationData)
|
fun onAvatarClicked(informationData: MessageInformationData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,10 +143,10 @@ class MessageActionsBottomSheet : BaseMvRxBottomSheetDialog() {
|
|||||||
) : Parcelable
|
) : Parcelable
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(eventId: String, roomId: String, informationData: MessageInformationData): MessageActionsBottomSheet {
|
fun newInstance(roomId: String, informationData: MessageInformationData): MessageActionsBottomSheet {
|
||||||
val args = Bundle()
|
val args = Bundle()
|
||||||
val parcelableArgs = ParcelableArgs(
|
val parcelableArgs = ParcelableArgs(
|
||||||
eventId,
|
informationData.eventId,
|
||||||
roomId,
|
roomId,
|
||||||
informationData
|
informationData
|
||||||
)
|
)
|
||||||
|
@ -39,16 +39,6 @@ class QuickReactionFragment : BaseMvRxFragment() {
|
|||||||
@BindView(R.id.root_layout)
|
@BindView(R.id.root_layout)
|
||||||
lateinit var rootLayout: ConstraintLayout
|
lateinit var rootLayout: ConstraintLayout
|
||||||
|
|
||||||
|
|
||||||
@BindView(R.id.quick_react_1)
|
|
||||||
lateinit var quickReact1: View
|
|
||||||
@BindView(R.id.quick_react_2)
|
|
||||||
lateinit var quickReact2: View
|
|
||||||
@BindView(R.id.quick_react_3)
|
|
||||||
lateinit var quickReact3: View
|
|
||||||
@BindView(R.id.quick_react_4)
|
|
||||||
lateinit var quickReact4: View
|
|
||||||
|
|
||||||
@BindView(R.id.quick_react_1_text)
|
@BindView(R.id.quick_react_1_text)
|
||||||
lateinit var quickReact1Text: TextView
|
lateinit var quickReact1Text: TextView
|
||||||
|
|
||||||
@ -78,16 +68,16 @@ class QuickReactionFragment : BaseMvRxFragment() {
|
|||||||
quickReact4Text.text = viewModel.likeNegative
|
quickReact4Text.text = viewModel.likeNegative
|
||||||
|
|
||||||
//configure click listeners
|
//configure click listeners
|
||||||
quickReact1.setOnClickListener {
|
quickReact1Text.setOnClickListener {
|
||||||
viewModel.toggleAgree(true)
|
viewModel.toggleAgree(true)
|
||||||
}
|
}
|
||||||
quickReact2.setOnClickListener {
|
quickReact2Text.setOnClickListener {
|
||||||
viewModel.toggleAgree(false)
|
viewModel.toggleAgree(false)
|
||||||
}
|
}
|
||||||
quickReact3.setOnClickListener {
|
quickReact3Text.setOnClickListener {
|
||||||
viewModel.toggleLike(true)
|
viewModel.toggleLike(true)
|
||||||
}
|
}
|
||||||
quickReact4.setOnClickListener {
|
quickReact4Text.setOnClickListener {
|
||||||
viewModel.toggleLike(false)
|
viewModel.toggleLike(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,32 +88,32 @@ class QuickReactionFragment : BaseMvRxFragment() {
|
|||||||
TransitionManager.beginDelayedTransition(rootLayout)
|
TransitionManager.beginDelayedTransition(rootLayout)
|
||||||
when (it.agreeTrigleState) {
|
when (it.agreeTrigleState) {
|
||||||
TriggleState.NONE -> {
|
TriggleState.NONE -> {
|
||||||
quickReact1.alpha = 1f
|
quickReact1Text.alpha = 1f
|
||||||
quickReact2.alpha = 1f
|
quickReact2Text.alpha = 1f
|
||||||
}
|
}
|
||||||
TriggleState.FIRST -> {
|
TriggleState.FIRST -> {
|
||||||
quickReact1.alpha = 1f
|
quickReact1Text.alpha = 1f
|
||||||
quickReact2.alpha = 0.2f
|
quickReact2Text.alpha = 0.2f
|
||||||
|
|
||||||
}
|
}
|
||||||
TriggleState.SECOND -> {
|
TriggleState.SECOND -> {
|
||||||
quickReact1.alpha = 0.2f
|
quickReact1Text.alpha = 0.2f
|
||||||
quickReact2.alpha = 1f
|
quickReact2Text.alpha = 1f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when (it.likeTriggleState) {
|
when (it.likeTriggleState) {
|
||||||
TriggleState.NONE -> {
|
TriggleState.NONE -> {
|
||||||
quickReact3.alpha = 1f
|
quickReact3Text.alpha = 1f
|
||||||
quickReact4.alpha = 1f
|
quickReact4Text.alpha = 1f
|
||||||
}
|
}
|
||||||
TriggleState.FIRST -> {
|
TriggleState.FIRST -> {
|
||||||
quickReact3.alpha = 1f
|
quickReact3Text.alpha = 1f
|
||||||
quickReact4.alpha = 0.2f
|
quickReact4Text.alpha = 0.2f
|
||||||
|
|
||||||
}
|
}
|
||||||
TriggleState.SECOND -> {
|
TriggleState.SECOND -> {
|
||||||
quickReact3.alpha = 0.2f
|
quickReact3Text.alpha = 0.2f
|
||||||
quickReact4.alpha = 1f
|
quickReact4Text.alpha = 1f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,19 +83,18 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
|
|||||||
// val all = event.root.toContent()
|
// val all = event.root.toContent()
|
||||||
// val ev = all.toModel<Event>()
|
// val ev = all.toModel<Event>()
|
||||||
return when (messageContent) {
|
return when (messageContent) {
|
||||||
is MessageEmoteContent -> buildEmoteMessageItem(eventId, messageContent, informationData, callback)
|
is MessageEmoteContent -> buildEmoteMessageItem(messageContent, informationData, callback)
|
||||||
is MessageTextContent -> buildTextMessageItem(eventId, event.sendState, messageContent, informationData, callback)
|
is MessageTextContent -> buildTextMessageItem(event.sendState, messageContent, informationData, callback)
|
||||||
is MessageImageContent -> buildImageMessageItem(eventId, messageContent, informationData, callback)
|
is MessageImageContent -> buildImageMessageItem(messageContent, informationData, callback)
|
||||||
is MessageNoticeContent -> buildNoticeMessageItem(eventId, messageContent, informationData, callback)
|
is MessageNoticeContent -> buildNoticeMessageItem(messageContent, informationData, callback)
|
||||||
is MessageVideoContent -> buildVideoMessageItem(eventId, messageContent, informationData, callback)
|
is MessageVideoContent -> buildVideoMessageItem(messageContent, informationData, callback)
|
||||||
is MessageFileContent -> buildFileMessageItem(eventId, messageContent, informationData, callback)
|
is MessageFileContent -> buildFileMessageItem(messageContent, informationData, callback)
|
||||||
is MessageAudioContent -> buildAudioMessageItem(eventId, messageContent, informationData, callback)
|
is MessageAudioContent -> buildAudioMessageItem(messageContent, informationData, callback)
|
||||||
else -> buildNotHandledMessageItem(messageContent)
|
else -> buildNotHandledMessageItem(messageContent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildAudioMessageItem(eventId: String, messageContent: MessageAudioContent,
|
private fun buildAudioMessageItem(messageContent: MessageAudioContent, informationData: MessageInformationData,
|
||||||
informationData: MessageInformationData,
|
|
||||||
callback: TimelineEventController.Callback?): MessageFileItem? {
|
callback: TimelineEventController.Callback?): MessageFileItem? {
|
||||||
return MessageFileItem_()
|
return MessageFileItem_()
|
||||||
.informationData(informationData)
|
.informationData(informationData)
|
||||||
@ -107,20 +106,19 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
|
|||||||
}))
|
}))
|
||||||
.cellClickListener(
|
.cellClickListener(
|
||||||
DebouncedClickListener(View.OnClickListener { view ->
|
DebouncedClickListener(View.OnClickListener { view ->
|
||||||
callback?.onEventCellClicked(eventId, informationData, messageContent, view)
|
callback?.onEventCellClicked(informationData, messageContent, view)
|
||||||
}))
|
}))
|
||||||
.clickListener(
|
.clickListener(
|
||||||
DebouncedClickListener(View.OnClickListener { _ ->
|
DebouncedClickListener(View.OnClickListener { _ ->
|
||||||
callback?.onAudioMessageClicked(messageContent)
|
callback?.onAudioMessageClicked(messageContent)
|
||||||
}))
|
}))
|
||||||
.longClickListener { view ->
|
.longClickListener { view ->
|
||||||
return@longClickListener callback?.onEventLongClicked(eventId, informationData, messageContent, view)
|
return@longClickListener callback?.onEventLongClicked(informationData, messageContent, view)
|
||||||
?: false
|
?: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildFileMessageItem(eventId: String, messageContent: MessageFileContent,
|
private fun buildFileMessageItem(messageContent: MessageFileContent, informationData: MessageInformationData,
|
||||||
informationData: MessageInformationData,
|
|
||||||
callback: TimelineEventController.Callback?): MessageFileItem? {
|
callback: TimelineEventController.Callback?): MessageFileItem? {
|
||||||
return MessageFileItem_()
|
return MessageFileItem_()
|
||||||
.informationData(informationData)
|
.informationData(informationData)
|
||||||
@ -132,16 +130,16 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
|
|||||||
}))
|
}))
|
||||||
.cellClickListener(
|
.cellClickListener(
|
||||||
DebouncedClickListener(View.OnClickListener { view ->
|
DebouncedClickListener(View.OnClickListener { view ->
|
||||||
callback?.onEventCellClicked(eventId, informationData, messageContent, view)
|
callback?.onEventCellClicked(informationData, messageContent, view)
|
||||||
}))
|
}))
|
||||||
|
.longClickListener { view ->
|
||||||
|
return@longClickListener callback?.onEventLongClicked(informationData, messageContent, view)
|
||||||
|
?: false
|
||||||
|
}
|
||||||
.clickListener(
|
.clickListener(
|
||||||
DebouncedClickListener(View.OnClickListener { _ ->
|
DebouncedClickListener(View.OnClickListener { _ ->
|
||||||
callback?.onFileMessageClicked(messageContent)
|
callback?.onFileMessageClicked(messageContent)
|
||||||
}))
|
}))
|
||||||
.longClickListener { view ->
|
|
||||||
return@longClickListener callback?.onEventLongClicked(eventId, informationData, messageContent, view)
|
|
||||||
?: false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildNotHandledMessageItem(messageContent: MessageContent): DefaultItem? {
|
private fun buildNotHandledMessageItem(messageContent: MessageContent): DefaultItem? {
|
||||||
@ -149,8 +147,7 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
|
|||||||
return DefaultItem_().text(text)
|
return DefaultItem_().text(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildImageMessageItem(eventId: String, messageContent: MessageImageContent,
|
private fun buildImageMessageItem(messageContent: MessageImageContent, informationData: MessageInformationData,
|
||||||
informationData: MessageInformationData,
|
|
||||||
callback: TimelineEventController.Callback?): MessageImageVideoItem? {
|
callback: TimelineEventController.Callback?): MessageImageVideoItem? {
|
||||||
|
|
||||||
val (maxWidth, maxHeight) = timelineMediaSizeProvider.getMaxSize()
|
val (maxWidth, maxHeight) = timelineMediaSizeProvider.getMaxSize()
|
||||||
@ -178,17 +175,16 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
|
|||||||
}))
|
}))
|
||||||
.cellClickListener(
|
.cellClickListener(
|
||||||
DebouncedClickListener(View.OnClickListener { view ->
|
DebouncedClickListener(View.OnClickListener { view ->
|
||||||
callback?.onEventCellClicked(eventId, informationData, messageContent, view)
|
callback?.onEventCellClicked(informationData, messageContent, view)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
.longClickListener { view ->
|
.longClickListener { view ->
|
||||||
return@longClickListener callback?.onEventLongClicked(eventId, informationData, messageContent, view)
|
return@longClickListener callback?.onEventLongClicked(informationData, messageContent, view)
|
||||||
?: false
|
?: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildVideoMessageItem(eventId: String, messageContent: MessageVideoContent,
|
private fun buildVideoMessageItem(messageContent: MessageVideoContent, informationData: MessageInformationData,
|
||||||
informationData: MessageInformationData,
|
|
||||||
callback: TimelineEventController.Callback?): MessageImageVideoItem? {
|
callback: TimelineEventController.Callback?): MessageImageVideoItem? {
|
||||||
|
|
||||||
val (maxWidth, maxHeight) = timelineMediaSizeProvider.getMaxSize()
|
val (maxWidth, maxHeight) = timelineMediaSizeProvider.getMaxSize()
|
||||||
@ -217,17 +213,16 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
|
|||||||
}))
|
}))
|
||||||
.cellClickListener(
|
.cellClickListener(
|
||||||
DebouncedClickListener(View.OnClickListener { view ->
|
DebouncedClickListener(View.OnClickListener { view ->
|
||||||
callback?.onEventCellClicked(eventId, informationData, messageContent, view)
|
callback?.onEventCellClicked(informationData, messageContent, view)
|
||||||
}))
|
}))
|
||||||
.clickListener { view -> callback?.onVideoMessageClicked(messageContent, videoData, view) }
|
.clickListener { view -> callback?.onVideoMessageClicked(messageContent, videoData, view) }
|
||||||
.longClickListener { view ->
|
.longClickListener { view ->
|
||||||
return@longClickListener callback?.onEventLongClicked(eventId, informationData, messageContent, view)
|
return@longClickListener callback?.onEventLongClicked(informationData, messageContent, view)
|
||||||
?: false
|
?: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildTextMessageItem(eventId: String, sendState: SendState,
|
private fun buildTextMessageItem(sendState: SendState, messageContent: MessageTextContent,
|
||||||
messageContent: MessageTextContent,
|
|
||||||
informationData: MessageInformationData,
|
informationData: MessageInformationData,
|
||||||
callback: TimelineEventController.Callback?): MessageTextItem? {
|
callback: TimelineEventController.Callback?): MessageTextItem? {
|
||||||
|
|
||||||
@ -246,20 +241,19 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
|
|||||||
//click on the text
|
//click on the text
|
||||||
.clickListener(
|
.clickListener(
|
||||||
DebouncedClickListener(View.OnClickListener { view ->
|
DebouncedClickListener(View.OnClickListener { view ->
|
||||||
callback?.onEventCellClicked(eventId, informationData, messageContent, view)
|
callback?.onEventCellClicked(informationData, messageContent, view)
|
||||||
}))
|
}))
|
||||||
.cellClickListener(
|
.cellClickListener(
|
||||||
DebouncedClickListener(View.OnClickListener { view ->
|
DebouncedClickListener(View.OnClickListener { view ->
|
||||||
callback?.onEventCellClicked(eventId, informationData, messageContent, view)
|
callback?.onEventCellClicked(informationData, messageContent, view)
|
||||||
}))
|
}))
|
||||||
.longClickListener { view ->
|
.longClickListener { view ->
|
||||||
return@longClickListener callback?.onEventLongClicked(eventId, informationData, messageContent, view)
|
return@longClickListener callback?.onEventLongClicked(informationData, messageContent, view)
|
||||||
?: false
|
?: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildNoticeMessageItem(eventId: String, messageContent: MessageNoticeContent,
|
private fun buildNoticeMessageItem(messageContent: MessageNoticeContent, informationData: MessageInformationData,
|
||||||
informationData: MessageInformationData,
|
|
||||||
callback: TimelineEventController.Callback?): MessageTextItem? {
|
callback: TimelineEventController.Callback?): MessageTextItem? {
|
||||||
|
|
||||||
val message = messageContent.body.let {
|
val message = messageContent.body.let {
|
||||||
@ -279,16 +273,15 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
|
|||||||
}))
|
}))
|
||||||
.cellClickListener(
|
.cellClickListener(
|
||||||
DebouncedClickListener(View.OnClickListener { view ->
|
DebouncedClickListener(View.OnClickListener { view ->
|
||||||
callback?.onEventCellClicked(eventId, informationData, messageContent, view)
|
callback?.onEventCellClicked(informationData, messageContent, view)
|
||||||
}))
|
}))
|
||||||
.longClickListener { view ->
|
.longClickListener { view ->
|
||||||
return@longClickListener callback?.onEventLongClicked(eventId, informationData, messageContent, view)
|
return@longClickListener callback?.onEventLongClicked(informationData, messageContent, view)
|
||||||
?: false
|
?: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildEmoteMessageItem(eventId: String, messageContent: MessageEmoteContent,
|
private fun buildEmoteMessageItem(messageContent: MessageEmoteContent, informationData: MessageInformationData,
|
||||||
informationData: MessageInformationData,
|
|
||||||
callback: TimelineEventController.Callback?): MessageTextItem? {
|
callback: TimelineEventController.Callback?): MessageTextItem? {
|
||||||
|
|
||||||
val message = messageContent.body.let {
|
val message = messageContent.body.let {
|
||||||
@ -304,10 +297,10 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
|
|||||||
}))
|
}))
|
||||||
.cellClickListener(
|
.cellClickListener(
|
||||||
DebouncedClickListener(View.OnClickListener { view ->
|
DebouncedClickListener(View.OnClickListener { view ->
|
||||||
callback?.onEventCellClicked(eventId, informationData, messageContent, view)
|
callback?.onEventCellClicked(informationData, messageContent, view)
|
||||||
}))
|
}))
|
||||||
.longClickListener { view ->
|
.longClickListener { view ->
|
||||||
return@longClickListener callback?.onEventLongClicked(eventId, informationData, messageContent, view)
|
return@longClickListener callback?.onEventLongClicked(informationData, messageContent, view)
|
||||||
?: false
|
?: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,5 @@ data class MessageInformationData(
|
|||||||
val time: CharSequence? = null,
|
val time: CharSequence? = null,
|
||||||
val avatarUrl: String?,
|
val avatarUrl: String?,
|
||||||
val memberName: CharSequence? = null,
|
val memberName: CharSequence? = null,
|
||||||
val userId: String? = null,
|
|
||||||
val showInformation: Boolean = true
|
val showInformation: Boolean = true
|
||||||
) : Parcelable
|
) : Parcelable
|
@ -2,39 +2,31 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:id="@+id/root_layout"
|
android:id="@+id/root_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="96dp">
|
android:layout_height="96dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
<RelativeLayout
|
android:id="@+id/quick_react_1_text"
|
||||||
android:id="@+id/quick_react_1"
|
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_marginEnd="4dp"
|
android:layout_marginEnd="4dp"
|
||||||
android:layout_marginRight="4dp"
|
android:layout_marginRight="4dp"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
|
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
|
android:textSize="30sp"
|
||||||
|
app:autoSizeTextType="uniform"
|
||||||
app:layout_constraintBottom_toTopOf="@id/quick_react_agree_text"
|
app:layout_constraintBottom_toTopOf="@id/quick_react_agree_text"
|
||||||
app:layout_constraintEnd_toStartOf="@id/quick_react_2"
|
app:layout_constraintEnd_toStartOf="@id/quick_react_2_text"
|
||||||
app:layout_constraintHorizontal_chainStyle="packed"
|
app:layout_constraintHorizontal_chainStyle="packed"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintVertical_chainStyle="packed">
|
app:layout_constraintVertical_chainStyle="packed"
|
||||||
|
tools:text="👍" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/quick_react_1_text"
|
android:id="@+id/quick_react_2_text"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:textSize="30sp"
|
|
||||||
tools:text="👍" />
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/quick_react_2"
|
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_marginStart="4dp"
|
android:layout_marginStart="4dp"
|
||||||
@ -42,21 +34,15 @@
|
|||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/quick_react_1"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/center_guideline"
|
|
||||||
|
|
||||||
app:layout_constraintStart_toEndOf="@id/quick_react_1"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/quick_react_1">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/quick_react_2_text"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:textSize="30sp"
|
android:textSize="30sp"
|
||||||
|
app:autoSizeTextType="uniform"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/quick_react_1_text"
|
||||||
|
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/center_guideline"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/quick_react_1_text"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/quick_react_1_text"
|
||||||
tools:text="👎" />
|
tools:text="👎" />
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/quick_react_agree_text"
|
android:id="@+id/quick_react_agree_text"
|
||||||
@ -69,7 +55,7 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@id/center_guideline"
|
app:layout_constraintEnd_toStartOf="@id/center_guideline"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/quick_react_1" />
|
app:layout_constraintTop_toBottomOf="@id/quick_react_1_text" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Guideline
|
<androidx.constraintlayout.widget.Guideline
|
||||||
android:id="@+id/center_guideline"
|
android:id="@+id/center_guideline"
|
||||||
@ -78,8 +64,8 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintGuide_percent="0.5" />
|
app:layout_constraintGuide_percent="0.5" />
|
||||||
|
|
||||||
<RelativeLayout
|
<TextView
|
||||||
android:id="@+id/quick_react_3"
|
android:id="@+id/quick_react_3_text"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_marginEnd="4dp"
|
android:layout_marginEnd="4dp"
|
||||||
@ -87,23 +73,17 @@
|
|||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/quick_react_1"
|
android:textSize="30sp"
|
||||||
app:layout_constraintEnd_toStartOf="@id/quick_react_4"
|
app:autoSizeTextType="uniform"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/quick_react_1_text"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/quick_react_4_text"
|
||||||
app:layout_constraintHorizontal_chainStyle="packed"
|
app:layout_constraintHorizontal_chainStyle="packed"
|
||||||
app:layout_constraintStart_toEndOf="@id/center_guideline"
|
app:layout_constraintStart_toEndOf="@id/center_guideline"
|
||||||
app:layout_constraintTop_toTopOf="@id/quick_react_1">
|
app:layout_constraintTop_toTopOf="@id/quick_react_1_text"
|
||||||
|
tools:text="😀" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/quick_react_3_text"
|
android:id="@+id/quick_react_4_text"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:textSize="30sp"
|
|
||||||
tools:text="😀" />
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/quick_react_4"
|
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_marginStart="4dp"
|
android:layout_marginStart="4dp"
|
||||||
@ -111,20 +91,13 @@
|
|||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/quick_react_3"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/quick_react_3"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/quick_react_3">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/quick_react_4_text"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:textSize="30sp"
|
android:textSize="30sp"
|
||||||
|
app:autoSizeTextType="uniform"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/quick_react_3_text"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/quick_react_3_text"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/quick_react_3_text"
|
||||||
tools:text="😞" />
|
tools:text="😞" />
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/quick_react_like_text"
|
android:id="@+id/quick_react_like_text"
|
||||||
|
@ -1402,10 +1402,4 @@ Why choose Riot.im?
|
|||||||
<string name="autodiscover_well_known_autofill_dialog_message">Riot detected a custom server configuration for your userId domain \"%s\":\n%s</string>
|
<string name="autodiscover_well_known_autofill_dialog_message">Riot detected a custom server configuration for your userId domain \"%s\":\n%s</string>
|
||||||
<string name="autodiscover_well_known_autofill_confirm">Use Config</string>
|
<string name="autodiscover_well_known_autofill_confirm">Use Config</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="title_activity_emoji_reaction_picker">Reactions</string>
|
|
||||||
<string name="reactions_agree">Agree</string>
|
|
||||||
<string name="reactions_like">Like</string>
|
|
||||||
<string name="message_add_reaction">Add Reaction</string>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -5,4 +5,10 @@
|
|||||||
<string name="global_retry">"Retry"</string>
|
<string name="global_retry">"Retry"</string>
|
||||||
<string name="room_list_empty">"Join a room to start using the app."</string>
|
<string name="room_list_empty">"Join a room to start using the app."</string>
|
||||||
|
|
||||||
|
|
||||||
|
<string name="title_activity_emoji_reaction_picker">Reactions</string>
|
||||||
|
<string name="reactions_agree">Agree</string>
|
||||||
|
<string name="reactions_like">Like</string>
|
||||||
|
<string name="message_add_reaction">Add Reaction</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue
Block a user