forked from upstream-mirrors/quik
Message bubble respects dark theme
This commit is contained in:
@@ -25,6 +25,10 @@ class Colors @Inject constructor(context: Context, prefs: Preferences) {
|
||||
.map { dark -> if (dark) R.color.backgroundDark else R.color.backgroundLight }
|
||||
.map { res -> context.resources.getColor(res) }
|
||||
|
||||
val bubble: Observable<Int> = prefs.dark.asObservable()
|
||||
.map { dark -> if (dark) R.color.bubbleDark else R.color.bubbleLight }
|
||||
.map { res -> context.resources.getColor(res) }
|
||||
|
||||
val switchThumbEnabled: Observable<Int> = prefs.dark.asObservable()
|
||||
.map { dark -> if (dark) R.color.switch_thumb_enabled_dark else R.color.switch_thumb_enabled_light }
|
||||
.map { res -> context.resources.getColor(res) }
|
||||
@@ -41,8 +45,6 @@ class Colors @Inject constructor(context: Context, prefs: Preferences) {
|
||||
.map { dark -> if (dark) R.color.switch_track_disabled_dark else R.color.switch_track_disabled_light }
|
||||
.map { res -> context.resources.getColor(res) }
|
||||
|
||||
val bubbleColor = 0xFFFFFFFF.toInt()
|
||||
|
||||
val textPrimary = 0xFF49555F.toInt()
|
||||
val textSecondary = 0xFF70808D.toInt()
|
||||
val textTertiary = 0xFFB7B9C0.toInt()
|
||||
|
||||
@@ -8,8 +8,8 @@ import android.view.ViewGroup
|
||||
import com.jakewharton.rxbinding2.view.RxView
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.di.appComponent
|
||||
import com.moez.QKSMS.common.util.DateFormatter
|
||||
import com.moez.QKSMS.common.util.Colors
|
||||
import com.moez.QKSMS.common.util.DateFormatter
|
||||
import com.moez.QKSMS.common.util.extensions.dpToPx
|
||||
import com.moez.QKSMS.common.util.extensions.setBackgroundTint
|
||||
import com.moez.QKSMS.common.util.extensions.setPadding
|
||||
@@ -54,7 +54,8 @@ class MessagesAdapter : RealmRecyclerViewAdapter<Message, QkViewHolder>(null, tr
|
||||
when (viewType) {
|
||||
VIEWTYPE_ME -> {
|
||||
view = layoutInflater.inflate(R.layout.message_list_item_out, parent, false)
|
||||
view.body.setBackgroundTint(colors.bubbleColor)
|
||||
disposables += colors.bubble
|
||||
.subscribe { color -> view.body.setBackgroundTint(color) }
|
||||
}
|
||||
else -> {
|
||||
view = layoutInflater.inflate(R.layout.message_list_item_in, parent, false)
|
||||
|
||||
@@ -10,10 +10,12 @@
|
||||
<color name="textSecondaryLight">#ccffffff</color>
|
||||
<color name="textTertiaryLight">#80ffffff</color>
|
||||
|
||||
<color name="bubbleLight">#F4F4F4</color>
|
||||
<color name="bubbleLight">#FFFFFF</color>
|
||||
<color name="bubbleDark">#333333</color>
|
||||
|
||||
<color name="backgroundLight">#F2F2F2</color>
|
||||
<color name="backgroundDark">#212121</color>
|
||||
|
||||
<color name="statusLight">#F1F1F1</color>
|
||||
|
||||
<color name="list_separator">#F2F2F2</color>
|
||||
|
||||
Reference in New Issue
Block a user