diff options
author | Alex Ning <chineseperson5@gmail.com> | 2019-08-26 07:55:18 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2019-08-26 07:55:18 +0000 |
commit | 1da0e08552fbd5564eb7df539ec0d15d8201c1fa (patch) | |
tree | f54a664dfb00f04c3f721e3bbba4ba37cd8aaf59 | |
parent | 5e144c6de94d4fe2233b83b3c804d101ebcbe703 (diff) | |
download | infinity-for-reddit-1da0e08552fbd5564eb7df539ec0d15d8201c1fa.tar infinity-for-reddit-1da0e08552fbd5564eb7df539ec0d15d8201c1fa.tar.gz infinity-for-reddit-1da0e08552fbd5564eb7df539ec0d15d8201c1fa.tar.bz2 infinity-for-reddit-1da0e08552fbd5564eb7df539ec0d15d8201c1fa.tar.lz infinity-for-reddit-1da0e08552fbd5564eb7df539ec0d15d8201c1fa.tar.xz infinity-for-reddit-1da0e08552fbd5564eb7df539ec0d15d8201c1fa.tar.zst infinity-for-reddit-1da0e08552fbd5564eb7df539ec0d15d8201c1fa.zip |
Tap the error view to retry loading comments in ViewPostDetailActivity. Minor UI tweaks.
13 files changed, 49 insertions, 13 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java index 0f29b823..ec46235d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java @@ -86,6 +86,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie interface CommentRecyclerViewAdapterCallback { void updatePost(Post post); + void retryFetchingComments(); void retryFetchingMoreComments(); } @@ -1413,6 +1414,9 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie class LoadCommentsFailedViewHolder extends RecyclerView.ViewHolder { LoadCommentsFailedViewHolder(@NonNull View itemView) { super(itemView); + itemView.setOnClickListener(view -> { + mCommentRecyclerViewAdapterCallback.retryFetchingComments(); + }); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RulesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RulesActivity.java index 39ab8d42..e519797a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/RulesActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RulesActivity.java @@ -6,7 +6,6 @@ import android.content.res.Resources; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; -import android.util.Log; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; @@ -117,6 +116,13 @@ public class RulesActivity extends AppCompatActivity { params.topMargin = getResources().getDimensionPixelSize(statusBarResourceId); toolbar.setLayoutParams(params); } + + if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) { + int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); + if (navBarResourceId > 0) { + recyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId)); + } + } } } @@ -240,7 +246,6 @@ public class RulesActivity extends AppCompatActivity { String shortName = rulesArray.getJSONObject(i).getString(JSONUtils.SHORT_NAME_KEY); String description = null; if(rulesArray.getJSONObject(i).has(JSONUtils.DESCRIPTION_KEY)) { - Log.i("asdfasdf", "" + rulesArray.getJSONObject(i).getString(JSONUtils.DESCRIPTION_KEY)); description = Utils.addSubredditAndUserLink(rulesArray.getJSONObject(i).getString(JSONUtils.DESCRIPTION_KEY)); } rules.add(new Rule(shortName, description)); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java index a170275c..8bdff436 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java @@ -352,6 +352,11 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo } @Override + public void retryFetchingComments() { + fetchComments(false); + } + + @Override public void retryFetchingMoreComments() { isLoadingMoreChildren = false; loadMoreChildrenSuccess = true; @@ -444,6 +449,11 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo } @Override + public void retryFetchingComments() { + fetchComments(false); + } + + @Override public void retryFetchingMoreComments() { isLoadingMoreChildren = false; loadMoreChildrenSuccess = true; diff --git a/app/src/main/res/layout/activity_post_image.xml b/app/src/main/res/layout/activity_post_image.xml index 2ea9b68b..795e53cf 100644 --- a/app/src/main/res/layout/activity_post_image.xml +++ b/app/src/main/res/layout/activity_post_image.xml @@ -64,7 +64,7 @@ android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:text="@string/rules" - android:textColor="@color/colorAccent" /> + android:textColor="@android:color/white" /> </RelativeLayout> @@ -156,7 +156,9 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toStartOf="@+id/select_from_library_fab_post_image_activity" - app:layout_constraintHorizontal_chainStyle="spread" /> + app:layout_constraintHorizontal_chainStyle="spread" + app:backgroundTint="@color/backgroundColorPrimary" + app:tint="@android:color/white" /> <com.google.android.material.floatingactionbutton.FloatingActionButton android:id="@+id/select_from_library_fab_post_image_activity" @@ -167,7 +169,9 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@+id/capture_fab_post_image_activity" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_chainStyle="spread" /> + app:layout_constraintHorizontal_chainStyle="spread" + app:backgroundTint="@color/backgroundColorPrimary" + app:tint="@android:color/white" /> </androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/main/res/layout/activity_post_link.xml b/app/src/main/res/layout/activity_post_link.xml index 9de49a9e..54c843bf 100644 --- a/app/src/main/res/layout/activity_post_link.xml +++ b/app/src/main/res/layout/activity_post_link.xml @@ -64,7 +64,7 @@ android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:text="@string/rules" - android:textColor="@color/colorAccent" /> + android:textColor="@android:color/white" /> </RelativeLayout> diff --git a/app/src/main/res/layout/activity_post_text.xml b/app/src/main/res/layout/activity_post_text.xml index b9798901..11001a14 100644 --- a/app/src/main/res/layout/activity_post_text.xml +++ b/app/src/main/res/layout/activity_post_text.xml @@ -64,7 +64,7 @@ android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:text="@string/rules" - android:textColor="@color/colorAccent" /> + android:textColor="@android:color/white" /> </RelativeLayout> diff --git a/app/src/main/res/layout/activity_post_video.xml b/app/src/main/res/layout/activity_post_video.xml index 512f0304..3e87bd88 100644 --- a/app/src/main/res/layout/activity_post_video.xml +++ b/app/src/main/res/layout/activity_post_video.xml @@ -64,7 +64,7 @@ android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:text="@string/rules" - android:textColor="@color/colorAccent" /> + android:textColor="@android:color/white" /> </RelativeLayout> @@ -156,7 +156,9 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toStartOf="@+id/select_from_library_fab_post_video_activity" - app:layout_constraintHorizontal_chainStyle="spread" /> + app:layout_constraintHorizontal_chainStyle="spread" + app:backgroundTint="@color/backgroundColorPrimary" + app:tint="@android:color/white" /> <com.google.android.material.floatingactionbutton.FloatingActionButton android:id="@+id/select_from_library_fab_post_video_activity" @@ -167,7 +169,9 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@+id/capture_fab_post_video_activity" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_chainStyle="spread" /> + app:layout_constraintHorizontal_chainStyle="spread" + app:backgroundTint="@color/backgroundColorPrimary" + app:tint="@android:color/white" /> </androidx.constraintlayout.widget.ConstraintLayout> 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 ab1dd28b..443881da 100644 --- a/app/src/main/res/layout/activity_view_subreddit_detail.xml +++ b/app/src/main/res/layout/activity_view_subreddit_detail.xml @@ -125,6 +125,8 @@ android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" + app:backgroundTint="@color/backgroundColorPrimary" + app:tint="@android:color/white" app:srcCompat="@drawable/baseline_add_white_24" /> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml index 27a54b4c..5039ca20 100644 --- a/app/src/main/res/layout/app_bar_main.xml +++ b/app/src/main/res/layout/app_bar_main.xml @@ -72,6 +72,8 @@ android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" + app:backgroundTint="@color/backgroundColorPrimary" + app:tint="@android:color/white" app:srcCompat="@drawable/baseline_add_white_24" /> </androidx.coordinatorlayout.widget.CoordinatorLayout> 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 index f699efd0..9d8f9f7d 100644 --- a/app/src/main/res/layout/item_load_comments_failed_placeholder.xml +++ b/app/src/main/res/layout/item_load_comments_failed_placeholder.xml @@ -9,12 +9,13 @@ android:layout_width="150dp" android:layout_height="150dp" android:layout_gravity="center_horizontal" - android:src="@drawable/load_post_error_indicator"/> + android:src="@drawable/load_post_error_indicator" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" - android:text="@string/load_comments_failed"/> + android:gravity="center" + android:text="@string/load_comments_failed" /> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 418fd02d..4282dff3 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -22,6 +22,8 @@ <color name="backgroundColor">#121212</color> + <color name="backgroundColorPrimary">#1565C0</color> + <color name="backgroundColorPrimaryDark">#1565C0</color> <color name="roundedBottomSheetPrimaryBackground">#242424</color> diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index b4c1fd87..65c75a1d 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -22,6 +22,8 @@ <color name="backgroundColor">#FFFFFF</color> + <color name="backgroundColorPrimary">@color/colorPrimary</color> + <color name="backgroundColorPrimaryDark">@color/colorPrimaryDark</color> <color name="roundedBottomSheetPrimaryBackground">#FFFFFF</color> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8a88d944..09740a2f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -52,7 +52,7 @@ <string name="no_users">No users found</string> <string name="no_storage_permission">No storage permission to save this file</string> - <string name="load_comments_failed">Error loading comments</string> + <string name="load_comments_failed">Error loading comments.\nTap to retry.</string> <string name="retry">Retry</string> <string name="comments">Comments</string> <string name="no_comments_yet">No comments yet. Write a comment?</string> |