From 4364e20e36aba6de96d25b237cac7c178a5e1980 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Thu, 30 Aug 2018 14:08:02 +0800 Subject: Display a custom error view when there is something wrong when loading best posts. Probably fix a bug that holder.getAdapterPosition() returns -1 when loading subreddit icons in the RecyclerView of PostFragment. Subreddit banners are parsed correctly in ParseSubscribedThing. Check if the api call is successful in onResponse. Rewrite some methods. --- .../res/drawable/load_post_error_indicator.png | Bin 0 -> 60464 bytes .../res/layout/activity_view_subreddit_detail.xml | 3 ++- app/src/main/res/layout/fragment_post.xml | 22 +++++++++++++++++++++ app/src/main/res/values/strings.xml | 2 ++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/load_post_error_indicator.png (limited to 'app/src/main/res') diff --git a/app/src/main/res/drawable/load_post_error_indicator.png b/app/src/main/res/drawable/load_post_error_indicator.png new file mode 100644 index 00000000..a067fb1e Binary files /dev/null and b/app/src/main/res/drawable/load_post_error_indicator.png differ diff --git a/app/src/main/res/layout/activity_view_subreddit_detail.xml b/app/src/main/res/layout/activity_view_subreddit_detail.xml index d5f6ec57..ed05ebf1 100644 --- a/app/src/main/res/layout/activity_view_subreddit_detail.xml +++ b/app/src/main/res/layout/activity_view_subreddit_detail.xml @@ -21,7 +21,7 @@ android:layout_height="match_parent" android:fitsSystemWindows="true" app:contentScrim="?attr/colorPrimary" - app:layout_scrollFlags="scroll|exitUntilCollapsed" + app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed" app:toolbarId="@+id/toolbar"> diff --git a/app/src/main/res/layout/fragment_post.xml b/app/src/main/res/layout/fragment_post.xml index e18a4a62..431a2292 100644 --- a/app/src/main/res/layout/fragment_post.xml +++ b/app/src/main/res/layout/fragment_post.xml @@ -19,6 +19,28 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> + + + + + + + +