fix: stabilize native navigation and add dark theme

This commit is contained in:
Hermes Agent
2026-07-09 11:13:31 +00:00
parent 68fe7b81d2
commit 317cc8e3a1
3 changed files with 49 additions and 34 deletions
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:allowBackup="true"
@@ -64,6 +64,7 @@ import androidx.compose.material.icons.outlined.EmojiEvents
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Card
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
@@ -241,7 +242,16 @@ fun HermesNativeApp() {
runCatching { api.health() }.onSuccess { online = true }.onFailure { online = false }
}
MaterialTheme(colorScheme = MaterialTheme.colorScheme.copy(background = Cream, surface = Paper)) {
MaterialTheme(
colorScheme = darkColorScheme(
background = Cream,
surface = Paper,
primary = Green,
onPrimary = Color.White,
onBackground = Ink,
onSurface = Ink
)
) {
Scaffold(
modifier = Modifier.fillMaxSize(),
containerColor = Cream,
@@ -284,14 +294,17 @@ fun slideFor(from: Int, to: Int): ContentTransform {
}
fun vibrate(context: Context) {
val vibrator = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
val manager = context.getSystemService(Application.VIBRATOR_MANAGER_SERVICE) as VibratorManager
manager.defaultVibrator
} else {
@Suppress("DEPRECATION") context.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
runCatching {
val vibrator = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
val manager = context.getSystemService(Application.VIBRATOR_MANAGER_SERVICE) as VibratorManager
manager.defaultVibrator
} else {
@Suppress("DEPRECATION") context.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
}
if (!vibrator.hasVibrator()) return
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) vibrator.vibrate(VibrationEffect.createPredefined(VibrationEffect.EFFECT_TICK))
else @Suppress("DEPRECATION") vibrator.vibrate(20)
}
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) vibrator.vibrate(VibrationEffect.createPredefined(VibrationEffect.EFFECT_TICK))
else @Suppress("DEPRECATION") vibrator.vibrate(20)
}
@Composable
@@ -586,28 +599,28 @@ fun CompactQuest(title: String, label: String, text: String, icon: ImageVector,
@Composable fun RoundButton(icon: ImageVector, onClick: () -> Unit) { Button(onClick = onClick, modifier = Modifier.size(50.dp), shape = RoundedCornerShape(16.dp), contentPadding = androidx.compose.foundation.layout.PaddingValues(0.dp), colors = ButtonDefaults.buttonColors(containerColor = Blue, contentColor = Color.White), elevation = ButtonDefaults.buttonElevation(defaultElevation = 5.dp, pressedElevation = 1.dp)) { Icon(icon, null) } }
val Green = Color(0xFF58CC02)
val GreenDark = Color(0xFF46A302)
val GreenShadow = Color(0xFFB8E9A4)
val GreenBorder = Color(0xFF8DDB6C)
val PaleGreen = Color(0xFFE8F8DF)
val GreenDark = Color(0xFF7FE83B)
val GreenShadow = Color(0xFF244B19)
val GreenBorder = Color(0xFF3D7F28)
val PaleGreen = Color(0xFF17301A)
val Blue = Color(0xFF1CB0F6)
val BlueDark = Color(0xFF1687C2)
val PaleBlue = Color(0xFFE2F3FF)
val BlueDark = Color(0xFF73D4FF)
val PaleBlue = Color(0xFF112A3A)
val Gold = Color(0xFFFFC800)
val GoldDark = Color(0xFFC99500)
val PaleGold = Color(0xFFFFF6D6)
val Orange = Color(0xFFFF9600)
val PaleOrange = Color(0xFFFFF0D8)
val OrangeBorder = Color(0xFFE7BE82)
val OrangeShadow = Color(0xFFE4C99D)
val Red = Color(0xFFFF4B4B)
val PaleRed = Color(0xFFFFE4E4)
val RedBorder = Color(0xFFFFB8B8)
val RedShadow = Color(0xFFE9B4B4)
val Cream = Color(0xFFF2F7E8)
val Paper = Color(0xFFFFFEF8)
val Surface = Color(0xFFF3F8ED)
val Ink = Color(0xFF243B2E)
val Muted = Color(0xFF6D7C72)
val NeutralBorder = Color(0xFFDCE8D5)
val NeutralShadow = Color(0xFFC8D8C0)
val GoldDark = Color(0xFFFFD95A)
val PaleGold = Color(0xFF332A10)
val Orange = Color(0xFFFFA033)
val PaleOrange = Color(0xFF332312)
val OrangeBorder = Color(0xFF7B4D1C)
val OrangeShadow = Color(0xFF26180C)
val Red = Color(0xFFFF6B6B)
val PaleRed = Color(0xFF3A171B)
val RedBorder = Color(0xFF8B3D45)
val RedShadow = Color(0xFF271013)
val Cream = Color(0xFF08100E)
val Paper = Color(0xFF111B18)
val Surface = Color(0xFF17231F)
val Ink = Color(0xFFEAF7EE)
val Muted = Color(0xFF9FB4A7)
val NeutralBorder = Color(0xFF294138)
val NeutralShadow = Color(0xFF060B0A)
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:style/Theme.Material.Light.NoActionBar">
<style name="AppTheme" parent="android:style/Theme.Material.NoActionBar">
<item name="android:fontFamily">sans</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowLightNavigationBar">true</item>
<item name="android:windowLightStatusBar">false</item>
<item name="android:windowLightNavigationBar">false</item>
<item name="android:colorAccent">@color/seed_green</item>
<item name="android:windowBackground">#0B1110</item>
</style>
</resources>