I simply need to detect if the system navigation bar is located to the right of the screen as seen in image below.
You can use Insets API and register OnApplyWindowInsetsListener
to check the height of the system navigation bar to know the orientation direction:
ViewCompat.setOnApplyWindowInsetsListener(
window.decorView
) { _: View, windowInsets: WindowInsetsCompat ->
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
if (insets.bottom > 0) {
// Navigation Bar at Bottom
} else if (insets.right > 0) {
// Navigation Bar at Right
} else if (insets.left > 0) {
// Navigation Bar at Left
}
WindowInsetsCompat.CONSUMED
}