Skip to content

Redesigned long press menu #12032

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

Open
wants to merge 23 commits into
base: refactor
Choose a base branch
from
Open

Conversation

Stypox
Copy link
Member

@Stypox Stypox commented Feb 12, 2025

What is it?

  • [ x ] Feature (user facing)
  • [ x ] Codebase improvement (dev facing)

Description of the changes in your PR

This PR replaces InfoItemDialog with a JetpackCompose-based bottom sheet menu. This new menu is supposed to replace all item long press menus across the app, i.e. streams, playlists, channels. The menu contains more details than before about the stream/playlist/channel that was clicked, laid out in a (imo) nice design.

Please provide feedback both on the code and on the UI, but please keep in mind the points below when suggesting an alternative layout. Note that the order of buttons is not yet finalized, and that at the moment the menu only works for streams.

Portrait Landscape/tablet
Before After

Motivation and design goals

  • A text-based menu is difficult to read and only allows for a handful of actions, while an icon-based menu is more compact and also easier to use. There still are some labels to explain what the actions do though.
  • The menu puts the most frequent actions always in the same places, so muscle memory can help perform press the buttons faster.
  • Users keep asking for new long press menu actions, therefore the long press actions system should be easily extendable and the set of actions should possibly even be editable by the user.
  • We want to provide the same experience across the app (hence same menu for streams, playlists, channels), which also deduplicates a lot of code.
  • A menu at the bottom of the screen is easier to use in one-handed mode.
  • The menu adapts well to different screen sizes, e.g. by showing more/less buttons or adapting the header with item information.

Some of these points arose after some discussions in the NewPipe Matrix channel

TODO

  • Also use the dialog for playlists and channels
  • Perform asynchronous stuff with coroutines instead of RxJava3
  • Implement "Start playing from here" actions
  • Handle Kodi action
  • Decide whether to allow the user to customize the menu (there is already a mini settings button in the top right of the menu for that purpose, but now it doesn't do anything)
  • Various other TODOs spread out in code
  • Understand which issues are solved by this PR
  • Add documentation
  • Add UI tests (?)

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.

Due diligence

@github-actions github-actions bot added the size/giant PRs with more than 750 changed lines label Feb 12, 2025
}
}

Column {
Copy link
Member

Choose a reason for hiding this comment

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

FlowRow could be used here instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

Mmmh, that's what I was using in the beginning, but I don't think you can have a FlowRow with a maximum amount of items per row, but also have an item that weighs more than the others (i.e. the header). Also, I wanted the buttons to expand as much as possible, to not waste any space.

Copy link
Member

Choose a reason for hiding this comment

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

The linked documentation mentions a maxItemsInEachRow attribute.

Copy link
Member Author

@Stypox Stypox Feb 13, 2025

Choose a reason for hiding this comment

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

I know, but I need the header to be counted as if it were 4 items. And then if more items can fit alongside the header, I need those to be aligned well. If you want to give it a try with FlowRow go ahead, but I couldn't make it do what I want.

Copy link
Member

@Isira-Seneviratne Isira-Seneviratne Feb 14, 2025

Choose a reason for hiding this comment

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

I was able to make the needed changes using FlowRow (it might need to be tweaked a bit).

Could you grant write access? I can't push the commit to this branch.

Copy link
Member Author

Choose a reason for hiding this comment

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

Mmmh, I should have given you write access to the NewPipe repository (or maybe you had it already), which should be enough according to what GitHub says:

[...] users with write access to TeamNewPipe/NewPipe can add new commits to your long-press-menu branch.

Anyways, thank you for the patch! I haven't tested it yet (will do tomorrow) but from a brief look it seems like the fact that the header is always 66% of the width means the buttons in the first row won't be aligned like the ones below. Also, the buttons should fill as much horizontal space as possible, so misclicks can still be caught, and there might also be more space for the button label text. One final (minor) thing is that I wanted the layout to scale well just based on the available space, not specifically based on whether the device is landscape or portrait, so the header sizing in your patch does not fulfill this requirement.

Copy link
Member

Choose a reason for hiding this comment

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

One final (minor) thing is that I wanted the layout to scale well just based on the available space, not specifically based on whether the device is landscape or portrait, so the header sizing in your patch does not fulfill this requirement.

That can be implemented using currentWindowAdaptiveInfo().windowSizeClass, like in the determineItemViewMode() method.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, but what's bad about using BoxWithConstraints and measuring the actual available space?

Copy link
Member

@Isira-Seneviratne Isira-Seneviratne Feb 15, 2025

Choose a reason for hiding this comment

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

Good point, though using it results in the IDE checking if the constraints are actually used. Also, it results in a lot more complexity than using FlowRow.

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right that it is indeed much more complex, so we might want to change the requirements. In the meantime I will add more documentation on the requirements (so people reading the code know why it was made like that).

@NaN-Sz
Copy link

NaN-Sz commented Mar 1, 2025

I suggest something like this:

the idea of a more button is to trigger a second bottom sheet containing the remaining items.
Or perhaps it could expand to cover the entire screen, providing more space.

@Stypox
Copy link
Member Author

Stypox commented Mar 1, 2025

@NaN-Sz thanks for the feedback! We already thought of the More button but the bottom sheet dialog already has kind of a way to show more buttons when there are too many (i.e. the menu starts out partially expanded, and you can scroll up to see the other buttons). What do you think about that?

Also, do you think the buttons are too small in my screenshots? Your mockup has much bigger ones, that's why I'm asking. I find the buttons in my screenshots easy to press correctly but it's arguable. Maybe we could put a slider in the "long-press menu's settings menu" to pick a size for buttons. This would be quite a niche setting, but also easy to understand what it does (and we would put it only in the "long-press menu's settings menu", not in the app's settings).

