mirror of
				https://github.com/SimpleMobileTools/Simple-Keyboard.git
				synced 2025-06-05 21:49:26 +02:00 
			
		
		
		
	properly color the background of pinned clips
This commit is contained in:
		| @@ -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) | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user