Skip to content

Adds a flexible smart organizer to Favorites - #92

Open
biglag wants to merge 11 commits into
UsagiApp:develfrom
biglag:feature/smart-favorites-organizer
Open

Adds a flexible smart organizer to Favorites#92
biglag wants to merge 11 commits into
UsagiApp:develfrom
biglag:feature/smart-favorites-organizer

Conversation

@biglag

@biglag biglag commented Aug 11, 2026

Copy link
Copy Markdown

Summary

Adds a flexible smart organizer to Favorites while preserving the familiar folder-based navigation.

Users can organize large libraries using manual categories, rule-based smart folders, and automatic lifecycle stages such as Not started, Reading, Waiting, Completed, and Needs review.

What changed

Favorites organization

  • Keep All favorites as a permanent system folder.
  • Preserve manual category tabs and add smart-folder tabs.
  • Add an adjacent create action and long-press folder management.
  • Add automatic lifecycle subfolders with consistent item counts.
  • Keep transient filters scoped independently per folder.
  • Hide filter dimensions already fixed by the selected smart folder.

Smart folders

  • Add smart-folder creation, editing, deletion, and ordering.
  • Support rules based on:
    • sources;
    • manual categories;
    • tags;
    • SFW/NSFW content;
    • on-device state;
    • new chapters.
  • Add explicit handling for invalid or missing rule references.
  • Add organizer refresh for source-dependent terminal states.

Global favorite membership

  • Separate global favorite membership from editable categories.
  • Allow titles to remain in All favorites without belonging to a manual folder.
  • Make All favorites directly selectable from manga details.
  • Removing a title from its last manual category no longer removes it from Favorites.
  • Explicitly clearing All favorites removes all active memberships for the title.
  • Details now derives the favorite icon from global membership and uses category names only as optional labels.

Persistence and backup

  • Advance the Room database from version 28 to 32.
  • Add reserved global favorite membership and repair existing installations.
  • Remove the legacy trigger that coupled manual-category removal to global membership.
  • Add smart folders to local backup and restore.
  • Keep reserved global membership local-only and excluded from category/cloud-sync payloads.

Reading lifecycle

  • Centralize reading progress calculation and completion semantics.
  • Keep list queries and stage counters on the same lifecycle predicates.
  • Resolve completion against the preferred branch and matching source.
  • Refresh stale progress and source status for terminal organizer stages.

Runtime quality

  • Bind Favorites container controls only to the active pager page lifecycle.
  • Prevent destroyed Favorites fragments from being retained after folder deletion or page switching.
  • Dispose source-list image requests and RecyclerView infrastructure correctly.
  • Update the AndroidX Hilt compiler for Kotlin 2 and KSP2 compatibility.
  • Preserve API 21 support and modern 16 KB native-library compatibility.

Database migration

The database schema advances through:

  • 28 → 29: smart-folder storage;
  • 29 → 30: reserved global favorite membership and initial backfill;
  • 30 → 31: repair missing or inactive global memberships;
  • 31 → 32: remove manual-removal coupling.

Existing favorite, category, and manga data is preserved during forward migration. Downgrading to an earlier schema is not supported by Room.

Verification

  • FavouritesOrganizerDaoTest: 10/10 tests passed on Pixel 10.
  • Focused Room migration 31 → 32: 1/1 test passed on Pixel 10.
  • FavoriteSelectionStateTest passed in a fresh Gradle run.
  • assembleDebug completed successfully with --rerun-tasks.
  • openspec validate smart-favorites-organizer --strict passed.
  • Debug APK installed with adb install -r, preserving the existing database.

Pixel smoke coverage included:

  • removing a title from a manual folder while keeping it in All favorites;
  • explicitly removing the title from Favorites;
  • adding it again directly through All favorites;
  • verifying the details label, selector state, Favorites count, and visible title;
  • checking Room, SQLite, AndroidRuntime, and LeakCanary logs after the flow.

Remote cover requests still produced unrelated HTTP 404 and timeout messages. Close #82

biglag and others added 4 commits August 6, 2026 03:31
- add rule-based smart folders and lifecycle stages
- unify reading progress and completion handling
- add organizer refresh and per-scope stage counts
- persist and back up smart folders
- add Room migration, tests, and OpenSpec documentation
- improve native library compatibility and image request cleanup
- preserve All favorites independently of editable categories
- restore folder tabs and scope-aware filters
- bind container controls only to the active page lifecycle
- add database migrations and regression coverage
- clean up source views and update AndroidX Hilt compiler
@biglag
biglag requested a review from dragonx943 as a code owner August 11, 2026 13:19
@biglag

biglag commented Aug 11, 2026

Copy link
Copy Markdown
Author

Not expect it woulbe so large

@sang765

sang765 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

SKILL.md 😭

@biglag

biglag commented Aug 11, 2026

Copy link
Copy Markdown
Author

SKILL.md 😭

mb cleaning it up

@sang765 sang765 added the enhancement New feature or request label Aug 12, 2026
@dragonx943 dragonx943 changed the title Feature/smart favorites organizer Adds a flexible smart organizer to Favorites Aug 12, 2026

