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

Rework feed new items handling #7050

Merged
merged 13 commits into from
Nov 15, 2021

Conversation

litetex
Copy link
Member

@litetex litetex commented Sep 3, 2021

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

Follow up of #6686

Changes:

  • Fixed the weird duplicate FeedSuccessEvents as seen in Fixed scrolling on refresh in the feed #6686 (comment) and Fixed scrolling on refresh in the feed #6686 (comment) by using a Maybe instead of Flowable
  • New items are now highlighted with a border in the background
    grafik
  • If new items got fetched a "New feed items" button pops up
    grafik
    • Clicking the button scrolls to the top of the list and hides it
    • The button automatically vanishes after 10s (when device animations are on)
    • The button automatically vanishes when scrolling to the top
    • The button automatically vanishes if the feed is reloaded

Before/After Screenshots/Screen Record

Before (click to expand)
Broken.mp4
After (click to expand)
NewPipeFeedReworkDemo1.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

How to test

  • Install the apk / Checkout the branch
  • optional Set your phone / emulator system time to 2021-07-15 at 23:55 (you might need to reset it as the clock counts)
  • Import an old state of your feed, you can e.g. use this: NewPipeData-20210716_190308.zip
  • Go to Feed/"What's New" and refresh it

@litetex litetex changed the title Feed refactor new items handling Rework feed new items handling Sep 3, 2021
@litetex litetex marked this pull request as ready for review September 3, 2021 20:32
@litetex litetex mentioned this pull request Sep 3, 2021
3 tasks
@litetex litetex added the GUI Issue is related to the graphical user interface label Sep 3, 2021
@SameenAhnaf

This comment has been minimized.

@litetex
Copy link
Member Author

litetex commented Sep 4, 2021

@SameenAhnaf
Thank you for the feedback!

However most of these statements would blow up the current scope of this Pull Request.
Please create a new issue or check for existing similar ones like e.g. #7047, leave a comment and/or upvote them
This PullRequestis only meant to improve the handling of the "new items" as mentioned in it's predecessor #6686

Is 5. related to this PullRequest? I don't understand the statement...

New video titles should be bold instead of making it confined in the boxes

To the errors you found (6.x):
I can't reproduce them with my setup neither on the emulator nor on my real phone.
I also switched to the Grid-view to see if there are any problems however I was unable to find one...

Could you post your configuration (Settings>Content>Export database) here? (maybe clean it before posting it publicly)
I'm otherwise not able to reproduce the problem...

@SameenAhnaf

This comment has been minimized.

@nikhilCad
Copy link

Only a single line separating the old and new videos can be good as well

@tsiflimagas
Copy link
Contributor

I got this after new items were loaded, couldn't reproduce it though

Exception

  • User Action: ui error
  • Request: ACRA report
  • Content Country: US
  • Content Language: en-US
  • App Language: en_US
  • Service: none
  • Version: 0.21.9
  • OS: Linux Android 11 - 30
Crash log

java.lang.NullPointerException
	at org.schabi.newpipe.local.feed.FeedFragment.getFeedBinding(FeedFragment.kt:87)
	at org.schabi.newpipe.local.feed.FeedFragment.hideNewItemsLoaded$lambda-26(FeedFragment.kt:639)
	at org.schabi.newpipe.local.feed.FeedFragment.$r8$lambda$vVY6QBNGtFe0us3zVVzOHMF1I-w(Unknown Source:0)
	at org.schabi.newpipe.local.feed.FeedFragment$$ExternalSyntheticLambda14.run(Unknown Source:2)
	at org.schabi.newpipe.ktx.ViewUtils$animateAlpha$2.onAnimationEnd(View.kt:192)
	at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1111)
	at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:554)
	at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1250)
	at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1492)
	at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
	at android.animation.AnimationHandler.access$100(AnimationHandler.java:37)
	at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1044)
	at android.view.Choreographer.doCallbacks(Choreographer.java:869)
	at android.view.Choreographer.doFrame(Choreographer.java:799)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1031)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:223)
	at android.app.ActivityThread.main(ActivityThread.java:7665)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:594)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)


@litetex
Copy link
Member Author

litetex commented Sep 5, 2021

Thanks for all the feedback!

@nikhilCad

Only a single line separating the old and new videos can be good as well

Adding a completely different element in the video list between all the same elements doesn't work / is too difficult to implement. The list is also manage by the groupie framework, which would require additional effort

@litetex
Copy link
Member Author

litetex commented Sep 5, 2021

