3 |
efrain |
1 |
package com.cesams.leaderslinked.v2;
|
|
|
2 |
|
|
|
3 |
import android.content.Context;
|
|
|
4 |
import android.util.AttributeSet;
|
|
|
5 |
import android.view.MotionEvent;
|
|
|
6 |
import android.view.View;
|
|
|
7 |
import android.webkit.WebView;
|
|
|
8 |
|
|
|
9 |
import androidx.core.view.MotionEventCompat;
|
|
|
10 |
|
|
|
11 |
public class TouchyWebView extends WebView {
|
|
|
12 |
|
|
|
13 |
private ITouckWebView iTouckWebView;
|
|
|
14 |
|
|
|
15 |
public TouchyWebView(Context context) {
|
|
|
16 |
super(context);
|
|
|
17 |
}
|
|
|
18 |
|
|
|
19 |
public TouchyWebView(Context context, AttributeSet attrs) {
|
|
|
20 |
super(context, attrs);
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
public TouchyWebView(Context context, AttributeSet attrs, int defStyle) {
|
|
|
24 |
super(context, attrs, defStyle);
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
public void setiTouckWebView(ITouckWebView iTouckWebView) {
|
|
|
28 |
this.iTouckWebView = iTouckWebView;
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
/*
|
|
|
32 |
@Override
|
|
|
33 |
public boolean onTouchEvent(MotionEvent event) {
|
|
|
34 |
//Check is required to prevent crash
|
|
|
35 |
|
|
|
36 |
if (MotionEvent.findPointerIndex(event, 0) == -1) {
|
|
|
37 |
return super.onTouchEvent(event);
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
if (event.getPointerCount() >= 2) {
|
|
|
41 |
requestDisallowInterceptTouchEvent(true);
|
|
|
42 |
} else {
|
|
|
43 |
requestDisallowInterceptTouchEvent(false);
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
return super.onTouchEvent(event);
|
|
|
47 |
}*/
|
|
|
48 |
|
|
|
49 |
|
|
|
50 |
@Override
|
|
|
51 |
public boolean onTouchEvent(MotionEvent event){
|
|
|
52 |
// requestDisallowInterceptTouchEvent(true);
|
|
|
53 |
return super.onTouchEvent(event);
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
@Override
|
|
|
57 |
protected void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY) {
|
|
|
58 |
super.onOverScrolled(scrollX, scrollY, clampedX, clampedY);
|
|
|
59 |
// The refresh logic is now handled by SwipeRefreshLayout
|
|
|
60 |
/*
|
|
|
61 |
requestDisallowInterceptTouchEvent(true);
|
|
|
62 |
|
|
|
63 |
System.out.println("onOverScrolled scrollY = " + scrollY + " clampedY = " + clampedY);
|
|
|
64 |
|
|
|
65 |
if(this.iTouckWebView != null) {
|
|
|
66 |
this.iTouckWebView.reloadPage();
|
|
|
67 |
}
|
|
|
68 |
*/
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
}
|