mirror of
https://github.com/oxen-io/session-android.git
synced 2023-12-14 02:53:01 +01:00
* refactor: Migrate home screen to data binding * Add view binding * Migrate ConversationView to view binding * Migrate ConversationActivityV2 to view binding * View model refactor * Move more functionality to the view model * Add ui state events flow * Update conversation item bindings * Update profile picture view bindings * Replace Kotlin synthetics with view bindings * Fix qr code fragment binding and optimize imports * View binding refactors * Make TextSecurePreferences an interface and add an implementation to improve testability * Add conversation repository * Migrate remaining TextSecurePreferences functions into the interface * Add unit conversation unit tests * Add unit test coverage for remaining view model functions
32 lines
1.3 KiB
Kotlin
32 lines
1.3 KiB
Kotlin
package org.thoughtcrime.securesms.conversation.v2.messages
|
|
|
|
import android.content.Context
|
|
import android.content.res.ColorStateList
|
|
import android.util.AttributeSet
|
|
import android.view.LayoutInflater
|
|
import android.widget.LinearLayout
|
|
import androidx.annotation.ColorInt
|
|
import network.loki.messenger.databinding.ViewDocumentBinding
|
|
import org.thoughtcrime.securesms.database.model.MmsMessageRecord
|
|
|
|
class DocumentView : LinearLayout {
|
|
private lateinit var binding: ViewDocumentBinding
|
|
// region Lifecycle
|
|
constructor(context: Context) : super(context) { initialize() }
|
|
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { initialize() }
|
|
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { initialize() }
|
|
|
|
private fun initialize() {
|
|
binding = ViewDocumentBinding.inflate(LayoutInflater.from(context), this, true)
|
|
}
|
|
// endregion
|
|
|
|
// region Updating
|
|
fun bind(message: MmsMessageRecord, @ColorInt textColor: Int) {
|
|
val document = message.slideDeck.documentSlide!!
|
|
binding.documentTitleTextView.text = document.fileName.or("Untitled File")
|
|
binding.documentTitleTextView.setTextColor(textColor)
|
|
binding.documentViewIconImageView.imageTintList = ColorStateList.valueOf(textColor)
|
|
}
|
|
// endregion
|
|
} |