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"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<application <application
android:allowBackup="true" android:allowBackup="true"
@@ -64,6 +64,7 @@ import androidx.compose.material.icons.outlined.EmojiEvents
import androidx.compose.material3.Button import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Card import androidx.compose.material3.Card
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.CardDefaults import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
@@ -241,7 +242,16 @@ fun HermesNativeApp() {
runCatching { api.health() }.onSuccess { online = true }.onFailure { online = false } 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( Scaffold(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
containerColor = Cream, containerColor = Cream,
@@ -284,15 +294,18 @@ fun slideFor(from: Int, to: Int): ContentTransform {
} }
fun vibrate(context: Context) { fun vibrate(context: Context) {
runCatching {
val vibrator = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) { 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 val manager = context.getSystemService(Application.VIBRATOR_MANAGER_SERVICE) as VibratorManager
manager.defaultVibrator manager.defaultVibrator
} else { } else {
@Suppress("DEPRECATION") context.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator @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)) 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) else @Suppress("DEPRECATION") vibrator.vibrate(20)
} }
}
@Composable @Composable
fun NativeTopBar(screen: Screen, online: Boolean) { fun NativeTopBar(screen: Screen, online: Boolean) {
@@ -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) } } @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 Green = Color(0xFF58CC02)
val GreenDark = Color(0xFF46A302) val GreenDark = Color(0xFF7FE83B)
val GreenShadow = Color(0xFFB8E9A4) val GreenShadow = Color(0xFF244B19)
val GreenBorder = Color(0xFF8DDB6C) val GreenBorder = Color(0xFF3D7F28)
val PaleGreen = Color(0xFFE8F8DF) val PaleGreen = Color(0xFF17301A)
val Blue = Color(0xFF1CB0F6) val Blue = Color(0xFF1CB0F6)
val BlueDark = Color(0xFF1687C2) val BlueDark = Color(0xFF73D4FF)
val PaleBlue = Color(0xFFE2F3FF) val PaleBlue = Color(0xFF112A3A)
val Gold = Color(0xFFFFC800) val Gold = Color(0xFFFFC800)
val GoldDark = Color(0xFFC99500) val GoldDark = Color(0xFFFFD95A)
val PaleGold = Color(0xFFFFF6D6) val PaleGold = Color(0xFF332A10)
val Orange = Color(0xFFFF9600) val Orange = Color(0xFFFFA033)
val PaleOrange = Color(0xFFFFF0D8) val PaleOrange = Color(0xFF332312)
val OrangeBorder = Color(0xFFE7BE82) val OrangeBorder = Color(0xFF7B4D1C)
val OrangeShadow = Color(0xFFE4C99D) val OrangeShadow = Color(0xFF26180C)
val Red = Color(0xFFFF4B4B) val Red = Color(0xFFFF6B6B)
val PaleRed = Color(0xFFFFE4E4) val PaleRed = Color(0xFF3A171B)
val RedBorder = Color(0xFFFFB8B8) val RedBorder = Color(0xFF8B3D45)
val RedShadow = Color(0xFFE9B4B4) val RedShadow = Color(0xFF271013)
val Cream = Color(0xFFF2F7E8) val Cream = Color(0xFF08100E)
val Paper = Color(0xFFFFFEF8) val Paper = Color(0xFF111B18)
val Surface = Color(0xFFF3F8ED) val Surface = Color(0xFF17231F)
val Ink = Color(0xFF243B2E) val Ink = Color(0xFFEAF7EE)
val Muted = Color(0xFF6D7C72) val Muted = Color(0xFF9FB4A7)
val NeutralBorder = Color(0xFFDCE8D5) val NeutralBorder = Color(0xFF294138)
val NeutralShadow = Color(0xFFC8D8C0) val NeutralShadow = Color(0xFF060B0A)
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <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:fontFamily">sans</item>
<item name="android:windowLightStatusBar">true</item> <item name="android:windowLightStatusBar">false</item>
<item name="android:windowLightNavigationBar">true</item> <item name="android:windowLightNavigationBar">false</item>
<item name="android:colorAccent">@color/seed_green</item> <item name="android:colorAccent">@color/seed_green</item>
<item name="android:windowBackground">#0B1110</item>
</style> </style>
</resources> </resources>