From c4690a6e38004fa0442e6c15b9637ee209e9c2dd Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Tue, 25 Jun 2019 09:21:44 +0800 Subject: Reimplement ViewPostActivity using one recyclerview to display a post and its comments instead of using a recyclerview inside NestedScrollView to prevent onBindViewHolder gets called for all the comments data at once and thus consumes more memory and freezes after the comments are loaded. --- app/src/main/res/drawable/no_comment_indicator.png | Bin 60561 -> 0 bytes .../main/res/drawable/no_comment_placeholder.png | Bin 0 -> 60561 bytes .../main/res/layout/activity_view_post_detail.xml | 335 +-------------------- app/src/main/res/layout/item_load_comments.xml | 19 ++ .../item_load_comments_failed_placeholder.xml | 8 + .../res/layout/item_no_comment_placeholder.xml | 8 + app/src/main/res/layout/item_post_detail.xml | 252 ++++++++++++++++ 7 files changed, 290 insertions(+), 332 deletions(-) delete mode 100644 app/src/main/res/drawable/no_comment_indicator.png create mode 100644 app/src/main/res/drawable/no_comment_placeholder.png create mode 100644 app/src/main/res/layout/item_load_comments.xml create mode 100644 app/src/main/res/layout/item_load_comments_failed_placeholder.xml create mode 100644 app/src/main/res/layout/item_no_comment_placeholder.xml create mode 100644 app/src/main/res/layout/item_post_detail.xml (limited to 'app/src/main/res') diff --git a/app/src/main/res/drawable/no_comment_indicator.png b/app/src/main/res/drawable/no_comment_indicator.png deleted file mode 100644 index 62a3668f..00000000 Binary files a/app/src/main/res/drawable/no_comment_indicator.png and /dev/null differ diff --git a/app/src/main/res/drawable/no_comment_placeholder.png b/app/src/main/res/drawable/no_comment_placeholder.png new file mode 100644 index 00000000..62a3668f Binary files /dev/null and b/app/src/main/res/drawable/no_comment_placeholder.png differ diff --git a/app/src/main/res/layout/activity_view_post_detail.xml b/app/src/main/res/layout/activity_view_post_detail.xml index 0c9f6786..7416ed7a 100644 --- a/app/src/main/res/layout/activity_view_post_detail.xml +++ b/app/src/main/res/layout/activity_view_post_detail.xml @@ -21,339 +21,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> \ No newline at end of file diff --git a/app/src/main/res/layout/item_load_comments.xml b/app/src/main/res/layout/item_load_comments.xml new file mode 100644 index 00000000..06bc8c38 --- /dev/null +++ b/app/src/main/res/layout/item_load_comments.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_load_comments_failed_placeholder.xml b/app/src/main/res/layout/item_load_comments_failed_placeholder.xml new file mode 100644 index 00000000..476d3d2d --- /dev/null +++ b/app/src/main/res/layout/item_load_comments_failed_placeholder.xml @@ -0,0 +1,8 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_no_comment_placeholder.xml b/app/src/main/res/layout/item_no_comment_placeholder.xml new file mode 100644 index 00000000..becf93d4 --- /dev/null +++ b/app/src/main/res/layout/item_no_comment_placeholder.xml @@ -0,0 +1,8 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_post_detail.xml b/app/src/main/res/layout/item_post_detail.xml new file mode 100644 index 00000000..870d21ef --- /dev/null +++ b/app/src/main/res/layout/item_post_detail.xml @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3