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

Make UI behavior for playback information display more consistent #8180

Merged
merged 1 commit into from
Feb 26, 2023

Conversation

Trust04zh
Copy link
Contributor

@Trust04zh Trust04zh commented Apr 12, 2022

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  1. Make Resume playback the dependency of Positions in lists. This change has been put on hold, see this comment.
  2. Regain the function to control if playback information for videos in lists should display for option Positions in lists.
  3. Use Resume playback to control if playback information in VideoDetailFragment should display (positionView and detailPositionView, for UI), and remove this function for Positions in lists.
  4. Animate without delay in case that positionView and detailPositionView should disappear. (this fixes Instant inconsistent display for playback information in VideoDetailFragment  #8176)

Before/After Screenshots/Screen Record

The first half of the two videos explain how the option Positions in lists should control the display of playback information in the list (change 2), and the second half explain how to eliminate the instant inconsistency in playback information display (change 4).

  • Before:
before.mp4
  • After:
after.mp4

Fixes the following issue(s)

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.

Due diligence

Copy link
Member

@litetex litetex left a comment

Choose a reason for hiding this comment

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

Thank you for the PR.

Had a quick review:

  • Please add some documentation/comments that explain (e.g. on complex if blocks) why stuff is happening
  • Some code snippets look like they are copy-pasted. Consider using abstraction.
  • Please don't use settings-logic inside a UI class (#Layering)

@Trust04zh
Copy link
Contributor Author

Trust04zh commented Apr 15, 2022

Thank @litetex for commenting! This really helps me on improvement. I add some response here.

Please add some documentation/comments that explain (e.g. on complex if blocks) why stuff is happening

Gonna do that.

Some code snippets look like they are copy-pasted. Consider using abstraction.

yes, in class LocalPlaylistStreamItemHolder, LocalStatisticStreamItemHolder, StreamMiniInfoItemHolder there are copy-pasted code, while you can see that the previous code that surrounding my changes (some are with high similarity) didn't use abstraction, so I just keep the style as previous code. I can also try to do abstraction for my changes and previous code, please reply if you think this would be better.

Please don't use settings-logic inside a UI class (#Layering)

I will find an appropriate place for it (maybe a helper class).

@Trust04zh
Copy link
Contributor Author

The updates

  • add a util class dependentPreferenceHelper to retrive option value (enabled or not) with complex dependencies.
  • add just one comment, I think the code is clear to read now.
  • use primitive boolean instead of Boolean for added methods.
  • removed the debug log info since it can not be reached.

@sonarcloud
Copy link

sonarcloud bot commented Apr 18, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
10.3% 10.3% Duplication

@Trust04zh
Copy link
Contributor Author

Just a remind that this pr has been shelved for some time, it may be better if someone would like to review this if the issues related to this pr should be solved and my solution being considered to be acceptable, or I may forget about my codes XD. Anyway I hope my pr not to bother you, so you can also just take this pr as a reference (if helpful) when solving related issues in the future.

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Thank you for the PR! I agree with litetex, the code in the various stream item holders should be deduplicated. Maybe you could add a common method that takes as parameter the itemProgressView, and the data needed to take decisions and update the UI.
Since this and other requested changes require knowledge about the codebase, if you need help or want me to do this, just ask ;-)

@opusforlife2
Copy link
Collaborator

@Trust04zh Hey, will you be incorporating the review at some point?

@opusforlife2 opusforlife2 added GUI Issue is related to the graphical user interface waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. labels Aug 23, 2022
@Trust04zh
Copy link
Contributor Author

@opusforlife2 yes, I will check the review and update the code in the recent two or three days.

@github-actions github-actions bot removed the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Aug 25, 2022
@sonarcloud
Copy link

sonarcloud bot commented Aug 29, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@Trust04zh
Copy link
Contributor Author

Thank you for the reviews @Stypox! I agree with them and updated the code accordingly. There is no functinoal change in the new commits.

As some code changes are removed in new commits, the duplication in item holder classes reduces but still exists.

Maybe you could add a common method that takes as parameter the itemProgressView, and the data needed to take decisions and update the UI.

I'm not sure about how to make such code abstraction, since the three classes are not simply extended from the same superclass and the updateState methods have different signature. I would be appreciate if you could do this.

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Sorry for the long time passed... I hope you still remember something ;-)

@Trust04zh
Copy link
Contributor Author

@Stypox Thanks for your reviewing and sorry that I just found the email reminding me for your reply, the code is updated.

@sonarcloud
Copy link