@SameenAhnaf
I think that's generally a good idea however e-mails can't contain additional formatting in the header. YouTube videos e.g. can (don't know if other services can also do that):
grafik

So I think bold titles only aren't the best expression that something is new.
However I will additionally make the video-text bold to the already bordered background so people clearly see the difference.

grafik

@litetex
Copy link
Member Author

litetex commented Sep 5, 2021

@tsiflimagas
Thank you for the report!

I got this after new items were loaded, couldn't reproduce it though
...

I think that happens because the view isn't anymore there e.g. switching the view.
I made the corresponding lambda more-null safe.

@litetex
Copy link
Member Author

litetex commented Sep 5, 2021

@SameenAhnaf
Thank you for the export!

However when I tried to import your data, there seem to be no subscriptions where the feed is fetched from and I end up with an empty page.
Please resend/post a corrected version where I can reproduce the problem 😄

@SameenAhnaf

This comment has been minimized.

@litetex

This comment has been minimized.

@SameenAhnaf

This comment has been minimized.

@SameenAhnaf

This comment has been minimized.

@litetex

This comment has been minimized.

@SameenAhnaf

This comment has been minimized.

@litetex
Copy link
Member Author

litetex commented Sep 8, 2021

@SameenAhnaf
I think I managed to fix the vanishing "new feed items" button by checking if animations are on in the system and maybe the other problems as well :)
If they are off the button doesn't vanish after 10s anymore.

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.

Code looks almost good :-D
I tested and it works :-)

Stypox
Stypox previously requested changes Sep 10, 2021
@TobiGr
Copy link
Member

TobiGr commented Sep 10, 2021

why is the chip / button at the bottom?
I think it is more intuitive to have it at the top for two reasons:

  1. the new items are at the top, so I'd also look at the top after refreshing, not at the bottom
  2. the refresh gesture starts at the top and usually stops at 1/3 of the height, i.e. the finger is still in the upper part of the screen when the gesture is finished and most likely also when the list is updated / the chip is shown.

On another note: the button us quite near at the bottom of the screen which caused my fat fingers to trigger the O button which closed the app.

@litetex
Copy link
Member Author

litetex commented Sep 10, 2021

@TobiGr
I think the button would obscure the newly loaded feed items at the top that's why I put it at the bottom.

Moving the button up a bit shouldn't be a problem 😄

@tsiflimagas
Copy link
Contributor

tsiflimagas commented Sep 11, 2021

A small issue was caused from latest changes, "new feed items" button appears on every app start, and when returning to "what's new" from search.

@litetex litetex force-pushed the feed-refactor-new-items-handling branch from 40418a1 to daebceb Compare September 12, 2021 13:04
@litetex
Copy link
Member Author

litetex commented Sep 12, 2021

@tsiflimagas

Thanks for noticing.
I accidentally forgot to set the default visibility to gone while removing the layout.

Should be fixed now

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, I tested on API 19 emulated, API 30 tablet emulated and API 30 real, and everything works well.

@tsiflimagas
Copy link
Contributor

Here's another crash I got. It seems that it happens if you refresh the feed, there are new videos, but you quickly go and open a playlist while the feed's still loading.

Exception

  • User Action: ui error
  • Request: ACRA report
  • Content Country: US
  • Content Language: en-US
  • App Language: en_US
  • Service: none
  • Version: 0.21.10
  • OS: Linux Android 11 - 30
Crash log

java.lang.NullPointerException
	at org.schabi.newpipe.local.feed.FeedFragment.getFeedBinding(FeedFragment.kt:89)
	at org.schabi.newpipe.local.feed.FeedFragment.hideNewItemsLoaded$lambda-26(FeedFragment.kt:653)
	at org.schabi.newpipe.local.feed.FeedFragment.$r8$lambda$vVY6QBNGtFe0us3zVVzOHMF1I-w(Unknown Source:0)
	at org.schabi.newpipe.local.feed.FeedFragment$$ExternalSyntheticLambda14.run(Unknown Source:2)
	at org.schabi.newpipe.ktx.ViewUtils$animateAlpha$2.onAnimationEnd(View.kt:192)
	at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1111)
	at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:554)
	at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1250)
	at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1492)
	at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
	at android.animation.AnimationHandler.access$100(AnimationHandler.java:37)
	at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1044)
	at android.view.Choreographer.doCallbacks(Choreographer.java:869)
	at android.view.Choreographer.doFrame(Choreographer.java:799)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1031)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:223)
	at android.app.ActivityThread.main(ActivityThread.java:7665)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:594)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)


@TobiGr
Copy link
Member

TobiGr commented Nov 14, 2021

I'd also squash a few of these commits, because some of them improve or re-do stuff that is done in previous commits of this PR, e.g. c871ca8, 3c5e77f or 5d7815e

@litetex litetex marked this pull request as draft November 15, 2021 19:25
@litetex litetex force-pushed the feed-refactor-new-items-handling branch from c17bc85 to 7638d22 Compare November 15, 2021 19:28
@litetex litetex marked this pull request as ready for review November 15, 2021 19:28
@litetex
Copy link
Member Author

litetex commented Nov 15, 2021

Rebased and squashed the branch.

Copy link
Member

@Redirion Redirion left a comment

Choose a reason for hiding this comment

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

lgtm

@Redirion Redirion merged commit d5199ea into TeamNewPipe:dev Nov 15, 2021
@litetex litetex deleted the feed-refactor-new-items-handling branch November 16, 2021 17:51
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.

Obviously I am late, but yes, this looks good :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feed Issue is related to the feed GUI Issue is related to the graphical user interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

After Feed Update, Requires Manual Scroll Up to show Latest Videos
8 participants