Skip to content

Commit

Permalink
[Android] fix news ntp gps crash (uplift to 1.47.x) (#16909)
Browse files Browse the repository at this point in the history
fix news ntp gps crash android
  • Loading branch information
tapanmodh committed Jan 31, 2023
1 parent 7cf1f9d commit 309f3cd
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,19 +380,21 @@ private void setNtpRecyclerView(LinearLayoutManager linearLayoutManager) {
mIsTopSitesEnabled = shouldDisplayTopSites();

if (mNtpAdapter == null) {
mNtpAdapter = new BraveNtpAdapter(mActivity, this, Glide.with(mActivity),
mNewsItemsFeedCard, mBraveNewsController, mMvTilesContainerLayout,
mNtpImageGlobal, mSponsoredTab, mWallpaper, mSponsoredLogo,
mNTPBackgroundImagesBridge, false, mRecyclerView.getHeight(),
mIsTopSitesEnabled, 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, 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 309f3cd

Please sign in to comment.