@dragonx943 dragonx943 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your contributions, here are some of my comments on this PR. Hopefully, it will be improved to make it more accessible to users.

In addition to the above comments, I hope that the code changes in this PR have been refactored, ensuring they are minimal to avoid redundancy of any unused resources / variables / methods. Furthermore, please ensure the execution flow is truly optimized for Android devices (especially low-spec devices running on Android 5.0, SDK 21), and that memory leaks are avoided.

Besides the code changes, I'd like you to improve the interface: Instead of placing them directly on the filter chips, you could simplify unnecessary parts like "refresh" and "create", and put their filters into the general Favorites filter table (as shown in the image). Regarding adding them, since you already have "Smart folders," the "+" isn't really necessary at this point.

Image Image

Comment thread gradle/libs.versions.toml Outdated
Comment thread gradle/libs.versions.toml
Comment thread app/src/main/res/values/strings.xml Outdated
@dragonx943 dragonx943 added this to Usagi Aug 17, 2026
@dragonx943 dragonx943 moved this to Doing in Usagi Aug 17, 2026
@biglag

biglag commented Aug 17, 2026

Copy link
Copy Markdown
Author

Thanks for your contributions, here are some of my comments on this PR. Hopefully, it will be improved to make it more accessible to users.

In addition to the above comments, I hope that the code changes in this PR have been refactored, ensuring they are minimal to avoid redundancy of any unused resources / variables / methods. Furthermore, please ensure the execution flow is truly optimized for Android devices (especially low-spec devices running on Android 5.0, SDK 21), and that memory leaks are avoided.

Besides the code changes, I'd like you to improve the interface: Instead of placing them directly on the filter chips, you could simplify unnecessary parts like "refresh" and "create", and put their filters into the general Favorites filter table (as shown in the image). Regarding adding them, since you already have "Smart folders," the "+" isn't really necessary at this point.

Image Image

Interface is still bottleneck for me, it mostly like draft rn, need to think how to do it good
Opened for any references, and will refine it more

@biglag

biglag commented Aug 17, 2026

Copy link
Copy Markdown
Author

and need to test more for eansure leak sceanrio is not appear

@biglag

biglag commented Aug 17, 2026

Copy link
Copy Markdown
Author

But I kind busy rn, will do it slow within a week

- move Favorites filters, sorting, refresh, and folder management into the list options sheet
- redesign smart folder creation with grouped rule and display sections
- add searchable selections and allow smart folders without explicit rules
- add direct folder creation and improve component spacing
- align AndroidX Hilt dependencies for API 21 compatibility
- add regression coverage for filters, rules, and widget padding
@biglag

biglag commented Aug 23, 2026

Copy link
Copy Markdown
Author
image image image image

upd ui and some logic, now way better

@dragonx943

Copy link
Copy Markdown
Member

image image image image
upd ui and some logic, now way better

can you remove these buttons?
image

@biglag

biglag commented Aug 23, 2026

Copy link
Copy Markdown
Author

image image image image
upd ui and some logic, now way better

can you remove these buttons? image

hm, how to launch fiilter and add folder? Folder can be added from 3 dot menu but for filter open question

@dragonx943

Copy link
Copy Markdown
Member

image image image image
upd ui and some logic, now way better

can you remove these buttons? image

hm, how to launch fiilter and add folder? Folder can be added from 3 dot menu but for filter open question

filters can be activated via filter chips and if users wants to add a folder, they can do so through the "Favorite Categories" interface

improving this could allow for clearer differentiation of functions instead of trying to cram them onto one screen, which is quite difficult to see

- remove permanent create and filter buttons from Favorites
- give folder tabs and lifecycle chips the full available width
- add Pixel instrumentation coverage for header navigation sizing
@dragonx943

Copy link
Copy Markdown
Member

This PR is ready for the testing phase; the results will be reported in a few days. If there are no issues / problems, it will be automatically approved.

@dragonx943 dragonx943 moved this from Doing to Done in Usagi Aug 24, 2026
@dragonx943 dragonx943 moved this from Done to Doing in Usagi Aug 24, 2026
@dragonx943

Copy link
Copy Markdown
Member

@biglag After a short testing period, I found a few issues that need to be addressed before merging / approving this PR, please take a look about them:

  • About UI / UX: Should merge these options...
image image

...to filter chips, that current interface for them is a bit poor (in my personal experience). And some glitched dialogs / boxes, not optimized for displaying:

image image image
  • This button needs improve (remove it, should be automated instead of manual):
image
  • I have no idea about this text, should remove it?
image
  • App crashed in a test case (and how 2 reproduce):
image image

I didn't test your feature on Android 5 / 6 devices, since I have no time to do that. I will try it soon, after your fixes / patches.
Again, thanks for your contributions. I will wait until you are ready to review.

@biglag

biglag commented Aug 28, 2026

Copy link
Copy Markdown
Author

@biglag After a short testing period, I found a few issues that need to be addressed before merging / approving this PR, please take a look about them:

  • About UI / UX: Should merge these options...

image image
...to filter chips, that current interface for them is a bit poor (in my personal experience). And some glitched dialogs / boxes, not optimized for displaying:

image image image

  • This button needs improve (remove it, should be automated instead of manual):
image * I have no idea about this text, should remove it? image * App crashed in a test case (and how 2 reproduce):

image image
I didn't test your feature on Android 5 / 6 devices, since I have no time to do that. I will try it soon, after your fixes / patches. Again, thanks for your contributions. I will wait until you are ready to review.

I'll test it on Android 5 / 6 devices dw

- move binary filters to chips and support standalone list options
- automate terminal-stage refresh and hide empty rule summaries
- polish smart-folder selectors, transitions, and dialog sizing
- add regression coverage for organizer and selection UI
@biglag

biglag commented Aug 30, 2026

Copy link
Copy Markdown
Author

Tested on android 5/6, didn't see any unstable things, seems like all normal, but I was tested only the new logic with folder, not the whole app

@dragonx943

dragonx943 commented Aug 30, 2026

Copy link
Copy Markdown
Member

Tested on android 5/6, didn't see any unstable things, seems like all normal, but I was tested only the new logic with folder, not the whole app

Remove these number, they are not necessary

image

Remove this button, it already exists in list options dialog

image

Remove this border and add icon for these filter chips (for better appearance)

image

But in my opinion, "Filter this view" should be merged with quick filter chips (like All, Not started, Reading, etc.) instead of in the options list

Synchronize font sizes between these main heading titles

image

@dragonx943

Copy link
Copy Markdown
Member
image

Also, pay attention to the number of lines of code added; most of it comes from the test file (it's not necessary to upload it to the main branch) 👌

@dragonx943

Copy link
Copy Markdown
Member

Any update?

@biglag

biglag commented Sep 6, 2026

Copy link
Copy Markdown
Author

Any update?

Work has taken up all my free time. I'll update soon

- use borderless icon chips in the list options filter section
- unify source and genre selectors with other filter chips
- align section headings and spacing
- remove lifecycle counts and duplicate smart-folder menu entry
- remove UI tests from version control while retaining them locally
@biglag

biglag commented Sep 6, 2026

Copy link
Copy Markdown
Author

Tested on android 5/6, didn't see any unstable things, seems like all normal, but I was tested only the new logic with folder, not the whole app

Remove these number, they are not necessary

image Remove this button, it already exists in list options dialog image Remove this border and add icon for these filter chips (for better appearance) image _But in my opinion, "Filter this view" should be merged with quick filter chips (like All, Not started, Reading, etc.) instead of in the options list_

Synchronize font sizes between these main heading titles

image

With quick filter chips looks kinda messy, so I keep it in filter after test
Screenshot 2026-09-06 at 5 26 13 PM

@biglag

biglag commented Sep 6, 2026

Copy link
Copy Markdown
Author

Lmk if need another tests cleanup

@dragonx943

Copy link
Copy Markdown
Member

Tested on android 5/6, didn't see any unstable things, seems like all normal, but I was tested only the new logic with folder, not the whole app

Remove these number, they are not necessary
image
Remove this button, it already exists in list options dialog
image
Remove this border and add icon for these filter chips (for better appearance)
image
But in my opinion, "Filter this view" should be merged with quick filter chips (like All, Not started, Reading, etc.) instead of in the options list
Synchronize font sizes between these main heading titles
image

With quick filter chips looks kinda messy, so I keep it in filter after test Screenshot 2026-09-06 at 5 26 13 PM

I mean putting it in a single row instead of 2 rows

@biglag

biglag commented Sep 6, 2026

Copy link
Copy Markdown
Author

Tested on android 5/6, didn't see any unstable things, seems like all normal, but I was tested only the new logic with folder, not the whole app

Remove these number, they are not necessary
image
Remove this button, it already exists in list options dialog
image
Remove this border and add icon for these filter chips (for better appearance)
image
But in my opinion, "Filter this view" should be merged with quick filter chips (like All, Not started, Reading, etc.) instead of in the options list
Synchronize font sizes between these main heading titles
image

With quick filter chips looks kinda messy, so I keep it in filter after test Screenshot 2026-09-06 at 5 26 13 PM

I mean putting it in a single row instead of 2 rows

a lot of mooves need to do to pick it, didn't u think so? We can test it like that and if it bad merge it to the quick filter chips

@dragonx943

Copy link
Copy Markdown
Member

Tested on android 5/6, didn't see any unstable things, seems like all normal, but I was tested only the new logic with folder, not the whole app

Remove these number, they are not necessary
image
Remove this button, it already exists in list options dialog
image
Remove this border and add icon for these filter chips (for better appearance)
image
But in my opinion, "Filter this view" should be merged with quick filter chips (like All, Not started, Reading, etc.) instead of in the options list
Synchronize font sizes between these main heading titles
image

With quick filter chips looks kinda messy, so I keep it in filter after test Screenshot 2026-09-06 at 5 26 13 PM

I mean putting it in a single row instead of 2 rows

merge it to the quick filter chips

yup, do it

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

Labels

enhancement New feature or request

Projects

Status: Doing

Development

Successfully merging this pull request may close these issues.

Smart Favorites organizer with main folders and automatic reading states

4 participants