Skip to content

Commit

Permalink
Merge pull request #16890 from brave/fix_news_ntp_gps_crash_android
Browse files Browse the repository at this point in the history
[Android] fix news ntp gps crash
  • Loading branch information
tapanmodh authored Jan 29, 2023
2 parents 0b19967 + bee6677 commit 2882fe2
Showing 1 changed file with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -397,19 +397,22 @@ private void setNtpRecyclerView(LinearLayoutManager linearLayoutManager) {
mIsBraveStatsEnabled = shouldDisplayBraveStats();

if (mNtpAdapter == null) {
mNtpAdapter = new BraveNtpAdapter(mActivity, this, Glide.with(mActivity),
mNewsItemsFeedCard, mBraveNewsController, mMvTilesContainerLayout,
mNtpImageGlobal, mSponsoredTab, mWallpaper, mSponsoredLogo,
mNTPBackgroundImagesBridge, false, mRecyclerView.getHeight(),
mIsTopSitesEnabled, mIsBraveStatsEnabled, mIsDisplayNews, mIsDisplayNewsOptin);

mRecyclerView.setAdapter(mNtpAdapter);

if (mRecyclerView.getItemAnimator() != null) {
RecyclerView.ItemAnimator itemAnimator = mRecyclerView.getItemAnimator();
if (itemAnimator instanceof SimpleItemAnimator) {
SimpleItemAnimator simpleItemAnimator = (SimpleItemAnimator) itemAnimator;
simpleItemAnimator.setSupportsChangeAnimations(false);
if (mActivity != null && !mActivity.isDestroyed() && !mActivity.isFinishing()) {
mNtpAdapter = new BraveNtpAdapter(mActivity, this, Glide.with(mActivity),
mNewsItemsFeedCard, mBraveNewsController, mMvTilesContainerLayout,
mNtpImageGlobal, mSponsoredTab, mWallpaper, mSponsoredLogo,
mNTPBackgroundImagesBridge, false, mRecyclerView.getHeight(),
mIsTopSitesEnabled, mIsBraveStatsEnabled, mIsDisplayNews,
mIsDisplayNewsOptin);

mRecyclerView.setAdapter(mNtpAdapter);

if (mRecyclerView.getItemAnimator() != null) {
RecyclerView.ItemAnimator itemAnimator = mRecyclerView.getItemAnimator();
if (itemAnimator instanceof SimpleItemAnimator) {
SimpleItemAnimator simpleItemAnimator = (SimpleItemAnimator) itemAnimator;
simpleItemAnimator.setSupportsChangeAnimations(false);
}
}
}
} else {
Expand Down

0 comments on commit 2882fe2

Please sign in to comment.