Some fixes
This commit is contained in:
parent
e841f6ef75
commit
a6d8a10e30
|
@ -91,6 +91,7 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface {
|
||||||
private TextView progress;
|
private TextView progress;
|
||||||
private ProgressBar pbar_inf;
|
private ProgressBar pbar_inf;
|
||||||
private TextView message_ready;
|
private TextView message_ready;
|
||||||
|
private boolean canSwipe;
|
||||||
private TextView media_description;
|
private TextView media_description;
|
||||||
private Attachment attachment;
|
private Attachment attachment;
|
||||||
SwipeBackLayout mSwipeBackLayout;
|
SwipeBackLayout mSwipeBackLayout;
|
||||||
|
@ -118,10 +119,14 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface {
|
||||||
mSwipeBackLayout.setSwipeBackListener(new SwipeBackLayout.OnSwipeBackListener() {
|
mSwipeBackLayout.setSwipeBackListener(new SwipeBackLayout.OnSwipeBackListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onViewPositionChanged(View mView, float swipeBackFraction, float SWIPE_BACK_FACTOR) {
|
public void onViewPositionChanged(View mView, float swipeBackFraction, float SWIPE_BACK_FACTOR) {
|
||||||
|
canSwipe = swipeBackFraction<0.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewSwipeFinished(View mView, boolean isEnd) {
|
public void onViewSwipeFinished(View mView, boolean isEnd) {
|
||||||
if( isEnd) {
|
if(!isEnd)
|
||||||
|
canSwipe = true;
|
||||||
|
else {
|
||||||
finish();
|
finish();
|
||||||
overridePendingTransition(0, 0);
|
overridePendingTransition(0, 0);
|
||||||
}
|
}
|
||||||
|
@ -198,6 +203,7 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface {
|
||||||
scheduleHiddenDescription = false;
|
scheduleHiddenDescription = false;
|
||||||
}
|
}
|
||||||
}, 6000);
|
}, 6000);
|
||||||
|
canSwipe = true;
|
||||||
loader = findViewById(R.id.loader);
|
loader = findViewById(R.id.loader);
|
||||||
imageView = findViewById(R.id.media_picture);
|
imageView = findViewById(R.id.media_picture);
|
||||||
videoView = findViewById(R.id.media_video);
|
videoView = findViewById(R.id.media_video);
|
||||||
|
@ -229,6 +235,7 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface {
|
||||||
imageView.setOnMatrixChangeListener(new OnMatrixChangedListener() {
|
imageView.setOnMatrixChangeListener(new OnMatrixChangedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onMatrixChanged(RectF rect) {
|
public void onMatrixChanged(RectF rect) {
|
||||||
|
canSwipe = (imageView.getScale() == 1 );
|
||||||
mSwipeBackLayout.isDisabled(imageView.getScale() != 1 );
|
mSwipeBackLayout.isDisabled(imageView.getScale() != 1 );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -284,7 +291,7 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface {
|
||||||
}
|
}
|
||||||
}, 6000);
|
}, 6000);
|
||||||
}
|
}
|
||||||
if( mediaPosition > attachments.size() || mediaPosition < 1 || attachments.size() <= 1)
|
if( !canSwipe || mediaPosition > attachments.size() || mediaPosition < 1 || attachments.size() <= 1)
|
||||||
return super.dispatchTouchEvent(event);
|
return super.dispatchTouchEvent(event);
|
||||||
switch(event.getAction()){
|
switch(event.getAction()){
|
||||||
case MotionEvent.ACTION_DOWN: {
|
case MotionEvent.ACTION_DOWN: {
|
||||||
|
|
Loading…
Reference in New Issue