Fix view pager scrolling of bottom sheet

As was suggested in https://github.com/AntennaPod/AntennaPod/pull/4020#discussion_r406795883
This commit is contained in:
Ebrahim Byagowi 2020-04-11 00:10:37 +04:30
parent 292afd7d30
commit 77dc78dfe8
1 changed files with 3 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.core.view.ViewCompat; import androidx.core.view.ViewCompat;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.widget.ViewPager2; import androidx.viewpager2.widget.ViewPager2;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@ -34,7 +35,8 @@ public class ViewPagerBottomSheetBehavior<V extends View> extends BottomSheetBeh
if (view instanceof ViewPager2) { if (view instanceof ViewPager2) {
ViewPager2 viewPager = (ViewPager2) view; ViewPager2 viewPager = (ViewPager2) view;
View currentViewPagerChild = viewPager.getChildAt(viewPager.getCurrentItem()); RecyclerView recycler = (RecyclerView) viewPager.getChildAt(0);
View currentViewPagerChild = recycler.getChildAt(viewPager.getCurrentItem());
if (currentViewPagerChild != null) { if (currentViewPagerChild != null) {
return findScrollingChild(currentViewPagerChild); return findScrollingChild(currentViewPagerChild);
} }