Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions app/src/main/java/com/electricdreams/numo/ModernPOSActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,26 @@ class ModernPOSActivity : AppCompatActivity(), SatocashWallet.OperationFeedback,
// Use the same resolved background color as ThemeManager so the
// ModernPOS window background matches the active theme selection
// (obsidian, green, bitcoin orange, white, etc.). This ensures the
// navigation pill always floats above the correct themed background
// instead of a hardcoded "green".
// navigation bar always matches the current theme.
val bgColor = com.electricdreams.numo.ui.theme.ThemeManager.resolveBackgroundColor(this)
window.setBackgroundDrawable(android.graphics.drawable.ColorDrawable(bgColor))

window.statusBarColor = android.graphics.Color.TRANSPARENT
window.navigationBarColor = android.graphics.Color.TRANSPARENT
// Set both status bar and navigation bar to match the theme background.
// Note: We use the actual color instead of TRANSPARENT because some devices
// (like Sunmi POS terminals) don't properly support transparent system bars
// and will show a system default color instead.
window.statusBarColor = bgColor
window.navigationBarColor = bgColor

// Determine if this is a light theme (white) to set appropriate icon colors
val prefs = getSharedPreferences("app_prefs", MODE_PRIVATE)
val theme = prefs.getString("app_theme", "green") ?: "green"
val isLightTheme = (theme == "white")

