1package com.cheogram.android;
2
3import android.content.Context;
4import android.util.AttributeSet;
5import android.view.View;
6import android.webkit.WebView;
7
8public class WebviewAwareViewPager extends androidx.viewpager.widget.ViewPager {
9 public WebviewAwareViewPager(Context context) {
10 super(context);
11 }
12
13 public WebviewAwareViewPager(Context context, AttributeSet attrs) {
14 super(context, attrs);
15 }
16
17 @Override
18 protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
19 if (v instanceof WebView) {
20 // This disables all viewpager swiping over the webview, which is a bit too aggressive
21 // But the default is to do it too often, so tradeoffs...
22 return true;
23 }
24 return super.canScroll(v, checkV, dx, x, y);
25 }
26}