aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/res
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2018-08-30 06:08:02 +0000
committerAlex Ning <chineseperson5@gmail.com>2018-08-30 06:08:02 +0000
commit4364e20e36aba6de96d25b237cac7c178a5e1980 (patch)
tree1738f18c8dcafcc3aff1a5b302eaa6febdb298b1 /app/src/main/res
parent3fa625742862f55e50799ec346fa35e81aedcd20 (diff)
downloadinfinity-for-reddit-4364e20e36aba6de96d25b237cac7c178a5e1980.tar
infinity-for-reddit-4364e20e36aba6de96d25b237cac7c178a5e1980.tar.gz
infinity-for-reddit-4364e20e36aba6de96d25b237cac7c178a5e1980.tar.bz2
infinity-for-reddit-4364e20e36aba6de96d25b237cac7c178a5e1980.tar.lz
infinity-for-reddit-4364e20e36aba6de96d25b237cac7c178a5e1980.tar.xz
infinity-for-reddit-4364e20e36aba6de96d25b237cac7c178a5e1980.tar.zst
infinity-for-reddit-4364e20e36aba6de96d25b237cac7c178a5e1980.zip
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.
Diffstat (limited to 'app/src/main/res')
-rw-r--r--app/src/main/res/drawable/load_post_error_indicator.pngbin0 -> 60464 bytes
-rw-r--r--app/src/main/res/layout/activity_view_subreddit_detail.xml3
-rw-r--r--app/src/main/res/layout/fragment_post.xml22
-rw-r--r--app/src/main/res/values/strings.xml2
4 files changed, 26 insertions, 1 deletions
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
--- /dev/null
+++ b/app/src/main/res/drawable/load_post_error_indicator.png
Binary files 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">
<RelativeLayout
@@ -109,6 +109,7 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
+ app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:navigationIcon="?attr/homeAsUpIndicator" />
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" />
+ <LinearLayout
+ android:id="@+id/fetch_post_error_linear_layout_post_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:orientation="vertical"
+ android:visibility="gone">
+
+ <ImageView
+ android:id="@+id/fetch_post_error_image_view_post_fragment"
+ android:layout_width="150dp"
+ android:layout_height="wrap_content" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:gravity="center"
+ android:text="@string/load_posts_error"/>
+
+ </LinearLayout>
+
<!--<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_post_fragment"
android:layout_width="wrap_content"
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 2014e3bb..2b98acbb 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -8,6 +8,8 @@
<string name="action_settings">Settings</string>
<string name="action_download">Download</string>
+ <string name="load_posts_error">Error loading posts.\nTap to retry.</string>
+
<string name="load_data_failed">Cannot load posts</string>
<string name="load_comment_failed">Error loading comments</string>
<string name="retry">Retry</string>