SimonHalvdansson / Harmonic-HN

Modern Android client for Hacker News
https://play.google.com/store/apps/details?id=com.simon.harmonichackernews
Apache License 2.0
622 stars 38 forks source link

Cap scroll animation length #151

Open jonas-w opened 9 months ago

jonas-w commented 9 months ago

I use the navigation buttons to go the next comment quite often, but sometimes there are so many child comments that it takes ages to scroll.

For example https://news.ycombinator.com/item?id=39340501 it takes nearly 18s for me 5o scroll past the top comment when pressing the down navigation button.

Same for the long press to either go all the way to the top or the bottom, it seems a bit faster but still takes way too long.

Is it maybe possible to cap these animations, so they won't take longer than X (i don't know what the best value would be) seconds?

SimonHalvdansson commented 8 months ago

This is a very reasonable request. It is not super easy to implement however (see e.g. this).

As I understand it, we can only set the number of pixels scrolled per ms and we don't know the total number of pixels since we don't do layout for the RecyclerView elements in advance. The best solution to this is clearly just to count the number of posts being scrolled past and have like a "super fast mode" which is activated if the number of comments > 30 for example. Seems doable.

i-am-gizm0 commented 6 months ago

I think Reddit took an interesting approach to this problem by collapsing some comments when there are a lot of responses. Their "next top comment" button is also instant.