mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 12:47:26 +01:00
Use another GifImageView library.
This commit is contained in:
parent
3a58964d6c
commit
2b0228ab47
Binary file not shown.
Binary file not shown.
@ -68,10 +68,10 @@ dependencies {
|
|||||||
implementation 'com.jakewharton:butterknife:8.8.1'
|
implementation 'com.jakewharton:butterknife:8.8.1'
|
||||||
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
|
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
|
||||||
implementation 'com.github.santalu:aspect-ratio-imageview:1.0.6'
|
implementation 'com.github.santalu:aspect-ratio-imageview:1.0.6'
|
||||||
implementation 'com.felipecsl:gifimageview:2.2.0'
|
|
||||||
implementation "android.arch.paging:runtime:1.0.1"
|
implementation "android.arch.paging:runtime:1.0.1"
|
||||||
implementation "com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE"
|
implementation "com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE"
|
||||||
implementation "ru.noties:markwon:2.0.1"
|
implementation "ru.noties:markwon:2.0.1"
|
||||||
implementation "ru.noties:markwon-syntax-highlight:2.0.1"
|
implementation "ru.noties:markwon-syntax-highlight:2.0.1"
|
||||||
implementation "ru.noties:markwon-view:2.0.1"
|
implementation "ru.noties:markwon-view:2.0.1"
|
||||||
|
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16'
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import android.content.Context;
|
|||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
import com.felipecsl.gifimageview.library.GifImageView;
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
|
|
||||||
public class AspectRatioGifImageView extends GifImageView {
|
public class AspectRatioGifImageView extends GifImageView {
|
||||||
private float ratio;
|
private float ratio;
|
||||||
|
@ -5,7 +5,6 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.ColorFilter;
|
import android.graphics.ColorFilter;
|
||||||
import android.graphics.drawable.Animatable;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
@ -158,22 +157,6 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
|
|||||||
glide.load(iconImageUrl)
|
glide.load(iconImageUrl)
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
.error(glide.load(R.drawable.subreddit_default_icon))
|
.error(glide.load(R.drawable.subreddit_default_icon))
|
||||||
.listener(new RequestListener<Drawable>() {
|
|
||||||
@Override
|
|
||||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
|
||||||
if(resource instanceof Animatable) {
|
|
||||||
//This is a gif
|
|
||||||
//((Animatable) resource).start();
|
|
||||||
((DataViewHolder) holder).subredditIconGifImageView.startAnimation();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.into(((DataViewHolder) holder).subredditIconGifImageView);
|
.into(((DataViewHolder) holder).subredditIconGifImageView);
|
||||||
} else {
|
} else {
|
||||||
glide.load(R.drawable.subreddit_default_icon)
|
glide.load(R.drawable.subreddit_default_icon)
|
||||||
@ -190,22 +173,6 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
|
|||||||
glide.load(post.getSubredditIconUrl())
|
glide.load(post.getSubredditIconUrl())
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
.error(glide.load(R.drawable.subreddit_default_icon))
|
.error(glide.load(R.drawable.subreddit_default_icon))
|
||||||
.listener(new RequestListener<Drawable>() {
|
|
||||||
@Override
|
|
||||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
|
||||||
if(resource instanceof Animatable) {
|
|
||||||
//This is a gif
|
|
||||||
//((Animatable) resource).start();
|
|
||||||
((DataViewHolder) holder).subredditIconGifImageView.startAnimation();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.into(((DataViewHolder) holder).subredditIconGifImageView);
|
.into(((DataViewHolder) holder).subredditIconGifImageView);
|
||||||
} else {
|
} else {
|
||||||
glide.load(R.drawable.subreddit_default_icon)
|
glide.load(R.drawable.subreddit_default_icon)
|
||||||
@ -240,22 +207,6 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
|
|||||||
glide.load(iconImageUrl)
|
glide.load(iconImageUrl)
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
.error(glide.load(R.drawable.subreddit_default_icon))
|
.error(glide.load(R.drawable.subreddit_default_icon))
|
||||||
.listener(new RequestListener<Drawable>() {
|
|
||||||
@Override
|
|
||||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
|
||||||
if(resource instanceof Animatable) {
|
|
||||||
//This is a gif
|
|
||||||
//((Animatable) resource).start();
|
|
||||||
((DataViewHolder) holder).subredditIconGifImageView.startAnimation();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.into(((DataViewHolder) holder).subredditIconGifImageView);
|
.into(((DataViewHolder) holder).subredditIconGifImageView);
|
||||||
} else {
|
} else {
|
||||||
glide.load(R.drawable.subreddit_default_icon)
|
glide.load(R.drawable.subreddit_default_icon)
|
||||||
@ -272,22 +223,6 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
|
|||||||
glide.load(post.getAuthorIconUrl())
|
glide.load(post.getAuthorIconUrl())
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
.error(glide.load(R.drawable.subreddit_default_icon))
|
.error(glide.load(R.drawable.subreddit_default_icon))
|
||||||
.listener(new RequestListener<Drawable>() {
|
|
||||||
@Override
|
|
||||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
|
||||||
if(resource instanceof Animatable) {
|
|
||||||
//This is a gif
|
|
||||||
//((Animatable) resource).start();
|
|
||||||
((DataViewHolder) holder).subredditIconGifImageView.startAnimation();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.into(((DataViewHolder) holder).subredditIconGifImageView);
|
.into(((DataViewHolder) holder).subredditIconGifImageView);
|
||||||
} else {
|
} else {
|
||||||
glide.load(R.drawable.subreddit_default_icon)
|
glide.load(R.drawable.subreddit_default_icon)
|
||||||
@ -687,12 +622,6 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
|
|||||||
@Override
|
@Override
|
||||||
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
|
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
|
||||||
if(holder instanceof DataViewHolder) {
|
if(holder instanceof DataViewHolder) {
|
||||||
if(((DataViewHolder) holder).imageView.isAnimating()) {
|
|
||||||
((DataViewHolder) holder).imageView.stopAnimation();
|
|
||||||
}
|
|
||||||
if(((DataViewHolder) holder).subredditIconGifImageView.isAnimating()) {
|
|
||||||
((DataViewHolder) holder).subredditIconGifImageView.stopAnimation();
|
|
||||||
}
|
|
||||||
glide.clear(((DataViewHolder) holder).imageView);
|
glide.clear(((DataViewHolder) holder).imageView);
|
||||||
glide.clear(((DataViewHolder) holder).subredditIconGifImageView);
|
glide.clear(((DataViewHolder) holder).subredditIconGifImageView);
|
||||||
((DataViewHolder) holder).stickiedPostImageView.setVisibility(View.GONE);
|
((DataViewHolder) holder).stickiedPostImageView.setVisibility(View.GONE);
|
||||||
|
@ -2,10 +2,7 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.Animatable;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -14,17 +11,13 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.RequestManager;
|
import com.bumptech.glide.RequestManager;
|
||||||
import com.bumptech.glide.load.DataSource;
|
|
||||||
import com.bumptech.glide.load.engine.GlideException;
|
|
||||||
import com.bumptech.glide.request.RequestListener;
|
|
||||||
import com.bumptech.glide.request.RequestOptions;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
import com.bumptech.glide.request.target.Target;
|
|
||||||
import com.felipecsl.gifimageview.library.GifImageView;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import SubscribedSubredditDatabase.SubscribedSubredditData;
|
import SubscribedSubredditDatabase.SubscribedSubredditData;
|
||||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||||
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
|
|
||||||
class SubscribedSubredditRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
class SubscribedSubredditRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
@ -62,23 +55,7 @@ class SubscribedSubredditRecyclerViewAdapter extends RecyclerView.Adapter<Recycl
|
|||||||
glide.load(mSubscribedSubredditData.get(i).getIconUrl())
|
glide.load(mSubscribedSubredditData.get(i).getIconUrl())
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
.error(glide.load(R.drawable.subreddit_default_icon))
|
.error(glide.load(R.drawable.subreddit_default_icon))
|
||||||
.listener(new RequestListener<Drawable>() {
|
.into(((SubredditViewHolder) viewHolder).iconGifImageView);
|
||||||
@Override
|
|
||||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
|
||||||
if(resource instanceof Animatable) {
|
|
||||||
//This is a gif
|
|
||||||
//((Animatable) resource).start();
|
|
||||||
((SubredditViewHolder) viewHolder).iconGifImageView.startAnimation();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}).into(((SubredditViewHolder) viewHolder).iconGifImageView);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
glide.load(R.drawable.subreddit_default_icon)
|
glide.load(R.drawable.subreddit_default_icon)
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
@ -97,9 +74,6 @@ class SubscribedSubredditRecyclerViewAdapter extends RecyclerView.Adapter<Recycl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
|
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
|
||||||
if(((SubredditViewHolder) holder).iconGifImageView.isAnimating()) {
|
|
||||||
((SubredditViewHolder) holder).iconGifImageView.stopAnimation();
|
|
||||||
}
|
|
||||||
glide.clear(((SubredditViewHolder) holder).iconGifImageView);
|
glide.clear(((SubredditViewHolder) holder).iconGifImageView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,7 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.Animatable;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -14,17 +11,13 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.RequestManager;
|
import com.bumptech.glide.RequestManager;
|
||||||
import com.bumptech.glide.load.DataSource;
|
|
||||||
import com.bumptech.glide.load.engine.GlideException;
|
|
||||||
import com.bumptech.glide.request.RequestListener;
|
|
||||||
import com.bumptech.glide.request.RequestOptions;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
import com.bumptech.glide.request.target.Target;
|
|
||||||
import com.felipecsl.gifimageview.library.GifImageView;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import SubscribedUserDatabase.SubscribedUserData;
|
import SubscribedUserDatabase.SubscribedUserData;
|
||||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||||
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
|
|
||||||
public class SubscribedUserRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class SubscribedUserRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
private List<SubscribedUserData> mSubscribedUserData;
|
private List<SubscribedUserData> mSubscribedUserData;
|
||||||
@ -60,22 +53,7 @@ public class SubscribedUserRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
glide.load(mSubscribedUserData.get(i).getIconUrl())
|
glide.load(mSubscribedUserData.get(i).getIconUrl())
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
.error(glide.load(R.drawable.subreddit_default_icon))
|
.error(glide.load(R.drawable.subreddit_default_icon))
|
||||||
.listener(new RequestListener<Drawable>() {
|
.into(((UserViewHolder) viewHolder).iconGifImageView);
|
||||||
@Override
|
|
||||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
|
||||||
if(resource instanceof Animatable) {
|
|
||||||
//This is a gif
|
|
||||||
((Animatable) resource).start();
|
|
||||||
((SubscribedUserRecyclerViewAdapter.UserViewHolder) viewHolder).iconGifImageView.startAnimation();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}).into(((UserViewHolder) viewHolder).iconGifImageView);
|
|
||||||
} else {
|
} else {
|
||||||
glide.load(R.drawable.subreddit_default_icon)
|
glide.load(R.drawable.subreddit_default_icon)
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
|
@ -4,7 +4,6 @@ import android.content.Intent;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.ColorFilter;
|
import android.graphics.ColorFilter;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.Animatable;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -139,22 +138,6 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
glide.load(iconImageUrl)
|
glide.load(iconImageUrl)
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
.error(glide.load(R.drawable.subreddit_default_icon))
|
.error(glide.load(R.drawable.subreddit_default_icon))
|
||||||
.listener(new RequestListener<Drawable>() {
|
|
||||||
@Override
|
|
||||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
|
||||||
if(resource instanceof Animatable) {
|
|
||||||
//This is a gif
|
|
||||||
//((Animatable) resource).start();
|
|
||||||
mSubredditIconGifImageView.startAnimation();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.into(mSubredditIconGifImageView);
|
.into(mSubredditIconGifImageView);
|
||||||
} else {
|
} else {
|
||||||
glide.load(R.drawable.subreddit_default_icon)
|
glide.load(R.drawable.subreddit_default_icon)
|
||||||
@ -169,22 +152,6 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
glide.load(mPost.getSubredditIconUrl())
|
glide.load(mPost.getSubredditIconUrl())
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
.error(glide.load(R.drawable.subreddit_default_icon))
|
.error(glide.load(R.drawable.subreddit_default_icon))
|
||||||
.listener(new RequestListener<Drawable>() {
|
|
||||||
@Override
|
|
||||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
|
||||||
if(resource instanceof Animatable) {
|
|
||||||
//This is a gif
|
|
||||||
//((Animatable) resource).start();
|
|
||||||
mSubredditIconGifImageView.startAnimation();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.into(mSubredditIconGifImageView);
|
.into(mSubredditIconGifImageView);
|
||||||
} else {
|
} else {
|
||||||
glide.load(R.drawable.subreddit_default_icon)
|
glide.load(R.drawable.subreddit_default_icon)
|
||||||
|
@ -3,11 +3,8 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
import android.arch.lifecycle.ViewModelProviders;
|
import android.arch.lifecycle.ViewModelProviders;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.drawable.Animatable;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.design.chip.Chip;
|
import android.support.design.chip.Chip;
|
||||||
import android.support.design.widget.AppBarLayout;
|
import android.support.design.widget.AppBarLayout;
|
||||||
import android.support.design.widget.CollapsingToolbarLayout;
|
import android.support.design.widget.CollapsingToolbarLayout;
|
||||||
@ -25,12 +22,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.RequestManager;
|
import com.bumptech.glide.RequestManager;
|
||||||
import com.bumptech.glide.load.DataSource;
|
|
||||||
import com.bumptech.glide.load.engine.GlideException;
|
|
||||||
import com.bumptech.glide.request.RequestListener;
|
|
||||||
import com.bumptech.glide.request.RequestOptions;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
import com.bumptech.glide.request.target.Target;
|
|
||||||
import com.felipecsl.gifimageview.library.GifImageView;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
@ -45,6 +37,7 @@ import SubscribedSubredditDatabase.SubscribedSubredditRoomDatabase;
|
|||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||||
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
public class ViewSubredditDetailActivity extends AppCompatActivity {
|
public class ViewSubredditDetailActivity extends AppCompatActivity {
|
||||||
@ -168,22 +161,6 @@ public class ViewSubredditDetailActivity extends AppCompatActivity {
|
|||||||
glide.load(subredditData.getIconUrl())
|
glide.load(subredditData.getIconUrl())
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))
|
||||||
.error(glide.load(R.drawable.subreddit_default_icon))
|
.error(glide.load(R.drawable.subreddit_default_icon))
|
||||||
.listener(new RequestListener<Drawable>() {
|
|
||||||
@Override
|
|
||||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
|
||||||
if(resource instanceof Animatable) {
|
|
||||||
//This is a gif
|
|
||||||
((Animatable) resource).start();
|
|
||||||
iconGifImageView.startAnimation();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.into(iconGifImageView);
|
.into(iconGifImageView);
|
||||||
iconGifImageView.setOnClickListener(view -> {
|
iconGifImageView.setOnClickListener(view -> {
|
||||||
Intent intent = new Intent(ViewSubredditDetailActivity.this, ViewImageActivity.class);
|
Intent intent = new Intent(ViewSubredditDetailActivity.this, ViewImageActivity.class);
|
||||||
|
@ -3,11 +3,8 @@ package ml.docilealligator.infinityforreddit;
|
|||||||
import android.arch.lifecycle.ViewModelProviders;
|
import android.arch.lifecycle.ViewModelProviders;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.drawable.Animatable;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.design.chip.Chip;
|
import android.support.design.chip.Chip;
|
||||||
import android.support.design.widget.AppBarLayout;
|
import android.support.design.widget.AppBarLayout;
|
||||||
import android.support.design.widget.CollapsingToolbarLayout;
|
import android.support.design.widget.CollapsingToolbarLayout;
|
||||||
@ -24,12 +21,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.RequestManager;
|
import com.bumptech.glide.RequestManager;
|
||||||
import com.bumptech.glide.load.DataSource;
|
|
||||||
import com.bumptech.glide.load.engine.GlideException;
|
|
||||||
import com.bumptech.glide.request.RequestListener;
|
|
||||||
import com.bumptech.glide.request.RequestOptions;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
import com.bumptech.glide.request.target.Target;
|
|
||||||
import com.felipecsl.gifimageview.library.GifImageView;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
@ -44,6 +36,7 @@ import User.UserViewModel;
|
|||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||||
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
public class ViewUserDetailActivity extends AppCompatActivity {
|
public class ViewUserDetailActivity extends AppCompatActivity {
|
||||||
@ -166,23 +159,8 @@ public class ViewUserDetailActivity extends AppCompatActivity {
|
|||||||
glide.load(userData.getIconUrl())
|
glide.load(userData.getIconUrl())
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))
|
||||||
.error(glide.load(R.drawable.subreddit_default_icon))
|
.error(glide.load(R.drawable.subreddit_default_icon))
|
||||||
.listener(new RequestListener<Drawable>() {
|
|
||||||
@Override
|
|
||||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
|
||||||
if(resource instanceof Animatable) {
|
|
||||||
//This is a gif
|
|
||||||
((Animatable) resource).start();
|
|
||||||
iconGifImageView.startAnimation();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.into(iconGifImageView);
|
.into(iconGifImageView);
|
||||||
|
|
||||||
iconGifImageView.setOnClickListener(view -> {
|
iconGifImageView.setOnClickListener(view -> {
|
||||||
Intent intent = new Intent(this, ViewImageActivity.class);
|
Intent intent = new Intent(this, ViewImageActivity.class);
|
||||||
intent.putExtra(ViewImageActivity.TITLE_KEY, title);
|
intent.putExtra(ViewImageActivity.TITLE_KEY, title);
|
||||||
|
@ -32,17 +32,14 @@
|
|||||||
android:layout_height="180dp"
|
android:layout_height="180dp"
|
||||||
android:contentDescription="@string/content_description_banner_imageview" />
|
android:contentDescription="@string/content_description_banner_imageview" />
|
||||||
|
|
||||||
<com.felipecsl.gifimageview.library.GifImageView
|
<pl.droidsonroids.gif.GifImageView
|
||||||
android:id="@+id/icon_gif_image_view_view_subreddit_detail_activity"
|
android:id="@+id/icon_gif_image_view_view_subreddit_detail_activity"
|
||||||
android:layout_width="72dp"
|
android:layout_width="72dp"
|
||||||
android:layout_height="72dp"
|
android:layout_height="72dp"
|
||||||
android:layout_marginTop="-36dp"
|
android:layout_marginTop="-36dp"
|
||||||
app:civ_border_color="@android:color/white"
|
|
||||||
app:civ_border_width="1dp"
|
|
||||||
android:layout_below="@id/banner_image_view_view_subreddit_detail_activity"
|
android:layout_below="@id/banner_image_view_view_subreddit_detail_activity"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:elevation="4dp"
|
android:elevation="4dp" />
|
||||||
app:civ_circle_background_color="@android:color/white"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -32,17 +32,14 @@
|
|||||||
android:layout_height="180dp"
|
android:layout_height="180dp"
|
||||||
android:contentDescription="@string/content_description_banner_imageview" />
|
android:contentDescription="@string/content_description_banner_imageview" />
|
||||||
|
|
||||||
<com.felipecsl.gifimageview.library.GifImageView
|
<pl.droidsonroids.gif.GifImageView
|
||||||
android:id="@+id/icon_gif_image_view_view_user_detail_activity"
|
android:id="@+id/icon_gif_image_view_view_user_detail_activity"
|
||||||
android:layout_width="72dp"
|
android:layout_width="72dp"
|
||||||
android:layout_height="72dp"
|
android:layout_height="72dp"
|
||||||
android:layout_marginTop="-36dp"
|
android:layout_marginTop="-36dp"
|
||||||
app:civ_border_color="@android:color/white"
|
|
||||||
app:civ_border_width="1dp"
|
|
||||||
android:layout_below="@id/banner_image_view_view_user_detail_activity"
|
android:layout_below="@id/banner_image_view_view_user_detail_activity"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:elevation="4dp"
|
android:elevation="4dp" />
|
||||||
app:civ_circle_background_color="@android:color/white"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:background="?attr/selectableItemBackground">
|
android:background="?attr/selectableItemBackground">
|
||||||
|
|
||||||
<com.felipecsl.gifimageview.library.GifImageView
|
<pl.droidsonroids.gif.GifImageView
|
||||||
android:id="@+id/subreddit_icon_gif_image_view_item_subscribed_subreddit"
|
android:id="@+id/subreddit_icon_gif_image_view_item_subscribed_subreddit"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
|
Loading…
Reference in New Issue
Block a user