refactor: migrate to SimpleTheme from MaterialTheme
This commit is contained in:
parent
7bd3746b83
commit
f60fae4e55
18 changed files with 59 additions and 54 deletions
|
@ -9,7 +9,6 @@ import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.calculateEndPadding
|
import androidx.compose.foundation.layout.calculateEndPadding
|
||||||
import androidx.compose.foundation.layout.calculateStartPadding
|
import androidx.compose.foundation.layout.calculateStartPadding
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.toArgb
|
import androidx.compose.ui.graphics.toArgb
|
||||||
|
@ -24,6 +23,7 @@ import androidx.lifecycle.compose.LifecycleEventEffect
|
||||||
import androidx.lifecycle.compose.LifecycleResumeEffect
|
import androidx.lifecycle.compose.LifecycleResumeEffect
|
||||||
import androidx.lifecycle.compose.LifecycleStartEffect
|
import androidx.lifecycle.compose.LifecycleStartEffect
|
||||||
import com.simplemobiletools.commons.compose.system_ui_controller.rememberSystemUiController
|
import com.simplemobiletools.commons.compose.system_ui_controller.rememberSystemUiController
|
||||||
|
import com.simplemobiletools.commons.compose.theme.SimpleTheme
|
||||||
import com.simplemobiletools.commons.compose.theme.isLitWell
|
import com.simplemobiletools.commons.compose.theme.isLitWell
|
||||||
import com.simplemobiletools.commons.extensions.darkenColor
|
import com.simplemobiletools.commons.extensions.darkenColor
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ fun rememberMutableInteractionSource() = remember { MutableInteractionSource() }
|
||||||
fun AdjustNavigationBarColors() {
|
fun AdjustNavigationBarColors() {
|
||||||
val systemUiController = rememberSystemUiController()
|
val systemUiController = rememberSystemUiController()
|
||||||
val isSystemInDarkTheme = isSystemInDarkTheme()
|
val isSystemInDarkTheme = isSystemInDarkTheme()
|
||||||
val isSurfaceLitWell = MaterialTheme.colorScheme.surface.isLitWell()
|
val isSurfaceLitWell = SimpleTheme.colorScheme.surface.isLitWell()
|
||||||
val navigationBarColor = Color(MaterialTheme.colorScheme.surface.toArgb().darkenColor()).copy(alpha = 0.5f)
|
val navigationBarColor = Color(SimpleTheme.colorScheme.surface.toArgb().darkenColor()).copy(alpha = 0.5f)
|
||||||
DisposableEffect(systemUiController, isSystemInDarkTheme, navigationBarColor) {
|
DisposableEffect(systemUiController, isSystemInDarkTheme, navigationBarColor) {
|
||||||
systemUiController.setNavigationBarColor(color = navigationBarColor, darkIcons = !isSystemInDarkTheme)
|
systemUiController.setNavigationBarColor(color = navigationBarColor, darkIcons = !isSystemInDarkTheme)
|
||||||
systemUiController.navigationBarDarkContentEnabled = isSurfaceLitWell
|
systemUiController.navigationBarDarkContentEnabled = isSurfaceLitWell
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.simplemobiletools.commons.compose.screens
|
package com.simplemobiletools.commons.compose.screens
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
@ -16,6 +15,7 @@ import com.simplemobiletools.commons.compose.settings.SettingsListItem
|
||||||
import com.simplemobiletools.commons.compose.settings.SettingsTitleTextComponent
|
import com.simplemobiletools.commons.compose.settings.SettingsTitleTextComponent
|
||||||
import com.simplemobiletools.commons.compose.settings.scaffold.SettingsScaffold
|
import com.simplemobiletools.commons.compose.settings.scaffold.SettingsScaffold
|
||||||
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
|
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
|
||||||
|
import com.simplemobiletools.commons.compose.theme.SimpleTheme
|
||||||
|
|
||||||
private val startingTitlePadding = Modifier.padding(start = 60.dp)
|
private val startingTitlePadding = Modifier.padding(start = 60.dp)
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ internal fun SocialSection(
|
||||||
click = onGithubClick,
|
click = onGithubClick,
|
||||||
text = stringResource(id = R.string.github),
|
text = stringResource(id = R.string.github),
|
||||||
icon = R.drawable.ic_github_vector,
|
icon = R.drawable.ic_github_vector,
|
||||||
tint = MaterialTheme.colorScheme.onSurface
|
tint = SimpleTheme.colorScheme.onSurface
|
||||||
)
|
)
|
||||||
SocialText(
|
SocialText(
|
||||||
click = onRedditClick,
|
click = onRedditClick,
|
||||||
|
@ -203,7 +203,7 @@ internal fun SocialText(
|
||||||
@Composable
|
@Composable
|
||||||
internal fun TwoLinerTextItem(text: String, icon: Int, click: () -> Unit) {
|
internal fun TwoLinerTextItem(text: String, icon: Int, click: () -> Unit) {
|
||||||
SettingsListItem(
|
SettingsListItem(
|
||||||
tint = MaterialTheme.colorScheme.onSurface,
|
tint = SimpleTheme.colorScheme.onSurface,
|
||||||
click = click,
|
click = click,
|
||||||
text = text,
|
text = text,
|
||||||
icon = icon,
|
icon = icon,
|
||||||
|
|
|
@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.material3.ListItem
|
import androidx.compose.material3.ListItem
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
@ -132,7 +131,7 @@ private fun ContributorItem(
|
||||||
text = stringResource(id = languageContributor.contributorsId),
|
text = stringResource(id = languageContributor.contributorsId),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth(),
|
.fillMaxWidth(),
|
||||||
color = MaterialTheme.colorScheme.onSurface
|
color = SimpleTheme.colorScheme.onSurface
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.lazy.itemsIndexed
|
import androidx.compose.foundation.lazy.itemsIndexed
|
||||||
import androidx.compose.material3.ListItem
|
import androidx.compose.material3.ListItem
|
||||||
import androidx.compose.material3.ListItemDefaults
|
import androidx.compose.material3.ListItemDefaults
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
@ -61,7 +60,7 @@ private fun LicenseItem(
|
||||||
text = stringResource(id = license.textId),
|
text = stringResource(id = license.textId),
|
||||||
modifier = Modifier.padding(top = SimpleTheme.dimens.margin.extraSmall),
|
modifier = Modifier.padding(top = SimpleTheme.dimens.margin.extraSmall),
|
||||||
)
|
)
|
||||||
}, colors = ListItemDefaults.colors(headlineColor = MaterialTheme.colorScheme.primary, supportingColor = MaterialTheme.colorScheme.onSurface))
|
}, colors = ListItemDefaults.colors(headlineColor = SimpleTheme.colorScheme.primary, supportingColor = SimpleTheme.colorScheme.onSurface))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
@ -365,12 +365,12 @@ private fun blockedNumberListItemColors(
|
||||||
) = ListItemDefaults.colors(
|
) = ListItemDefaults.colors(
|
||||||
containerColor = if (isSelected) {
|
containerColor = if (isSelected) {
|
||||||
if (LocalTheme.current is Theme.SystemDefaultMaterialYou) {
|
if (LocalTheme.current is Theme.SystemDefaultMaterialYou) {
|
||||||
Color(MaterialTheme.colorScheme.primaryContainer.toArgb().darkenColor()).copy(alpha = 0.8f)
|
Color(SimpleTheme.colorScheme.primaryContainer.toArgb().darkenColor()).copy(alpha = 0.8f)
|
||||||
} else {
|
} else {
|
||||||
MaterialTheme.colorScheme.primary.copy(alpha = 0.3f)
|
SimpleTheme.colorScheme.primary.copy(alpha = 0.3f)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MaterialTheme.colorScheme.surface
|
SimpleTheme.colorScheme.surface
|
||||||
},
|
},
|
||||||
trailingIconColor = iconsColor
|
trailingIconColor = iconsColor
|
||||||
)
|
)
|
||||||
|
@ -488,7 +488,7 @@ private fun ActionModeToolbar(
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun actionModeBgColor(): Color =
|
private fun actionModeBgColor(): Color =
|
||||||
if (LocalTheme.current is Theme.SystemDefaultMaterialYou) {
|
if (LocalTheme.current is Theme.SystemDefaultMaterialYou) {
|
||||||
MaterialTheme.colorScheme.primaryContainer
|
SimpleTheme.colorScheme.primaryContainer
|
||||||
} else {
|
} else {
|
||||||
actionModeColor
|
actionModeColor
|
||||||
}
|
}
|
||||||
|
@ -580,7 +580,7 @@ private fun LazyListScope.emptyBlockedNumbers(
|
||||||
item {
|
item {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = R.string.not_blocking_anyone),
|
text = stringResource(id = R.string.not_blocking_anyone),
|
||||||
style = TextStyle(fontStyle = FontStyle.Italic, textAlign = TextAlign.Center, color = MaterialTheme.colorScheme.onSurface),
|
style = TextStyle(fontStyle = FontStyle.Italic, textAlign = TextAlign.Center, color = SimpleTheme.colorScheme.onSurface),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(top = SimpleTheme.dimens.margin.extraLarge, bottom = SimpleTheme.dimens.margin.small)
|
.padding(top = SimpleTheme.dimens.margin.extraLarge, bottom = SimpleTheme.dimens.margin.small)
|
||||||
|
@ -602,7 +602,7 @@ private fun LazyListScope.emptyBlockedNumbers(
|
||||||
style = TextStyle(
|
style = TextStyle(
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
textDecoration = TextDecoration.Underline,
|
textDecoration = TextDecoration.Underline,
|
||||||
color = MaterialTheme.colorScheme.primary,
|
color = SimpleTheme.colorScheme.primary,
|
||||||
fontSize = 18.sp
|
fontSize = 18.sp
|
||||||
),
|
),
|
||||||
modifier = Modifier.padding(SimpleTheme.dimens.margin.medium)
|
modifier = Modifier.padding(SimpleTheme.dimens.margin.medium)
|
||||||
|
@ -640,7 +640,7 @@ private fun LazyListScope.noPermissionToBlock(
|
||||||
style = TextStyle(
|
style = TextStyle(
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
textDecoration = TextDecoration.Underline,
|
textDecoration = TextDecoration.Underline,
|
||||||
color = MaterialTheme.colorScheme.primary,
|
color = SimpleTheme.colorScheme.primary,
|
||||||
fontSize = 18.sp
|
fontSize = 18.sp
|
||||||
),
|
),
|
||||||
modifier = Modifier.padding(SimpleTheme.dimens.margin.extraLarge)
|
modifier = Modifier.padding(SimpleTheme.dimens.margin.extraLarge)
|
||||||
|
|
|
@ -5,7 +5,10 @@ import androidx.compose.foundation.LocalIndication
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.ripple.LocalRippleTheme
|
import androidx.compose.material.ripple.LocalRippleTheme
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.Checkbox
|
||||||
|
import androidx.compose.material3.CheckboxColors
|
||||||
|
import androidx.compose.material3.CheckboxDefaults
|
||||||
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
|
@ -15,7 +18,10 @@ import androidx.compose.ui.unit.sp
|
||||||
import com.simplemobiletools.commons.compose.extensions.MyDevices
|
import com.simplemobiletools.commons.compose.extensions.MyDevices
|
||||||
import com.simplemobiletools.commons.compose.extensions.NoRippleTheme
|
import com.simplemobiletools.commons.compose.extensions.NoRippleTheme
|
||||||
import com.simplemobiletools.commons.compose.extensions.rememberMutableInteractionSource
|
import com.simplemobiletools.commons.compose.extensions.rememberMutableInteractionSource
|
||||||
import com.simplemobiletools.commons.compose.theme.*
|
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
|
||||||
|
import com.simplemobiletools.commons.compose.theme.SimpleTheme
|
||||||
|
import com.simplemobiletools.commons.compose.theme.preferenceLabelColor
|
||||||
|
import com.simplemobiletools.commons.compose.theme.preferenceValueColor
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SettingsCheckBoxComponent(
|
fun SettingsCheckBoxComponent(
|
||||||
|
@ -26,8 +32,8 @@ fun SettingsCheckBoxComponent(
|
||||||
isPreferenceEnabled: Boolean = true,
|
isPreferenceEnabled: Boolean = true,
|
||||||
onChange: ((Boolean) -> Unit)? = null,
|
onChange: ((Boolean) -> Unit)? = null,
|
||||||
checkboxColors: CheckboxColors = CheckboxDefaults.colors(
|
checkboxColors: CheckboxColors = CheckboxDefaults.colors(
|
||||||
checkedColor = MaterialTheme.colorScheme.primary,
|
checkedColor = SimpleTheme.colorScheme.primary,
|
||||||
checkmarkColor = MaterialTheme.colorScheme.surface,
|
checkmarkColor = SimpleTheme.colorScheme.surface,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
val interactionSource = rememberMutableInteractionSource()
|
val interactionSource = rememberMutableInteractionSource()
|
||||||
|
|
|
@ -38,8 +38,8 @@ fun SettingsGroupTitle(
|
||||||
.padding(horizontal = SimpleTheme.dimens.margin.extraLarge),
|
.padding(horizontal = SimpleTheme.dimens.margin.extraLarge),
|
||||||
contentAlignment = Alignment.CenterStart
|
contentAlignment = Alignment.CenterStart
|
||||||
) {
|
) {
|
||||||
val primary = MaterialTheme.colorScheme.primary
|
val primary = SimpleTheme.colorScheme.primary
|
||||||
val titleStyle = MaterialTheme.typography.headlineMedium.copy(color = primary)
|
val titleStyle = SimpleTheme.typography.headlineMedium.copy(color = primary)
|
||||||
ProvideTextStyle(value = titleStyle) { title() }
|
ProvideTextStyle(value = titleStyle) { title() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.simplemobiletools.commons.compose.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
@ -17,7 +16,7 @@ import com.simplemobiletools.commons.compose.theme.SimpleTheme
|
||||||
fun SettingsTitleTextComponent(
|
fun SettingsTitleTextComponent(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
text: String,
|
text: String,
|
||||||
color: Color = MaterialTheme.colorScheme.primary,
|
color: Color = SimpleTheme.colorScheme.primary,
|
||||||
maxLines: Int = 1,
|
maxLines: Int = 1,
|
||||||
overflow: TextOverflow = TextOverflow.Ellipsis
|
overflow: TextOverflow = TextOverflow.Ellipsis
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -4,7 +4,6 @@ import android.content.Context
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.isSystemInDarkTheme
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.TopAppBarScrollBehavior
|
import androidx.compose.material3.TopAppBarScrollBehavior
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
@ -14,6 +13,7 @@ import androidx.compose.ui.platform.LocalLayoutDirection
|
||||||
import com.simplemobiletools.commons.compose.extensions.onEventValue
|
import com.simplemobiletools.commons.compose.extensions.onEventValue
|
||||||
import com.simplemobiletools.commons.compose.system_ui_controller.rememberSystemUiController
|
import com.simplemobiletools.commons.compose.system_ui_controller.rememberSystemUiController
|
||||||
import com.simplemobiletools.commons.compose.theme.LocalTheme
|
import com.simplemobiletools.commons.compose.theme.LocalTheme
|
||||||
|
import com.simplemobiletools.commons.compose.theme.SimpleTheme
|
||||||
import com.simplemobiletools.commons.compose.theme.isNotLitWell
|
import com.simplemobiletools.commons.compose.theme.isNotLitWell
|
||||||
import com.simplemobiletools.commons.compose.theme.isSurfaceLitWell
|
import com.simplemobiletools.commons.compose.theme.isSurfaceLitWell
|
||||||
import com.simplemobiletools.commons.compose.theme.model.Theme
|
import com.simplemobiletools.commons.compose.theme.model.Theme
|
||||||
|
@ -35,7 +35,7 @@ internal fun ScreenBoxSettingsScaffold(paddingValues: PaddingValues, modifier: M
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(MaterialTheme.colorScheme.surface)
|
.background(SimpleTheme.colorScheme.surface)
|
||||||
.padding(
|
.padding(
|
||||||
top = paddingValues.calculateTopPadding(),
|
top = paddingValues.calculateTopPadding(),
|
||||||
start = paddingValues.calculateStartPadding(layoutDirection),
|
start = paddingValues.calculateStartPadding(layoutDirection),
|
||||||
|
|
|
@ -129,8 +129,8 @@ fun topAppBarColors(
|
||||||
contrastColor: Color
|
contrastColor: Color
|
||||||
) = TopAppBarDefaults.topAppBarColors(
|
) = TopAppBarDefaults.topAppBarColors(
|
||||||
scrolledContainerColor = Color(statusBarColor),
|
scrolledContainerColor = Color(statusBarColor),
|
||||||
containerColor = if (colorTransitionFraction == 1f) contrastColor else MaterialTheme.colorScheme.surface,
|
containerColor = if (colorTransitionFraction == 1f) contrastColor else SimpleTheme.colorScheme.surface,
|
||||||
navigationIconContentColor = if (colorTransitionFraction == 1f) contrastColor else MaterialTheme.colorScheme.surface
|
navigationIconContentColor = if (colorTransitionFraction == 1f) contrastColor else SimpleTheme.colorScheme.surface
|
||||||
)
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -161,7 +161,7 @@ fun SettingsNavigationIcon(
|
||||||
.clip(RoundedCornerShape(50))
|
.clip(RoundedCornerShape(50))
|
||||||
.clickable(
|
.clickable(
|
||||||
navigationIconInteractionSource, rememberRipple(
|
navigationIconInteractionSource, rememberRipple(
|
||||||
color = MaterialTheme.colorScheme.onSurface,
|
color = SimpleTheme.colorScheme.onSurface,
|
||||||
bounded = true
|
bounded = true
|
||||||
)
|
)
|
||||||
) { goBack() }
|
) { goBack() }
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.simplemobiletools.commons.compose.theme
|
package com.simplemobiletools.commons.compose.theme
|
||||||
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.ReadOnlyComposable
|
import androidx.compose.runtime.ReadOnlyComposable
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
@ -31,11 +30,11 @@ val iconsColor
|
||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
fun preferenceValueColor(isEnabled: Boolean) =
|
fun preferenceValueColor(isEnabled: Boolean) =
|
||||||
if (isEnabled) MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f) else disabledTextColor
|
if (isEnabled) SimpleTheme.colorScheme.onSurface.copy(alpha = 0.6f) else disabledTextColor
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
fun preferenceLabelColor(isEnabled: Boolean) = if (isEnabled) MaterialTheme.colorScheme.onSurface else disabledTextColor
|
fun preferenceLabelColor(isEnabled: Boolean) = if (isEnabled) SimpleTheme.colorScheme.onSurface else disabledTextColor
|
||||||
|
|
||||||
fun Color.isLitWell(threshold: Float = LUMINANCE_THRESHOLD) = luminance() > threshold
|
fun Color.isLitWell(threshold: Float = LUMINANCE_THRESHOLD) = luminance() > threshold
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,11 @@ import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Shapes
|
import androidx.compose.material3.Shapes
|
||||||
import androidx.compose.material3.Typography
|
import androidx.compose.material3.Typography
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.Immutable
|
||||||
import androidx.compose.runtime.ReadOnlyComposable
|
import androidx.compose.runtime.ReadOnlyComposable
|
||||||
import com.simplemobiletools.commons.compose.theme.model.Dimensions
|
import com.simplemobiletools.commons.compose.theme.model.Dimensions
|
||||||
|
|
||||||
|
@Immutable
|
||||||
object SimpleTheme {
|
object SimpleTheme {
|
||||||
val dimens: Dimensions
|
val dimens: Dimensions
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.simplemobiletools.commons.compose.theme
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import androidx.compose.foundation.isSystemInDarkTheme
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.ReadOnlyComposable
|
import androidx.compose.runtime.ReadOnlyComposable
|
||||||
import androidx.compose.ui.graphics.luminance
|
import androidx.compose.ui.graphics.luminance
|
||||||
|
@ -26,11 +25,11 @@ internal const val LUMINANCE_THRESHOLD = 0.5f
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
fun isSurfaceNotLitWell(threshold: Float = LUMINANCE_THRESHOLD) = MaterialTheme.colorScheme.surface.luminance() < threshold
|
fun isSurfaceNotLitWell(threshold: Float = LUMINANCE_THRESHOLD) = SimpleTheme.colorScheme.surface.luminance() < threshold
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
fun isSurfaceLitWell(threshold: Float = LUMINANCE_THRESHOLD) = MaterialTheme.colorScheme.surface.luminance() > threshold
|
fun isSurfaceLitWell(threshold: Float = LUMINANCE_THRESHOLD) = SimpleTheme.colorScheme.surface.luminance() > threshold
|
||||||
|
|
||||||
internal fun Context.isDarkMode(): Boolean {
|
internal fun Context.isDarkMode(): Boolean {
|
||||||
val darkModeFlag = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
|
val darkModeFlag = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
|
||||||
|
|
|
@ -204,8 +204,8 @@ private fun DialogCheckBoxChangeDateTimeFormatComponent(
|
||||||
isPreferenceEnabled: Boolean = true,
|
isPreferenceEnabled: Boolean = true,
|
||||||
onChange: ((Boolean) -> Unit)? = null,
|
onChange: ((Boolean) -> Unit)? = null,
|
||||||
checkboxColors: CheckboxColors = CheckboxDefaults.colors(
|
checkboxColors: CheckboxColors = CheckboxDefaults.colors(
|
||||||
checkedColor = MaterialTheme.colorScheme.primary,
|
checkedColor = SimpleTheme.colorScheme.primary,
|
||||||
checkmarkColor = MaterialTheme.colorScheme.surface,
|
checkmarkColor = SimpleTheme.colorScheme.surface,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
val interactionSource = rememberMutableInteractionSource()
|
val interactionSource = rememberMutableInteractionSource()
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.simplemobiletools.commons.dialogs
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.border
|
import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
@ -19,6 +18,7 @@ import androidx.compose.ui.unit.dp
|
||||||
import com.simplemobiletools.commons.R
|
import com.simplemobiletools.commons.R
|
||||||
import com.simplemobiletools.commons.compose.theme.LocalTheme
|
import com.simplemobiletools.commons.compose.theme.LocalTheme
|
||||||
import com.simplemobiletools.commons.compose.theme.Shapes
|
import com.simplemobiletools.commons.compose.theme.Shapes
|
||||||
|
import com.simplemobiletools.commons.compose.theme.SimpleTheme
|
||||||
import com.simplemobiletools.commons.compose.theme.light_grey_stroke
|
import com.simplemobiletools.commons.compose.theme.light_grey_stroke
|
||||||
import com.simplemobiletools.commons.compose.theme.model.Theme
|
import com.simplemobiletools.commons.compose.theme.model.Theme
|
||||||
import com.simplemobiletools.commons.extensions.baseConfig
|
import com.simplemobiletools.commons.extensions.baseConfig
|
||||||
|
@ -29,7 +29,7 @@ val dialogContainerColor
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
@Composable get() = when (LocalTheme.current) {
|
@Composable get() = when (LocalTheme.current) {
|
||||||
is Theme.BlackAndWhite -> Color.Black
|
is Theme.BlackAndWhite -> Color.Black
|
||||||
is Theme.SystemDefaultMaterialYou -> if (isSPlus()) colorResource(R.color.you_dialog_background_color) else MaterialTheme.colorScheme.surface
|
is Theme.SystemDefaultMaterialYou -> if (isSPlus()) colorResource(R.color.you_dialog_background_color) else SimpleTheme.colorScheme.surface
|
||||||
else -> {
|
else -> {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
Color(context.baseConfig.backgroundColor)
|
Color(context.baseConfig.backgroundColor)
|
||||||
|
@ -49,7 +49,7 @@ val dialogShape = Shapes.extraLarge
|
||||||
|
|
||||||
val dialogElevation = 0.dp
|
val dialogElevation = 0.dp
|
||||||
|
|
||||||
val dialogTextColor @Composable @ReadOnlyComposable get() = MaterialTheme.colorScheme.onSurface
|
val dialogTextColor @Composable @ReadOnlyComposable get() = SimpleTheme.colorScheme.onSurface
|
||||||
|
|
||||||
val Modifier.dialogBorder: Modifier
|
val Modifier.dialogBorder: Modifier
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
|
|
|
@ -9,7 +9,10 @@ import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Star
|
import androidx.compose.material.icons.filled.Star
|
||||||
import androidx.compose.material.icons.filled.StarOutline
|
import androidx.compose.material.icons.filled.StarOutline
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.AlertDialog
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment.Companion.CenterHorizontally
|
import androidx.compose.ui.Alignment.Companion.CenterHorizontally
|
||||||
import androidx.compose.ui.Alignment.Companion.End
|
import androidx.compose.ui.Alignment.Companion.End
|
||||||
|
@ -132,7 +135,7 @@ private fun StarRating(
|
||||||
maxRating: Int = 5,
|
maxRating: Int = 5,
|
||||||
currentRating: Int,
|
currentRating: Int,
|
||||||
onRatingChanged: (Int) -> Unit,
|
onRatingChanged: (Int) -> Unit,
|
||||||
starsColor: Color = MaterialTheme.colorScheme.primary,
|
starsColor: Color = SimpleTheme.colorScheme.primary,
|
||||||
) {
|
) {
|
||||||
val animatedRating by animateIntAsState(
|
val animatedRating by animateIntAsState(
|
||||||
targetValue = currentRating,
|
targetValue = currentRating,
|
||||||
|
|
|
@ -17,7 +17,7 @@ androidx-coreKtx = "1.12.0"
|
||||||
androidx-appcompat = "1.6.1"
|
androidx-appcompat = "1.6.1"
|
||||||
androidx-swiperefreshlayout = "1.1.0"
|
androidx-swiperefreshlayout = "1.1.0"
|
||||||
#Material
|
#Material
|
||||||
material = "1.9.0"
|
material = "1.10.0"
|
||||||
#patternLockView
|
#patternLockView
|
||||||
patternLockView = "a90b0d4bf0"
|
patternLockView = "a90b0d4bf0"
|
||||||
#reprint
|
#reprint
|
||||||
|
@ -27,12 +27,13 @@ recyclerviewFastscroller = "5a95285b1f"
|
||||||
#rtlViewpager
|
#rtlViewpager
|
||||||
rtlViewpager = "940f12724f"
|
rtlViewpager = "940f12724f"
|
||||||
#Compose
|
#Compose
|
||||||
composeActivity = "1.8.0-rc01"
|
composeActivity = "1.8.0"
|
||||||
compose = "1.6.0-alpha06"
|
compose = "1.6.0-alpha07"
|
||||||
composeCompiler = "1.5.3"
|
composeCompiler = "1.5.3"
|
||||||
composeMaterial3 = "1.2.0-alpha08"
|
composeMaterial3 = "1.2.0-alpha09"
|
||||||
#Glide
|
#Glide
|
||||||
glide = "4.16.0"
|
glide = "4.16.0"
|
||||||
|
glideCompose = "1.0.0-beta01"
|
||||||
#Room
|
#Room
|
||||||
room = "2.6.0-rc01"
|
room = "2.6.0-rc01"
|
||||||
#ezVcard
|
#ezVcard
|
||||||
|
@ -89,6 +90,7 @@ compose-uiTooling-preview = { module = "androidx.compose.ui:ui-tooling-preview",
|
||||||
compose-view-binding = { module = "androidx.compose.ui:ui-viewbinding", version.ref = "compose" }
|
compose-view-binding = { module = "androidx.compose.ui:ui-viewbinding", version.ref = "compose" }
|
||||||
#Glide
|
#Glide
|
||||||
glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" }
|
glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" }
|
||||||
|
glide-compose = { module = "com.github.bumptech.glide:compose", version.ref = "glideCompose" }
|
||||||
glide-compiler = { module = "com.github.bumptech.glide:compiler", version.ref = "glide" }
|
glide-compiler = { module = "com.github.bumptech.glide:compiler", version.ref = "glide" }
|
||||||
#Material
|
#Material
|
||||||
material = { module = "com.google.android.material:material", version.ref = "material" }
|
material = { module = "com.google.android.material:material", version.ref = "material" }
|
||||||
|
|
|
@ -4,12 +4,9 @@ import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||||
import com.simplemobiletools.commons.activities.ManageBlockedNumbersActivity
|
import com.simplemobiletools.commons.activities.ManageBlockedNumbersActivity
|
||||||
import com.simplemobiletools.commons.compose.extensions.DEVELOPER_PLAY_STORE_URL
|
|
||||||
import com.simplemobiletools.commons.compose.extensions.FAKE_VERSION_APP_LABEL
|
|
||||||
import com.simplemobiletools.commons.dialogs.BottomSheetChooserDialog
|
import com.simplemobiletools.commons.dialogs.BottomSheetChooserDialog
|
||||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
import com.simplemobiletools.commons.dialogs.WritePermissionDialog
|
||||||
import com.simplemobiletools.commons.extensions.appLaunched
|
import com.simplemobiletools.commons.extensions.appLaunched
|
||||||
import com.simplemobiletools.commons.extensions.launchViewIntent
|
|
||||||
import com.simplemobiletools.commons.extensions.toast
|
import com.simplemobiletools.commons.extensions.toast
|
||||||
import com.simplemobiletools.commons.extensions.viewBinding
|
import com.simplemobiletools.commons.extensions.viewBinding
|
||||||
import com.simplemobiletools.commons.helpers.LICENSE_AUTOFITTEXTVIEW
|
import com.simplemobiletools.commons.helpers.LICENSE_AUTOFITTEXTVIEW
|
||||||
|
@ -51,9 +48,9 @@ class MainActivity : BaseSimpleActivity() {
|
||||||
startActivity(Intent(this, TestDialogActivity::class.java))
|
startActivity(Intent(this, TestDialogActivity::class.java))
|
||||||
}
|
}
|
||||||
binding.testButton.setOnClickListener {
|
binding.testButton.setOnClickListener {
|
||||||
ConfirmationDialog(this, FAKE_VERSION_APP_LABEL, positive = com.simplemobiletools.commons.R.string.ok, negative = 0) {
|
WritePermissionDialog(this, mode = WritePermissionDialog.Mode.OpenDocumentTreeSDK30("")){
|
||||||
launchViewIntent(DEVELOPER_PLAY_STORE_URL)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue