This commit is contained in:
Sad Ellie 2023-04-08 20:40:06 +03:00
parent cd2b27c094
commit ede1ffe2cd
6 changed files with 55 additions and 55 deletions

View File

@ -33,9 +33,9 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.ListItem import androidx.compose.material3.ListItem
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.OutlinedTextFieldDefaults
import androidx.compose.material3.Switch import androidx.compose.material3.Switch
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
@ -52,7 +52,7 @@ import com.sadellie.unitto.core.ui.R
* Represents one item in list on Settings screen. * Represents one item in list on Settings screen.
* *
* @param label Main text. * @param label Main text.
* @param supportText Text that is located below label. * @param supportContent Text that is located below label.
* @param switchState Current switch state. * @param switchState Current switch state.
* @param onSwitchChange Action to perform when user clicks on this component or just switch. Gives * @param onSwitchChange Action to perform when user clicks on this component or just switch. Gives
* you new value. * you new value.
@ -61,7 +61,7 @@ import com.sadellie.unitto.core.ui.R
fun UnittoListItem( fun UnittoListItem(
label: String, label: String,
leadingContent: @Composable (() -> Unit)?, leadingContent: @Composable (() -> Unit)?,
supportText: String? = null, supportContent: String? = null,
switchState: Boolean, switchState: Boolean,
onSwitchChange: (Boolean) -> Unit onSwitchChange: (Boolean) -> Unit
) { ) {
@ -72,8 +72,8 @@ fun UnittoListItem(
indication = rememberRipple(), indication = rememberRipple(),
onClick = { onSwitchChange(!switchState) } onClick = { onSwitchChange(!switchState) }
), ),
headlineText = { Text(label) }, headlineContent = { Text(label) },
supportingText = { supportText?.let { Text(text = it) } }, supportingContent = { supportContent?.let { Text(text = it) } },
leadingContent = leadingContent, leadingContent = leadingContent,
trailingContent = { trailingContent = {
Switch( Switch(
@ -111,8 +111,8 @@ fun <T> UnittoListItem(
) )
ListItem( ListItem(
headlineText = { Text(label) }, headlineContent = { Text(label) },
supportingText = { supportText?.let { Text(text = it) } }, supportingContent = { supportText?.let { Text(text = it) } },
leadingContent = leadingContent, leadingContent = leadingContent,
trailingContent = { trailingContent = {
ExposedDropdownMenuBox( ExposedDropdownMenuBox(
@ -130,10 +130,10 @@ fun <T> UnittoListItem(
singleLine = true, singleLine = true,
enabled = false, enabled = false,
textStyle = MaterialTheme.typography.bodyLarge, textStyle = MaterialTheme.typography.bodyLarge,
colors = TextFieldDefaults.outlinedTextFieldColors( colors = OutlinedTextFieldDefaults.colors(
disabledBorderColor = MaterialTheme.colorScheme.outline,
disabledTextColor = MaterialTheme.colorScheme.onSurface, disabledTextColor = MaterialTheme.colorScheme.onSurface,
disabledTrailingIconColor = MaterialTheme.colorScheme.onSurfaceVariant disabledBorderColor = MaterialTheme.colorScheme.outline,
disabledTrailingIconColor = MaterialTheme.colorScheme.onSurfaceVariant,
), ),
trailingIcon = { trailingIcon = {
Icon( Icon(

View File

@ -75,7 +75,7 @@ internal fun AboutScreen(
stringResource(R.string.currency_rates_note_setting) stringResource(R.string.currency_rates_note_setting)
) )
}, },
headlineText = { Text(stringResource(R.string.currency_rates_note_setting)) }, headlineContent = { Text(stringResource(R.string.currency_rates_note_setting)) },
modifier = Modifier.clickable { showDialog = true } modifier = Modifier.clickable { showDialog = true }
) )
} }
@ -89,7 +89,7 @@ internal fun AboutScreen(
stringResource(R.string.terms_and_conditions) stringResource(R.string.terms_and_conditions)
) )
}, },
headlineText = { Text(stringResource(R.string.terms_and_conditions)) }, headlineContent = { Text(stringResource(R.string.terms_and_conditions)) },
modifier = Modifier.clickable { modifier = Modifier.clickable {
openLink( openLink(
mContext, mContext,
@ -108,7 +108,7 @@ internal fun AboutScreen(
stringResource(R.string.privacy_policy) stringResource(R.string.privacy_policy)
) )
}, },
headlineText = { Text(stringResource(R.string.privacy_policy)) }, headlineContent = { Text(stringResource(R.string.privacy_policy)) },
modifier = Modifier.clickable { modifier = Modifier.clickable {
openLink( openLink(
mContext, mContext,
@ -127,7 +127,7 @@ internal fun AboutScreen(
stringResource(R.string.open_source) stringResource(R.string.open_source)
) )
}, },
headlineText = { Text(stringResource(R.string.open_source)) }, headlineContent = { Text(stringResource(R.string.open_source)) },
modifier = Modifier.clickable { modifier = Modifier.clickable {
openLink( openLink(
mContext, mContext,
@ -146,8 +146,8 @@ internal fun AboutScreen(
stringResource(R.string.translate_app) stringResource(R.string.translate_app)
) )
}, },
headlineText = { Text(stringResource(R.string.translate_app)) }, headlineContent = { Text(stringResource(R.string.translate_app)) },
supportingText = { Text(stringResource(R.string.translate_app_support)) }, supportingContent = { Text(stringResource(R.string.translate_app_support)) },
modifier = Modifier.clickable { modifier = Modifier.clickable {
openLink( openLink(
mContext, mContext,
@ -166,7 +166,7 @@ internal fun AboutScreen(
stringResource(R.string.third_party_licenses) stringResource(R.string.third_party_licenses)
) )
}, },
headlineText = { Text(stringResource(R.string.third_party_licenses)) }, headlineContent = { Text(stringResource(R.string.third_party_licenses)) },
modifier = Modifier.clickable { navigateToThirdParty() } modifier = Modifier.clickable { navigateToThirdParty() }
) )
} }
@ -180,8 +180,8 @@ internal fun AboutScreen(
stringResource(R.string.app_version_name_setting) stringResource(R.string.app_version_name_setting)
) )
}, },
headlineText = { Text(stringResource(R.string.app_version_name_setting)) }, headlineContent = { Text(stringResource(R.string.app_version_name_setting)) },
supportingText = { Text("${BuildConfig.APP_NAME} (${BuildConfig.APP_CODE})") }, supportingContent = { Text("${BuildConfig.APP_NAME} (${BuildConfig.APP_CODE})") },
modifier = Modifier.combinedClickable { modifier = Modifier.combinedClickable {
if (userPrefs.value.enableToolsExperiment) { if (userPrefs.value.enableToolsExperiment) {
Toast.makeText(mContext, "Tools already enabled!", Toast.LENGTH_LONG).show() Toast.makeText(mContext, "Tools already enabled!", Toast.LENGTH_LONG).show()

View File

@ -88,8 +88,8 @@ internal fun SettingsScreen(
stringResource(R.string.theme_setting), stringResource(R.string.theme_setting),
) )
}, },
headlineText = { Text(stringResource(R.string.theme_setting)) }, headlineContent = { Text(stringResource(R.string.theme_setting)) },
supportingText = { Text(stringResource(R.string.theme_setting_support)) }, supportingContent = { Text(stringResource(R.string.theme_setting_support)) },
modifier = Modifier.clickable { navControllerAction(themesRoute) } modifier = Modifier.clickable { navControllerAction(themesRoute) }
) )
} }
@ -103,8 +103,8 @@ internal fun SettingsScreen(
stringResource(R.string.starting_screen_setting), stringResource(R.string.starting_screen_setting),
) )
}, },
headlineText = { Text(stringResource(R.string.starting_screen_setting)) }, headlineContent = { Text(stringResource(R.string.starting_screen_setting)) },
supportingText = { Text(stringResource(R.string.starting_screen_setting_support)) }, supportingContent = { Text(stringResource(R.string.starting_screen_setting_support)) },
modifier = Modifier.clickable { dialogState = DialogState.START_SCREEN } modifier = Modifier.clickable { dialogState = DialogState.START_SCREEN }
) )
} }
@ -121,8 +121,8 @@ internal fun SettingsScreen(
stringResource(R.string.precision_setting), stringResource(R.string.precision_setting),
) )
}, },
headlineText = { Text(stringResource(R.string.precision_setting)) }, headlineContent = { Text(stringResource(R.string.precision_setting)) },
supportingText = { Text(stringResource(R.string.precision_setting_support)) }, supportingContent = { Text(stringResource(R.string.precision_setting_support)) },
modifier = Modifier.clickable { dialogState = DialogState.PRECISION } modifier = Modifier.clickable { dialogState = DialogState.PRECISION }
) )
} }
@ -130,8 +130,8 @@ internal fun SettingsScreen(
// SEPARATOR // SEPARATOR
item { item {
ListItem( ListItem(
headlineText = { Text(stringResource(R.string.separator_setting)) }, headlineContent = { Text(stringResource(R.string.separator_setting)) },
supportingText = { Text(stringResource(R.string.separator_setting_support)) }, supportingContent = { Text(stringResource(R.string.separator_setting_support)) },
modifier = Modifier modifier = Modifier
.clickable { dialogState = DialogState.SEPARATOR } .clickable { dialogState = DialogState.SEPARATOR }
.padding(start = 40.dp) .padding(start = 40.dp)
@ -141,8 +141,8 @@ internal fun SettingsScreen(
// OUTPUT FORMAT // OUTPUT FORMAT
item { item {
ListItem( ListItem(
headlineText = { Text(stringResource(R.string.output_format_setting)) }, headlineContent = { Text(stringResource(R.string.output_format_setting)) },
supportingText = { Text(stringResource(R.string.output_format_setting_support)) }, supportingContent = { Text(stringResource(R.string.output_format_setting_support)) },
modifier = Modifier modifier = Modifier
.clickable { dialogState = DialogState.OUTPUT_FORMAT } .clickable { dialogState = DialogState.OUTPUT_FORMAT }
.padding(start = 40.dp) .padding(start = 40.dp)
@ -161,8 +161,8 @@ internal fun SettingsScreen(
stringResource(R.string.disable_unit_group_description), stringResource(R.string.disable_unit_group_description),
) )
}, },
headlineText = { Text(stringResource(R.string.unit_groups_setting)) }, headlineContent = { Text(stringResource(R.string.unit_groups_setting)) },
supportingText = { Text(stringResource(R.string.unit_groups_support)) }, supportingContent = { Text(stringResource(R.string.unit_groups_support)) },
modifier = Modifier.clickable { navControllerAction(unitsGroupRoute) } modifier = Modifier.clickable { navControllerAction(unitsGroupRoute) }
) )
} }
@ -176,8 +176,8 @@ internal fun SettingsScreen(
stringResource(R.string.units_sorting) stringResource(R.string.units_sorting)
) )
}, },
headlineText = { Text(stringResource(R.string.units_sorting)) }, headlineContent = { Text(stringResource(R.string.units_sorting)) },
supportingText = { Text(stringResource(R.string.units_sorting_support)) }, supportingContent = { Text(stringResource(R.string.units_sorting_support)) },
modifier = Modifier.clickable { dialogState = DialogState.UNIT_LIST_SORTING } modifier = Modifier.clickable { dialogState = DialogState.UNIT_LIST_SORTING }
) )
} }
@ -192,7 +192,7 @@ internal fun SettingsScreen(
stringResource(R.string.format_time) stringResource(R.string.format_time)
) )
}, },
supportText = stringResource(R.string.format_time_support), supportContent = stringResource(R.string.format_time_support),
switchState = userPrefs.value.unitConverterFormatTime, switchState = userPrefs.value.unitConverterFormatTime,
onSwitchChange = viewModel::updateUnitConverterFormatTime onSwitchChange = viewModel::updateUnitConverterFormatTime
) )
@ -211,7 +211,7 @@ internal fun SettingsScreen(
stringResource(R.string.enable_vibrations) stringResource(R.string.enable_vibrations)
) )
}, },
supportText = stringResource(R.string.enable_vibrations_support), supportContent = stringResource(R.string.enable_vibrations_support),
switchState = userPrefs.value.enableVibrations, switchState = userPrefs.value.enableVibrations,
onSwitchChange = viewModel::updateVibrations onSwitchChange = viewModel::updateVibrations
) )
@ -227,7 +227,7 @@ internal fun SettingsScreen(
stringResource(R.string.rate_this_app), stringResource(R.string.rate_this_app),
) )
}, },
headlineText = { Text(stringResource(R.string.rate_this_app)) }, headlineContent = { Text(stringResource(R.string.rate_this_app)) },
modifier = Modifier.clickable { openLink(mContext, BuildConfig.STORE_LINK) } modifier = Modifier.clickable { openLink(mContext, BuildConfig.STORE_LINK) }
) )
} }
@ -242,8 +242,8 @@ internal fun SettingsScreen(
stringResource(R.string.about_unitto), stringResource(R.string.about_unitto),
) )
}, },
headlineText = { Text(stringResource(R.string.about_unitto)) }, headlineContent = { Text(stringResource(R.string.about_unitto)) },
supportingText = { Text(stringResource(R.string.about_unitto_support)) }, supportingContent = { Text(stringResource(R.string.about_unitto_support)) },
modifier = Modifier.clickable { navControllerAction(aboutRoute) } modifier = Modifier.clickable { navControllerAction(aboutRoute) }
) )
} }

