code review cleaning

This commit is contained in:
Valere 2019-06-07 13:55:32 +02:00
parent 651d0472cd
commit 438404b5ba
4 changed files with 10 additions and 17 deletions

View File

@ -55,8 +55,12 @@ class RoomDetailViewModel(initialState: RoomDetailViewState,
private val roomId = initialState.roomId
private val eventId = initialState.eventId
private val displayedEventsObservable = BehaviorRelay.create<RoomDetailActions.EventDisplayed>()
private val timeline = room.createTimeline(eventId,
if (TimelineDisplayableEvents.DEBUG_HIDDEN_EVENT) TimelineDisplayableEvents.DEBUG_DISPLAYABLE_TYPES else TimelineDisplayableEvents.DISPLAYABLE_TYPES)
private val allowedTypes = if (TimelineDisplayableEvents.DEBUG_HIDDEN_EVENT) {
TimelineDisplayableEvents.DEBUG_DISPLAYABLE_TYPES
} else {
TimelineDisplayableEvents.DISPLAYABLE_TYPES
}
private val timeline = room.createTimeline(eventId, allowedTypes)
companion object : MvRxViewModelFactory<RoomDetailViewModel, RoomDetailViewState> {

View File

@ -33,7 +33,6 @@ import com.airbnb.mvrx.withState
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import im.vector.riotredesign.R
import im.vector.riotredesign.core.glide.GlideApp
import im.vector.riotredesign.features.home.AvatarRenderer
import im.vector.riotredesign.features.home.room.detail.timeline.item.MessageInformationData
import kotlinx.android.synthetic.main.bottom_sheet_message_actions.*
@ -122,17 +121,7 @@ class MessageActionsBottomSheet : BaseMvRxBottomSheetDialog() {
senderNameTextView.text = it.senderName
messageBodyTextView.text = it.messageBody
messageTimestampText.text = it.ts
GlideApp.with(this).clear(senderAvatarImageView)
if (it.senderAvatarPath != null) {
GlideApp.with(this)
.load(it.senderAvatarPath)
.circleCrop()
.placeholder(AvatarRenderer.getPlaceholderDrawable(requireContext(), it.userId, it.senderName))
.into(senderAvatarImageView)
} else {
senderAvatarImageView.setImageDrawable(AvatarRenderer.getPlaceholderDrawable(requireContext(), it.userId, it.senderName))
}
AvatarRenderer.render(it.senderAvatarPath, it.userId, it.senderName, senderAvatarImageView)
} else {
bottom_sheet_message_preview.isVisible = false
}

View File

@ -96,7 +96,7 @@ class MessageActionsViewModel(initialState: MessageActionState) : VectorViewMode
ts = dateFormat.format(Date(originTs ?: 0)),
showPreview = body != null,
canReact = event.root.type == EventType.MESSAGE,
senderAvatarPath = currentSession.contentUrlResolver().resolveFullSize(parcel.informationData.avatarUrl)
senderAvatarPath = parcel.informationData.avatarUrl
)
} else {
//can this happen?

View File

@ -25,7 +25,6 @@ import android.graphics.Typeface
import android.graphics.drawable.Drawable
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.animation.AccelerateDecelerateInterpolator
import android.view.animation.DecelerateInterpolator
@ -44,7 +43,8 @@ import im.vector.riotredesign.core.utils.TextUtils
* Displays a String reaction (emoji), with a count, and that can be selected or not (toggle)
*/
class ReactionButton @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null,
defStyleAttr: Int = 0) : FrameLayout(context, attrs, defStyleAttr), View.OnClickListener, View.OnLongClickListener {
defStyleAttr: Int = 0)
: FrameLayout(context, attrs, defStyleAttr), View.OnClickListener, View.OnLongClickListener {
companion object {
private val DECCELERATE_INTERPOLATOR = DecelerateInterpolator()