Add ripples to unit holders

This commit is contained in:
Ensar Sarajčić 2023-09-14 09:52:05 +02:00
parent 89249927fc
commit 230c2717b0
3 changed files with 19 additions and 1 deletions

View File

@ -3,6 +3,8 @@ package com.simplemobiletools.calculator.views
import android.app.Activity
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.BlendMode
import android.graphics.PorterDuff
import android.graphics.drawable.GradientDrawable
import android.graphics.drawable.LayerDrawable
import android.graphics.drawable.RippleDrawable
@ -87,7 +89,7 @@ class ConverterView @JvmOverloads constructor(
)
}
binding.topUnitHolder.setBackgroundColor(context.getProperPrimaryColor().lightenColor().adjustAlpha(LOWER_ALPHA))
binding.topUnitHolder.backgroundTintList = ColorStateList.valueOf(context.getProperPrimaryColor().lightenColor().adjustAlpha(LOWER_ALPHA))
binding.swapButton.applyColorFilter(context.getProperPrimaryColor())
val drawable = ResourcesCompat.getDrawable(

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?android:attr/colorControlHighlight">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="#000000" />
<corners android:radius="@dimen/activity_margin" />
</shape>
</item>
<item android:id="@+id/colored_background">
<shape android:shape="rectangle">
<solid android:color="#FFFFFF" />
</shape>
</item>
</ripple>

View File

@ -11,6 +11,7 @@
android:layout_height="wrap_content"
android:paddingStart="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"
android:background="@drawable/colored_ripple"
android:orientation="vertical"
android:layout_weight="3">
@ -72,6 +73,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/activity_margin"
android:background="@drawable/ripple_background"
android:paddingEnd="@dimen/activity_margin"
android:orientation="vertical"
android:layout_weight="3">