aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java11
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewImgurImageFragment.java23
-rw-r--r--app/src/main/res/anim/slide_out_down.xml12
-rw-r--r--app/src/main/res/anim/slide_out_up.xml12
-rw-r--r--app/src/main/res/layout/fragment_view_imgur_images.xml6
7 files changed, 21 insertions, 47 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java
index 0577ba2f..dd2b0d1c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java
@@ -11,7 +11,6 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.Html;
-import android.util.DisplayMetrics;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -155,16 +154,6 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa
setTitle("");
}
- DisplayMetrics displayMetrics = new DisplayMetrics();
- getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
- int windowHeight = displayMetrics.heightPixels;
-
- /*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);
mLoadErrorLinearLayout.setVisibility(View.GONE);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
index bbf36110..a7975e47 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
@@ -1248,7 +1248,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
if ((mPost.isNSFW() && mNeedBlurNsfw && !(mPost.getPostType() == Post.GIF_TYPE && mAutoplayNsfwVideos)) || (mPost.isSpoiler() && mNeedBlurSpoiler)) {
imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))).into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView);
} else {
- if (mImageViewWidth > mPost.getPreviewWidth()) {
+ if (mImageViewWidth > mPost.getPreviewWidth() && mPost.getPostType() == Post.IMAGE_TYPE) {
imageRequestBuilder.override(Target.SIZE_ORIGINAL).into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView);
} else {
imageRequestBuilder.into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
index 835d8af1..d630f12a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
@@ -875,7 +875,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10)))
.into(((PostImageAndGifAutoplayViewHolder) holder).imageView);
} else {
- if (mImageViewWidth > post.getPreviewWidth()) {
+ if (mImageViewWidth > post.getPreviewWidth() && post.getPostType() == Post.IMAGE_TYPE) {
imageRequestBuilder.override(Target.SIZE_ORIGINAL).into(((PostImageAndGifAutoplayViewHolder) holder).imageView);
} else {
imageRequestBuilder.into(((PostImageAndGifAutoplayViewHolder) holder).imageView);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewImgurImageFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewImgurImageFragment.java
index 51c48d26..83411416 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewImgurImageFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewImgurImageFragment.java
@@ -26,7 +26,6 @@ import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.fragment.app.Fragment;
-import com.alexvasilkov.gestures.views.GestureImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import com.bumptech.glide.load.DataSource;
@@ -35,6 +34,8 @@ 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.davemorrissey.labs.subscaleview.ImageSource;
+import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import java.io.File;
@@ -58,7 +59,7 @@ public class ViewImgurImageFragment extends Fragment {
@BindView(R.id.progress_bar_view_imgur_image_fragment)
ProgressBar progressBar;
@BindView(R.id.image_view_view_imgur_image_fragment)
- GestureImageView imageView;
+ SubsamplingScaleImageView imageView;
@BindView(R.id.load_image_error_linear_layout_view_imgur_image_fragment)
LinearLayout errorLinearLayout;
@@ -110,20 +111,30 @@ public class ViewImgurImageFragment extends Fragment {
}
private void loadImage() {
- glide.load(imgurMedia.getLink()).listener(new RequestListener<Drawable>() {
+ glide.asBitmap().load(imgurMedia.getLink()).listener(new RequestListener<Bitmap>() {
@Override
- public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
+ public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource) {
progressBar.setVisibility(View.GONE);
errorLinearLayout.setVisibility(View.VISIBLE);
return false;
}
@Override
- public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
+ public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) {
progressBar.setVisibility(View.GONE);
return false;
}
- }).override(Target.SIZE_ORIGINAL).into(imageView);
+ }).into(new CustomTarget<Bitmap>() {
+ @Override
+ public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
+ imageView.setImage(ImageSource.bitmap(resource));
+ }
+
+ @Override
+ public void onLoadCleared(@Nullable Drawable placeholder) {
+
+ }
+ });
}
@Override
diff --git a/app/src/main/res/anim/slide_out_down.xml b/app/src/main/res/anim/slide_out_down.xml
deleted file mode 100644
index 4c64d6c4..00000000
--- a/app/src/main/res/anim/slide_out_down.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?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
deleted file mode 100644
index 945e2b7e..00000000
--- a/app/src/main/res/anim/slide_out_up.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?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/layout/fragment_view_imgur_images.xml b/app/src/main/res/layout/fragment_view_imgur_images.xml
index 63620c08..20110897 100644
--- a/app/src/main/res/layout/fragment_view_imgur_images.xml
+++ b/app/src/main/res/layout/fragment_view_imgur_images.xml
@@ -13,13 +13,11 @@
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
- <com.alexvasilkov.gestures.views.GestureImageView
+ <com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
android:id="@+id/image_view_view_imgur_image_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:adjustViewBounds="true"
- android:scaleType="fitCenter"
- app:gest_fillViewport="true" />
+ app:quickScaleEnabled="false" />
<LinearLayout
android:id="@+id/load_image_error_linear_layout_view_imgur_image_fragment"