tint tweaks

This commit is contained in:
Phillip Thelen 2023-01-18 15:21:44 +01:00
parent 1724c8e034
commit f85ddcc35d
6 changed files with 23 additions and 9 deletions

View file

@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size android:width="32dp" android:height="32dp" />
<stroke android:width="2dp" android:color="?colorTintedBackgroundOffset" />
<stroke android:width="2dp" android:color="?textColorTintedSecondary" />
</shape>

View file

@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size android:width="32dp" android:height="32dp" />
<solid android:color="@color/white" />
<solid android:color="?tintedUiMain" />
</shape>

View file

@ -184,6 +184,7 @@
android:id="@+id/habit_adjust_positive_streak_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent"
android:inputType="number" />
</com.google.android.material.textfield.TextInputLayout>
<Space
@ -200,6 +201,7 @@
android:id="@+id/habit_adjust_negative_streak_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent"
android:inputType="number"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>

View file

@ -28,6 +28,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.platform.LocalContext
@ -39,6 +40,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.habitrpg.android.habitica.R
import com.habitrpg.android.habitica.ui.theme.HabiticaTheme
import com.habitrpg.common.habitica.extensions.getThemeColor
@Composable
fun HabitScoringSelector(
@ -80,7 +82,13 @@ private fun HabitScoringSelection(
val context = LocalContext.current
val borderColor = selectedState.animateColor {
if (it) HabiticaTheme.colors.tintedUiMain else HabiticaTheme.colors.tintedUiDetails
if (it) HabiticaTheme.colors.tintedUiMain else Color(context.getThemeColor(R.attr.textColorTintedSecondary))
}
val iconColor = selectedState.animateColor {
if (it) HabiticaTheme.colors.tintedUiDetails else Color(context.getThemeColor(R.attr.textColorTintedSecondary))
}
val textColor = selectedState.animateColor {
if (it) Color(context.getThemeColor(R.attr.textColorTintedPrimary)) else Color(context.getThemeColor(R.attr.textColorTintedSecondary))
}
Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(12.dp), modifier = modifier) {
Box(
@ -103,13 +111,13 @@ private fun HabitScoringSelection(
.background(HabiticaTheme.colors.tintedUiMain, CircleShape)
)
}
Image(icon, null, colorFilter = ColorFilter.tint(HabiticaTheme.colors.tintedUiDetails))
Image(icon, null, colorFilter = ColorFilter.tint(iconColor.value))
}
Text(
text,
fontWeight = if (selected) FontWeight.Medium else FontWeight.Normal,
fontSize = 14.sp,
color = HabiticaTheme.colors.tintedUiDetails
color = textColor.value
)
}
}

View file

@ -2,6 +2,7 @@ package com.habitrpg.android.habitica.ui.views.tasks.form
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.animateColor
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.spring
import androidx.compose.animation.core.updateTransition
@ -76,6 +77,10 @@ private fun <V> TaskFormSelection(
modifier: Modifier = Modifier
) {
val selectedState = updateTransition(selected)
val context = LocalContext.current
val textColor = selectedState.animateColor {
if (it) HabiticaTheme.colors.tintedUiDetails else Color(context.getThemeColor(R.attr.textColorTintedSecondary))
}
Box(
contentAlignment = Alignment.Center, modifier = modifier
.background(
@ -102,7 +107,7 @@ private fun <V> TaskFormSelection(
text,
fontWeight = if (selected) FontWeight.Medium else FontWeight.Normal,
fontSize = 16.sp,
color = HabiticaTheme.colors.tintedUiDetails,
color = textColor.value,
modifier = Modifier.padding(15.dp)
)
}

View file

@ -287,11 +287,10 @@ class TaskSchedulingControls @JvmOverloads constructor(
button.tag = weekdayCode
if (isActive) {
button.background = ContextCompat.getDrawable(context, R.drawable.habit_scoring_circle_selected)
button.background.mutate().setTint(tintColor)
button.setTextColor(context.getThemeColor(R.attr.tintedUiMain))
button.setTextColor(context.getThemeColor(R.attr.tintedUiDetails))
} else {
button.background = ContextCompat.getDrawable(context, R.drawable.habit_scoring_circle)
button.setTextColor(context.getThemeColor(R.attr.colorPrimaryDark))
button.setTextColor(context.getThemeColor(R.attr.textColorTintedSecondary))
}
button.setOnClickListener {
setWeekdayActive(weekdayCode, !isActive)