fixing a glitch at scrolling fragments

This commit is contained in:
tibbi 2022-10-11 11:06:01 +02:00
parent 7d01cbf25d
commit 97d147dfd0
3 changed files with 4 additions and 3 deletions

View file

@ -358,8 +358,10 @@ class MainActivity : SimpleActivity(), FlingListener {
Handler().postDelayed({
if (fragment is AllAppsFragment) {
fragment.all_apps_grid.scrollToPosition(0)
fragment.touchDownY = -1
} else if (fragment is WidgetsFragment) {
fragment.widgets_list.scrollToPosition(0)
fragment.touchDownY = -1
}
}, ANIMATION_DURATION)
}

View file

@ -21,8 +21,8 @@ import com.simplemobiletools.launcher.models.HomeScreenGridItem
import kotlinx.android.synthetic.main.all_apps_fragment.view.*
class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment(context, attributeSet), AllAppsListener {
private var touchDownY = -1
private var lastTouchCoords = Pair(0f, 0f)
var touchDownY = -1
var ignoreTouches = false
@SuppressLint("ClickableViewAccessibility")

View file

@ -23,10 +23,9 @@ import com.simplemobiletools.launcher.interfaces.WidgetsFragmentListener
import com.simplemobiletools.launcher.models.*
import kotlinx.android.synthetic.main.widgets_fragment.view.*
class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment(context, attributeSet), WidgetsFragmentListener {
private var touchDownY = -1
private var lastTouchCoords = Pair(0f, 0f)
var touchDownY = -1
var ignoreTouches = false
override fun setupFragment(activity: MainActivity) {