sonarcloud bot commented Dec 4, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
8.6% 8.6% Duplication

@Trust04zh
Copy link
Contributor Author

@Stypox Thanks for your reviewing! The code mentioned are updated.

@Stypox
Copy link
Member

Stypox commented Jan 20, 2023

@Trust04zh there are some unresolved points. You can use the "Resolve conversation" button to mark off things you have already done, in order not to forget anything. #8180 (comment) #8180 (comment)

@Trust04zh
Copy link
Contributor Author

Trust04zh commented Jan 24, 2023

@Stypox Now they are marked as resolve. Sorry I took a few days to reply, I just took a vacation.

@Stypox
Copy link
Member

Stypox commented Jan 28, 2023

Mmmh, you didn't push any new commit though, so I guess you misunderstood me: the things I did not mark as done myself were the ones that still needed to be done ;-)

I unresolved the two mentioned comments again. It's just two small things.

@Trust04zh
Copy link
Contributor Author

@Stypox updated now, thank you for the reminder, I did forget to deal with them 😟

…ations

The following is the list of all commits squashed together:

Regain function for option `Positions in lists`

use option `Resume playback` to control display of progress info in VideoDetailFragment, remove this (extra) function from option `Positions in lists`.
remove extra check for live streams, live streams updates just as non-live streams.

fix TeamNewPipe#8176 by eliminating exit delay

Regain function for option `Positions in lists`

update code with developer's comments

 apply static import to methods in util class DependentPreferenceHelper

Regain function for option `Positions in lists`

use option `Resume playback` to control display of progress info in VideoDetailFragment, remove this (extra) function from option `Positions in lists`.
remove extra check for live streams, live streams updates just as non-live streams.

fix behavior for displaying progress bar when autoplay off but video resume on

not to retrieve unnecessary states when position in lists disabled

fix mistake in code

simplify conditional logic

update doc comment and remove unused method

Fix not showing duration if position indicators disabled

Positions in lists only depends on watch history
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

I made some changes:

  • rebased and squashed commits
  • Now positions in lists only depends on watch history. Was there a specific reason for them to depend on "Resume playback"? One might want to see progress on items without resuming playback. 3ee3ddb
  • Fix not showing duration if position indicators disabled. A condition was not in the correct place. a3699ca

Do these changes look good to you @Trust04zh?

@Stypox Stypox added the history Anything to do with previously watched stuff label Feb 7, 2023
@sonarcloud
Copy link

sonarcloud bot commented Feb 7, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
4.3% 4.3% Duplication

@Trust04zh
Copy link
Contributor Author

@Stypox yes, they are good to me.

Now positions in lists only depends on watch history. Was there a specific reason for them to depend on "Resume playback"? One might want to see progress on items without resuming playback.

In my understanding, displaying progress just tells playback information vaguely, and if users do not want to resume playback, it does not quite make sense. There was no clear discussion for this point in the previous issue, and the change is fine to me.

@Stypox Stypox merged commit 097c236 into TeamNewPipe:dev Feb 26, 2023
@Stypox Stypox mentioned this pull request Mar 1, 2023
3 tasks
@opusforlife2
Copy link
Collaborator

Thanks again, @Trust04zh!

@opusforlife2
Copy link
Collaborator

@Trust04zh Could I bother you to update the PR description at the top with the latest changes? It's outdated, and difficult to understand exactly what the final state of things is.

I think the videos are outdated as well now.

@Trust04zh
Copy link
Contributor Author

@opusforlife2

I have updated the description of this pr based on the final changes, including:

  • Indicating that Resume playback did not become a dependency of Positions in lists.
  • Adding an explanation of what changes are reflected in the two videos.

I think that the description now clarifies things, and I'm willing to update if there are still unclear points for you.

@opusforlife2
Copy link
Collaborator

Thanks!

Sorry, I don't understand point 4 at all. I was basically asking for changes that are visible to the user, not what code changes have been done. Point 2 is clear to me, from that perspective. Not sure what part of the videos is addressing point 4.

@Trust04zh
Copy link
Contributor Author

Trust04zh commented Apr 9, 2023

Change 4 is for fixing #8176. In the "before" video, around 38 to 39 second, you can see the inconsistent behavior that the playback information becomes wrong for an instant.

I added a note for change 4 to indicate that it is for fixing #8176.

@opusforlife2
Copy link
Collaborator

Ah. Got it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI Issue is related to the graphical user interface history Anything to do with previously watched stuff
Projects
None yet
4 participants