Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Fix Load new content behaviour correctly #12852

Merged
merged 3 commits into from
Apr 5, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -654,18 +654,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 @@ -938,8 +926,6 @@ public void onClick(View v) {
new SettingsLauncherImpl();
settingsLauncher.launchSettingsActivity(
getContext(), BraveNewsPreferences.class);
mParentScrollView.getViewTreeObserver()
.removeOnGlobalLayoutListener(listener);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tapanmodh yeah makes sense :)

}
}
});
Expand Down Expand Up @@ -1001,8 +987,17 @@ 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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tapanmodh did you try with 100 here?maybe it can work the same way a be a bit faster. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea. Let me try with 100 and see.


Expand Down