Skip to content

Commit

Permalink
Merge pull request #12930 from brave/pr12852_load_new_content_behavio…
Browse files Browse the repository at this point in the history
…ur_fix_android_1.38.x

[Android] Fix Load new content behaviour correctly (uplift to 1.38.x)
  • Loading branch information
kjozwiak authored Apr 8, 2022
2 parents e0bac42 + 2505d64 commit 406921c
Showing 1 changed file with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -892,18 +892,6 @@ public void run() {
} // end page loop
processFeed();

new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mParentScrollView.scrollTo(0, 0);
mRecyclerView.scrollToPosition(0);
if (mImageCreditLayout != null) {
mImageCreditLayout.setVisibility(View.VISIBLE);
mImageCreditLayout.setAlpha(1);
}
}
}, 300);

BraveActivity.getBraveActivity().setNewsItemsFeedCards(mNewsItemsFeedCard);
BraveActivity.getBraveActivity().setLoadedFeed(true);
} catch (Exception e) {
Expand Down Expand Up @@ -1219,8 +1207,6 @@ public void onClick(View v) {
new SettingsLauncherImpl();
settingsLauncher.launchSettingsActivity(
getContext(), BraveNewsPreferences.class);
mParentScrollView.getViewTreeObserver()
.removeOnGlobalLayoutListener(listener);
}
}
});
Expand Down Expand Up @@ -1282,10 +1268,19 @@ public void onClick(View v) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mParentScrollView.scrollTo(0, 0);
mRecyclerView.scrollToPosition(0);
if (!ConfigurationUtils.isTablet(mActivity)
&& ConfigurationUtils.isLandscape(
mActivity)) {
mParentScrollView.smoothScrollTo(0, 0);
} else {
mParentScrollView.smoothScrollTo(0,
mRecyclerView.getHeight()
- mParentScrollView
.getMaxScrollAmount()
+ dpToPx(getContext(), 90));
}
}
}, 300);
}, 100);

newContentButtonText.setVisibility(View.VISIBLE);
loadingSpinner.setVisibility(View.GONE);
Expand Down

0 comments on commit 406921c

Please sign in to comment.