From be9bc8d014cbf8932e7ef9487f3f762102c3b433 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 1 Nov 2021 21:46:37 +0800 Subject: Optimize some layouts. --- .../adapters/PostRecyclerViewAdapter.java | 24 +++++++-------- .../main/res/layout/activity_view_post_detail.xml | 3 +- .../main/res/layout/activity_view_user_detail.xml | 30 +++++++++---------- .../res/layout/fragment_theme_preview_posts.xml | 3 +- .../res/layout/item_post_card_2_video_autoplay.xml | 3 +- ...ost_card_2_video_autoplay_legacy_controller.xml | 3 +- .../res/layout/item_post_card_2_with_preview.xml | 32 +++++++++----------- app/src/main/res/layout/item_post_gallery.xml | 34 +++++++++------------- app/src/main/res/layout/item_post_text.xml | 3 +- .../res/layout/item_post_video_type_autoplay.xml | 3 +- ..._post_video_type_autoplay_legacy_controller.xml | 3 +- app/src/main/res/layout/item_post_with_preview.xml | 17 ++++++----- app/src/main/res/layout/item_trending_search.xml | 3 +- 13 files changed, 77 insertions(+), 84 deletions(-) (limited to 'app') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index 11d4145b..448013f1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -1776,7 +1776,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter { + errorTextView.setOnClickListener(view -> { progressBar.setVisibility(View.VISIBLE); - errorRelativeLayout.setVisibility(View.GONE); + errorTextView.setVisibility(View.GONE); loadImage(this); }); @@ -3797,13 +3795,13 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter target, boolean isFirstResource) { progressBar.setVisibility(View.GONE); - errorRelativeLayout.setVisibility(View.VISIBLE); + errorTextView.setVisibility(View.VISIBLE); return false; } @Override public boolean onResourceReady(Drawable resource, Object model, Target target, DataSource dataSource, boolean isFirstResource) { - errorRelativeLayout.setVisibility(View.GONE); + errorTextView.setVisibility(View.GONE); progressBar.setVisibility(View.GONE); return false; } @@ -4116,8 +4114,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter { + errorTextView.setOnClickListener(view -> { progressBar.setVisibility(View.VISIBLE); - errorRelativeLayout.setVisibility(View.GONE); + errorTextView.setVisibility(View.GONE); loadImage(this); }); @@ -4202,13 +4198,13 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter target, boolean isFirstResource) { progressBar.setVisibility(View.GONE); - errorRelativeLayout.setVisibility(View.VISIBLE); + errorTextView.setVisibility(View.VISIBLE); return false; } @Override public boolean onResourceReady(Drawable resource, Object model, Target target, DataSource dataSource, boolean isFirstResource) { - errorRelativeLayout.setVisibility(View.GONE); + errorTextView.setVisibility(View.GONE); progressBar.setVisibility(View.GONE); return false; } 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 2b6052ed..3746f5c6 100644 --- a/app/src/main/res/layout/activity_view_post_detail.xml +++ b/app/src/main/res/layout/activity_view_post_detail.xml @@ -54,7 +54,8 @@ android:layout_height="wrap_content" android:layout_gravity="bottom" android:visibility="gone" - app:cardElevation="16dp"> + app:cardElevation="16dp" + style="?attr/materialCardViewElevatedStyle"> + tools:application="ml.docilealligator.infinityforreddit.activities.ViewUserDetailActivity"> + app:navigationIcon="?attr/homeAsUpIndicator" /> - + - + + app:cardElevation="2dp" + style="?attr/materialCardViewElevatedStyle"> + app:cardCornerRadius="8dp" + style="?attr/materialCardViewElevatedStyle"> + app:cardCornerRadius="8dp" + style="?attr/materialCardViewElevatedStyle"> + app:cardCornerRadius="8dp" + style="?attr/materialCardViewElevatedStyle"> - - - - - + android:layout_height="wrap_content" + android:drawableTop="@drawable/ic_error_outline_black_24dp" + android:layout_gravity="center" + android:paddingStart="16dp" + android:paddingEnd="16dp" + android:text="@string/error_loading_image_tap_to_retry" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:visibility="gone" /> + app:cardCornerRadius="8dp" + style="?attr/materialCardViewElevatedStyle"> - - - - - + android:layout_height="wrap_content" + android:layout_gravity="center" + android:paddingStart="16dp" + android:paddingEnd="16dp" + app:drawableTopCompat="@drawable/ic_error_outline_black_24dp" + android:layout_centerInParent="true" + android:text="@string/error_loading_image_tap_to_retry" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:visibility="gone" /> + app:cardCornerRadius="16dp" + style="?attr/materialCardViewElevatedStyle"> + app:cardCornerRadius="16dp" + style="?attr/materialCardViewElevatedStyle"> + app:cardCornerRadius="16dp" + style="?attr/materialCardViewElevatedStyle"> + app:cardCornerRadius="16dp" + style="?attr/materialCardViewElevatedStyle"> @@ -130,7 +130,7 @@ android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" - app:lib_setRadius="3dp" + app:lib_setRadius="6dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -143,7 +143,7 @@ android:textSize="?attr/font_12" android:fontFamily="?attr/font_family" android:visibility="gone" - app:lib_setRadius="3dp" + app:lib_setRadius="6dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -156,7 +156,7 @@ android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" - app:lib_setRadius="3dp" + app:lib_setRadius="6dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -168,7 +168,7 @@ android:textSize="?attr/font_12" android:fontFamily="?attr/font_family" android:visibility="gone" - app:lib_setRadius="3dp" + app:lib_setRadius="6dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -243,7 +243,8 @@ android:gravity="center" android:text="@string/error_loading_image_tap_to_retry" android:textSize="?attr/font_default" - android:fontFamily="?attr/font_family" /> + android:fontFamily="?attr/font_family" + android:visibility="gone" /> diff --git a/app/src/main/res/layout/item_trending_search.xml b/app/src/main/res/layout/item_trending_search.xml index d1cdbded..8a14922a 100644 --- a/app/src/main/res/layout/item_trending_search.xml +++ b/app/src/main/res/layout/item_trending_search.xml @@ -8,7 +8,8 @@ android:layout_marginStart="16dp" android:layout_marginEnd="16dp" app:cardCornerRadius="16dp" - app:cardElevation="2dp"> + app:cardElevation="2dp" + style="?attr/materialCardViewElevatedStyle">