From 1bd9ba61c6cccd1fc318f1698fddc0d13e4723cf Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Fri, 28 Sep 2018 14:49:49 +0800 Subject: Change the layout of post. Add an error view when loading the preview image fails. --- .../res/drawable/ic_error_outline_black_24dp.xml | 9 + .../main/res/layout/activity_view_post_detail.xml | 29 +- .../main/res/layout/item_footer_progress_bar.xml | 5 +- app/src/main/res/layout/item_post.xml | 359 +++++++++++---------- app/src/main/res/values/strings.xml | 1 + 5 files changed, 226 insertions(+), 177 deletions(-) create mode 100644 app/src/main/res/drawable/ic_error_outline_black_24dp.xml (limited to 'app/src/main/res') diff --git a/app/src/main/res/drawable/ic_error_outline_black_24dp.xml b/app/src/main/res/drawable/ic_error_outline_black_24dp.xml new file mode 100644 index 00000000..a07a0f90 --- /dev/null +++ b/app/src/main/res/drawable/ic_error_outline_black_24dp.xml @@ -0,0 +1,9 @@ + + + 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 c3a1c688..025f8ef1 100644 --- a/app/src/main/res/layout/activity_view_post_detail.xml +++ b/app/src/main/res/layout/activity_view_post_detail.xml @@ -144,12 +144,6 @@ android:layout_marginTop="16dp" android:visibility="gone"> - - + + + + + + + + @@ -18,7 +18,7 @@ android:id="@+id/relative_layout_footer_progress_bar_item" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="8dp" + android:layout_marginTop="16dp" android:layout_marginBottom="16dp" android:layout_marginLeft="16dp" android:layout_marginStart="16dp" @@ -41,6 +41,7 @@ android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:layout_centerVertical="true" + android:background="@color/colorAccent" android:text="@string/retry" /> diff --git a/app/src/main/res/layout/item_post.xml b/app/src/main/res/layout/item_post.xml index 78a55cf2..c34ee582 100644 --- a/app/src/main/res/layout/item_post.xml +++ b/app/src/main/res/layout/item_post.xml @@ -1,208 +1,229 @@ + + - + android:layout_height="wrap_content" + android:layout_marginBottom="8dp" + android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" + android:layout_marginRight="16dp" + android:layout_marginEnd="16dp" + android:layout_marginTop="16dp"> + + - + android:layout_toStartOf="@id/stickied_post_image_view_best_post_item" + android:layout_toEndOf="@id/subreddit_icon_circle_image_view_best_post_item" + android:layout_centerVertical="true" + android:textColor="#E91E63"/> - + - - - + - + - + + + + android:layout_centerVertical="true" + android:textColor="@android:color/white"/> - + + + android:layout_marginStart="4dp" + android:layout_marginEnd="8dp" + android:layout_toEndOf="@id/gilded_image_view_item_best_post" + android:layout_toStartOf="@id/nsfw_text_view_item_best_post" + android:layout_centerVertical="true" + android:visibility="gone" + android:textSize="20sp" + android:textColor="@color/gold"/> - - - + - + - + - + - + android:layout_height="match_parent" + android:scaleType="centerCrop" /> - + - + android:layout_height="wrap_content" + android:drawableTop="@drawable/ic_error_outline_black_24dp" + android:layout_gravity="center" + android:gravity="center" + android:text="@string/tap_to_retry" /> - + - + - - - + + + - + - - - + - + - + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3616ff91..325f4684 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -9,6 +9,7 @@ Download Refresh + Error loading image. Tap to retry. Error loading posts.\nTap to retry. Cannot load posts -- cgit v1.2.3