Skip to content

Commit

Permalink
Fix drawer toolbar not closing in certain cases
Browse files Browse the repository at this point in the history
  • Loading branch information
gujjwal00 committed Feb 1, 2024
1 parent a29f4de commit 17e7b0f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions app/src/main/java/com/gaurav/avnc/ui/vnc/VncActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ class VncActivity : AppCompatActivity() {
}

private fun closeDrawers() {
binding.zoomOptions.isChecked = false
binding.gestureStyleToggle.isChecked = false
binding.drawerLayout.closeDrawers()
}

Expand Down Expand Up @@ -353,6 +351,17 @@ class VncActivity : AppCompatActivity() {
root.systemGestureExclusionRects = listOf(rect)
}
}

// Close flyouts after drawer is closed
// We can't do this when calling closeDrawers() because that will change drawer
// size *while* drawer is closing. This can mess with internal calculations of DrawerLayout,
// and close operation can fail.
binding.drawerLayout.addDrawerListener(object : DrawerLayout.SimpleDrawerListener() {
override fun onDrawerClosed(drawerView: View) {
binding.zoomOptions.isChecked = false
binding.gestureStyleToggle.isChecked = false
}
})
}

/**
Expand Down

0 comments on commit 17e7b0f

Please sign in to comment.