Disable mouse scroll for WebView

This commit is contained in:
M66B 2020-06-05 14:20:28 +02:00
parent f23a3c06f6
commit 65b871eb42
1 changed files with 10 additions and 0 deletions

View File

@ -24,6 +24,8 @@ import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.util.Pair;
import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.DownloadListener;
import android.webkit.WebSettings;
@ -168,6 +170,14 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
return false;
}
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_SCROLL &&
(event.getSource() & InputDevice.SOURCE_MOUSE) != 0)
return false;
return super.onGenericMotionEvent(event);
}
interface IWebView {
void onSizeChanged(int w, int h, int ow, int oh);