Fixed the error drawable of glide image loading has not been done rounded corners transformation.

This commit is contained in:
Alex Ning 2019-02-26 22:16:34 +08:00
parent 9530e1f497
commit acc08489fa
9 changed files with 34 additions and 18 deletions

View File

@ -199,7 +199,8 @@ public class MainActivity extends AppCompatActivity {
if (!mProfileImageUrl.equals("")) {
glide.load(mProfileImageUrl)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(144, 0)))
.error(glide.load(R.drawable.subreddit_default_icon))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(144, 0))))
.into(mProfileImageView);
} else {
glide.load(R.drawable.subreddit_default_icon)
@ -259,7 +260,8 @@ public class MainActivity extends AppCompatActivity {
if (!profileImageUrl.equals("")) {
glide.load(profileImageUrl)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(128, 0)))
.error(glide.load(R.drawable.subreddit_default_icon))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(128, 0))))
.into(mProfileImageView);
} else {
glide.load(R.drawable.subreddit_default_icon)

View File

@ -156,7 +156,8 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
if(!iconImageUrl.equals("")) {
glide.load(iconImageUrl)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(glide.load(R.drawable.subreddit_default_icon))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
.into(((DataViewHolder) holder).subredditIconGifImageView);
} else {
glide.load(R.drawable.subreddit_default_icon)
@ -172,7 +173,8 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
} else if(!post.getSubredditIconUrl().equals("")) {
glide.load(post.getSubredditIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(glide.load(R.drawable.subreddit_default_icon))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
.into(((DataViewHolder) holder).subredditIconGifImageView);
} else {
glide.load(R.drawable.subreddit_default_icon)
@ -206,7 +208,8 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
if(!iconImageUrl.equals("")) {
glide.load(iconImageUrl)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(glide.load(R.drawable.subreddit_default_icon))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
.into(((DataViewHolder) holder).subredditIconGifImageView);
} else {
glide.load(R.drawable.subreddit_default_icon)
@ -222,7 +225,8 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
} else if(!post.getAuthorIconUrl().equals("")) {
glide.load(post.getAuthorIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(glide.load(R.drawable.subreddit_default_icon))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
.into(((DataViewHolder) holder).subredditIconGifImageView);
} else {
glide.load(R.drawable.subreddit_default_icon)

View File

@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -102,9 +103,11 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred
});
if(subredditData.getIconUrl() != null) {
Log.i("url", subredditData.getIconUrl());
glide.load(subredditData.getIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(glide.load(R.drawable.subreddit_default_icon))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
.into(((DataViewHolder) holder).iconGifImageView);
} else {
glide.load(R.drawable.subreddit_default_icon)

View File

@ -2,8 +2,6 @@ package ml.docilealligator.infinityforreddit;
import android.content.Context;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -16,6 +14,8 @@ import com.bumptech.glide.request.RequestOptions;
import java.util.List;
import SubscribedSubredditDatabase.SubscribedSubredditData;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
import pl.droidsonroids.gif.GifImageView;
@ -54,7 +54,8 @@ class SubscribedSubredditRecyclerViewAdapter extends RecyclerView.Adapter<Recycl
if(!mSubscribedSubredditData.get(i).getIconUrl().equals("")) {
glide.load(mSubscribedSubredditData.get(i).getIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(glide.load(R.drawable.subreddit_default_icon))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
.into(((SubredditViewHolder) viewHolder).iconGifImageView);
} else {
glide.load(R.drawable.subreddit_default_icon)

View File

@ -2,8 +2,6 @@ package ml.docilealligator.infinityforreddit;
import android.content.Context;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -16,6 +14,8 @@ import com.bumptech.glide.request.RequestOptions;
import java.util.List;
import SubscribedUserDatabase.SubscribedUserData;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
import pl.droidsonroids.gif.GifImageView;
@ -52,7 +52,8 @@ public class SubscribedUserRecyclerViewAdapter extends RecyclerView.Adapter<Recy
if(!mSubscribedUserData.get(i).getIconUrl().equals("")) {
glide.load(mSubscribedUserData.get(i).getIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(glide.load(R.drawable.subreddit_default_icon))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
.into(((UserViewHolder) viewHolder).iconGifImageView);
} else {
glide.load(R.drawable.subreddit_default_icon)

View File

@ -104,7 +104,8 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R
if(UserData.getIconUrl() != null) {
glide.load(UserData.getIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(glide.load(R.drawable.subreddit_default_icon))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
.into(((UserListingRecyclerViewAdapter.DataViewHolder) holder).iconGifImageView);
} else {
glide.load(R.drawable.subreddit_default_icon)

View File

@ -142,7 +142,8 @@ public class ViewPostDetailActivity extends AppCompatActivity {
if(!iconImageUrl.equals("")) {
glide.load(iconImageUrl)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(glide.load(R.drawable.subreddit_default_icon))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
.into(mSubredditIconGifImageView);
} else {
glide.load(R.drawable.subreddit_default_icon)
@ -156,7 +157,8 @@ public class ViewPostDetailActivity extends AppCompatActivity {
} else if(!mPost.getSubredditIconUrl().equals("")) {
glide.load(mPost.getSubredditIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(glide.load(R.drawable.subreddit_default_icon))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
.into(mSubredditIconGifImageView);
} else {
glide.load(R.drawable.subreddit_default_icon)

View File

@ -159,7 +159,8 @@ public class ViewSubredditDetailActivity extends AppCompatActivity {
} else {
glide.load(subredditData.getIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))
.error(glide.load(R.drawable.subreddit_default_icon))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0))))
.into(iconGifImageView);
iconGifImageView.setOnClickListener(view -> {
Intent intent = new Intent(ViewSubredditDetailActivity.this, ViewImageActivity.class);

View File

@ -157,7 +157,8 @@ public class ViewUserDetailActivity extends AppCompatActivity {
} else {
glide.load(userData.getIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))
.error(glide.load(R.drawable.subreddit_default_icon))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0))))
.into(iconGifImageView);
iconGifImageView.setOnClickListener(view -> {