Kotlin to Java Code Plaeas

Can someone translate this into java please:

private fun hideSystemUI() {
    WindowCompat.setDecorFitsSystemWindows(window, false)
    WindowInsetsControllerCompat(window, mainContainer).let { controller ->
        controller.hide(WindowInsetsCompat.Type.systemBars())
        controller.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
    }
}

private fun showSystemUI() {
    WindowCompat.setDecorFitsSystemWindows(window, true)
    WindowInsetsControllerCompat(window, mainContainer).show(WindowInsetsCompat.Type.systemBars())
}

What is the part that is confusing to you? I think this is almost like its equivalent Java code. The only tricky part is let - it just means that both hide() and systemBarsBehavior is invoked/set on WindowInsetsControllerCompat object.

2 Likes