From 47832e1e91db7e355b8122e1b533966c8df5ddba Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Fri, 27 Sep 2019 16:58:57 +0800 Subject: Blurring spoiler post images is now available. Change spoiler and flair text background colors. Fixed collapsed comments shown after orientation change. --- .../infinityforreddit/ChangeSpoilerBlurEvent.java | 8 ++++++ .../CommentAndPostRecyclerViewAdapter.java | 27 ++++++++++++------- .../infinityforreddit/PostFragment.java | 22 +++++++++++++--- .../infinityforreddit/PostRecyclerViewAdapter.java | 14 +++++++--- .../infinityforreddit/SharedPreferencesUtils.java | 1 + .../infinityforreddit/ViewPostDetailActivity.java | 30 ++++++++++++++++------ 6 files changed, 77 insertions(+), 25 deletions(-) create mode 100644 app/src/main/java/ml/docilealligator/infinityforreddit/ChangeSpoilerBlurEvent.java (limited to 'app/src/main/java/ml') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeSpoilerBlurEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeSpoilerBlurEvent.java new file mode 100644 index 00000000..f8c22224 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeSpoilerBlurEvent.java @@ -0,0 +1,8 @@ +package ml.docilealligator.infinityforreddit; + +public class ChangeSpoilerBlurEvent { + public boolean needBlurSpoiler; + public ChangeSpoilerBlurEvent(boolean needBlurSpoiler) { + this.needBlurSpoiler = needBlurSpoiler; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java index f2fb4545..897b2e86 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java @@ -52,6 +52,8 @@ import jp.wasabeef.glide.transformations.BlurTransformation; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; import retrofit2.Retrofit; +import static ml.docilealligator.infinityforreddit.CommentActivity.WRITE_COMMENT_REQUEST_CODE; + class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter { private static final int VIEW_TYPE_POST_DETAIL = 0; private static final int VIEW_TYPE_FIRST_LOADING = 1; @@ -78,6 +80,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter getVisibleComments() { + return mVisibleComments; + } + void initiallyLoading() { if(mVisibleComments.size() != 0) { int previousSize = mVisibleComments.size(); @@ -1162,6 +1167,10 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter= 0) { + mAdapter.addChildComment(comment, parentFullname, parentPosition); + } } } else { Toast.makeText(this, R.string.send_comment_failed, Toast.LENGTH_SHORT).show(); @@ -1219,7 +1232,7 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo } } else if(requestCode == EDIT_COMMENT_REQUEST_CODE) { if(resultCode == RESULT_OK) { - mAdapter.editComment(data.getExtras().getString(EditCommentActivity.EXTRA_EDITED_COMMENT_CONTENT), + mAdapter.editComment(data.getStringExtra(EditCommentActivity.EXTRA_EDITED_COMMENT_CONTENT), data.getExtras().getInt(EditCommentActivity.EXTRA_EDITED_COMMENT_POSITION)); } } @@ -1228,6 +1241,7 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo @Override protected void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); + comments = mAdapter.getVisibleComments(); Bridge.saveInstanceState(this, outState); } -- cgit v1.2.3