From ed2e91f036220af251fcad84b3231b8429630879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Thu, 14 Sep 2023 09:53:32 +0200 Subject: [PATCH] Remove ripple effect from bottom unit when top is tapped --- .../calculator/views/ConverterView.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calculator/views/ConverterView.kt b/app/src/main/kotlin/com/simplemobiletools/calculator/views/ConverterView.kt index fb6d4674..0ad03136 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calculator/views/ConverterView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calculator/views/ConverterView.kt @@ -92,13 +92,13 @@ class ConverterView @JvmOverloads constructor( binding.topUnitHolder.backgroundTintList = ColorStateList.valueOf(context.getProperPrimaryColor().lightenColor().adjustAlpha(LOWER_ALPHA)) binding.swapButton.applyColorFilter(context.getProperPrimaryColor()) - val drawable = ResourcesCompat.getDrawable( - resources, com.simplemobiletools.commons.R.drawable.pill_background, context.theme - )?.constantState?.newDrawable()?.mutate() as RippleDrawable - val bgLayerList = drawable.findDrawableByLayerId(com.simplemobiletools.commons.R.id.button_pill_background_holder) as LayerDrawable - val bgLayer = bgLayerList.findDrawableByLayerId(com.simplemobiletools.commons.R.id.button_pill_background_shape) as GradientDrawable - bgLayer.cornerRadius = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.rounded_corner_radius_big) listOf(binding.topUnitSymbol, binding.bottomUnitSymbol).forEach { + val drawable = ResourcesCompat.getDrawable( + resources, com.simplemobiletools.commons.R.drawable.pill_background, context.theme + )?.constantState?.newDrawable()?.mutate() as RippleDrawable + val bgLayerList = drawable.findDrawableByLayerId(com.simplemobiletools.commons.R.id.button_pill_background_holder) as LayerDrawable + val bgLayer = bgLayerList.findDrawableByLayerId(com.simplemobiletools.commons.R.id.button_pill_background_shape) as GradientDrawable + bgLayer.cornerRadius = context.resources.getDimension(com.simplemobiletools.commons.R.dimen.rounded_corner_radius_big) it.background = drawable it.background?.alpha = MEDIUM_ALPHA_INT }