CopyPastor

Detecting plagiarism made easy.

Score: 0.8043926358222961; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2022-07-16
by Suhrab

Original Post

Original - Posted on 2016-09-01
by Shabbir Dhangot



            
Present in both answers; Present only in the new answer; Present only in the old answer;

I searched for a very long time on all possible sites for solutions to this question but I had to experiment and make my own code please. Try below for kotlin
recyclerView.addOnItemTouchListener(object : RecyclerView.OnItemTouchListener { override fun onInterceptTouchEvent(rv: RecyclerView, e: MotionEvent): Boolean {
when (e.action){ MotionEvent.ACTION_MOVE -> viewPager2!!.isUserInputEnabled = false else -> viewPager2!!.isUserInputEnabled = true
} return false }
override fun onTouchEvent(rv: RecyclerView, e: MotionEvent) {
TODO("Not yet implemented") }
override fun onRequestDisallowInterceptTouchEvent(disallowIntercept: Boolean) { TODO("Not yet implemented") }
Here is solution.
requestDisallowInterceptTouchEvent()
This method will not allow parent to move. It stops viewpager touch event.
horizontalRecyclerView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() { @Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { int action = e.getAction(); switch (action) { case MotionEvent.ACTION_MOVE: rv.getParent().requestDisallowInterceptTouchEvent(true); break; } return false; }
@Override public void onTouchEvent(RecyclerView rv, MotionEvent e) {
}
@Override public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
} });

        
Present in both answers; Present only in the new answer; Present only in the old answer;