Skip to content
This repository was archived by the owner on Jun 14, 2022. It is now read-only.
This repository was archived by the owner on Jun 14, 2022. It is now read-only.

Move database loading/file reading off of the main thread #635

@jsoberg

Description

@jsoberg

Is your feature request related to a problem? Please describe.
While implementing a fix for another issue, I noticed that database loading appears to always happen on the main thread (e.g. loadEntries() in the EntriesCardAdapter). This is generally a bad practice, and the UI lag may be noticeable on slower devices. I use a Samsung S9 in my everyday usage and haven't noticed it on that device, however I can imagine that on slower/older devices the lag may be more noticeable.

Describe the solution you'd like
Ideally, we could offload database loading and any file parsing onto a background thread. Perhaps we could add a loading progress view (where applicable) while the background work completes.

Additional context
I looked at usages of DatabaseHelper.loadDatabase to find where this was happening, though I believe this may be happening in other places. Adding a quick Application impl for the app with StrictMode thread policy logging enabled can help root out any instances.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions