From c8d1a9e37ada68835838440ce7c25b0ee96798b5 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Tue, 7 May 2019 23:55:49 +0800 Subject: [PATCH] Dark theme support. --- .../CommentMultiLevelRecyclerViewAdapter.java | 4 +- .../PostRecyclerViewAdapter.java | 6 +- ...ubscribedSubredditRecyclerViewAdapter.java | 2 +- .../SubscribedUserRecyclerViewAdapter.java | 7 +- .../ViewPostDetailActivity.java | 10 +- .../ViewSubredditDetailActivity.java | 4 +- app/src/main/res/layout/activity_main.xml | 7 +- .../res/layout/activity_view_post_detail.xml | 14 +- .../layout/activity_view_subreddit_detail.xml | 8 +- .../res/layout/activity_view_user_detail.xml | 6 +- app/src/main/res/layout/fragment_post.xml | 1 + app/src/main/res/layout/item_comment.xml | 229 +++++++++--------- app/src/main/res/layout/item_post.xml | 9 +- .../res/layout/item_subreddit_listing.xml | 5 +- ...ubreddit.xml => item_subscribed_thing.xml} | 2 +- app/src/main/res/layout/item_user_listing.xml | 5 +- app/src/main/res/values-night/colors.xml | 26 ++ app/src/main/res/values-v28/styles.xml | 2 +- app/src/main/res/values/colors.xml | 14 ++ app/src/main/res/values/styles.xml | 4 +- 20 files changed, 207 insertions(+), 158 deletions(-) rename app/src/main/res/layout/{item_subscribed_subreddit.xml => item_subscribed_thing.xml} (94%) create mode 100644 app/src/main/res/values-night/colors.xml diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentMultiLevelRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentMultiLevelRecyclerViewAdapter.java index a8928495..e9f29f3c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentMultiLevelRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentMultiLevelRecyclerViewAdapter.java @@ -156,7 +156,7 @@ class CommentMultiLevelRecyclerViewAdapter extends MultiLevelAdapter { commentItem.setVoteType(1); newVoteType = RedditUtils.DIR_UPVOTE; ((CommentViewHolder) holder).upvoteButton - .setColorFilter(ContextCompat.getColor(mContext, R.color.colorPrimary), android.graphics.PorterDuff.Mode.SRC_IN); + .setColorFilter(ContextCompat.getColor(mContext, R.color.backgroundColorPrimaryDark), android.graphics.PorterDuff.Mode.SRC_IN); } else { //Upvoted before commentItem.setVoteType(0); @@ -172,7 +172,7 @@ class CommentMultiLevelRecyclerViewAdapter extends MultiLevelAdapter { if(newVoteType.equals(RedditUtils.DIR_UPVOTE)) { commentItem.setVoteType(1); ((CommentViewHolder) holder).upvoteButton - .setColorFilter(ContextCompat.getColor(mContext, R.color.colorPrimary), android.graphics.PorterDuff.Mode.SRC_IN); + .setColorFilter(ContextCompat.getColor(mContext, R.color.backgroundColorPrimaryDark), android.graphics.PorterDuff.Mode.SRC_IN); } else { commentItem.setVoteType(0); ((CommentViewHolder) holder).upvoteButton.clearColorFilter(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java index 0bc59909..717df7de 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java @@ -270,7 +270,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter + android:src="@drawable/ic_outline_account_circle_24px" + android:tint="@color/primaryTextColor"/> + android:textColor="@color/primaryTextColor" /> + android:background="@color/dividerColor" /> + app:chipBackgroundColor="@color/backgroundColorPrimaryDark"/> - - + + android:background="@color/backgroundColor"> @@ -86,7 +86,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" - android:textColor="@android:color/black" /> + android:textColor="@color/primaryTextColor" /> @@ -95,7 +95,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="16dp" - android:textColor="@android:color/black" + android:textColor="@color/primaryTextColor" android:visibility="gone"/> diff --git a/app/src/main/res/layout/activity_view_user_detail.xml b/app/src/main/res/layout/activity_view_user_detail.xml index 9bd70a72..70b225f8 100644 --- a/app/src/main/res/layout/activity_view_user_detail.xml +++ b/app/src/main/res/layout/activity_view_user_detail.xml @@ -48,7 +48,7 @@ android:paddingStart="16dp" android:paddingEnd="16dp" android:layout_below="@id/banner_image_view_view_user_detail_activity" - android:background="@android:color/white"> + android:background="@color/backgroundColor"> - - - + + android:layout_height="wrap_content"> + + + android:layout_marginTop="12dp" + android:layout_marginBottom="12dp" + android:orientation="vertical"> - + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp"> - + + + + + + + android:layout_marginTop="8dp" + android:layout_marginStart="32dp" + android:layout_marginEnd="32dp" + android:layout_marginBottom="8dp" + android:textColor="@color/primaryTextColor"/> + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/item_post.xml b/app/src/main/res/layout/item_post.xml index 02c8ce23..8f1beb79 100644 --- a/app/src/main/res/layout/item_post.xml +++ b/app/src/main/res/layout/item_post.xml @@ -50,7 +50,7 @@ android:layout_height="24dp" android:layout_marginStart="8dp" android:layout_marginEnd="8dp" - android:tint="@color/colorPrimary" + android:tint="@color/textColorPrimaryDark" android:visibility="gone" app:layout_constraintStart_toEndOf="@id/subreddit_icon_name_linear_layout_view_item_best_post" app:layout_constraintEnd_toStartOf="@+id/post_time_text_view_best_post_item" @@ -77,7 +77,7 @@ android:paddingStart="16dp" android:paddingEnd="16dp" android:textSize="18sp" - android:textColor="#000000"/> + android:textColor="@color/primaryTextColor"/> + app:chipBackgroundColor="@color/backgroundColorPrimaryDark" /> @@ -34,9 +34,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:src="@drawable/baseline_add_white_24" - android:tint="@color/colorPrimary" + android:tint="@color/textColorPrimaryDark" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" diff --git a/app/src/main/res/layout/item_subscribed_subreddit.xml b/app/src/main/res/layout/item_subscribed_thing.xml similarity index 94% rename from app/src/main/res/layout/item_subscribed_subreddit.xml rename to app/src/main/res/layout/item_subscribed_thing.xml index 0717c7c4..0f4afc20 100644 --- a/app/src/main/res/layout/item_subscribed_subreddit.xml +++ b/app/src/main/res/layout/item_subscribed_thing.xml @@ -18,7 +18,7 @@ android:id="@+id/subreddit_name_text_view_item_subscribed_subreddit" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="@android:color/black" + android:textColor="@color/primaryTextColor" android:layout_gravity="center_vertical"/> \ No newline at end of file diff --git a/app/src/main/res/layout/item_user_listing.xml b/app/src/main/res/layout/item_user_listing.xml index 24ba6102..04b16bdc 100644 --- a/app/src/main/res/layout/item_user_listing.xml +++ b/app/src/main/res/layout/item_user_listing.xml @@ -24,7 +24,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginStart="32dp" - android:textColor="@android:color/black" + android:textColor="@color/primaryTextColor" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@+id/user_icon_gif_image_view_item_user_listing" app:layout_constraintTop_toTopOf="parent" /> @@ -34,9 +34,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:src="@drawable/baseline_add_white_24" - android:tint="@color/colorPrimary" + android:tint="@color/textColorPrimaryDark" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml new file mode 100644 index 00000000..8e2257d5 --- /dev/null +++ b/app/src/main/res/values-night/colors.xml @@ -0,0 +1,26 @@ + + + #242424 + #141414 + #FF4081 + + #E91E63 + + #88000000 + + #FFC107 + + #FFFFFF + + #1E88E5 + + #242424 + + #69666C + + #424242 + + #181818 + + #1976D2 + diff --git a/app/src/main/res/values-v28/styles.xml b/app/src/main/res/values-v28/styles.xml index 07037335..96398f20 100644 --- a/app/src/main/res/values-v28/styles.xml +++ b/app/src/main/res/values-v28/styles.xml @@ -1,7 +1,7 @@ -