mirror of
https://github.com/element-hq/element-android
synced 2024-11-25 10:55:38 +03:00
Merge pull request #1079 from vector-im/feature/ftue
FTUE: do not display a different color when encrypting message when not in developer mode.
This commit is contained in:
commit
cde068f267
11 changed files with 84 additions and 64 deletions
|
@ -6,6 +6,7 @@ Features ✨:
|
||||||
|
|
||||||
Improvements 🙌:
|
Improvements 🙌:
|
||||||
- Add support for `/plain` command (#12)
|
- Add support for `/plain` command (#12)
|
||||||
|
- FTUE: do not display a different color when encrypting message when not in developer mode.
|
||||||
|
|
||||||
Bugfix 🐛:
|
Bugfix 🐛:
|
||||||
- Fix crash on attachment preview screen (#1088)
|
- Fix crash on attachment preview screen (#1088)
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package im.vector.riotx.features.home.room.detail.timeline
|
||||||
|
|
||||||
|
import androidx.annotation.ColorInt
|
||||||
|
import im.vector.matrix.android.api.session.room.send.SendState
|
||||||
|
import im.vector.riotx.R
|
||||||
|
import im.vector.riotx.core.resources.ColorProvider
|
||||||
|
import im.vector.riotx.features.settings.VectorPreferences
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class MessageColorProvider @Inject constructor(
|
||||||
|
private val colorProvider: ColorProvider,
|
||||||
|
private val vectorPreferences: VectorPreferences) {
|
||||||
|
|
||||||
|
@ColorInt
|
||||||
|
fun getMessageTextColor(sendState: SendState): Int {
|
||||||
|
return if (vectorPreferences.developerMode()) {
|
||||||
|
when (sendState) {
|
||||||
|
// SendStates, in the classical order they will occur
|
||||||
|
SendState.UNKNOWN,
|
||||||
|
SendState.UNSENT -> colorProvider.getColorFromAttribute(R.attr.vctr_sending_message_text_color)
|
||||||
|
SendState.ENCRYPTING -> colorProvider.getColorFromAttribute(R.attr.vctr_encrypting_message_text_color)
|
||||||
|
SendState.SENDING -> colorProvider.getColorFromAttribute(R.attr.vctr_sending_message_text_color)
|
||||||
|
SendState.SENT,
|
||||||
|
SendState.SYNCED -> colorProvider.getColorFromAttribute(R.attr.vctr_message_text_color)
|
||||||
|
SendState.UNDELIVERED,
|
||||||
|
SendState.FAILED_UNKNOWN_DEVICES -> colorProvider.getColorFromAttribute(R.attr.vctr_unsent_message_text_color)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// When not in developer mode, we do not use special color for the encrypting state
|
||||||
|
when (sendState) {
|
||||||
|
SendState.UNKNOWN,
|
||||||
|
SendState.UNSENT,
|
||||||
|
SendState.ENCRYPTING,
|
||||||
|
SendState.SENDING -> colorProvider.getColorFromAttribute(R.attr.vctr_sending_message_text_color)
|
||||||
|
SendState.SENT,
|
||||||
|
SendState.SYNCED -> colorProvider.getColorFromAttribute(R.attr.vctr_message_text_color)
|
||||||
|
SendState.UNDELIVERED,
|
||||||
|
SendState.FAILED_UNKNOWN_DEVICES -> colorProvider.getColorFromAttribute(R.attr.vctr_unsent_message_text_color)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -222,7 +222,7 @@ class MessageItemFactory @Inject constructor(
|
||||||
referenceId = informationData.eventId,
|
referenceId = informationData.eventId,
|
||||||
informationData = informationData,
|
informationData = informationData,
|
||||||
avatarRenderer = attributes.avatarRenderer,
|
avatarRenderer = attributes.avatarRenderer,
|
||||||
colorProvider = attributes.colorProvider,
|
messageColorProvider = attributes.messageColorProvider,
|
||||||
itemLongClickListener = attributes.itemLongClickListener,
|
itemLongClickListener = attributes.itemLongClickListener,
|
||||||
itemClickListener = attributes.itemClickListener,
|
itemClickListener = attributes.itemClickListener,
|
||||||
reactionPillCallback = attributes.reactionPillCallback,
|
reactionPillCallback = attributes.reactionPillCallback,
|
||||||
|
|
|
@ -27,8 +27,8 @@ import im.vector.matrix.android.api.session.room.model.message.MessageVerificati
|
||||||
import im.vector.matrix.android.api.session.room.timeline.TimelineEvent
|
import im.vector.matrix.android.api.session.room.timeline.TimelineEvent
|
||||||
import im.vector.matrix.android.internal.session.room.VerificationState
|
import im.vector.matrix.android.internal.session.room.VerificationState
|
||||||
import im.vector.riotx.core.epoxy.VectorEpoxyModel
|
import im.vector.riotx.core.epoxy.VectorEpoxyModel
|
||||||
import im.vector.riotx.core.resources.ColorProvider
|
|
||||||
import im.vector.riotx.core.resources.UserPreferencesProvider
|
import im.vector.riotx.core.resources.UserPreferencesProvider
|
||||||
|
import im.vector.riotx.features.home.room.detail.timeline.MessageColorProvider
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController
|
import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.helper.AvatarSizeProvider
|
import im.vector.riotx.features.home.room.detail.timeline.helper.AvatarSizeProvider
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.helper.MessageInformationDataFactory
|
import im.vector.riotx.features.home.room.detail.timeline.helper.MessageInformationDataFactory
|
||||||
|
@ -43,7 +43,7 @@ import javax.inject.Inject
|
||||||
* several checks are made to see if this conclusion is attached to a known request
|
* several checks are made to see if this conclusion is attached to a known request
|
||||||
*/
|
*/
|
||||||
class VerificationItemFactory @Inject constructor(
|
class VerificationItemFactory @Inject constructor(
|
||||||
private val colorProvider: ColorProvider,
|
private val messageColorProvider: MessageColorProvider,
|
||||||
private val messageInformationDataFactory: MessageInformationDataFactory,
|
private val messageInformationDataFactory: MessageInformationDataFactory,
|
||||||
private val messageItemAttributesFactory: MessageItemAttributesFactory,
|
private val messageItemAttributesFactory: MessageItemAttributesFactory,
|
||||||
private val avatarSizeProvider: AvatarSizeProvider,
|
private val avatarSizeProvider: AvatarSizeProvider,
|
||||||
|
@ -97,7 +97,7 @@ class VerificationItemFactory @Inject constructor(
|
||||||
isPositive = false,
|
isPositive = false,
|
||||||
informationData = informationData,
|
informationData = informationData,
|
||||||
avatarRenderer = attributes.avatarRenderer,
|
avatarRenderer = attributes.avatarRenderer,
|
||||||
colorProvider = colorProvider,
|
messageColorProvider = messageColorProvider,
|
||||||
emojiTypeFace = attributes.emojiTypeFace,
|
emojiTypeFace = attributes.emojiTypeFace,
|
||||||
itemClickListener = attributes.itemClickListener,
|
itemClickListener = attributes.itemClickListener,
|
||||||
itemLongClickListener = attributes.itemLongClickListener,
|
itemLongClickListener = attributes.itemLongClickListener,
|
||||||
|
@ -130,7 +130,7 @@ class VerificationItemFactory @Inject constructor(
|
||||||
isPositive = true,
|
isPositive = true,
|
||||||
informationData = informationData,
|
informationData = informationData,
|
||||||
avatarRenderer = attributes.avatarRenderer,
|
avatarRenderer = attributes.avatarRenderer,
|
||||||
colorProvider = colorProvider,
|
messageColorProvider = messageColorProvider,
|
||||||
emojiTypeFace = attributes.emojiTypeFace,
|
emojiTypeFace = attributes.emojiTypeFace,
|
||||||
itemClickListener = attributes.itemClickListener,
|
itemClickListener = attributes.itemClickListener,
|
||||||
itemLongClickListener = attributes.itemLongClickListener,
|
itemLongClickListener = attributes.itemLongClickListener,
|
||||||
|
|
|
@ -27,14 +27,13 @@ import im.vector.riotx.R
|
||||||
import im.vector.riotx.core.di.ActiveSessionHolder
|
import im.vector.riotx.core.di.ActiveSessionHolder
|
||||||
import im.vector.riotx.core.di.ScreenScope
|
import im.vector.riotx.core.di.ScreenScope
|
||||||
import im.vector.riotx.core.error.ErrorFormatter
|
import im.vector.riotx.core.error.ErrorFormatter
|
||||||
import im.vector.riotx.core.resources.ColorProvider
|
|
||||||
import im.vector.riotx.core.utils.TextUtils
|
import im.vector.riotx.core.utils.TextUtils
|
||||||
import im.vector.riotx.features.ui.getMessageTextColor
|
import im.vector.riotx.features.home.room.detail.timeline.MessageColorProvider
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@ScreenScope
|
@ScreenScope
|
||||||
class ContentUploadStateTrackerBinder @Inject constructor(private val activeSessionHolder: ActiveSessionHolder,
|
class ContentUploadStateTrackerBinder @Inject constructor(private val activeSessionHolder: ActiveSessionHolder,
|
||||||
private val colorProvider: ColorProvider,
|
private val messageColorProvider: MessageColorProvider,
|
||||||
private val errorFormatter: ErrorFormatter) {
|
private val errorFormatter: ErrorFormatter) {
|
||||||
|
|
||||||
private val updateListeners = mutableMapOf<String, ContentUploadStateTracker.UpdateListener>()
|
private val updateListeners = mutableMapOf<String, ContentUploadStateTracker.UpdateListener>()
|
||||||
|
@ -44,7 +43,7 @@ class ContentUploadStateTrackerBinder @Inject constructor(private val activeSess
|
||||||
progressLayout: ViewGroup) {
|
progressLayout: ViewGroup) {
|
||||||
activeSessionHolder.getSafeActiveSession()?.also { session ->
|
activeSessionHolder.getSafeActiveSession()?.also { session ->
|
||||||
val uploadStateTracker = session.contentUploadProgressTracker()
|
val uploadStateTracker = session.contentUploadProgressTracker()
|
||||||
val updateListener = ContentMediaProgressUpdater(progressLayout, isLocalFile, colorProvider, errorFormatter)
|
val updateListener = ContentMediaProgressUpdater(progressLayout, isLocalFile, messageColorProvider, errorFormatter)
|
||||||
updateListeners[eventId] = updateListener
|
updateListeners[eventId] = updateListener
|
||||||
uploadStateTracker.track(eventId, updateListener)
|
uploadStateTracker.track(eventId, updateListener)
|
||||||
}
|
}
|
||||||
|
@ -68,7 +67,7 @@ class ContentUploadStateTrackerBinder @Inject constructor(private val activeSess
|
||||||
|
|
||||||
private class ContentMediaProgressUpdater(private val progressLayout: ViewGroup,
|
private class ContentMediaProgressUpdater(private val progressLayout: ViewGroup,
|
||||||
private val isLocalFile: Boolean,
|
private val isLocalFile: Boolean,
|
||||||
private val colorProvider: ColorProvider,
|
private val messageColorProvider: MessageColorProvider,
|
||||||
private val errorFormatter: ErrorFormatter) : ContentUploadStateTracker.UpdateListener {
|
private val errorFormatter: ErrorFormatter) : ContentUploadStateTracker.UpdateListener {
|
||||||
|
|
||||||
override fun onUpdate(state: ContentUploadStateTracker.State) {
|
override fun onUpdate(state: ContentUploadStateTracker.State) {
|
||||||
|
@ -92,7 +91,7 @@ private class ContentMediaProgressUpdater(private val progressLayout: ViewGroup,
|
||||||
progressBar?.isIndeterminate = true
|
progressBar?.isIndeterminate = true
|
||||||
progressBar?.progress = 0
|
progressBar?.progress = 0
|
||||||
progressTextView?.text = progressLayout.context.getString(R.string.send_file_step_idle)
|
progressTextView?.text = progressLayout.context.getString(R.string.send_file_step_idle)
|
||||||
progressTextView?.setTextColor(colorProvider.getMessageTextColor(SendState.UNSENT))
|
progressTextView?.setTextColor(messageColorProvider.getMessageTextColor(SendState.UNSENT))
|
||||||
} else {
|
} else {
|
||||||
progressLayout.isVisible = false
|
progressLayout.isVisible = false
|
||||||
}
|
}
|
||||||
|
@ -120,7 +119,7 @@ private class ContentMediaProgressUpdater(private val progressLayout: ViewGroup,
|
||||||
val progressTextView = progressLayout.findViewById<TextView>(R.id.mediaProgressTextView)
|
val progressTextView = progressLayout.findViewById<TextView>(R.id.mediaProgressTextView)
|
||||||
progressBar?.isIndeterminate = true
|
progressBar?.isIndeterminate = true
|
||||||
progressTextView?.text = progressLayout.context.getString(resId)
|
progressTextView?.text = progressLayout.context.getString(resId)
|
||||||
progressTextView?.setTextColor(colorProvider.getMessageTextColor(SendState.ENCRYPTING))
|
progressTextView?.setTextColor(messageColorProvider.getMessageTextColor(SendState.ENCRYPTING))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun doHandleProgress(resId: Int, current: Long, total: Long) {
|
private fun doHandleProgress(resId: Int, current: Long, total: Long) {
|
||||||
|
@ -134,7 +133,7 @@ private class ContentMediaProgressUpdater(private val progressLayout: ViewGroup,
|
||||||
progressTextView?.text = progressLayout.context.getString(resId,
|
progressTextView?.text = progressLayout.context.getString(resId,
|
||||||
TextUtils.formatFileSize(progressLayout.context, current, true),
|
TextUtils.formatFileSize(progressLayout.context, current, true),
|
||||||
TextUtils.formatFileSize(progressLayout.context, total, true))
|
TextUtils.formatFileSize(progressLayout.context, total, true))
|
||||||
progressTextView?.setTextColor(colorProvider.getMessageTextColor(SendState.SENDING))
|
progressTextView?.setTextColor(messageColorProvider.getMessageTextColor(SendState.SENDING))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleFailure(state: ContentUploadStateTracker.State.Failure) {
|
private fun handleFailure(state: ContentUploadStateTracker.State.Failure) {
|
||||||
|
@ -143,7 +142,7 @@ private class ContentMediaProgressUpdater(private val progressLayout: ViewGroup,
|
||||||
val progressTextView = progressLayout.findViewById<TextView>(R.id.mediaProgressTextView)
|
val progressTextView = progressLayout.findViewById<TextView>(R.id.mediaProgressTextView)
|
||||||
progressBar?.isVisible = false
|
progressBar?.isVisible = false
|
||||||
progressTextView?.text = errorFormatter.toHumanReadable(state.throwable)
|
progressTextView?.text = errorFormatter.toHumanReadable(state.throwable)
|
||||||
progressTextView?.setTextColor(colorProvider.getMessageTextColor(SendState.UNDELIVERED))
|
progressTextView?.setTextColor(messageColorProvider.getMessageTextColor(SendState.UNDELIVERED))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleSuccess() {
|
private fun handleSuccess() {
|
||||||
|
|
|
@ -20,9 +20,9 @@ package im.vector.riotx.features.home.room.detail.timeline.helper
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import im.vector.matrix.android.api.session.room.model.message.MessageContent
|
import im.vector.matrix.android.api.session.room.model.message.MessageContent
|
||||||
import im.vector.riotx.EmojiCompatFontProvider
|
import im.vector.riotx.EmojiCompatFontProvider
|
||||||
import im.vector.riotx.core.resources.ColorProvider
|
|
||||||
import im.vector.riotx.core.utils.DebouncedClickListener
|
import im.vector.riotx.core.utils.DebouncedClickListener
|
||||||
import im.vector.riotx.features.home.AvatarRenderer
|
import im.vector.riotx.features.home.AvatarRenderer
|
||||||
|
import im.vector.riotx.features.home.room.detail.timeline.MessageColorProvider
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController
|
import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.item.AbsMessageItem
|
import im.vector.riotx.features.home.room.detail.timeline.item.AbsMessageItem
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.item.MessageInformationData
|
import im.vector.riotx.features.home.room.detail.timeline.item.MessageInformationData
|
||||||
|
@ -30,7 +30,7 @@ import javax.inject.Inject
|
||||||
|
|
||||||
class MessageItemAttributesFactory @Inject constructor(
|
class MessageItemAttributesFactory @Inject constructor(
|
||||||
private val avatarRenderer: AvatarRenderer,
|
private val avatarRenderer: AvatarRenderer,
|
||||||
private val colorProvider: ColorProvider,
|
private val messageColorProvider: MessageColorProvider,
|
||||||
private val avatarSizeProvider: AvatarSizeProvider,
|
private val avatarSizeProvider: AvatarSizeProvider,
|
||||||
private val emojiCompatFontProvider: EmojiCompatFontProvider) {
|
private val emojiCompatFontProvider: EmojiCompatFontProvider) {
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class MessageItemAttributesFactory @Inject constructor(
|
||||||
avatarSize = avatarSizeProvider.avatarSize,
|
avatarSize = avatarSizeProvider.avatarSize,
|
||||||
informationData = informationData,
|
informationData = informationData,
|
||||||
avatarRenderer = avatarRenderer,
|
avatarRenderer = avatarRenderer,
|
||||||
colorProvider = colorProvider,
|
messageColorProvider = messageColorProvider,
|
||||||
itemLongClickListener = View.OnLongClickListener { view ->
|
itemLongClickListener = View.OnLongClickListener { view ->
|
||||||
callback?.onEventLongClicked(informationData, messageContent, view) ?: false
|
callback?.onEventLongClicked(informationData, messageContent, view) ?: false
|
||||||
},
|
},
|
||||||
|
|
|
@ -24,12 +24,11 @@ import androidx.annotation.IdRes
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import im.vector.matrix.android.api.session.room.send.SendState
|
import im.vector.matrix.android.api.session.room.send.SendState
|
||||||
import im.vector.riotx.R
|
import im.vector.riotx.R
|
||||||
import im.vector.riotx.core.resources.ColorProvider
|
|
||||||
import im.vector.riotx.core.utils.DebouncedClickListener
|
import im.vector.riotx.core.utils.DebouncedClickListener
|
||||||
import im.vector.riotx.features.home.AvatarRenderer
|
import im.vector.riotx.features.home.AvatarRenderer
|
||||||
|
import im.vector.riotx.features.home.room.detail.timeline.MessageColorProvider
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController
|
import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController
|
||||||
import im.vector.riotx.features.reactions.widget.ReactionButton
|
import im.vector.riotx.features.reactions.widget.ReactionButton
|
||||||
import im.vector.riotx.features.ui.getMessageTextColor
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base timeline item with reactions and read receipts.
|
* Base timeline item with reactions and read receipts.
|
||||||
|
@ -105,7 +104,7 @@ abstract class AbsBaseMessageItem<H : AbsBaseMessageItem.Holder> : BaseEventItem
|
||||||
protected open fun renderSendState(root: View, textView: TextView?, failureIndicator: ImageView? = null) {
|
protected open fun renderSendState(root: View, textView: TextView?, failureIndicator: ImageView? = null) {
|
||||||
root.isClickable = baseAttributes.informationData.sendState.isSent()
|
root.isClickable = baseAttributes.informationData.sendState.isSent()
|
||||||
val state = if (baseAttributes.informationData.hasPendingEdits) SendState.UNSENT else baseAttributes.informationData.sendState
|
val state = if (baseAttributes.informationData.hasPendingEdits) SendState.UNSENT else baseAttributes.informationData.sendState
|
||||||
textView?.setTextColor(baseAttributes.colorProvider.getMessageTextColor(state))
|
textView?.setTextColor(baseAttributes.messageColorProvider.getMessageTextColor(state))
|
||||||
failureIndicator?.isVisible = baseAttributes.informationData.sendState.hasFailed()
|
failureIndicator?.isVisible = baseAttributes.informationData.sendState.hasFailed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +119,7 @@ abstract class AbsBaseMessageItem<H : AbsBaseMessageItem.Holder> : BaseEventItem
|
||||||
// val avatarSize: Int,
|
// val avatarSize: Int,
|
||||||
val informationData: MessageInformationData
|
val informationData: MessageInformationData
|
||||||
val avatarRenderer: AvatarRenderer
|
val avatarRenderer: AvatarRenderer
|
||||||
val colorProvider: ColorProvider
|
val messageColorProvider: MessageColorProvider
|
||||||
val itemLongClickListener: View.OnLongClickListener?
|
val itemLongClickListener: View.OnLongClickListener?
|
||||||
val itemClickListener: View.OnClickListener?
|
val itemClickListener: View.OnClickListener?
|
||||||
// val memberClickListener: View.OnClickListener?
|
// val memberClickListener: View.OnClickListener?
|
||||||
|
|
|
@ -23,9 +23,9 @@ import android.widget.TextView
|
||||||
import androidx.annotation.IdRes
|
import androidx.annotation.IdRes
|
||||||
import com.airbnb.epoxy.EpoxyAttribute
|
import com.airbnb.epoxy.EpoxyAttribute
|
||||||
import im.vector.riotx.R
|
import im.vector.riotx.R
|
||||||
import im.vector.riotx.core.resources.ColorProvider
|
|
||||||
import im.vector.riotx.core.utils.DebouncedClickListener
|
import im.vector.riotx.core.utils.DebouncedClickListener
|
||||||
import im.vector.riotx.features.home.AvatarRenderer
|
import im.vector.riotx.features.home.AvatarRenderer
|
||||||
|
import im.vector.riotx.features.home.room.detail.timeline.MessageColorProvider
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController
|
import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +88,7 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
|
||||||
val avatarSize: Int,
|
val avatarSize: Int,
|
||||||
override val informationData: MessageInformationData,
|
override val informationData: MessageInformationData,
|
||||||
override val avatarRenderer: AvatarRenderer,
|
override val avatarRenderer: AvatarRenderer,
|
||||||
override val colorProvider: ColorProvider,
|
override val messageColorProvider: MessageColorProvider,
|
||||||
override val itemLongClickListener: View.OnLongClickListener? = null,
|
override val itemLongClickListener: View.OnLongClickListener? = null,
|
||||||
override val itemClickListener: View.OnClickListener? = null,
|
override val itemClickListener: View.OnClickListener? = null,
|
||||||
val memberClickListener: View.OnClickListener? = null,
|
val memberClickListener: View.OnClickListener? = null,
|
||||||
|
|
|
@ -26,8 +26,8 @@ import androidx.core.view.updateLayoutParams
|
||||||
import com.airbnb.epoxy.EpoxyAttribute
|
import com.airbnb.epoxy.EpoxyAttribute
|
||||||
import com.airbnb.epoxy.EpoxyModelClass
|
import com.airbnb.epoxy.EpoxyModelClass
|
||||||
import im.vector.riotx.R
|
import im.vector.riotx.R
|
||||||
import im.vector.riotx.core.resources.ColorProvider
|
|
||||||
import im.vector.riotx.features.home.AvatarRenderer
|
import im.vector.riotx.features.home.AvatarRenderer
|
||||||
|
import im.vector.riotx.features.home.room.detail.timeline.MessageColorProvider
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController
|
import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController
|
||||||
|
|
||||||
@EpoxyModelClass(layout = R.layout.item_timeline_event_base_state)
|
@EpoxyModelClass(layout = R.layout.item_timeline_event_base_state)
|
||||||
|
@ -80,7 +80,7 @@ abstract class VerificationRequestConclusionItem : AbsBaseMessageItem<Verificati
|
||||||
val isPositive: Boolean,
|
val isPositive: Boolean,
|
||||||
override val informationData: MessageInformationData,
|
override val informationData: MessageInformationData,
|
||||||
override val avatarRenderer: AvatarRenderer,
|
override val avatarRenderer: AvatarRenderer,
|
||||||
override val colorProvider: ColorProvider,
|
override val messageColorProvider: MessageColorProvider,
|
||||||
override val itemLongClickListener: View.OnLongClickListener? = null,
|
override val itemLongClickListener: View.OnLongClickListener? = null,
|
||||||
override val itemClickListener: View.OnClickListener? = null,
|
override val itemClickListener: View.OnClickListener? = null,
|
||||||
override val reactionPillCallback: TimelineEventController.ReactionPillCallback? = null,
|
override val reactionPillCallback: TimelineEventController.ReactionPillCallback? = null,
|
||||||
|
|
|
@ -32,10 +32,10 @@ import im.vector.matrix.android.api.session.crypto.verification.VerificationServ
|
||||||
import im.vector.matrix.android.internal.session.room.VerificationState
|
import im.vector.matrix.android.internal.session.room.VerificationState
|
||||||
import im.vector.riotx.R
|
import im.vector.riotx.R
|
||||||
import im.vector.riotx.core.extensions.exhaustive
|
import im.vector.riotx.core.extensions.exhaustive
|
||||||
import im.vector.riotx.core.resources.ColorProvider
|
|
||||||
import im.vector.riotx.core.utils.DebouncedClickListener
|
import im.vector.riotx.core.utils.DebouncedClickListener
|
||||||
import im.vector.riotx.features.home.AvatarRenderer
|
import im.vector.riotx.features.home.AvatarRenderer
|
||||||
import im.vector.riotx.features.home.room.detail.RoomDetailAction
|
import im.vector.riotx.features.home.room.detail.RoomDetailAction
|
||||||
|
import im.vector.riotx.features.home.room.detail.timeline.MessageColorProvider
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController
|
import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController
|
||||||
|
|
||||||
@EpoxyModelClass(layout = R.layout.item_timeline_event_base_state)
|
@EpoxyModelClass(layout = R.layout.item_timeline_event_base_state)
|
||||||
|
@ -166,7 +166,7 @@ abstract class VerificationRequestItem : AbsBaseMessageItem<VerificationRequestI
|
||||||
// val avatarSize: Int,
|
// val avatarSize: Int,
|
||||||
override val informationData: MessageInformationData,
|
override val informationData: MessageInformationData,
|
||||||
override val avatarRenderer: AvatarRenderer,
|
override val avatarRenderer: AvatarRenderer,
|
||||||
override val colorProvider: ColorProvider,
|
override val messageColorProvider: MessageColorProvider,
|
||||||
override val itemLongClickListener: View.OnLongClickListener? = null,
|
override val itemLongClickListener: View.OnLongClickListener? = null,
|
||||||
override val itemClickListener: View.OnClickListener? = null,
|
override val itemClickListener: View.OnClickListener? = null,
|
||||||
// val memberClickListener: View.OnClickListener? = null,
|
// val memberClickListener: View.OnClickListener? = null,
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2019 New Vector Ltd
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package im.vector.riotx.features.ui
|
|
||||||
|
|
||||||
import androidx.annotation.ColorInt
|
|
||||||
import im.vector.matrix.android.api.session.room.send.SendState
|
|
||||||
import im.vector.riotx.R
|
|
||||||
import im.vector.riotx.core.resources.ColorProvider
|
|
||||||
|
|
||||||
@ColorInt
|
|
||||||
fun ColorProvider.getMessageTextColor(sendState: SendState): Int {
|
|
||||||
return when (sendState) {
|
|
||||||
// SendStates, in the classical order they will occur
|
|
||||||
SendState.UNKNOWN,
|
|
||||||
SendState.UNSENT -> getColorFromAttribute(R.attr.vctr_sending_message_text_color)
|
|
||||||
SendState.ENCRYPTING -> getColorFromAttribute(R.attr.vctr_encrypting_message_text_color)
|
|
||||||
SendState.SENDING -> getColorFromAttribute(R.attr.vctr_sending_message_text_color)
|
|
||||||
SendState.SENT,
|
|
||||||
SendState.SYNCED -> getColorFromAttribute(R.attr.vctr_message_text_color)
|
|
||||||
SendState.UNDELIVERED,
|
|
||||||
SendState.FAILED_UNKNOWN_DEVICES -> getColorFromAttribute(R.attr.vctr_unsent_message_text_color)
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue