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 /app/src/main/java/ml | |
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.
Diffstat (limited to 'app/src/main/java/ml')
3 files changed, 21 insertions, 2 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; |