-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add ability to hide played items in a feed #3371
Conversation
app/src/main/java/org/schabi/newpipe/database/stream/StreamWithState.kt
Outdated
Show resolved
Hide resolved
aede87e
to
e79ca8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! I especially like the new groupie-based StreamItem
holder. :-D
app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt
Outdated
Show resolved
Hide resolved
Question: Does this hide videos that have been only barely been started watching? (Like for a few seconds or minutes, or a few percent of total video time) I know it hides stuff that a significant portion has been watched from the gif, but idk about that. |
I don't think so, this would require to change the way stream states are saved. Currently timestamps are only saved if at least |
After testing on my phone I found some things that should be improved:
|
e79ca8a
to
e1ef59f
Compare
The two are related, it looked very bad so I disabled it from the main page. Though the second has nothing to do with this changes, the view pager seems to let the animation end to finally setup the menu, you can test it by instead pressing the tab's icon, it should be instantly changed. I think it's possible to improve how fast it does that, but that's for another pull request.
I thought that the method that I was using did that, but apparently not. Fixed it.
Should not matter even if it had thousands, there's a limit to how many items are pulled from the database. |
android:endColor="#B2000000" | ||
android:startColor="#E6000000"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer the shadow to be more transparent, something like this:
android:endColor="#B2000000" | |
android:startColor="#E6000000"/> | |
android:endColor="#6C000000" | |
android:startColor="#A0000000"/> |
Also, what about making the color different based on the theme? Imo the black shadow looks a little bit strange in the white theme, but maybe it's just an impression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer the shadow to be more transparent
IMO, that much more transparency makes it hard to read when the thumbnail doesn't use darker colors.
But I do like to see the thumbnail a little better...
What about making the gradient a little lighter towards the end, what do you say on a 90% → 40% gradient instead of the current 90% → 70%?
Also, what about making the color different based on the theme?
B&W or some other color?
Imo the black shadow looks a little bit strange in the white theme, but maybe it's just an impression.
To me it isn't much different/stranger than any other dark thumbnail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
B&W or some other color?
I was thinking about B&W, but then you are right, there is actually no need for this.
So, let's use a 90% → 40%
black shadow, it seems the best option.
android:layout_alignBottom="@id/itemThumbnailView" | ||
android:layout_gravity="top|left" | ||
android:background="@drawable/item_in_history_indicator_background" | ||
android:ellipsize="end" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a good idea? In theory the ellipsize should never be triggered, but even if it is I'd prefer marquee
(also below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if it was just one view or even a list that you can select an element it'd be fine with the marquee, but with this much items, I don't think so. What about the users that use the bigger fonts and have a bunch of items that are already played, wouldn't that be too distracting?
I think that's why the marquee effect is designed to only start when the item is actually selected (otherwise you have to call setSelected(true)
manually).
Maybe an auto-sizing text view would work better here, even though we won't be able adapt all sizes, most of them will be fine with that. It'd also work better on the mini version of the stream item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about using marquee, but never calling setSelected(true)
on it, so that the IN HISTORY
text fades at the end instead of showing three points? Anyway, if this would look too strange, I'm ok with not changing anything, since "in theory the ellipsize should never be triggered"
@mauriciocolli could you rebase, please? Then I would like to merge this. |
|
06be78b
to
22a9cd3
Compare
- Use components from the new Groupie list library for displaying the feed list.
60b5de3
to
faa93ca
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get this crash when using a tablet emulator for viewing the feed. Are all layouts updated?
Crash log
2021-06-10 22:35:50.738 10153-10153/org.schabi.newpipe.debug.feedhideplayeditems E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.schabi.newpipe.debug.feedhideplayeditems, PID: 10153
java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to androidx.constraintlayout.widget.ConstraintLayout
at org.schabi.newpipe.databinding.ListStreamItemBinding.bind(ListStreamItemBinding.java:104)
at org.schabi.newpipe.local.feed.item.StreamItem.initializeViewBinding(StreamItem.kt:44)
at org.schabi.newpipe.local.feed.item.StreamItem.initializeViewBinding(StreamItem.kt:23)
at com.xwray.groupie.viewbinding.BindableItem.createViewHolder(BindableItem.java:39)
at com.xwray.groupie.viewbinding.BindableItem.createViewHolder(BindableItem.java:23)
at com.xwray.groupie.GroupAdapter.onCreateViewHolder(GroupAdapter.java:209)
at com.xwray.groupie.GroupAdapter.onCreateViewHolder(GroupAdapter.java:20)
at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:7078)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6235)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6118)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6114)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2303)
at androidx.recyclerview.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:561)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:665)
at androidx.recyclerview.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4134)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3851)
at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4404)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at androidx.swiperefreshlayout.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:689)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1103)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at androidx.coordinatorlayout.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1213)
at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:899)
at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:919)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at androidx.drawerlayout.widget.DrawerLayout.onLayout(DrawerLayout.java:1231)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
2021-06-10 22:35:50.739 10153-10153/org.schabi.newpipe.debug.feedhideplayeditems E/AndroidRuntime: at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at com.android.internal.policy.DecorView.onLayout(DecorView.java:784)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3470)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2938)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1952)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8171)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:731)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
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:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
2021-06-10 22:35:50.740 10153-10153/org.schabi.newpipe.debug.feedhideplayeditems E/ACRA: ACRA caught a ClassCastException for org.schabi.newpipe.debug.feedhideplayeditems
java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to androidx.constraintlayout.widget.ConstraintLayout
at org.schabi.newpipe.databinding.ListStreamItemBinding.bind(ListStreamItemBinding.java:104)
at org.schabi.newpipe.local.feed.item.StreamItem.initializeViewBinding(StreamItem.kt:44)
at org.schabi.newpipe.local.feed.item.StreamItem.initializeViewBinding(StreamItem.kt:23)
at com.xwray.groupie.viewbinding.BindableItem.createViewHolder(BindableItem.java:39)
at com.xwray.groupie.viewbinding.BindableItem.createViewHolder(BindableItem.java:23)
at com.xwray.groupie.GroupAdapter.onCreateViewHolder(GroupAdapter.java:209)
at com.xwray.groupie.GroupAdapter.onCreateViewHolder(GroupAdapter.java:20)
at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:7078)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6235)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6118)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6114)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2303)
at androidx.recyclerview.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:561)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:665)
at androidx.recyclerview.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4134)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3851)
at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4404)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at androidx.swiperefreshlayout.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:689)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1103)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at androidx.coordinatorlayout.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1213)
at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:899)
at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:919)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at androidx.drawerlayout.widget.DrawerLayout.onLayout(DrawerLayout.java:1231)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
2021-06-10 22:35:50.740 10153-10153/org.schabi.newpipe.debug.feedhideplayeditems E/ACRA: at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at com.android.internal.policy.DecorView.onLayout(DecorView.java:784)
at android.view.View.layout(View.java:22844)
at android.view.ViewGroup.layout(ViewGroup.java:6389)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3470)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2938)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1952)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8171)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:731)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
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:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
/** | ||
* Playback state will not be saved, if playback time is less than this threshold. | ||
*/ | ||
private static final int PLAYBACK_SAVE_THRESHOLD_START_SECONDS = 5; | ||
private static final long PLAYBACK_SAVE_THRESHOLD_START_MILLISECONDS = 5000; // 5000ms = 5s | ||
|
||
/** | ||
* Playback state will not be saved, if time left is less than this threshold. | ||
* @see #isFinished(long) | ||
* @see org.schabi.newpipe.database.feed.dao.FeedDAO#getLiveOrNotPlayedStreams() | ||
*/ | ||
private static final int PLAYBACK_SAVE_THRESHOLD_END_SECONDS = 10; | ||
public static final long PLAYBACK_FINISHED_END_MILLISECONDS = 60000; // 60000ms = 60s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That inline comments can be moved into the JDoc
app/src/main/java/org/schabi/newpipe/database/stream/model/StreamStateEntity.java
Show resolved
Hide resolved
@Stypox Seems to be fixed now. 👍 |
…ition Consider stream state valid also if >1/4 of video was watched
faa93ca
to
32df4d3
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to all involved!
What is it?
Description of the changes in your PR
Fixes #3611
Testing apk
The APK can be found by going to the "Checks" tab below the title and then on "artifacts" on the right.