diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 81f069b..945fb45 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -15,7 +15,7 @@ android { applicationId = "com.d4rk.cartcalculator" minSdk = 26 targetSdk = 34 - versionCode = 43 + versionCode = 44 versionName = "1.0.1" archivesName = "${applicationId}-v${versionName}" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/kotlin/com/d4rk/cartcalculator/ui/settings/privacy/ads/AdsSettingsComposable.kt b/app/src/main/kotlin/com/d4rk/cartcalculator/ui/settings/privacy/ads/AdsSettingsComposable.kt index 4af8fc1..928f713 100644 --- a/app/src/main/kotlin/com/d4rk/cartcalculator/ui/settings/privacy/ads/AdsSettingsComposable.kt +++ b/app/src/main/kotlin/com/d4rk/cartcalculator/ui/settings/privacy/ads/AdsSettingsComposable.kt @@ -80,6 +80,7 @@ fun AdsSettingsComposable(activity : AdsSettingsActivity) { item { Box(modifier = Modifier.padding(horizontal = 8.dp)) { PreferenceItem(title = stringResource(R.string.personalized_ads) , + enabled = switchState.value , summary = stringResource(id = R.string.summary_ads_personalized_ads) , onClick = { val params = ConsentRequestParameters.Builder() diff --git a/app/src/main/kotlin/com/d4rk/cartcalculator/utils/ComposablesUtils.kt b/app/src/main/kotlin/com/d4rk/cartcalculator/utils/ComposablesUtils.kt index e4359e8..6fd6bee 100644 --- a/app/src/main/kotlin/com/d4rk/cartcalculator/utils/ComposablesUtils.kt +++ b/app/src/main/kotlin/com/d4rk/cartcalculator/utils/ComposablesUtils.kt @@ -20,6 +20,7 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Check import androidx.compose.material3.Card import androidx.compose.material3.Icon +import androidx.compose.material3.LocalContentColor import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Switch import androidx.compose.material3.SwitchDefaults @@ -118,30 +119,40 @@ fun PreferenceCategoryItem( */ @Composable fun PreferenceItem( - icon: ImageVector? = null, - title: String? = null, - summary: String? = null, - onClick: () -> Unit = {} + icon : ImageVector? = null , + title : String? = null , + summary : String? = null , + enabled : Boolean = true , + onClick : () -> Unit = {} ) { Row( modifier = Modifier - .fillMaxWidth() - .clip(RoundedCornerShape(16.dp)) - .clickable(onClick = onClick), verticalAlignment = Alignment.CenterVertically + .fillMaxWidth() + .clip(RoundedCornerShape(16.dp)) + .clickable(enabled = enabled , onClick = onClick) , + verticalAlignment = Alignment.CenterVertically ) { icon?.let { Spacer(modifier = Modifier.width(16.dp)) - Icon(it, contentDescription = null) + Icon(it , contentDescription = null) Spacer(modifier = Modifier.width(16.dp)) } Column( modifier = Modifier.padding(16.dp) ) { title?.let { - Text(text = it, style = MaterialTheme.typography.titleLarge) + Text( + text = it , + style = MaterialTheme.typography.titleLarge , + color = if (! enabled) LocalContentColor.current.copy(alpha = 0.38f) else LocalContentColor.current + ) } summary?.let { - Text(text = it, style = MaterialTheme.typography.bodyMedium) + Text( + text = it , + style = MaterialTheme.typography.bodyMedium , + color = if (! enabled) LocalContentColor.current.copy(alpha = 0.38f) else LocalContentColor.current + ) } } }