From 36a06290ef08290c2ca3d1f58839fdb258fbad3c Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Tue, 29 Oct 2019 22:33:53 +0800 Subject: Fixed UI issues in posts and comments. Version 1.4.0. --- .../Activity/LinkResolverActivity.java | 4 +- .../Adapter/CommentAndPostRecyclerViewAdapter.java | 8 + .../Adapter/PostRecyclerViewAdapter.java | 13 +- .../infinityforreddit/CommentData.java | 10 +- .../infinityforreddit/JSONUtils.java | 1 + .../infinityforreddit/ParseComment.java | 12 +- .../main/res/drawable/ic_comment_white_24dp.xml | 12 +- .../res/drawable/ic_insert_comment_white_24dp.xml | 5 - app/src/main/res/layout/item_comment.xml | 181 +++++---------------- app/src/main/res/layout/item_post.xml | 151 ++++------------- app/src/main/res/layout/item_post_detail.xml | 88 +++++----- .../main/res/menu/view_post_detail_activity.xml | 2 +- app/src/main/res/values/colors.xml | 2 + 13 files changed, 169 insertions(+), 320 deletions(-) delete mode 100644 app/src/main/res/drawable/ic_insert_comment_white_24dp.xml (limited to 'app/src/main') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java index 8a2dfb89..a6e130b8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java @@ -36,9 +36,9 @@ public class LinkResolverActivity extends AppCompatActivity { private static final String POST_PATTERN = "/r/\\w+/comments/\\w+/{0,1}\\w+/{0,1}"; private static final String COMMENT_PATTERN = "/r/\\w+/comments/\\w+/{0,1}\\w+/\\w+/{0,1}"; - private static final String SUBREDDIT_PATTERN = "/r/\\w+/{0,1}"; + private static final String SUBREDDIT_PATTERN = "/[rR]/\\w+/{0,1}"; private static final String USER_PATTERN_1 = "/user/\\w+/{0,1}"; - private static final String USER_PATTERN_2 = "/u/\\w+/{0,1}"; + private static final String USER_PATTERN_2 = "/[uU]/\\w+/{0,1}"; @Inject SharedPreferences mSharedPreferences; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index 97c7fb98..12f06260 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -582,6 +582,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter { + ((DataViewHolder) holder).nameTextView.setOnClickListener(view -> { if (canStartActivity) { canStartActivity = false; if (post.getSubredditNamePrefixed().startsWith("u/")) { @@ -263,6 +262,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter + ((DataViewHolder) holder).nameTextView.performClick()); } else { if (post.getAuthorIconUrl() == null) { String authorName = post.getAuthor().equals("[deleted]") ? post.getSubredditNamePrefixed().substring(2) : post.getAuthor(); @@ -300,7 +302,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter { + ((DataViewHolder) holder).nameTextView.setOnClickListener(view -> { if (canStartActivity) { canStartActivity = false; Intent intent = new Intent(mContext, ViewUserDetailActivity.class); @@ -308,6 +310,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter + ((DataViewHolder) holder).nameTextView.performClick()); } ((DataViewHolder) holder).postTimeTextView.setText(postTime); @@ -807,8 +812,6 @@ public class PostRecyclerViewAdapter extends PagedListAdapter - + + diff --git a/app/src/main/res/drawable/ic_insert_comment_white_24dp.xml b/app/src/main/res/drawable/ic_insert_comment_white_24dp.xml deleted file mode 100644 index 8ab8d733..00000000 --- a/app/src/main/res/drawable/ic_insert_comment_white_24dp.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/app/src/main/res/layout/item_comment.xml b/app/src/main/res/layout/item_comment.xml index 242841b2..377b5337 100644 --- a/app/src/main/res/layout/item_comment.xml +++ b/app/src/main/res/layout/item_comment.xml @@ -1,7 +1,6 @@ + android:paddingStart="16dp" + android:paddingEnd="16dp"> + + - + app:layout_constraintEnd_toStartOf="@+id/barrier" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/author_text_view_item_post_comment" /> + app:layout_constraintTop_toTopOf="parent" /> + + @@ -71,127 +95,6 @@ android:textColor="@color/primaryTextColor" android:textSize="?attr/content_font_default" /> - - + android:layout_height="wrap_content" + android:padding="16dp"> - - - - - + app:layout_constraintTop_toTopOf="parent"/> - + + app:layout_constraintStart_toEndOf="@id/name_text_view_item_post" + app:layout_constraintEnd_toStartOf="@+id/guideline2" + app:layout_constraintTop_toTopOf="parent"/> + + - - + android:layout_height="wrap_content" + android:padding="16dp"> - - - - - + app:layout_constraintTop_toTopOf="parent" /> - + - + + app:layout_constraintTop_toTopOf="parent" /> + + diff --git a/app/src/main/res/menu/view_post_detail_activity.xml b/app/src/main/res/menu/view_post_detail_activity.xml index 4f33f387..56f5d12c 100644 --- a/app/src/main/res/menu/view_post_detail_activity.xml +++ b/app/src/main/res/menu/view_post_detail_activity.xml @@ -5,7 +5,7 @@ android:id="@+id/action_comment_view_post_detail_activity" android:orderInCategory="1" android:title="@string/action_add_comment" - android:icon="@drawable/ic_insert_comment_white_24dp" + android:icon="@drawable/ic_comment_white_24dp" app:showAsAction="ifRoom" android:visible="false" /> diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 9aa277b0..c3302cc6 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -77,4 +77,6 @@ #EE02EB #00AA8C + + #EE02C4 -- cgit v1.2.3