Prevent flinging while movement on other axis is active

This commit is contained in:
Ensar Sarajčić 2023-08-23 13:08:25 +02:00
parent 6c8800f266
commit a34bab78af
1 changed files with 16 additions and 0 deletions

View File

@ -749,6 +749,10 @@ class MainActivity : SimpleActivity(), FlingListener {
}
override fun onFlingUp() {
if (mIgnoreYMoveEvents) {
return
}
if (!isWidgetsFragmentExpanded()) {
mIgnoreUpEvent = true
showFragment(binding.allAppsFragment)
@ -757,6 +761,10 @@ class MainActivity : SimpleActivity(), FlingListener {
@SuppressLint("WrongConstant")
override fun onFlingDown() {
if (mIgnoreYMoveEvents) {
return
}
mIgnoreUpEvent = true
if (isAllAppsFragmentExpanded()) {
hideFragment(binding.allAppsFragment)
@ -771,11 +779,19 @@ class MainActivity : SimpleActivity(), FlingListener {
}
override fun onFlingRight() {
if (mIgnoreXMoveEvents) {
return
}
mIgnoreUpEvent = true
binding.homeScreenGrid.root.prevPage(redraw = true)
}
override fun onFlingLeft() {
if (mIgnoreXMoveEvents) {
return
}
mIgnoreUpEvent = true
binding.homeScreenGrid.root.nextPage(redraw = true)
}