This commit is contained in:
stom79 2019-01-13 17:00:24 +01:00
parent 4af86fd431
commit e841f6ef75
2 changed files with 8 additions and 14 deletions

View File

@ -56,7 +56,7 @@ ext.evernoteLibraryVersion = '1.2.6'
ext.gsonLibraryVersion = '2.8.2'
ext.guavaLibraryVersion = '24.1-android'
ext.photoViewLibraryVersion = '2.0.0'
ext.swipebackLibraryVersion = '1.0.2'
ext.swipebackLibraryVersion = '1.0.3'
ext.ratethisappLibraryVersion = '1.2.0'
ext.uploadServiceVersion = "3.4.2"
ext.torrentstreamVersion = "2.6.1"
@ -77,14 +77,14 @@ dependencies {
implementation "com.google.code.gson:gson:$gsonLibraryVersion"
implementation "com.google.guava:guava:$guavaLibraryVersion"
implementation "com.github.chrisbanes:PhotoView:$photoViewLibraryVersion"
implementation "com.gongwen:swipeback:$swipebackLibraryVersion"
implementation "com.github.stom79:SwipeBackLayout:$swipebackLibraryVersion"
implementation 'com.github.stom79:country-picker-android:1.2.0'
implementation 'com.github.stom79:mytransl:1.5'
implementation 'com.github.stom79:SparkButton:1.0.10'
implementation "com.koushikdutta.async:androidasync:2.+"
implementation 'com.vanniktech:emoji-one:0.6.0-SNAPSHOT'
implementation 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
implementation 'com.github.franmontiel:LocaleChanger:0.9.2'
implementation 'com.github.stom79:SparkButton:1.0.10'
implementation 'com.github.GrenderG:Toasty:1.3.1'
implementation 'com.elconfidencial.bubbleshowcase:bubbleshowcase:1.3.1'
implementation 'com.android.support:multidex:1.0.3'

View File

@ -91,10 +91,9 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface {
private TextView progress;
private ProgressBar pbar_inf;
private TextView message_ready;
private boolean canSwipe;
private TextView media_description;
private Attachment attachment;
SwipeBackLayout mSwipeBackLayout;
private enum actionSwipe{
RIGHT_TO_LEFT,
LEFT_TO_RIGHT,
@ -112,21 +111,17 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface {
setTheme(R.style.TransparentBlack);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_media);
SwipeBackLayout mSwipeBackLayout = new SwipeBackLayout(MediaActivity.this);
mSwipeBackLayout = new SwipeBackLayout(MediaActivity.this);
mSwipeBackLayout.setDirectionMode(SwipeBackLayout.FROM_BOTTOM);
mSwipeBackLayout.setMaskAlpha(125);
mSwipeBackLayout.setSwipeBackFactor(0.5f);
mSwipeBackLayout.setSwipeBackListener(new SwipeBackLayout.OnSwipeBackListener() {
@Override
public void onViewPositionChanged(View mView, float swipeBackFraction, float SWIPE_BACK_FACTOR) {
canSwipe = swipeBackFraction<0.1;
}
@Override
public void onViewSwipeFinished(View mView, boolean isEnd) {
if(!isEnd)
canSwipe = true;
else {
if( isEnd) {
finish();
overridePendingTransition(0, 0);
}
@ -203,7 +198,6 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface {
scheduleHiddenDescription = false;
}
}, 6000);
canSwipe = true;
loader = findViewById(R.id.loader);
imageView = findViewById(R.id.media_picture);
videoView = findViewById(R.id.media_video);
@ -235,7 +229,7 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface {
imageView.setOnMatrixChangeListener(new OnMatrixChangedListener() {
@Override
public void onMatrixChanged(RectF rect) {
canSwipe = (imageView.getScale() == 1 );
mSwipeBackLayout.isDisabled(imageView.getScale() != 1 );
}
});
pbar_inf = findViewById(R.id.pbar_inf);
@ -290,7 +284,7 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface {
}
}, 6000);
}
if( !canSwipe || mediaPosition > attachments.size() || mediaPosition < 1 || attachments.size() <= 1)
if( mediaPosition > attachments.size() || mediaPosition < 1 || attachments.size() <= 1)
return super.dispatchTouchEvent(event);
switch(event.getAction()){
case MotionEvent.ACTION_DOWN: {