Skip to content

Conversation

Stypox
Copy link
Member

@Stypox Stypox commented May 29, 2019

The order of the items in the stream long-press menu should be the same in every view (playlist, search, info...), so that the user can subconsciously memorize it, without having to read the same info over and over again. Also, I think consistency is a good thing. See #2354 for more info.

I fixed the menu so that it is the same across the app, and I chose this order:

enqueue-background
enqueue-popup
new-background
new-popup
[  ...  specific actions, such as delete-from-history]
add-to-playlist
share

The subscription long-press menu (in the local subscription list) was also modified to comply with the above order: it is now unsubscribe; share; instead of share; unsubcribe;.

I decided to remove the new-on-main-player option since it was mostly useless. The other play options are useful to (for example) enqueue while carrying on browsing flawlessly. But opening the main player interrupts what the user was doing anyway. And, from a time point of view, one could open the stream details and open the main player in roughly the same time it would take to long-press and then click.

  • Before merging I'd like to improve the menu labels: those were inconsistent, too. The new-background option had two different strings used in different views: "Play directly in background" (direct_on_background) and "Start playing in the background" (start_here_on_background). So the direct_on_background string should be removed, along with start_here_on_main which is no longer used (as explained above).
  • Soundcloud has no video playback, but the entry to play on popup appears in the menu anyway. This has to be fixed.
  • Remove the ugly if-else-cascade
  • Fix crash when closing a starting/loading popup.

Testing APK: app-debug.zip

Fixes #1142
Closes #2354

Stypox added 6 commits May 29, 2019 16:22
Also made the code that creates the menus consistent across files.
VideoDetailFragment already borrows a consistant menu from the stream list it holds.
They were exactly the same as the base class function
Inverted unsubscribe with share, since share has always been put after content-specific actions.
start_here_on_background has the same meaning

start_here_on_main is now unused, but I left it there so that if it ever becomes useful again, it is ready to be used.
@Stypox
Copy link
Member Author

Stypox commented May 30, 2019

I addressed the duplicate direct_on_background string in b6cfb8a, but I decided to leave the unused start_here_on_main there, so that if it ever becomes useful again it's ready to be used.

@Stypox Stypox mentioned this pull request May 30, 2019
1 task
@theScrabi theScrabi added the feature request Issue is related to a feature in the app label Jun 26, 2019
@Stypox Stypox changed the title Make long-press menu consistent across views Make long-press menu consistent across views Jul 18, 2019
@Stypox Stypox mentioned this pull request Jul 22, 2019
1 task
Stypox added 2 commits July 22, 2019 10:28
…alls.

`resumePlayback`'s value is `false` when the video is enqueued, `true` otherwise.
Also make the use of getContext() and getActivity() more consistant.
@Stypox
Copy link
Member Author

Stypox commented Jul 22, 2019

There are no popup entries anymore when the long-pressed stream is audio-only. I had to replace the switch block with the ugly if - else if, but I don't think there was anything that could be done.

@Redirion
Copy link
Member

There are no popup entries anymore when the long-pressed stream is audio-only. I had to replace the switch block with the ugly if - else if, but I don't think there was anything that could be done.

you could work with enums: https://schneide.blog/2010/12/13/avoid-switch-use-enum/

Stypox added 3 commits July 24, 2019 17:21
Common actions and labels are now in a unique enum: StreamDialogEntry
If an action is not common to every long-press menu (e.g. delete) a custom action has to be provided using e.g. delete.setAction(...)
@Stypox
Copy link
Member Author

Stypox commented Jul 24, 2019

@Redirion fixed. Is it ok now? I did my best, and I really love Java enums! 😍

showStreamDialog
StreamDialogEntry

Btw 9df27f4 is just to increase safety for any potential future user/reader of StreamDialogEntry code. If you think I should remove it, tell me :-)

@Stypox
Copy link
Member Author

Stypox commented Jul 24, 2019

Also, I found a bug: the app crashes when the popup player is closed while starting. I don't know if this problem is caused by my code.

@Redirion
Copy link
Member

@Redirion fixed. Is it ok now? I did my best, and I really love Java enums! heart_eyes

It looks beautifully!

You have some unused imports in BaseListFragment that could be cleaned up.

I will test the code later (in about 8 hours).

@Stypox
Copy link
Member Author

Stypox commented Jul 25, 2019

@Redirion I added a test APK to the description

@Stypox
Copy link
Member Author

Stypox commented Jul 25, 2019

Ok, fixed the crash. The problem was caused by the recent resume playback pr #2288: the popup's BasePlayer tried to re-init when closing, since the loaded-listener was called both on video loading completion and when a not-yet-loaded popup is closed.

@nv95 can you please confirm that what I did in 7c9ef58 was ok?

@justanidea
Copy link
Contributor

justanidea commented Jul 25, 2019

I tried the Apk and all seem to be good for me

@Koitharu
Copy link
Contributor

@Stypox I'll look on this on weekends

@Koitharu
Copy link
Contributor

@Stypox I was try it and looks like everything is ok

@Redirion
Copy link
Member

I have used it on daily basis since you provided the apk and only had two unrelated crashes. This should be fine for merge.

Copy link
Contributor

@TobiGr TobiGr left a comment

Choose a reason for hiding this comment

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

The code is a beauty ❤️

@TobiGr TobiGr merged commit 4e5a20e into TeamNewPipe:dev Jul 31, 2019
This was referenced Jul 31, 2019
@kurobon-jp
Copy link

I don’t understand why Start playing here and Start playing in the background deleted.
Did you decide that you don't need the action that plays continuously from the middle of the list?

@Stypox
Copy link
Member Author

Stypox commented Aug 3, 2019

I did not delete either of them. They are still there and are being used (see the apk in release 0.17.0). I only deleted direct_on_background since it was a duplicate of start_here_on_background.

@kurobon-jp
Copy link

In my environment, after merging the Stypox:menu-consistency, the Start playing here are gone.

e7b068e
old_1
4e5a20e
new_1

Start playing in the background items remain, but it seems to be different from the previous behavior.

e7b068e
old_2
4e5a20e
new_2

@Stypox
Copy link
Member Author

Stypox commented Aug 4, 2019

Yes, I removed "start playing here" because it seemed mostly useless. See above.

About the differencies about arrows... I don't know why that happens, will look into it in a week (after vacation)

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

Labels

feature request Issue is related to a feature in the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Making the long-press menu consistant across the application [feature request] add "add to playlist" to the list of related videos

7 participants