mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-19 07:15:25 +02:00
fix: Fix message info
This commit is contained in:
parent
5e3e2a2e22
commit
e8337f2fc2
@ -1,5 +1,7 @@
|
|||||||
package app.myzel394.alibi.ui.components.SettingsScreen.Tiles
|
package app.myzel394.alibi.ui.components.SettingsScreen.Tiles
|
||||||
|
|
||||||
|
import android.os.Message
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.magnifier
|
import androidx.compose.foundation.magnifier
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
@ -20,7 +22,10 @@ import app.myzel394.alibi.dataStore
|
|||||||
import app.myzel394.alibi.db.AppLockSettings
|
import app.myzel394.alibi.db.AppLockSettings
|
||||||
import app.myzel394.alibi.db.AppSettings
|
import app.myzel394.alibi.db.AppSettings
|
||||||
import app.myzel394.alibi.helpers.AppLockHelper
|
import app.myzel394.alibi.helpers.AppLockHelper
|
||||||
|
import app.myzel394.alibi.ui.components.atoms.MessageBox
|
||||||
|
import app.myzel394.alibi.ui.components.atoms.MessageType
|
||||||
import app.myzel394.alibi.ui.components.atoms.SettingsTile
|
import app.myzel394.alibi.ui.components.atoms.SettingsTile
|
||||||
|
import app.myzel394.alibi.ui.components.atoms.VisualDensity
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ -43,13 +48,16 @@ fun EnableAppLockTile(
|
|||||||
description = stringResource(R.string.ui_settings_option_enableAppLock_description),
|
description = stringResource(R.string.ui_settings_option_enableAppLock_description),
|
||||||
tertiaryLine = {
|
tertiaryLine = {
|
||||||
if (appLockSupport === AppLockHelper.SupportType.NONE_ENROLLED) {
|
if (appLockSupport === AppLockHelper.SupportType.NONE_ENROLLED) {
|
||||||
Text(
|
Box(
|
||||||
stringResource(R.string.ui_settings_option_enableAppLock_enrollmentRequired),
|
modifier = Modifier.padding(top = 8.dp)
|
||||||
color = Color.Yellow,
|
) {
|
||||||
style = MaterialTheme.typography.bodySmall,
|
MessageBox(
|
||||||
modifier = Modifier.padding(top = 4.dp)
|
type = MessageType.WARNING,
|
||||||
|
message = stringResource(R.string.ui_settings_option_enableAppLock_enrollmentRequired),
|
||||||
|
density = VisualDensity.COMPACT,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
leading = {
|
leading = {
|
||||||
Icon(
|
Icon(
|
||||||
|
@ -3,6 +3,7 @@ package app.myzel394.alibi.ui.components.atoms
|
|||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Check
|
import androidx.compose.material.icons.filled.Check
|
||||||
@ -27,6 +28,7 @@ fun MessageBox(
|
|||||||
type: MessageType,
|
type: MessageType,
|
||||||
message: String,
|
message: String,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
|
density: VisualDensity = VisualDensity.COMFORTABLE,
|
||||||
) {
|
) {
|
||||||
val isDark = rememberIsInDarkMode()
|
val isDark = rememberIsInDarkMode()
|
||||||
val containerColor = when (type) {
|
val containerColor = when (type) {
|
||||||
@ -51,9 +53,16 @@ fun MessageBox(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clip(MaterialTheme.shapes.medium)
|
.clip(MaterialTheme.shapes.medium)
|
||||||
.background(backgroundColor)
|
.background(backgroundColor)
|
||||||
.padding(horizontal = 8.dp, vertical = 16.dp)
|
.let {
|
||||||
|
if (density == VisualDensity.COMFORTABLE) {
|
||||||
|
it.padding(horizontal = 8.dp, vertical = 16.dp)
|
||||||
|
} else {
|
||||||
|
it.padding(8.dp)
|
||||||
|
}
|
||||||
|
}
|
||||||
.then(modifier)
|
.then(modifier)
|
||||||
) {
|
) {
|
||||||
|
if (density == VisualDensity.COMFORTABLE) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = when (type) {
|
imageVector = when (type) {
|
||||||
MessageType.ERROR -> Icons.Default.Error
|
MessageType.ERROR -> Icons.Default.Error
|
||||||
@ -66,18 +75,21 @@ fun MessageBox(
|
|||||||
tint = textColor,
|
tint = textColor,
|
||||||
modifier = Modifier.padding(16.dp)
|
modifier = Modifier.padding(16.dp)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
Column {
|
Column {
|
||||||
if (title != null) {
|
if (title != null) {
|
||||||
Text(
|
Text(
|
||||||
text = title,
|
text = title,
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
color = textColor,
|
color = textColor,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Text(
|
Text(
|
||||||
text = message,
|
text = message,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = textColor,
|
color = textColor,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,3 +103,8 @@ enum class MessageType {
|
|||||||
SUCCESS,
|
SUCCESS,
|
||||||
WARNING,
|
WARNING,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum class VisualDensity {
|
||||||
|
COMPACT,
|
||||||
|
COMFORTABLE,
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user