diff --git a/app/src/main/java/com/longdo/mjpegview/MainActivity.java b/app/src/main/java/com/longdo/mjpegview/MainActivity.java index d73f291..7c5d4c6 100644 --- a/app/src/main/java/com/longdo/mjpegview/MainActivity.java +++ b/app/src/main/java/com/longdo/mjpegview/MainActivity.java @@ -29,6 +29,7 @@ protected void onCreate(Bundle savedInstanceState) { view2 = findViewById(R.id.mjpegview2); view2.setAdjustHeight(true); + view2.setSupportPinchZoomAndPan(true); //view.setAdjustWidth(true); view2.setMode(MjpegView.MODE_FIT_WIDTH); //view.setMsecWaitAfterReadImageError(1000); diff --git a/build.gradle b/build.gradle index eb79a38..fe3f51b 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.2' + classpath 'com.android.tools.build:gradle:4.1.3' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' diff --git a/mjpegviewer/build.gradle b/mjpegviewer/build.gradle index 0a0a594..174c811 100644 --- a/mjpegviewer/build.gradle +++ b/mjpegviewer/build.gradle @@ -27,14 +27,14 @@ ext { } android { - compileSdkVersion 29 - buildToolsVersion '29.0.3' + compileSdkVersion 30 + buildToolsVersion '30.0.3' defaultConfig { minSdkVersion 14 - targetSdkVersion 29 - versionCode 108 - versionName "1.0.8" + targetSdkVersion 30 + versionCode 109 + versionName "1.0.9" } buildTypes { release { @@ -46,7 +46,7 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.appcompat:appcompat:1.2.0' } apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle' diff --git a/mjpegviewer/src/main/java/com/longdo/mjpegviewer/MjpegView.java b/mjpegviewer/src/main/java/com/longdo/mjpegviewer/MjpegView.java index c048942..2089a46 100755 --- a/mjpegviewer/src/main/java/com/longdo/mjpegviewer/MjpegView.java +++ b/mjpegviewer/src/main/java/com/longdo/mjpegviewer/MjpegView.java @@ -56,6 +56,7 @@ public class MjpegView extends View{ private boolean isRecycleBitmap; private boolean isUserForceConfigRecycle; + private boolean isSupportPinchZoomAndPan; public MjpegView(Context context){ super(context); @@ -301,6 +302,14 @@ public void setRecycleBitmap(boolean recycleBitmap) { isRecycleBitmap = recycleBitmap; } + public boolean getSupportPinchZoomAndPan() { + return isSupportPinchZoomAndPan; + } + + public void setSupportPinchZoomAndPan(boolean supportPinchZoomAndPan) { + isSupportPinchZoomAndPan = supportPinchZoomAndPan; + } + class MjpegDownloader extends Thread{ private boolean run = true; @@ -545,7 +554,9 @@ public void onScaleEnd(ScaleGestureDetector detector) { @Override public boolean onTouchEvent(MotionEvent event) { - if(event.getPointerCount() == 1) { + if (!isSupportPinchZoomAndPan) { + return false; + } else if(event.getPointerCount() == 1) { int id = event.getAction(); if(id == MotionEvent.ACTION_DOWN){ touchStart.set(event.getX(),event.getY());