mirror of
https://github.com/SimpleMobileTools/Simple-Keyboard.git
synced 2025-02-17 04:10:40 +01:00
properly color the background of pinned clips
This commit is contained in:
parent
e8c4d4c6b7
commit
7a48011aa4
@ -2,6 +2,8 @@ package com.simplemobiletools.keyboard.adapters
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.graphics.drawable.LayerDrawable
|
||||||
|
import android.graphics.drawable.RippleDrawable
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@ -33,6 +35,7 @@ class ClipsKeyboardAdapter(
|
|||||||
private val layoutInflater = LayoutInflater.from(context)
|
private val layoutInflater = LayoutInflater.from(context)
|
||||||
private val baseConfig = context.config
|
private val baseConfig = context.config
|
||||||
private var textColor = baseConfig.textColor
|
private var textColor = baseConfig.textColor
|
||||||
|
private var backgroundColor = baseConfig.backgroundColor
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
val layoutId = when (viewType) {
|
val layoutId = when (viewType) {
|
||||||
@ -64,10 +67,16 @@ class ClipsKeyboardAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setupClip(view: View, clip: Clip) {
|
private fun setupClip(view: View, clip: Clip) {
|
||||||
view.clip_value.apply {
|
view.apply {
|
||||||
text = clip.value
|
val rippleBg = clip_holder.background as RippleDrawable
|
||||||
removeUnderlines()
|
val layerDrawable = rippleBg.findDrawableByLayerId(R.id.clipboard_background_holder) as LayerDrawable
|
||||||
setTextColor(textColor)
|
layerDrawable.findDrawableByLayerId(R.id.clipboard_background_shape).applyColorFilter(backgroundColor)
|
||||||
|
|
||||||
|
clip_value.apply {
|
||||||
|
text = clip.value
|
||||||
|
removeUnderlines()
|
||||||
|
setTextColor(textColor)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user