From 44e2987a848ec07fd866f8ed76bb29c66b03e60a Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Sun, 4 Aug 2019 11:11:52 +0800 Subject: Fixed UI in dark theme. Minor bugs fixed. --- .../CommentAndPostRecyclerViewAdapter.java | 20 +++--- .../infinityforreddit/PostRecyclerViewAdapter.java | 74 +++++++++++----------- .../infinityforreddit/ViewUserDetailActivity.java | 29 ++++++--- 3 files changed, 65 insertions(+), 58 deletions(-) (limited to 'app/src/main/java/ml') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java index 26776df0..3d3769d1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java @@ -166,15 +166,15 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter { if(mActivity != null && getItemCount() > 0) { - if(!iconImageUrl.equals("")) { - mGlide.load(iconImageUrl) + if(iconImageUrl == null || iconImageUrl.equals("")) { + mGlide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) - .error(mGlide.load(R.drawable.subreddit_default_icon) - .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) .into(((PostDetailViewHolder) holder).mIconGifImageView); } else { - mGlide.load(R.drawable.subreddit_default_icon) + mGlide.load(iconImageUrl) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) + .error(mGlide.load(R.drawable.subreddit_default_icon) + .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) .into(((PostDetailViewHolder) holder).mIconGifImageView); } @@ -202,15 +202,15 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter { - if(!iconImageUrl.equals("")) { - mGlide.load(iconImageUrl) + if(iconImageUrl == null || iconImageUrl.equals("")) { + mGlide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) - .error(mGlide.load(R.drawable.subreddit_default_icon) - .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) .into(((PostDetailViewHolder) holder).mIconGifImageView); } else { - mGlide.load(R.drawable.subreddit_default_icon) + mGlide.load(iconImageUrl) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) + .error(mGlide.load(R.drawable.subreddit_default_icon) + .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) .into(((PostDetailViewHolder) holder).mIconGifImageView); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java index 724b00ba..e5c8a896 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java @@ -138,7 +138,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter { if(mContext != null && getItemCount() > 0) { - if(!iconImageUrl.equals("")) { + if(iconImageUrl == null || iconImageUrl.equals("")) { + glide.load(R.drawable.subreddit_default_icon) + .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) + .into(((DataViewHolder) holder).iconGifImageView); + } else { glide.load(iconImageUrl) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .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) - .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) - .into(((DataViewHolder) holder).subredditIconGifImageView); + .into(((DataViewHolder) holder).iconGifImageView); } if(holder.getAdapterPosition() >= 0) { @@ -187,29 +187,27 @@ class PostRecyclerViewAdapter extends PagedListAdapter { if(mContext != null && getItemCount() > 0) { - if(iconImageUrl == null) { - - } else if(!iconImageUrl.equals("")) { + if(iconImageUrl == null || iconImageUrl.equals("")) { + glide.load(R.drawable.subreddit_default_icon) + .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) + .into(((DataViewHolder) holder).iconGifImageView); + } else { glide.load(iconImageUrl) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .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) - .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) - .into(((DataViewHolder) holder).subredditIconGifImageView); + .into(((DataViewHolder) holder).iconGifImageView); } if(holder.getAdapterPosition() >= 0) { @@ -222,18 +220,18 @@ class PostRecyclerViewAdapter extends PagedListAdapter { + ((DataViewHolder) holder).iconNameLinearLayout.setOnClickListener(view -> { if(canStartActivity) { canStartActivity = false; if(post.getSubredditNamePrefixed().startsWith("u/")) { @@ -253,16 +251,16 @@ class PostRecyclerViewAdapter extends PagedListAdapter { if(mContext != null && getItemCount() > 0) { - if(!iconImageUrl.equals("")) { + if(iconImageUrl == null || iconImageUrl.equals("")) { + glide.load(R.drawable.subreddit_default_icon) + .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) + .into(((DataViewHolder) holder).iconGifImageView); + } else { glide.load(iconImageUrl) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .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) - .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) - .into(((DataViewHolder) holder).subredditIconGifImageView); + .into(((DataViewHolder) holder).iconGifImageView); } if(holder.getAdapterPosition() >= 0) { @@ -275,17 +273,17 @@ class PostRecyclerViewAdapter extends PagedListAdapter { + ((DataViewHolder) holder).iconNameLinearLayout.setOnClickListener(view -> { if(canStartActivity) { canStartActivity = false; Intent intent = new Intent(mContext, ViewUserDetailActivity.class); @@ -652,9 +650,9 @@ class PostRecyclerViewAdapter extends PagedListAdapter