Fix color of conversation theme checkmark

This commit is contained in:
Moez Bhatti
2018-03-14 16:23:12 -07:00
parent 46da38c8c6
commit abd1766483
4 changed files with 14 additions and 2 deletions
@@ -47,6 +47,12 @@ class ThemeAdapter @Inject constructor(
private val colors: Colors
) : QkAdapter<List<Int>>() {
var threadId: Long = 0
set(value) {
field = value
threadIdChanged()
}
val colorSelected: Subject<Int> = PublishSubject.create()
var selectedColor: Int = -1
@@ -113,9 +119,11 @@ class ThemeAdapter @Inject constructor(
.forEach { theme -> view.palette.addView(theme) }
}
override fun onAttachedToRecyclerView(recyclerView: RecyclerView) {
disposables += colors.textPrimaryOnTheme
private fun threadIdChanged() {
disposables.clear()
disposables += colors.textPrimaryOnThemeForConversation(threadId)
.subscribe { color -> iconTint = color }
}
override fun onDetachedFromRecyclerView(recyclerView: RecyclerView) {
@@ -67,6 +67,7 @@ class ThemePickerActivity : QkThemedActivity<ThemePickerViewModel>(), ThemePicke
rgbPicker.alpha = state.rgbAlpha
rgbPicker.setBackgroundColor(state.selectedColor)
themeAdapter.threadId = state.threadId
themeAdapter.selectedColor = state.selectedColor
}
@@ -19,6 +19,7 @@
package presentation.feature.themepicker
data class ThemePickerState(
val threadId: Long = 0,
val selectedColor: Int = -1,
val rgbAlpha: Float = 0f
)
@@ -39,6 +39,8 @@ class ThemePickerViewModel(intent: Intent) : QkViewModel<ThemePickerView, ThemeP
init {
appComponent.inject(this)
newState { it.copy(threadId = threadId) }
theme = prefs.theme(threadId)
disposables += theme.asObservable()