aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java9
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java11
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java7
-rw-r--r--app/src/main/res/anim/slide_out_down.xml12
-rw-r--r--app/src/main/res/anim/slide_out_up.xml12
6 files changed, 52 insertions, 6 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java
index a1802a90..cc48a870 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java
@@ -36,6 +36,7 @@ import com.bumptech.glide.load.resource.gif.GifDrawable;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
+import com.thefuntasty.hauler.DragDirection;
import com.thefuntasty.hauler.HaulerView;
import java.io.File;
@@ -117,7 +118,11 @@ public class ViewGIFActivity extends AppCompatActivity {
actionBar.setHomeAsUpIndicator(upArrow);
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarAndExoPlayerControllerColor)));
- mHaulerView.setOnDragDismissedListener(dragDirection -> finish());
+ mHaulerView.setOnDragDismissedListener(dragDirection -> {
+ int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down;
+ finish();
+ overridePendingTransition(0, slide);
+ });
glide = Glide.with(this);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java
index 62fa12a5..670a89d9 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java
@@ -43,6 +43,7 @@ import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.target.Target;
import com.bumptech.glide.request.transition.Transition;
+import com.thefuntasty.hauler.DragDirection;
import com.thefuntasty.hauler.HaulerView;
import java.io.File;
@@ -138,7 +139,11 @@ public class ViewImageActivity extends AppCompatActivity implements SetAsWallpap
setTitle("");
}
- mHaulerView.setOnDragDismissedListener(dragDirection -> finish());
+ mHaulerView.setOnDragDismissedListener(dragDirection -> {
+ int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down;
+ finish();
+ overridePendingTransition(0, slide);
+ });
mLoadErrorLinearLayout.setOnClickListener(view -> {
mProgressBar.setVisibility(View.VISIBLE);
@@ -237,7 +242,7 @@ public class ViewImageActivity extends AppCompatActivity implements SetAsWallpap
@Override
public void saveSuccess(File imageFile) {
Uri uri = FileProvider.getUriForFile(ViewImageActivity.this,
- BuildConfig.APPLICATION_ID + ".provider",imageFile);
+ BuildConfig.APPLICATION_ID + ".provider", imageFile);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java
index f35d220f..e5fba668 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java
@@ -32,6 +32,7 @@ import androidx.viewpager.widget.ViewPager;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.transition.Transition;
+import com.thefuntasty.hauler.DragDirection;
import com.thefuntasty.hauler.HaulerView;
import org.json.JSONArray;
@@ -140,7 +141,11 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa
images = savedInstanceState.getParcelableArrayList(IMGUR_IMAGES_STATE);
}
- haulerView.setOnDragDismissedListener(dragDirection -> finish());
+ haulerView.setOnDragDismissedListener(dragDirection -> {
+ int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down;
+ finish();
+ overridePendingTransition(0, slide);
+ });
if (images == null) {
fetchImgurMedia(imgurId);
@@ -447,6 +452,7 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa
interface ParseImgurImagesAsyncTaskListener {
void success(ArrayList<ImgurMedia> images);
+
void failed();
}
@@ -501,6 +507,7 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa
interface ParseImgurImageAsyncTaskListener {
void success(ImgurMedia image);
+
void failed();
}
@@ -541,4 +548,4 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa
}
}
}
-} \ No newline at end of file
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java
index 1bccf67b..dad6ff0c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java
@@ -47,6 +47,7 @@ import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
import com.google.android.exoplayer2.util.Util;
+import com.thefuntasty.hauler.DragDirection;
import com.thefuntasty.hauler.HaulerView;
import java.io.File;
@@ -160,7 +161,11 @@ public class ViewVideoActivity extends AppCompatActivity {
params.rightMargin = getResources().getDimensionPixelSize(resourceId);
}
- haulerView.setOnDragDismissedListener(dragDirection -> finish());
+ haulerView.setOnDragDismissedListener(dragDirection -> {
+ int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down;
+ finish();
+ overridePendingTransition(0, slide);
+ });
Intent intent = getIntent();
mVideoUri = intent.getData();
diff --git a/app/src/main/res/anim/slide_out_down.xml b/app/src/main/res/anim/slide_out_down.xml
new file mode 100644
index 00000000..4c64d6c4
--- /dev/null
+++ b/app/src/main/res/anim/slide_out_down.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <translate
+ android:duration="@android:integer/config_shortAnimTime"
+ android:fromYDelta="0"
+ android:toYDelta="+50%p" />
+ <alpha
+ android:duration="@android:integer/config_shortAnimTime"
+ android:fromAlpha="1.0"
+ android:toAlpha="0.0" />
+</set>
diff --git a/app/src/main/res/anim/slide_out_up.xml b/app/src/main/res/anim/slide_out_up.xml
new file mode 100644
index 00000000..945e2b7e
--- /dev/null
+++ b/app/src/main/res/anim/slide_out_up.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <translate
+ android:duration="@android:integer/config_shortAnimTime"
+ android:fromYDelta="0"
+ android:toYDelta="-50%p" />
+ <alpha
+ android:duration="@android:integer/config_shortAnimTime"
+ android:fromAlpha="1.0"
+ android:toAlpha="0.0" />
+</set>