Skip to content

Commit

Permalink
v1.0.9, update dependencies, add pinch-zoom sample code
Browse files Browse the repository at this point in the history
  • Loading branch information
perthcpe23 committed Apr 27, 2021
1 parent b278701 commit f1b89ff
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions app/src/main/java/com/longdo/mjpegview/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
12 changes: 6 additions & 6 deletions mjpegviewer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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'
Expand Down
13 changes: 12 additions & 1 deletion mjpegviewer/src/main/java/com/longdo/mjpegviewer/MjpegView.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class MjpegView extends View{

private boolean isRecycleBitmap;
private boolean isUserForceConfigRecycle;
private boolean isSupportPinchZoomAndPan;

public MjpegView(Context context){
super(context);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit f1b89ff

Please sign in to comment.