More 5.0 theme fixes

This commit is contained in:
Moez Bhatti
2019-11-24 02:22:53 -05:00
parent a8cc408390
commit fbf10d6e6e
2 changed files with 10 additions and 1 deletions
@@ -64,7 +64,7 @@ fun View.setBackgroundTint(color: Int) {
// API 21 doesn't support this
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) {
background?.setColorFilter(color, PorterDuff.Mode.SRC_ATOP)
background?.setColorFilter(color, PorterDuff.Mode.SRC_IN)
}
backgroundTintList = ColorStateList.valueOf(color)
@@ -19,6 +19,7 @@
package com.moez.QKSMS.feature.compose.editing
import android.content.Context
import android.os.Build
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.RelativeLayout
@@ -27,7 +28,10 @@ import com.moez.QKSMS.R
import com.moez.QKSMS.common.base.QkAdapter
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 io.reactivex.subjects.PublishSubject
import kotlinx.android.synthetic.main.contact_chip.*
import kotlinx.android.synthetic.main.contact_chip.view.*
import javax.inject.Inject
@@ -40,6 +44,11 @@ class ChipsAdapter @Inject constructor() : QkAdapter<Chip>() {
val inflater = LayoutInflater.from(parent.context)
val view = inflater.inflate(R.layout.contact_chip, parent, false)
return QkViewHolder(view).apply {
// These theme attributes don't apply themselves on API 21
if (Build.VERSION.SDK_INT <= 22) {
content.setBackgroundTint(view.context.resolveThemeColor(R.attr.bubbleColor))
}
view.setOnClickListener {
val chip = getItem(adapterPosition)
showDetailedChip(view.context, chip)