forked from upstream-mirrors/quik
Fix color of conversation theme checkmark
This commit is contained in:
@@ -47,6 +47,12 @@ class ThemeAdapter @Inject constructor(
|
|||||||
private val colors: Colors
|
private val colors: Colors
|
||||||
) : QkAdapter<List<Int>>() {
|
) : QkAdapter<List<Int>>() {
|
||||||
|
|
||||||
|
var threadId: Long = 0
|
||||||
|
set(value) {
|
||||||
|
field = value
|
||||||
|
threadIdChanged()
|
||||||
|
}
|
||||||
|
|
||||||
val colorSelected: Subject<Int> = PublishSubject.create()
|
val colorSelected: Subject<Int> = PublishSubject.create()
|
||||||
|
|
||||||
var selectedColor: Int = -1
|
var selectedColor: Int = -1
|
||||||
@@ -113,9 +119,11 @@ class ThemeAdapter @Inject constructor(
|
|||||||
.forEach { theme -> view.palette.addView(theme) }
|
.forEach { theme -> view.palette.addView(theme) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAttachedToRecyclerView(recyclerView: RecyclerView) {
|
private fun threadIdChanged() {
|
||||||
disposables += colors.textPrimaryOnTheme
|
disposables.clear()
|
||||||
|
disposables += colors.textPrimaryOnThemeForConversation(threadId)
|
||||||
.subscribe { color -> iconTint = color }
|
.subscribe { color -> iconTint = color }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDetachedFromRecyclerView(recyclerView: RecyclerView) {
|
override fun onDetachedFromRecyclerView(recyclerView: RecyclerView) {
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ class ThemePickerActivity : QkThemedActivity<ThemePickerViewModel>(), ThemePicke
|
|||||||
rgbPicker.alpha = state.rgbAlpha
|
rgbPicker.alpha = state.rgbAlpha
|
||||||
rgbPicker.setBackgroundColor(state.selectedColor)
|
rgbPicker.setBackgroundColor(state.selectedColor)
|
||||||
|
|
||||||
|
themeAdapter.threadId = state.threadId
|
||||||
themeAdapter.selectedColor = state.selectedColor
|
themeAdapter.selectedColor = state.selectedColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package presentation.feature.themepicker
|
package presentation.feature.themepicker
|
||||||
|
|
||||||
data class ThemePickerState(
|
data class ThemePickerState(
|
||||||
|
val threadId: Long = 0,
|
||||||
val selectedColor: Int = -1,
|
val selectedColor: Int = -1,
|
||||||
val rgbAlpha: Float = 0f
|
val rgbAlpha: Float = 0f
|
||||||
)
|
)
|
||||||
@@ -39,6 +39,8 @@ class ThemePickerViewModel(intent: Intent) : QkViewModel<ThemePickerView, ThemeP
|
|||||||
init {
|
init {
|
||||||
appComponent.inject(this)
|
appComponent.inject(this)
|
||||||
|
|
||||||
|
newState { it.copy(threadId = threadId) }
|
||||||
|
|
||||||
theme = prefs.theme(threadId)
|
theme = prefs.theme(threadId)
|
||||||
|
|
||||||
disposables += theme.asObservable()
|
disposables += theme.asObservable()
|
||||||
|
|||||||
Reference in New Issue
Block a user