Skip to content

Collapse browser toolbar on scrolling the card list#18037

Closed
oakkitten wants to merge 1 commit intoankidroid:mainfrom
oakkitten:collapse-browser-toolbar
Closed

Collapse browser toolbar on scrolling the card list#18037
oakkitten wants to merge 1 commit intoankidroid:mainfrom
oakkitten:collapse-browser-toolbar

Conversation

@oakkitten
Copy link
Contributor

Purpose / Description

Collapse browser toolbar on scrolling the card list. The toolbar takes space and may take even more space when browser chips are introduced (see #17355, #12554).

Screen_recording_20250301_155316.mp4

Approach

Pretty straightforward, use AppBarLayout. I used my old commit which had some issues, namely:

  • Sometimes the fling gesture would be treated as a scroll gesture, with things just stopping scrolling instead of continuing scrolling after finger was lifted off the screen, and
  • If the card list had only a few cards, it wouldn't move with gestures and the toolbar could be stuck in half-collapsed state.

I suspected that these issues would be resolved with moving to RecyclerView, and it seems that they have.

See also the commit message.

How Has This Been Tested?

Briefly tested on my device API 34 and emulator API 24. Requires more on-hand testing to ensure the above issues are truly gone.

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Here I opted for an extra `LinearLayout` inside of the `AppBarLayout`
for a minimal and safe-contained change. Other options are available,
see the comment in the code.

I also moved the linear progress indicator to the bottom of the
`CoordinatorLayout` for the following reasons:

  * As a child of `CoordinatorLayout`, which is a “super-powered
    `FrameLayout`”, it doesn't shift other elements when it becomes
    visible and disappears;

  * It stays on the bottom and doesn't move with the scrolling cards;

  * Before, visually it was positioned just inside of the grid of the
    table, which looked a bit weird, and it has rounded corners and
    thus appeared shorter than the table;

  * It may be harder to move it along with the `RecyclerView`.
Copy link
Member

@lukstbit lukstbit left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Requesting @david-allison opinion as you worked on this extensively.

@lukstbit lukstbit added Needs Second Approval Has one approval, one more approval to merge Needs reviewer reply Waiting for a reply from another reviewer labels Mar 2, 2025
@lukstbit lukstbit requested a review from david-allison March 2, 2025 08:34
here it is not necessary to have another LinearLayout as a child.
Instead we could be setting app:layout_scrollFlags on the individual children.
However, the <include> tag can only override a very limited set of arguments,
so the alternatives here would be not using the <include> tag,
Copy link
Member

@BrayanDSO BrayanDSO Mar 2, 2025

Choose a reason for hiding this comment

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

my two cents: the alternative of not using <include> is super reasonable. Most of the new screens don't use it, if that matters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A quick search says there are 15 files saying <include layout="@layout/toolbar" in the XML

Copy link
Member

Choose a reason for hiding this comment

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

Most of the new screens don't use it

A quick search says there are 15 files saying <include layout="@layout/toolbar" in the XML

Yes, it is still used in some places, but most of the "new" ones use MaterialToolbar instead of including the toolbar.xml layout, which has some extra sutff that normally is not used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I see. I just went this way for the self-contained minimal change, otherwise I personally have no opinion on which way is the best one. 🤷‍♀️

@mikehardy
Copy link
Member

@oakkitten appears this PR got hung up on some very specific but not completely prescriptive feedback. I think it's a cool feature and I'd like to get it in but I know you are particular about your changes (and your quality standard is super high, so at least IMHO, that's totally justified). So I don't want to just open up this PR and slam some commits in to get it done as that might chafe ;-)

So to be prescriptive: it seems like the feedback to not use include would address both hanging comments at once - there wouldn't be the need for the big comment explanation and it wouldn't use include.

Do you think you could refactor this to use MaterialToolbar (I think that's right...), not use include, and to instead set scroll flags (I think that's correct?). I do like the idea of using what most of the other new screens are using (MaterialToolbar, I believe) so I think that's positive motion. I don't have implementation experience to decide details past that though, so whatever seems like it will work past that would work for me...

@mikehardy mikehardy added Needs Author Reply Waiting for a reply from the original author and removed Needs Second Approval Has one approval, one more approval to merge Needs reviewer reply Waiting for a reply from another reviewer labels Apr 5, 2025
@github-actions
Copy link
Contributor

Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Apr 19, 2025
@BrayanDSO BrayanDSO added Needs a new dev For PR that were good start but the original dev' left. Any dev can take over and finish it. and removed Stale Needs Author Reply Waiting for a reply from the original author labels Apr 19, 2025
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

Sorry this sat, life got extremely busy

  • When there is 1 item on the screen, the toolbar collapses, this seems unreasonable, as no 'scroll' occurs

Probably better to not use <includes>, but that's not a blocker to me

@david-allison david-allison added the Keep Open avoids the stale bot label Apr 21, 2025
@LUwUcifer
Copy link
Contributor

hey can i work on this

@david-allison
Copy link
Member

I'll FINALLY have get this over the finish line in the next few days for #18709

Code is written, just waiting on a few pre-PRs to be merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Has Conflicts Keep Open avoids the stale bot Needs a new dev For PR that were good start but the original dev' left. Any dev can take over and finish it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants