forked from upstream-mirrors/quik
@@ -153,10 +153,6 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
.autoDisposable(scope())
|
||||
.subscribe()
|
||||
|
||||
allThemes
|
||||
.autoDisposable(scope())
|
||||
.subscribe { messageList.scrapViews() }
|
||||
|
||||
window.callback = ComposeWindowCallback(window.callback, this)
|
||||
|
||||
// These theme attributes don't apply themselves on API 21
|
||||
@@ -299,6 +295,10 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
startActivityForResult(intent, SelectContactRequestCode)
|
||||
}
|
||||
|
||||
override fun themeChanged() {
|
||||
messageList.scrapViews()
|
||||
}
|
||||
|
||||
override fun showKeyboard() {
|
||||
message.postDelayed({
|
||||
message.showKeyboard()
|
||||
|
||||
@@ -62,6 +62,7 @@ interface ComposeView : QkView<ComposeState> {
|
||||
fun requestStoragePermission()
|
||||
fun requestSmsPermission()
|
||||
fun showContacts(sharing: Boolean, chips: List<Chip>)
|
||||
fun themeChanged()
|
||||
fun showKeyboard()
|
||||
fun requestCamera()
|
||||
fun requestGallery()
|
||||
|
||||
@@ -394,6 +394,13 @@ class ComposeViewModel @Inject constructor(
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe(view::scrollToMessage)
|
||||
|
||||
// Theme changes
|
||||
prefs.keyChanges
|
||||
.filter { key -> key.contains("theme") }
|
||||
.doOnNext { view.themeChanged() }
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe()
|
||||
|
||||
// Retry sending
|
||||
view.messageClickIntent
|
||||
.mapNotNull(messageRepo::getMessage)
|
||||
|
||||
@@ -183,7 +183,7 @@ class MessagesAdapter @Inject constructor(
|
||||
|
||||
val theme = when (message.isOutgoingMessage()) {
|
||||
true -> colors.theme()
|
||||
false -> colors.theme(contactCache[message.address]?.id ?: 0)
|
||||
false -> colors.theme(contactCache[message.address])
|
||||
}
|
||||
|
||||
// Update the selected state
|
||||
@@ -232,8 +232,7 @@ class MessagesAdapter @Inject constructor(
|
||||
|
||||
// Bind the avatar and bubble colour
|
||||
if (!message.isMe()) {
|
||||
view.avatar.recipientId = contactCache[message.address]?.id ?: 0
|
||||
view.avatar.setContact(contactCache[message.address]?.contact)
|
||||
view.avatar.setRecipient(contactCache[message.address])
|
||||
view.avatar.setVisible(!canGroup(message, next), View.INVISIBLE)
|
||||
|
||||
view.body.setTextColor(theme.textPrimary)
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.moez.QKSMS.common.base.QkViewHolder
|
||||
import com.moez.QKSMS.common.util.extensions.dpToPx
|
||||
import com.moez.QKSMS.common.util.extensions.resolveThemeColor
|
||||
import com.moez.QKSMS.common.util.extensions.setBackgroundTint
|
||||
import com.moez.QKSMS.model.Recipient
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import kotlinx.android.synthetic.main.contact_chip.*
|
||||
import kotlinx.android.synthetic.main.contact_chip.view.*
|
||||
@@ -60,7 +61,7 @@ class ChipsAdapter @Inject constructor() : QkAdapter<Chip>() {
|
||||
val chip = getItem(position)
|
||||
val view = holder.containerView
|
||||
|
||||
view.avatar.setContact(chip.contact)
|
||||
view.avatar.setRecipient(Recipient(id = -1, contact = chip.contact))
|
||||
view.name.text = chip.contact?.name?.takeIf { it.isNotBlank() } ?: chip.address
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@ import com.moez.QKSMS.common.util.Colors
|
||||
import com.moez.QKSMS.common.util.extensions.setBackgroundTint
|
||||
import com.moez.QKSMS.common.util.extensions.setTint
|
||||
import com.moez.QKSMS.injection.appComponent
|
||||
import com.moez.QKSMS.model.Recipient
|
||||
import kotlinx.android.synthetic.main.contact_chip_detailed.view.*
|
||||
import javax.inject.Inject
|
||||
|
||||
@@ -54,7 +55,7 @@ class DetailedChipView(context: Context) : RelativeLayout(context) {
|
||||
}
|
||||
|
||||
fun setChip(chip: Chip) {
|
||||
avatar.setContact(chip.contact)
|
||||
avatar.setRecipient(Recipient(id = -1, contact = chip.contact))
|
||||
name.text = chip.contact?.name?.takeIf { it.isNotBlank() } ?: chip.address
|
||||
info.text = chip.address
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user