diff --git a/app/src/main/kotlin/com/simplemobiletools/calculator/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calculator/activities/SettingsActivity.kt index 58c55593..91bddd2e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calculator/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calculator/activities/SettingsActivity.kt @@ -11,11 +11,13 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.simplemobiletools.calculator.compose.SettingsScreen import com.simplemobiletools.calculator.extensions.* import com.simplemobiletools.commons.activities.CustomizationActivity +import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState import com.simplemobiletools.commons.compose.extensions.enableEdgeToEdgeSimple import com.simplemobiletools.commons.compose.extensions.onEventValue import com.simplemobiletools.commons.compose.theme.AppThemeSurface import com.simplemobiletools.commons.compose.theme.getAppIconIds import com.simplemobiletools.commons.compose.theme.getAppLauncherName +import com.simplemobiletools.commons.dialogs.FeatureLockedAlertDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.* import java.util.Locale @@ -44,6 +46,13 @@ class SettingsActivity : AppCompatActivity() { } val isOrWasThankYouInstalled = onEventValue { context.isOrWasThankYouInstalled() } val displayLanguage = remember { Locale.getDefault().displayLanguage } + val featureLockedDialogState = rememberAlertDialogState().apply { + DialogMember { + FeatureLockedAlertDialog(alertDialogState = this) { + + } + } + } SettingsScreen( displayLanguage = displayLanguage, goBack = ::finish, @@ -70,7 +79,8 @@ class SettingsActivity : AppCompatActivity() { applicationContext.calculatorDB.deleteHistory() } }, - lockedCustomizeColorText = getCustomizeColorsString() + lockedCustomizeColorText = getCustomizeColorsString(), + featureLockedDialogState = featureLockedDialogState ) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calculator/compose/SettingsScreen.kt b/app/src/main/kotlin/com/simplemobiletools/calculator/compose/SettingsScreen.kt index ac3dea48..7e75f07c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calculator/compose/SettingsScreen.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calculator/compose/SettingsScreen.kt @@ -5,6 +5,8 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource import com.simplemobiletools.commons.R +import com.simplemobiletools.commons.compose.alert_dialog.AlertDialogState +import com.simplemobiletools.commons.compose.alert_dialog.rememberAlertDialogState import com.simplemobiletools.commons.compose.extensions.MyDevices import com.simplemobiletools.commons.compose.settings.SettingsCheckBoxComponent import com.simplemobiletools.commons.compose.settings.SettingsGroup @@ -33,7 +35,8 @@ internal fun SettingsScreen( useCommaAsDecimalMarkFlow: Boolean, onUseCommaAsDecimalMarkFlow: (Boolean) -> Unit, lockedCustomizeColorText: String, - displayLanguage: String + displayLanguage: String, + featureLockedDialogState : AlertDialogState ) { SettingsScaffold(title = stringResource(id = R.string.settings), goBack = goBack) { SettingsGroup(title = { @@ -41,8 +44,13 @@ internal fun SettingsScreen( }) { SettingsPreferenceComponent( label = lockedCustomizeColorText, - doOnPreferenceClick = customizeColors, - isPreferenceEnabled = isOrWasThankYouInstalled, + doOnPreferenceClick = { + if (isOrWasThankYouInstalled) { + customizeColors() + } else { + featureLockedDialogState.show() + } + }, preferenceLabelColor = MaterialTheme.colorScheme.onSurface ) SettingsPreferenceComponent( @@ -115,7 +123,8 @@ private fun SettingsScreenPreview() { useCommaAsDecimalMarkFlow = false, onUseCommaAsDecimalMarkFlow = {}, lockedCustomizeColorText = "Customize Colors", - displayLanguage = "English" + displayLanguage = "English", + featureLockedDialogState = rememberAlertDialogState() ) } }