@NaN-Sz
Copy link

NaN-Sz commented Mar 1, 2025

What do you think about that?

yes, it's actually better to scroll up than to use a button.

Also, do you think the buttons are too small in my screenshots?

Your buttons are a good size. But bigger buttons are easier to see and more intuitive. Having too many small buttons makes the interface look cluttered.

Maybe we could put a slider in the "long-press menu's settings menu" to pick a size for buttons.

I like the idea of customizing the app, I think it's a good idea.

@NaN-Sz
Copy link

NaN-Sz commented Mar 1, 2025

or maybe like this?

@TobiGr
Copy link
Contributor

TobiGr commented Mar 7, 2025

These are really good changes to the UI 🚀

I tested this on two devices and personally think that four columns are ok. The less columns we have, the more vertical space is required and thus the actions aren't within the "thumb-radius" anymore. However, it might be necessary to test this on small devices and potentially use three columns on those smaller screens.

I'd also suggest to not show more than three rows of actions by default on the smaller screens. It does not help people to find the stuff they need if their whole screens is plastered with action buttons. I'd vote in favour of the option to expand the bottom sheep by pulling it up which is quite intuitive. I do not think there is a need for a more button.

@Stypox Stypox closed this Mar 14, 2025
@Stypox Stypox deleted the long-press-menu branch March 14, 2025 10:41
@github-project-automation github-project-automation bot moved this from In Progress to Done in Rewrite Mar 14, 2025
@Stypox Stypox reopened this Mar 14, 2025
@TobiGr TobiGr added the GUI Issue is related to the graphical user interface label Mar 15, 2025
@TobiGr TobiGr moved this from Done to In Progress in Rewrite Mar 21, 2025
@shivang1809
Copy link

or maybe like this?

Would it be a good idea to make it like only 3 or 4 most used options come on long press (delete, add to playlist, share, background ,etc). And then could be swiped up to show this all like it is. This will reduce vertical space.

A cherry on cake will be if there's a customize option to chose which options should come on long press and all other in swipe up menu.

@ShareASmile ShareASmile added feature request Issue is related to a feature in the app codequality Improvements to the codebase to improve the code quality rewrite Issues and PRs related to rewrite labels Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codequality Improvements to the codebase to improve the code quality feature request Issue is related to a feature in the app GUI Issue is related to the graphical user interface rewrite Issues and PRs related to rewrite size/giant PRs with more than 750 changed lines
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

6 participants