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