Maybe fixed IllegaStateException for ShareLinkBottomSheetFragment and CopyTextBottomSheetFragment.

This commit is contained in:
Alex Ning 2020-12-02 13:57:53 +08:00
parent 1b2602ac3a
commit 71661e94f0
2 changed files with 9 additions and 12 deletions

View File

@ -229,8 +229,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
private Drawable mCommentIcon; private Drawable mCommentIcon;
private float mScale; private float mScale;
private ShareLinkBottomSheetFragment mShareLinkBottomSheetFragment;
private CopyTextBottomSheetFragment mCopyTextBottomSheetFragment;
private ExoCreator mExoCreator; private ExoCreator mExoCreator;
public CommentAndPostRecyclerViewAdapter(AppCompatActivity activity, CustomThemeWrapper customThemeWrapper, public CommentAndPostRecyclerViewAdapter(AppCompatActivity activity, CustomThemeWrapper customThemeWrapper,
@ -322,8 +320,9 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString(CopyTextBottomSheetFragment.EXTRA_RAW_TEXT, mPost.getSelfTextPlain()); bundle.putString(CopyTextBottomSheetFragment.EXTRA_RAW_TEXT, mPost.getSelfTextPlain());
bundle.putString(CopyTextBottomSheetFragment.EXTRA_MARKDOWN, mPost.getSelfText()); bundle.putString(CopyTextBottomSheetFragment.EXTRA_MARKDOWN, mPost.getSelfText());
mCopyTextBottomSheetFragment.setArguments(bundle); CopyTextBottomSheetFragment copyTextBottomSheetFragment = new CopyTextBottomSheetFragment();
mCopyTextBottomSheetFragment.show(mActivity.getSupportFragmentManager(), mCopyTextBottomSheetFragment.getTag()); copyTextBottomSheetFragment.setArguments(bundle);
copyTextBottomSheetFragment.show(mActivity.getSupportFragmentManager(), copyTextBottomSheetFragment.getTag());
return true; return true;
}); });
} }
@ -554,8 +553,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
DrawableCompat.setTint(mCommentIcon, mPostIconAndInfoColor); DrawableCompat.setTint(mCommentIcon, mPostIconAndInfoColor);
} }
mShareLinkBottomSheetFragment = new ShareLinkBottomSheetFragment();
mCopyTextBottomSheetFragment = new CopyTextBottomSheetFragment();
mExoCreator = exoCreator; mExoCreator = exoCreator;
} }
@ -2391,8 +2388,9 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
break; break;
} }
} }
mShareLinkBottomSheetFragment.setArguments(bundle); ShareLinkBottomSheetFragment shareLinkBottomSheetFragment = new ShareLinkBottomSheetFragment();
mShareLinkBottomSheetFragment.show(mActivity.getSupportFragmentManager(), mShareLinkBottomSheetFragment.getTag()); shareLinkBottomSheetFragment.setArguments(bundle);
shareLinkBottomSheetFragment.show(mActivity.getSupportFragmentManager(), shareLinkBottomSheetFragment.getTag());
}); });
if (mVoteButtonsOnTheRight) { if (mVoteButtonsOnTheRight) {

View File

@ -193,7 +193,6 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
private NetworkState networkState; private NetworkState networkState;
private ExoCreator mExoCreator; private ExoCreator mExoCreator;
private Callback mCallback; private Callback mCallback;
private ShareLinkBottomSheetFragment mShareLinkBottomSheetFragment;
public PostRecyclerViewAdapter(AppCompatActivity activity, Retrofit oauthRetrofit, Retrofit retrofit, public PostRecyclerViewAdapter(AppCompatActivity activity, Retrofit oauthRetrofit, Retrofit retrofit,
Retrofit gfycatRetrofit, Retrofit redgifsRetrofit, Retrofit gfycatRetrofit, Retrofit redgifsRetrofit,
@ -297,7 +296,6 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
mUserDao = redditDataRoomDatabase.userDao(); mUserDao = redditDataRoomDatabase.userDao();
mExoCreator = exoCreator; mExoCreator = exoCreator;
mCallback = callback; mCallback = callback;
mShareLinkBottomSheetFragment = new ShareLinkBottomSheetFragment();
} }
} }
@ -1117,8 +1115,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
break; break;
} }
} }
mShareLinkBottomSheetFragment.setArguments(bundle); ShareLinkBottomSheetFragment shareLinkBottomSheetFragment = new ShareLinkBottomSheetFragment();
mShareLinkBottomSheetFragment.show(mActivity.getSupportFragmentManager(), mShareLinkBottomSheetFragment.getTag()); shareLinkBottomSheetFragment.setArguments(bundle);
shareLinkBottomSheetFragment.show(mActivity.getSupportFragmentManager(), shareLinkBottomSheetFragment.getTag());
} }
@Override @Override