summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorstom79 <tschneider.ac@gmail.com>2019-01-13 17:00:24 +0100
committerstom79 <tschneider.ac@gmail.com>2019-01-13 17:00:24 +0100
commite841f6ef75d8ba333a6cadd615526fe56a3419fd (patch)
treeb2355ec693199dd8862a838a1b9b4e9b9c4d5501 /app
parent4af86fd431ed8a3ee040f939da227dc5b861afdd (diff)
Fix issue #719
Diffstat (limited to 'app')
-rw-r--r--app/build.gradle6
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/activities/MediaActivity.java16
2 files changed, 8 insertions, 14 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 5297a13ec..e86a4ce1d 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -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'
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/MediaActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/MediaActivity.java
index 1b28c5f6a..834642dab 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/MediaActivity.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/MediaActivity.java
@@ -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: {