Add per-conversation theme support

This commit is contained in:
Moez Bhatti
2018-03-12 17:42:33 -07:00
parent 6d6b3fbf77
commit b1625d7cd6
19 changed files with 166 additions and 76 deletions
@@ -136,14 +136,22 @@ class ComposeActivity : QkThemedActivity<ComposeViewModel>(), ComposeView {
intArrayOf(android.R.attr.state_enabled),
intArrayOf(-android.R.attr.state_enabled))
val iconEnabled = threadId
.distinctUntilChanged()
.switchMap { threadId -> colors.textPrimaryOnThemeForConversation(threadId) }
val iconDisabled = threadId
.distinctUntilChanged()
.switchMap { threadId -> colors.textTertiaryOnThemeForConversation(threadId) }
Observables
.combineLatest(colors.textPrimaryOnTheme, colors.textTertiaryOnTheme, { primary, tertiary ->
.combineLatest(iconEnabled, iconDisabled, { primary, tertiary ->
ColorStateList(states, intArrayOf(primary, tertiary))
})
.autoDisposable(scope())
.subscribe { tintList -> sendIcon.imageTintList = tintList }
colors.theme
theme
.autoDisposable(scope())
.subscribe { color -> send.setBackgroundTint(color) }
@@ -184,6 +192,8 @@ class ComposeActivity : QkThemedActivity<ComposeViewModel>(), ComposeView {
return
}
threadId.onNext(state.selectedConversation)
toolbarTitle.setVisible(!state.editingMode)
chips.setVisible(state.editingMode)
contacts.setVisible(state.contactsVisible)