Made bottom navigation bar transparent and matching screen background color
This commit is contained in:
@@ -104,7 +104,7 @@ fun AppTheme(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val view = LocalView.current
|
val view = LocalView.current
|
||||||
if (!view.isInEditMode) {
|
if (!view.isInEditMode)
|
||||||
SideEffect {
|
SideEffect {
|
||||||
val activity = view.context as? ComponentActivity
|
val activity = view.context as? ComponentActivity
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
@@ -118,19 +118,23 @@ fun AppTheme(
|
|||||||
android.graphics.Color.TRANSPARENT,
|
android.graphics.Color.TRANSPARENT,
|
||||||
) { isDark }
|
) { isDark }
|
||||||
)
|
)
|
||||||
} else {
|
if (VERSION.SDK_INT >= 29)
|
||||||
|
activity.window.isNavigationBarContrastEnforced = false
|
||||||
|
}
|
||||||
|
else {
|
||||||
val window = (view.context as Activity).window
|
val window = (view.context as Activity).window
|
||||||
val insetsController = WindowCompat.getInsetsController(window, view)
|
val insetsController = WindowCompat.getInsetsController(window, view)
|
||||||
|
if (VERSION.SDK_INT < 35)
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
|
window.navigationBarColor = android.graphics.Color.TRANSPARENT
|
||||||
|
if (VERSION.SDK_INT >= 29)
|
||||||
|
window.isNavigationBarContrastEnforced = false
|
||||||
val isBackgroundEffectivelyLight =
|
val isBackgroundEffectivelyLight =
|
||||||
ColorUtils.calculateLuminance(colorScheme.background.toArgb()) > 0.5
|
ColorUtils.calculateLuminance(colorScheme.background.toArgb()) > 0.5
|
||||||
insetsController.isAppearanceLightStatusBars = isBackgroundEffectivelyLight
|
insetsController.isAppearanceLightStatusBars = isBackgroundEffectivelyLight
|
||||||
insetsController.isAppearanceLightNavigationBars = isBackgroundEffectivelyLight
|
insetsController.isAppearanceLightNavigationBars = isBackgroundEffectivelyLight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
MaterialTheme(
|
MaterialTheme(colorScheme = colorScheme, content = content)
|
||||||
colorScheme = colorScheme,
|
|
||||||
content = content
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user