diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/MainActivity.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/MainActivity.kt
index ea3db8e6..614ef463 100644
--- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/MainActivity.kt
+++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/MainActivity.kt
@@ -1,5 +1,6 @@
package com.rifsxd.ksunext.ui
+import android.content.Context
import android.os.Build
import android.os.Bundle
import androidx.activity.ComponentActivity
@@ -70,7 +71,13 @@ class MainActivity : ComponentActivity() {
if (isManager) install()
setContent {
- KernelSUTheme {
+ // Read AMOLED mode preference
+ val prefs = getSharedPreferences("settings", Context.MODE_PRIVATE)
+ val amoledMode = prefs.getBoolean("enable_amoled", false)
+
+ KernelSUTheme (
+ amoledMode = amoledMode
+ ) {
val navController = rememberNavController()
val snackBarHostState = remember { SnackbarHostState() }
val currentDestination = navController.currentBackStackEntryAsState()?.value?.destination
diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Settings.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Settings.kt
index 4646eaff..d2f685e5 100644
--- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Settings.kt
+++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/screen/Settings.kt
@@ -7,6 +7,7 @@ import android.widget.Toast
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.clickable
+import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
@@ -359,6 +360,50 @@ fun SettingScreen(navigator: DestinationsNavigator) {
}
}
+ var enableAmoled by rememberSaveable {
+ mutableStateOf(
+ prefs.getBoolean("enable_amoled", false)
+ )
+ }
+ var showRestartDialog by remember { mutableStateOf(false) }
+ if (isSystemInDarkTheme()) {
+ SwitchItem(
+ icon = Icons.Filled.Contrast,
+ title = stringResource(id = R.string.settings_amoled_mode),
+ summary = stringResource(id = R.string.settings_amoled_mode_summary),
+ checked = enableAmoled
+ ) { checked ->
+ prefs.edit().putBoolean("enable_amoled", checked).apply()
+ enableAmoled = checked
+ showRestartDialog = true
+ }
+ if (showRestartDialog) {
+ AlertDialog(
+ onDismissRequest = { showRestartDialog = false },
+ title = { Text(stringResource(R.string.restart_required)) },
+ text = { Text(stringResource(R.string.restart_app_message)) },
+ confirmButton = {
+ TextButton(onClick = {
+ showRestartDialog = false
+ // Restart the app
+ val packageManager = context.packageManager
+ val intent = packageManager.getLaunchIntentForPackage(context.packageName)
+ intent?.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
+ context.startActivity(intent)
+ Runtime.getRuntime().exit(0)
+ }) {
+ Text(stringResource(R.string.restart_app))
+ }
+ },
+ dismissButton = {
+ TextButton(onClick = { showRestartDialog = false }) {
+ Text(stringResource(R.string.later))
+ }
+ }
+ )
+ }
+ }
+
if (isOverlayAvailable && useOverlayFs) {
val shrink = stringResource(id = R.string.shrink_sparse_image)
val shrinkMessage = stringResource(id = R.string.shrink_sparse_image_message)
diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/theme/Color.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/theme/Color.kt
index 675f4aef..8eda9c6e 100644
--- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/theme/Color.kt
+++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/theme/Color.kt
@@ -2,9 +2,11 @@ package com.rifsxd.ksunext.ui.theme
import androidx.compose.ui.graphics.Color
-val YELLOW = Color(0xFFeed502)
-val YELLOW_LIGHT = Color(0xFFffff52)
-val SECONDARY_LIGHT = Color(0xffa9817f)
+val PRIMARY = Color(0xFF8AADF4) // Catppuccin Blue
+val PRIMARY_LIGHT = Color(0xFFB7BDF8) // Catppuccin Lavender
+val SECONDARY_LIGHT = Color(0xFFA6DA95) // Catppuccin Green
-val YELLOW_DARK = Color(0xFFb7a400)
-val SECONDARY_DARK = Color(0xFF4c2b2b)
\ No newline at end of file
+val PRIMARY_DARK = Color(0xFF7DC4E4) // Catppuccin Sky
+val SECONDARY_DARK = Color(0xFFF5BDE6) // Catppuccin Pink
+
+val AMOLED_BLACK = Color(0xFF000000) // Pure black for AMOLED
\ No newline at end of file
diff --git a/manager/app/src/main/java/com/rifsxd/ksunext/ui/theme/Theme.kt b/manager/app/src/main/java/com/rifsxd/ksunext/ui/theme/Theme.kt
index 751708d8..4a65c193 100644
--- a/manager/app/src/main/java/com/rifsxd/ksunext/ui/theme/Theme.kt
+++ b/manager/app/src/main/java/com/rifsxd/ksunext/ui/theme/Theme.kt
@@ -17,14 +17,14 @@ import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
private val DarkColorScheme = darkColorScheme(
- primary = YELLOW,
- secondary = YELLOW_DARK,
+ primary = PRIMARY,
+ secondary = PRIMARY_DARK,
tertiary = SECONDARY_DARK
)
private val LightColorScheme = lightColorScheme(
- primary = YELLOW,
- secondary = YELLOW_LIGHT,
+ primary = PRIMARY,
+ secondary = PRIMARY_LIGHT,
tertiary = SECONDARY_LIGHT
)
@@ -33,9 +33,18 @@ fun KernelSUTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
+ amoledMode: Boolean = false,
content: @Composable () -> Unit
) {
val colorScheme = when {
+ amoledMode && darkTheme && dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
+ val context = LocalContext.current
+ val dynamicScheme = dynamicDarkColorScheme(context)
+ dynamicScheme.copy(
+ background = AMOLED_BLACK,
+ surface = AMOLED_BLACK
+ )
+ }
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
diff --git a/manager/app/src/main/res/values/strings.xml b/manager/app/src/main/res/values/strings.xml
index c4bb328f..bf8b3d1f 100644
--- a/manager/app/src/main/res/values/strings.xml
+++ b/manager/app/src/main/res/values/strings.xml
@@ -142,6 +142,10 @@
Close
Force stop
Restart
+ AMOLED mode
+ Enable a pure black theme useful for AMOLED screens to reduce eye strain and save battery.
+ Restart Required
+ The app needs to restart for this change to take effect.
Failed to update SELinux rules for: %s
Granting superuser isn\'t allowed for: %s
Changelog