Skip to content

Commit 88c6a88

Browse files
committed
addOnItemTouchListener
1 parent e70148f commit 88c6a88

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/src/main/java/com/hoc/pagination_mvi/ui/main/MainFragment.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.hoc.pagination_mvi.ui.main
33
import android.graphics.Rect
44
import android.os.Bundle
55
import android.view.LayoutInflater
6+
import android.view.MotionEvent
67
import android.view.View
78
import android.view.ViewGroup
89
import androidx.fragment.app.Fragment
@@ -108,6 +109,17 @@ class MainFragment : Fragment() {
108109
}
109110
}
110111
})
112+
113+
addOnItemTouchListener(object : RecyclerView.SimpleOnItemTouchListener() {
114+
override fun onInterceptTouchEvent(rv: RecyclerView, e: MotionEvent): Boolean {
115+
if (e.action == MotionEvent.ACTION_DOWN &&
116+
rv.scrollState == RecyclerView.SCROLL_STATE_SETTLING
117+
) {
118+
rv.stopScroll()
119+
}
120+
return false
121+
}
122+
})
111123
}
112124
}
113125

0 commit comments

Comments
 (0)