Skip to content

Commit

Permalink
Make statusbar auto hide after sometime if user swipes down in reader
Browse files Browse the repository at this point in the history
Signed-off-by: starry-shivam <[email protected]>
  • Loading branch information
starry-shivam committed May 15, 2024
1 parent 431c8f4 commit 09035f3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ fun LibraryScreen(navController: NavController) {

val showTapTargets = remember { mutableStateOf(false) }
LaunchedEffect(key1 = viewModel.showOnboardingTapTargets.value) {
delay(800) // Delay to prevent flickering
delay(500) // Delay to prevent flickering
showTapTargets.value = viewModel.showOnboardingTapTargets.value
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ class ReaderActivity : AppCompatActivity() {
// Fullscreen mode that ignores any cutout, notch etc.
WindowCompat.setDecorFitsSystemWindows(window, false)
val controller = WindowInsetsControllerCompat(window, window.decorView)
controller.hide(WindowInsetsCompat.Type.displayCutout())
controller.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
controller.hide(WindowInsetsCompat.Type.systemBars())
controller.hide(WindowInsetsCompat.Type.displayCutout())

// Set layout in display cutout mode for Android P and above.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
window.attributes.layoutInDisplayCutoutMode =
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/java/com/starry/myne/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,12 @@ fun AdjustEdgeToEdge(activity: AppCompatActivity, themeState: ThemeMode) {
navigationBarStyle = SystemBarStyle.dark(android.graphics.Color.TRANSPARENT)
)
} else {
activity.enableEdgeToEdge()
activity.enableEdgeToEdge(
navigationBarStyle = SystemBarStyle.light(
android.graphics.Color.TRANSPARENT,
android.graphics.Color.TRANSPARENT
)
)
}
}
}
Expand Down

0 comments on commit 09035f3

Please sign in to comment.