mirror of
https://github.com/element-hq/element-android
synced 2024-11-23 09:55:40 +03:00
Cleaning
This commit is contained in:
parent
93cb7b8ce6
commit
cfca4927e2
5 changed files with 7 additions and 46 deletions
|
@ -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
|
||||
}
|
|
@ -21,7 +21,6 @@ import com.airbnb.mvrx.ViewModelContext
|
|||
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.room.model.message.MessageContent
|
||||
import im.vector.riotredesign.VectorApplication
|
||||
import im.vector.riotredesign.core.platform.VectorViewModel
|
||||
import org.koin.android.ext.android.get
|
||||
import timber.log.Timber
|
||||
|
@ -44,12 +43,11 @@ class MessageActionsViewModel(initialState: MessageActionState) : VectorViewMode
|
|||
|
||||
companion object : MvRxViewModelFactory<MessageActionsViewModel, MessageActionState> {
|
||||
|
||||
val dateFormat = SimpleDateFormat("EEE, d MMM yyyy HH:mm")
|
||||
|
||||
override fun initialState(viewModelContext: ViewModelContext): MessageActionState? {
|
||||
val currentSession = viewModelContext.activity.get<Session>()
|
||||
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)
|
||||
return if (event != null) {
|
||||
|
|
|
@ -27,9 +27,7 @@ import com.airbnb.mvrx.BaseMvRxFragment
|
|||
import com.airbnb.mvrx.MvRx
|
||||
import com.airbnb.mvrx.fragmentViewModel
|
||||
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.features.home.room.detail.timeline.item.MessageInformationData
|
||||
import im.vector.riotredesign.features.themes.ThemeUtils
|
||||
|
||||
/**
|
||||
|
|
|
@ -84,10 +84,14 @@ class QuickReactionViewModel(initialState: QuickReactionState) : VectorViewModel
|
|||
when (state.likeTriggleState) {
|
||||
TriggleState.FIRST -> add(likePositive)
|
||||
TriggleState.SECOND -> add(likeNegative)
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
when (state.agreeTrigleState) {
|
||||
TriggleState.FIRST -> add(agreePositive)
|
||||
TriggleState.SECOND -> add(agreeNegative)
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,30 +25,14 @@ class EmojiDrawView @JvmOverloads constructor(
|
|||
invalidate()
|
||||
}
|
||||
|
||||
// var _mySpacing = 0f
|
||||
|
||||
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?) {
|
||||
EmojiRecyclerAdapter.beginTraceSession("EmojiDrawView.onDraw")
|
||||
super.onDraw(canvas)
|
||||
canvas?.save()
|
||||
val space = abs((width - emojiSize) / 2f)
|
||||
if (mLayout == null) {
|
||||
// canvas?.drawCircle(width / 2f ,width / 2f, emojiSize / 2f,tPaint)
|
||||
} else {
|
||||
if (mLayout != null) {
|
||||
canvas?.translate(space, space)
|
||||
mLayout!!.draw(canvas)
|
||||
}
|
||||
|
@ -62,7 +46,7 @@ class EmojiDrawView @JvmOverloads constructor(
|
|||
var emojiSize = 40
|
||||
|
||||
fun configureTextPaint(context: Context, typeface: Typeface?) {
|
||||
tPaint.isAntiAlias = true;
|
||||
tPaint.isAntiAlias = true
|
||||
tPaint.textSize = 24 * context.resources.displayMetrics.density
|
||||
tPaint.color = Color.LTGRAY
|
||||
typeface?.let {
|
||||
|
|
Loading…
Reference in a new issue