WindowInsetsControllerCompat(window, window.decorView).apply {
// For the dark themes we keep icons light; for white theme the
// ThemeManager will already have set light/dark appropriately.
isAppearanceLightStatusBars = false
isAppearanceLightNavigationBars = false
// Light icons for dark themes, dark icons for white theme
isAppearanceLightStatusBars = isLightTheme
isAppearanceLightNavigationBars = isLightTheme
}

ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content)) { v, windowInsets ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ class PaymentFailureActivity : AppCompatActivity() {

// Enable edge-to-edge, mirroring PaymentReceivedActivity
WindowCompat.setDecorFitsSystemWindows(window, false)
window.statusBarColor = android.graphics.Color.TRANSPARENT
window.navigationBarColor = android.graphics.Color.TRANSPARENT

// Use solid white for both status and navigation bars.
// Note: TRANSPARENT doesn't work well on some devices (like Sunmi POS terminals).
val bgColor = android.graphics.Color.WHITE
window.statusBarColor = bgColor
window.navigationBarColor = bgColor

val windowInsetsController = WindowCompat.getInsetsController(window, window.decorView)
windowInsetsController.isAppearanceLightStatusBars = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ class PaymentReceivedActivity : AppCompatActivity() {

// Enable edge-to-edge
WindowCompat.setDecorFitsSystemWindows(window, false)
window.statusBarColor = android.graphics.Color.TRANSPARENT
window.navigationBarColor = android.graphics.Color.TRANSPARENT

// Use solid white for both status and navigation bars.
// Note: TRANSPARENT doesn't work well on some devices (like Sunmi POS terminals).
val bgColor = android.graphics.Color.WHITE
window.statusBarColor = bgColor
window.navigationBarColor = bgColor

// Set light status bar icons (since background is white)
val windowInsetsController = WindowCompat.getInsetsController(window, window.decorView)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ import androidx.core.view.WindowInsetsControllerCompat
* Usage from an Activity:
*
* enableEdgeToEdgeWithPill(this)
* enableEdgeToEdgeWithPill(this, backgroundColor = Color.WHITE)
*
* @param backgroundColor The background color to use for status and navigation bars.
* Defaults to WHITE. Note: We use solid colors instead of TRANSPARENT
* because some devices (like Sunmi POS terminals) don't properly
* support transparent system bars.
*/
fun enableEdgeToEdgeWithPill(activity: Activity, lightNavIcons: Boolean = true) {
fun enableEdgeToEdgeWithPill(
activity: Activity,
lightNavIcons: Boolean = true,
backgroundColor: Int = Color.WHITE
) {
val window = activity.window

WindowCompat.setDecorFitsSystemWindows(window, false)
window.statusBarColor = Color.TRANSPARENT
window.navigationBarColor = Color.TRANSPARENT
window.statusBarColor = backgroundColor
window.navigationBarColor = backgroundColor

val controller = WindowInsetsControllerCompat(window, window.decorView)
controller.isAppearanceLightStatusBars = lightNavIcons
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ class WithdrawSuccessActivity : AppCompatActivity() {

// Enable edge-to-edge
WindowCompat.setDecorFitsSystemWindows(window, false)
window.statusBarColor = android.graphics.Color.TRANSPARENT
window.navigationBarColor = android.graphics.Color.TRANSPARENT

// Use solid white for both status and navigation bars.
// Note: TRANSPARENT doesn't work well on some devices (like Sunmi POS terminals).
val bgColor = android.graphics.Color.WHITE
window.statusBarColor = bgColor
window.navigationBarColor = bgColor

// Set light status bar icons (since background is white)
val windowInsetsController = WindowCompat.getInsetsController(window, window.decorView)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,12 @@ class TipSelectionActivity : AppCompatActivity() {

private fun setupWindowSettings() {
WindowCompat.setDecorFitsSystemWindows(window, false)
window.statusBarColor = Color.TRANSPARENT
window.navigationBarColor = Color.TRANSPARENT

// Use solid white for both status and navigation bars.
// Note: TRANSPARENT doesn't work well on some devices (like Sunmi POS terminals).
val bgColor = Color.WHITE
window.statusBarColor = bgColor
window.navigationBarColor = bgColor

// Light status bar (dark icons) since we have white background
WindowInsetsControllerCompat(window, window.decorView).apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ class ThemeManager(
// Update status bar and navigation bar colors
activity.window.statusBarColor = backgroundColor

// Let the system navigation bar be fully transparent so the gesture pill
// floats above whatever content/background we're drawing, instead of
// sitting on a solid-colored nav bar.
activity.window.navigationBarColor = android.graphics.Color.TRANSPARENT
// Set navigation bar to match the theme background color.
// Note: We use the actual color instead of TRANSPARENT because some devices
// (like Sunmi POS terminals) don't properly support transparent navigation
// bars and will show a system default color instead.
activity.window.navigationBarColor = backgroundColor

// Update status bar appearance based on theme
val windowInsetsController = WindowInsetsControllerCompat(activity.window, activity.window.decorView)
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<!-- Status bar color - matches window background for seamless edge-to-edge -->
<item name="android:statusBarColor">@color/dark_windowBackground</item>
<item name="android:windowLightStatusBar">false</item>
<!-- Navigation bar: transparent so gesture pill truly floats over content/background -->
<!-- Content views should handle bottom insets where needed. -->
<item name="android:navigationBarColor">@android:color/transparent</item>
<!-- Navigation bar: use solid color to match window background.
Note: Transparent doesn't work well on some devices (like Sunmi POS terminals). -->
<item name="android:navigationBarColor">@color/dark_windowBackground</item>
<item name="android:windowLightNavigationBar">false</item>
<!-- Text colors -->
<item name="android:textColor">@color/dark_textColorPrimary</item>
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<!-- Status bar color - matches window background for seamless edge-to-edge -->
<item name="android:statusBarColor">@color/color_bg_white</item>
<item name="android:windowLightStatusBar">true</item>
<!-- Navigation bar: transparent so gesture pill truly floats over content/background -->
<!-- Content views should handle bottom insets where needed. -->
<item name="android:navigationBarColor">@android:color/transparent</item>
<!-- Navigation bar: use solid color to match window background.
Note: Transparent doesn't work well on some devices (like Sunmi POS terminals). -->
<item name="android:navigationBarColor">@color/color_bg_white</item>
<item name="android:windowLightNavigationBar">true</item>
<!-- Text colors -->
<item name="android:textColor">@color/color_text_primary</item>
Expand Down