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

Improved list updates #335

Closed
OxygenCobalt opened this issue Jan 20, 2023 · 0 comments
Closed

Improved list updates #335

OxygenCobalt opened this issue Jan 20, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request rework Requires/Does changes to app architecture

Comments

@OxygenCobalt
Copy link
Owner

OxygenCobalt commented Jan 20, 2023

Note: This issue is somewhat technical and barely even noticeable in-app. Only logging this here so I can keep track of my ideas regarding how to resolve this system. You're probably better off ignoring this unless you really like wrangling RecyclerView.Adapter diffing implementation details.

Update the internal list system to provide different behavior in different situations.

Currently, Auxio uses a bunch of different strategies to update list information, including:

  • Asynchronous updates that cause items to jump around (Seen in detail views when resorting). These don't look nice visually, but are fast.
  • Synchronous updates that are used in editable lists such as the queue. These are relatively stabler compared to asynchronous updates, but are also degrade performance due to the ~O(nlogn) complexity of these updates and how they are ran on the main thread. You can see this in the app by moving items around in a large queue and setting how much the app freezes up.
  • Replace updates that fade the current list out and fade a new list in. This is seen in the home view. Generally nice for resorting operations, but not for any other kind of list update. The issue is that replace updates and asynchronous updates cannot be applied to the same adapter, as the class used (AsyncListDiffer) only allows asynchronous updating and trying to manually overwrite the list is extremely dangerous.

In practice, much of the app needs combinations of these updates, new types of updates, or different updates entirely.

I hope to soon unify all these operations under a single set of actions in a way that will not cause list inconsistency crashes using a datatype like:

enum UpdateWith {
    Diff(DiffUtil.DiffResult)
    Replace(startAt: Int)
    Move(from: Int, to: Int)
    // ...
}

Adapters would receive a new list from the ViewModel alongside this new datatype that instructs them how to visually signal the list change.

The end benefits of this change should be:

  • Much better list performance in the queue view due to the switch to specific update operations like moves and deletions.
  • Music library updates in the home view will become much less invasive.
  • Resorting lists will now have a consistent animation between the home and detail views.
@OxygenCobalt OxygenCobalt added enhancement New feature or request rework Requires/Does changes to app architecture labels Jan 20, 2023
@OxygenCobalt OxygenCobalt changed the title Adaptive list updates Improved list updates Jan 20, 2023
@OxygenCobalt OxygenCobalt self-assigned this Jan 22, 2023
@OxygenCobalt OxygenCobalt mentioned this issue Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request rework Requires/Does changes to app architecture
Projects
None yet
Development

No branches or pull requests

1 participant