aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-06-27 14:22:14 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-06-27 14:22:14 +0000
commitf638eb1e7eada7098b2335fbcd81b106f6a304f0 (patch)
tree661f0a508315ff38c016892f34193e5fdaddd4c8
parentd5c65ff492a9ad2b74df58837b389990c18cea3d (diff)
downloadinfinity-for-reddit-f638eb1e7eada7098b2335fbcd81b106f6a304f0.tar
infinity-for-reddit-f638eb1e7eada7098b2335fbcd81b106f6a304f0.tar.gz
infinity-for-reddit-f638eb1e7eada7098b2335fbcd81b106f6a304f0.tar.bz2
infinity-for-reddit-f638eb1e7eada7098b2335fbcd81b106f6a304f0.tar.lz
infinity-for-reddit-f638eb1e7eada7098b2335fbcd81b106f6a304f0.tar.xz
infinity-for-reddit-f638eb1e7eada7098b2335fbcd81b106f6a304f0.tar.zst
infinity-for-reddit-f638eb1e7eada7098b2335fbcd81b106f6a304f0.zip
Fix app crashes after switching from single thread mode to normal mode in CommentsRecyclerViewAdapter.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java6
1 files changed, 1 insertions, 5 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java
index 2d7b3b1f..eaaf7d96 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java
@@ -13,7 +13,6 @@ import android.text.Spanned;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.text.util.Linkify;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -774,7 +773,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
}
private void collapseChildren(int position) {
- Log.i("asdfasdf", "s " + position);
mVisibleComments.get(position).setExpanded(false);
int depth = mVisibleComments.get(position).getDepth();
int allChildrenSize = 0;
@@ -790,7 +788,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
mVisibleComments.subList(position + 1, position + 1 + allChildrenSize).clear();
}
if (mIsSingleCommentThreadMode) {
- Log.i("asdfasdf", "s1 " + getItemCount());
notifyItemRangeRemoved(position + 2, allChildrenSize);
if (mFullyCollapseComment) {
notifyItemChanged(position + 1);
@@ -1072,7 +1069,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
}
if (mIsSingleCommentThreadMode) {
- Log.i("asdfasdf", "now " + (mVisibleComments.size() + 1));
return mVisibleComments.size() + 1;
} else {
return mVisibleComments.size();
@@ -1446,7 +1442,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
if (comment != null) {
if (mVisibleComments.get(commentPosition).isExpanded()) {
collapseChildren(commentPosition);
- Log.i("asdfasdf", "ssf");
expandButton.setImageResource(R.drawable.ic_expand_more_grey_24dp);
} else {
comment.setExpanded(true);
@@ -1697,6 +1692,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
if (mActivity != null && mActivity instanceof ViewPostDetailActivity) {
mIsSingleCommentThreadMode = false;
mSingleCommentId = null;
+ notifyItemRemoved(0);
mFragment.changeToNomalThreadMode();
}
});