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

View File

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