This commit is contained in:
Valere 2019-05-10 09:28:52 +02:00
parent 93cb7b8ce6
commit cfca4927e2
5 changed files with 7 additions and 46 deletions

View file

@ -1,23 +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.matrix.android.api.session.room
import im.vector.matrix.android.api.session.events.model.Event
interface RoomEventService {
fun getEvent(eventId: String?) : Event
}

View file

@ -21,7 +21,6 @@ import com.airbnb.mvrx.ViewModelContext
import im.vector.matrix.android.api.session.Session import im.vector.matrix.android.api.session.Session
import im.vector.matrix.android.api.session.events.model.toModel import im.vector.matrix.android.api.session.events.model.toModel
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.riotredesign.VectorApplication
import im.vector.riotredesign.core.platform.VectorViewModel import im.vector.riotredesign.core.platform.VectorViewModel
import org.koin.android.ext.android.get import org.koin.android.ext.android.get
import timber.log.Timber import timber.log.Timber
@ -44,12 +43,11 @@ class MessageActionsViewModel(initialState: MessageActionState) : VectorViewMode
companion object : MvRxViewModelFactory<MessageActionsViewModel, MessageActionState> { companion object : MvRxViewModelFactory<MessageActionsViewModel, MessageActionState> {
val dateFormat = SimpleDateFormat("EEE, d MMM yyyy HH:mm")
override fun initialState(viewModelContext: ViewModelContext): MessageActionState? { override fun initialState(viewModelContext: ViewModelContext): MessageActionState? {
val currentSession = viewModelContext.activity.get<Session>() val currentSession = viewModelContext.activity.get<Session>()
val parcel = viewModelContext.args as MessageActionsBottomSheet.ParcelableArgs val parcel = viewModelContext.args as MessageActionsBottomSheet.ParcelableArgs
val dateFormat = SimpleDateFormat("EEE, d MMM yyyy HH:mm", Locale.getDefault())
val event = currentSession.getRoom(parcel.roomId)?.getTimeLineEvent(parcel.eventId) val event = currentSession.getRoom(parcel.roomId)?.getTimeLineEvent(parcel.eventId)
return if (event != null) { return if (event != null) {

View file

@ -27,9 +27,7 @@ import com.airbnb.mvrx.BaseMvRxFragment
import com.airbnb.mvrx.MvRx import com.airbnb.mvrx.MvRx
import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import im.vector.matrix.android.api.session.room.model.message.MessageContent
import im.vector.riotredesign.R import im.vector.riotredesign.R
import im.vector.riotredesign.features.home.room.detail.timeline.item.MessageInformationData
import im.vector.riotredesign.features.themes.ThemeUtils import im.vector.riotredesign.features.themes.ThemeUtils
/** /**

View file

@ -84,10 +84,14 @@ class QuickReactionViewModel(initialState: QuickReactionState) : VectorViewModel
when (state.likeTriggleState) { when (state.likeTriggleState) {
TriggleState.FIRST -> add(likePositive) TriggleState.FIRST -> add(likePositive)
TriggleState.SECOND -> add(likeNegative) TriggleState.SECOND -> add(likeNegative)
else -> {
}
} }
when (state.agreeTrigleState) { when (state.agreeTrigleState) {
TriggleState.FIRST -> add(agreePositive) TriggleState.FIRST -> add(agreePositive)
TriggleState.SECOND -> add(agreeNegative) TriggleState.SECOND -> add(agreeNegative)
else -> {
}
} }
} }
} }

View file

@ -25,30 +25,14 @@ class EmojiDrawView @JvmOverloads constructor(
invalidate() invalidate()
} }
// var _mySpacing = 0f
var emoji: String? = null var emoji: String? = null
// set(value) {
// if (value != null) {
// EmojiRecyclerAdapter.beginTraceSession("EmojiDrawView.TextStaticLayout")
// mLayout = StaticLayout(value, tPaint, emojiSize, Layout.Alignment.ALIGN_CENTER, 1f, 0f, true)
// if (value != field) invalidate()
// EmojiRecyclerAdapter.endTraceSession()
// } else {
// mLayout = null
//// if (value != field) invalidate()
// }
// field = value
// }
override fun onDraw(canvas: Canvas?) { override fun onDraw(canvas: Canvas?) {
EmojiRecyclerAdapter.beginTraceSession("EmojiDrawView.onDraw") EmojiRecyclerAdapter.beginTraceSession("EmojiDrawView.onDraw")
super.onDraw(canvas) super.onDraw(canvas)
canvas?.save() canvas?.save()
val space = abs((width - emojiSize) / 2f) val space = abs((width - emojiSize) / 2f)
if (mLayout == null) { if (mLayout != null) {
// canvas?.drawCircle(width / 2f ,width / 2f, emojiSize / 2f,tPaint)
} else {
canvas?.translate(space, space) canvas?.translate(space, space)
mLayout!!.draw(canvas) mLayout!!.draw(canvas)
} }
@ -62,7 +46,7 @@ class EmojiDrawView @JvmOverloads constructor(
var emojiSize = 40 var emojiSize = 40
fun configureTextPaint(context: Context, typeface: Typeface?) { fun configureTextPaint(context: Context, typeface: Typeface?) {
tPaint.isAntiAlias = true; tPaint.isAntiAlias = true
tPaint.textSize = 24 * context.resources.displayMetrics.density tPaint.textSize = 24 * context.resources.displayMetrics.density
tPaint.color = Color.LTGRAY tPaint.color = Color.LTGRAY
typeface?.let { typeface?.let {