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 ++++++--- app/src/main/res/layout/app_bar_main.xml | 1 + app/src/main/res/layout/item_post.xml | 8 +-- app/src/main/res/values-night/colors.xml | 14 ++++ app/src/main/res/values/colors.xml | 12 ++++ 7 files changed, 96 insertions(+), 62 deletions(-) (limited to 'app/src') 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 diff --git a/app/src/main/res/layout/item_post.xml b/app/src/main/res/layout/item_post.xml index 7598375d..e3be0913 100644 --- a/app/src/main/res/layout/item_post.xml +++ b/app/src/main/res/layout/item_post.xml @@ -19,7 +19,7 @@ android:layout_height="wrap_content"> diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index a08dfe08..e79b7fa2 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -27,4 +27,18 @@ #242424 #000000 + + #3C3C3C + + #FFFFFF + + @color/backgroundColor + + @color/tabLayoutWithExpandedCollapsingToolbarTextColor + + #FFFFFF + + @color/colorPrimary + + @color/tabLayoutWithCollapsedCollapsingToolbarTextColor diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 6bbfc9c6..b69907f3 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -29,4 +29,16 @@ #000000 #F0F0F0 + + @color/colorPrimary + + #FFFFFF + + @color/tabLayoutWithExpandedCollapsingToolbarTextColor + + #FFFFFF + + @color/colorPrimary + + @color/tabLayoutWithCollapsedCollapsingToolbarTextColor -- cgit v1.2.3