reset some values at touch events

This commit is contained in:
tibbi 2022-09-22 22:44:46 +02:00
parent d39d81b025
commit 2508e59a27
2 changed files with 4 additions and 0 deletions

View File

@ -201,6 +201,7 @@ class MainActivity : SimpleActivity(), FlingListener {
} }
fun startHandlingTouches(touchDownY: Int) { fun startHandlingTouches(touchDownY: Int) {
mLongPressedIcon = null
mTouchDownY = touchDownY mTouchDownY = touchDownY
mCurrentFragmentY = all_apps_fragment.y.toInt() mCurrentFragmentY = all_apps_fragment.y.toInt()
mIgnoreUpEvent = false mIgnoreUpEvent = false
@ -294,6 +295,7 @@ class MainActivity : SimpleActivity(), FlingListener {
} }
setOnDismissListener { setOnDismissListener {
mOpenPopupMenu = null
(all_apps_fragment as AllAppsFragment).ignoreTouches = false (all_apps_fragment as AllAppsFragment).ignoreTouches = false
} }

View File

@ -56,6 +56,8 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
} }
var shouldIntercept = false var shouldIntercept = false
// pull the whole fragment down if it is scrolled way to the top and the users pulls it even further
if (touchDownY != -1) { if (touchDownY != -1) {
shouldIntercept = touchDownY - event.y < 0 && all_apps_grid.computeVerticalScrollOffset() == 0 shouldIntercept = touchDownY - event.y < 0 && all_apps_grid.computeVerticalScrollOffset() == 0
if (shouldIntercept) { if (shouldIntercept) {