View File

@ -82,7 +82,7 @@ internal fun ThemesScreen(
) )
}, },
label = stringResource(R.string.enable_dynamic_colors), label = stringResource(R.string.enable_dynamic_colors),
supportText = stringResource(R.string.enable_dynamic_colors_support), supportContent = stringResource(R.string.enable_dynamic_colors_support),
switchState = themmoController.isDynamicThemeEnabled, switchState = themmoController.isDynamicThemeEnabled,
onSwitchChange = { onSwitchChange = {
themmoController.enableDynamicTheme(it) themmoController.enableDynamicTheme(it)
@ -106,7 +106,7 @@ internal fun ThemesScreen(
) )
}, },
label = stringResource(R.string.force_amoled_mode), label = stringResource(R.string.force_amoled_mode),
supportText = stringResource(R.string.force_amoled_mode_support), supportContent = stringResource(R.string.force_amoled_mode_support),
switchState = themmoController.isAmoledThemeEnabled, switchState = themmoController.isAmoledThemeEnabled,
onSwitchChange = { onSwitchChange = {
themmoController.enableAmoledTheme(it) themmoController.enableAmoledTheme(it)

View File

@ -100,7 +100,7 @@ internal fun UnitGroupsScreen(
} }
ListItem( ListItem(
headlineText = { Text(stringResource(item.res)) }, headlineContent = { Text(stringResource(item.res)) },
modifier = Modifier modifier = Modifier
.padding(horizontal = itemPadding) .padding(horizontal = itemPadding)
.clip(CircleShape) .clip(CircleShape)
@ -153,7 +153,7 @@ internal fun UnitGroupsScreen(
.background(MaterialTheme.colorScheme.surface) .background(MaterialTheme.colorScheme.surface)
.clickable { viewModel.returnUnitGroup(it) } .clickable { viewModel.returnUnitGroup(it) }
.animateItemPlacement(), .animateItemPlacement(),
headlineText = { Text(stringResource(it.res)) }, headlineContent = { Text(stringResource(it.res)) },
trailingContent = { trailingContent = {
Icon( Icon(
Icons.Default.AddCircleOutline, Icons.Default.AddCircleOutline,

View File

@ -2,31 +2,31 @@
appCode = "19" appCode = "19"
appName = "Jazzberry jam" appName = "Jazzberry jam"
kotlin = "1.8.10" kotlin = "1.8.10"
androidxCore = "1.9.0" androidxCore = "1.10.0"
androidGradlePlugin = "7.4.1" androidGradlePlugin = "7.4.2"
orgJetbrainsKotlinxCoroutinesTest = "1.6.4" orgJetbrainsKotlinxCoroutinesTest = "1.6.4"
androidxCompose = "1.4.0-beta01" androidxCompose = "1.5.0-alpha02"
androidxComposeCompiler = "1.4.2" androidxComposeCompiler = "1.4.4"
androidxComposeUi = "1.4.0-beta01" androidxComposeUi = "1.5.0-alpha02"
androidxComposeMaterial3 = "1.1.0-alpha06" androidxComposeMaterial3 = "1.1.0-beta02"
androidxNavigation = "2.5.3" androidxNavigation = "2.5.3"
androidxLifecycleRuntimeCompose = "2.6.0-beta01" androidxLifecycleRuntimeCompose = "2.6.1"
androidxHilt = "1.0.0" androidxHilt = "1.0.0"
comGoogleDagger = "2.44.2" comGoogleDagger = "2.45"
androidxComposeMaterialIconsExtended = "1.4.0-alpha04" androidxComposeMaterialIconsExtended = "1.5.0-alpha02"
androidxDatastore = "1.0.0" androidxDatastore = "1.0.0"
comGoogleAccompanist = "0.27.1" comGoogleAccompanist = "0.30.1"
androidxRoom = "2.4.3" androidxRoom = "2.5.1"
comSquareupMoshi = "1.14.0" comSquareupMoshi = "1.14.0"
comSquareupRetrofit2 = "2.9.0" comSquareupRetrofit2 = "2.9.0"
comGithubSadellieThemmo = "cf6be7e592" comGithubSadellieThemmo = "3e34a0dcfe"
orgBurnoutcrewComposereorderable = "0.9.6" orgBurnoutcrewComposereorderable = "0.9.6"
comGithubSadellieExprk = "e55cba8f41" comGithubSadellieExprk = "e55cba8f41"
mxParser = "5.2.1" mxParser = "5.2.1"
junit = "4.13.2" junit = "4.13.2"
androidxTest = "1.5.0" androidxTest = "1.5.0"
androidxTestExt = "1.1.4" androidxTestExt = "1.1.4"
androidDesugarJdkLibs = "2.0.2" androidDesugarJdkLibs = "2.0.3"
androidxTestRunner = "1.5.1" androidxTestRunner = "1.5.1"
androidxTestRules = "1.5.0" androidxTestRules = "1.5.0"
orgRobolectric = "4.9" orgRobolectric = "4.9"