-
-
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
Sort bookmarked playlists #8221
Conversation
demo.mp4The data storage logic has been modified, so more testing is required to avoid data loss. |
Two of the three code smells are about high complexity methods. But their logic is continuous, I don't think refactoring them is a necessity. Please keep me informed if there's anything else to do. |
c6b42c4
to
6526ff1
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.
Thank you! I have a few comments
app/src/main/java/org/schabi/newpipe/database/playlist/PlaylistLocalItem.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/local/bookmark/BookmarkFragment.java
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/local/bookmark/BookmarkFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/local/bookmark/BookmarkFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/local/bookmark/BookmarkFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/local/bookmark/BookmarkFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/local/holder/LocalBookmarkPlaylistItemHolder.java
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java
Outdated
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
SonarCloud Quality Gate failed. |
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.
Almost good, thank you! If you want me to take care of some of these changes, feel free to ask me ;-)
app/src/main/java/org/schabi/newpipe/database/playlist/PlaylistLocalItem.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/database/playlist/PlaylistLocalItem.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/local/bookmark/BookmarkFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/database/playlist/dao/PlaylistStreamDAO.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/database/playlist/dao/PlaylistStreamDAO.java
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/database/playlist/PlaylistLocalItem.java
Outdated
Show resolved
Hide resolved
app/src/test/java/org/schabi/newpipe/database/playlist/PlaylistLocalItemTest.java
Outdated
Show resolved
Hide resolved
Complete removal of unneeded index, and remove default value for `remote_playlists.display_index`.
Remove checkDisplayIndexModified because it was causing more problems than it solved. Now when adding new playlists they won't necessarily appear at the top, but will get sorted alphabetically along with the other playlists with index -1. This will be the case until any playlist is sorted, at which point all indices are assigned and newly added playlists will appear at the top again.
The 5 sonartype issues are due to:
I tested, fixed some things and made the implementation simpler. I tested again and everything seems to work well. I deleted, moved, renamed remote and local playlists and there were no inconsistencies. |
|
What is it?
Description of the changes in your PR
Add a new column
display_index (INTEGER NOT NULL DEFAULT 0)
inplaylists
andremote_playlists
.Implement an algorithm to merge local playlists and remote playlists by index. If they have the same index, sort them by name.
If the index saved in the database doesn't match the actual display index for some reason (e.g., setting to all zero after database migration, or a new playlist is created with index -1 (thus being on the top), or the index is not continuous after deletion, or the user changes the index), save the new index to the database.
Save the list 10 seconds after the last change occurred. The logic is almost the same as the one in
LocalPlaylistFragment
.Update: now the code is reused.
list_playlist_bookmark_item.xml
. It's justlist_playlist_mini_item.xml
adding an handle on the right.LocalBookmarkPlaylistItemHolder
andRemoteBookmarkPlaylistItemHolder
.LocalItemListAdapter
will choose the item holder with/without the handle.Before/After Screenshots/Screen Record
Before:
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