Commit graph

1416 commits

Author SHA1 Message Date
Konstantin Tutsch
1e8476b55c
Quality improvements for hectic German translations 2022-06-11 19:24:07 +02:00
OxygenCobalt
277e5a151f
playback: use more efficient no-op w/replaygain
When ReplayGain is not needed, use ByteBuffer.put in favor of a for
loop when doing a simple copy.

ByteBuffer.put is highly optimized and far more efficient than a for
loop.
2022-06-11 09:27:55 -06:00
OxygenCobalt
d42f5970f1
image: fix indicator <api 22
Redo the paths and remove scientific notation from the indicator to
make it work below API 22.

The fact that studio does not have a built-in vector editor of any
kind that properly handles the edge-cases is shameful.
2022-06-10 15:45:00 -06:00
OxygenCobalt
d80c49f11f
image: add image group
Add a new view called ImageGroup that will handle all advanced image
hacks from now on.

This includes the indicator (which is now animated), any selection
indicators, and the weirdness of the album song image. All of that
is now handled by ImageGroup. This is the culmination of probably
a day and a half of wrangling with android insanity and having to
remove a lot of what I liked about the indicator in order to make
this work on a basic level.

The only major bug I am currently aware of with this is that the
indicator is bugged out on Lollipop devices due to bad vectors.
Again.

I never want to do this again. I cannot believe that adding a basic
indicator took this long and required so much stupid hacks and
inefficient code. And then google wonders why android apps are so
visually unappealing and janky and laggy. Hm. Must be that devs aren't
using the brand new FooBarBlasterFlow library!
2022-06-10 11:57:50 -06:00
OxygenCobalt
ffe7298665
ui: add image playing indicator
Add a playing indicator to cover art.

This is simply to improve the general aestethics of this view. Of
course, the current way I implement this is incredibly stupid and I
plan to replace it.
2022-06-10 09:48:51 -06:00
OxygenCobalt
1d66907862
ui: remove edge-to-edge option
Remove the edge-to-edge option, as it turned out to be useless
with #149.
2022-06-09 17:03:38 -06:00
OxygenCobalt
84295dcf25
ui: completely rework icon management
Completely rework the way Auxio handles icons.

This is mostly two changes:
1. Removing ImageButton/StyledImageButton for MaterialButton. This is
done by abusing MaterialButton's theming options to make it only show
an icon.
2. Standardizing icon sizes into small, medium, and large categories.
Small is the default, Medium and Large are for edge-cases like the
playback icons which look horrible at 24dp.
3. Abusing the Toolbar to make it follow Material 3 guidelines. This
mostly involved removing the strange icon sizing and correctly padding
the view.
4. Reworking the playback bar to use more, smaller icons, making it
more like a Toolbar in the process (which I like).
2022-06-09 10:12:48 -06:00
OxygenCobalt
a56d5849db
ui: update bar styles
Update the styles of LinearProgressIndicator and Slider to be similar
across the entirety of the app.
2022-06-08 09:59:28 -06:00
OxygenCobalt
6f625da125
ui: supply view to windowinsetdcompat calls
Supply a view to WindowInsetsCompat.toWindowInsetsCompat through all
calls in the app.

This does nothing, but it would resolve future bugs if I were to use
the most exotic window inset types.
2022-06-08 09:48:14 -06:00
OxygenCobalt
7d4b953019
playback: pick larger inset out of bar/gesture
On the playback par, pick the larger inset out of the system bar
insets or system gesture insets.

This is to fix an issue where android just does not provide correct
gesture insets on Android 12L, and [maybe???] fix what is going on
in #149.
2022-06-08 09:33:14 -06:00
OxygenCobalt
a6c321cfa5
home: make toolbar collapse
Make the home toolbar collapse on scroll.

I was planning to implement this back in 2.0.0, but visual bugs stopped
me. Now, knowing how much space the the Toolbar + Tab combination takes
up on smaller devices, I think it would be better to have this in
general.
2022-06-08 09:31:57 -06:00
OxygenCobalt
cc2561f20f
ui: rework primitive backing data into sync
Rework PrimitiveBackingData into SyncBackingData.

Google says that you should not use DiffUtil on the main thread, as it
is far too slow. In practice, the time it takes to diff is negligable,
even more so when costly diffs are filled in with a replace call
instead. Not only that, but switching to a synced list differ fixees
the horrible nightmare that is the queue adapter. Generally a win-win
for most use-cases in Auxio.
2022-06-07 20:03:02 -06:00
OxygenCobalt
f85f366144
ui: change adapter animations
Rework the submitList animation to be less resource intensive and nicer
looking (at the cost of scroll positioning)

notifyDatasetChanged is slow and has no animation, but list diffing is
chaotic and basically useless outside of search. However, clearing the
adapter and then populating it with new items seems to work quite well,
albeit with the scroll position being lost sadly. Switch to that.
2022-06-07 19:14:54 -06:00
OxygenCobalt
d15055cc29
music: improve exoplayer tag management
Extend the range of tags Auxio is capable of recognizing, removing some
edge-cases in the process.

This is mostly three changes:
1. Auxio no longer tolerates tracks/discs/years that are 0. These are
usually never valid.
2. Auxio now has support for original date/year values. This are niche
tags, but I was inspired to implement it by this HN discussion at
https://news.ycombinator.com/item?id=31659799 simply because it
differentiates Auxio.
3. Auxio can handle the more esoteric tag variations in vorbis, such
as "YEAR" or "ALBUM ARTIST".
2022-06-07 17:50:11 -06:00
OxygenCobalt
c929357d76
ui: add edge-to-edge toggle
Add a toggle for edge-to-edge mode.

Normally we would want to enable edge-to-edge by default (in fact, we
still do). However, some phones (once again, samsung) don't provide
Auxio with actual window insets. As a result, we need to add a toggle
so that it can be disabled on busted devices.

Did you know that even when Auxio has it's edge-to-edge functionality
busted, Samsung Music works just fine? Very interesting.

Resolves #149.
2022-06-07 17:14:02 -06:00
OxygenCobalt
bd683ca09a
ui: use compat edge-to-edge
Use androidx compat tools when setting up edge-to-edge and applying
window insets.

This is mostly a readability tweak ahead of making edge-to-edge a
setting.
2022-06-07 13:41:13 -06:00
OxygenCobalt
1482333adc
music: remove version-specific display name hacks
Remove the version-specific display name hacks added previously.

Turns out RELATIVE_PATH only includes the directory structure. Oh.
Since this invalidates the purpose of version-specific display name
hacks, we just remove it.
2022-06-07 10:02:20 -06:00
OxygenCobalt
a6599eec2a
music: do not use future callback with exoplayer
Do not add a callback to a MetadataRetriever call in ExoPlayerBackend.

This fixes an issue where if an error occurs while a future completes,
the app will crash entirely. This is because Futures run on a different
Executor and thus exceptions will not bubble up to Indexer.
2022-06-07 10:01:13 -06:00
OxygenCobalt
8d7aa7936b
detail: respond to automatic rescanning
Make the detail UIs respond to automatic rescanning events.

This currently has no effect, but is instead a preparation step for the
seamless addition of automatic rescanning.
2022-06-06 20:05:12 -06:00
OxygenCobalt
0a18883a6a
music: replace loading with indexing
Replace all in-code instances of music loading with music indexing,
primarily for clarity.
2022-06-05 19:30:45 -06:00
OxygenCobalt
fb3c32b14c
music: split display name fix across versions
When having to fall back to an alternative displayName field, use
the version-specific RELATIVE_PATH and DATA fields when necessary.
2022-06-05 19:11:58 -06:00
OxygenCobalt
dd00c70488
music: do not auto-index unless indeterminate
Make IndexerService only auto-index music when there is no library AND
no loading has occured.

This resolves an issue where if IndexerService dies after a failed
index, IndexerService would try to index music regardless, as there was
no library present.
2022-06-05 11:47:04 -06:00
OxygenCobalt
f3a7813f5e
music: add support for excluding other volumes
Add support for excluding directories on other volumes, at least from
Android Q onwards.

Previously, Auxio only supported excluding the primary volume. This was
mostly out of laziness, as the excluded directory implementation was
shamelessly copied from Phonograph. This commit completely refactors
the excluded directory system, dumpstering the old database (which was
overkill anyway) for a new system based on SharedPreferences that is
actually capable of handling external volumes.

Now, limitations regarding external volumes still apply below Android
Q, as the VOLUME_NAME field does not exist on those versions. However,
this should resolve at least one major complaint regarding the
excluded directory system. Now theres just all of the other complaints.

Resolves #134.
2022-06-05 11:35:26 -06:00
OxygenCobalt
7673fa4a40
detail: do not cache viewholder pos for highlight
Fix an issue with highlighting in the detail UIs taht stemmed from the
ViewHolder position being cached.

Resorting could have changed the ViewHolder position, so caching it
will result in ViewHolders being incorrectly updated.
2022-06-04 13:51:59 -06:00
OxygenCobalt
b2ad54eef3
image: make bitmap provider use generation system
Make BitmapProvider leverage the generation system used in Indexer.

This helps reduce the surface for instruction-by-instruction race
conditions.
2022-06-04 13:42:16 -06:00
OxygenCobalt
9597dc4dd2
Merge branch 'Fjuro-patch-1' into dev
Update Czech translations.
2022-06-04 13:13:20 -06:00
OxygenCobalt
244c8ec404
Merge branch 'patch-1' of github.com:Fjuro/Auxio into Fjuro-patch-1
Update Czech translations.
2022-06-04 13:12:40 -06:00
OxygenCobalt
882e24bd12
music: improve genre parsing
Rework genre parsing to properly align with the ID3v2 standard.

The ID3v2 genre specification is weirdly complex. Auxio ignored most
of that and just parsed out the most common cases for genres (digits
and (digits)). For the sake of completeness, rework Auxio's genre
parser to handle the weirder cases like RX/CR, multiple values,
and escaping, with an implementation roughly based on Mutagen's
genre parser.
2022-06-04 11:15:54 -06:00
OxygenCobalt
09392ef381
music: improve indexer state management
Improve Indexer's state management by splitting up the current loading
state and the last response.

This is intended to resolve a bug where if the UI task and
IndexerService are both killed, the Indexer state would become
indeterminate and the library would not show. Resolve this by keeping
track of whatever the last completed state was and falling back to it
whenever the loading process is canceled.
2022-06-04 10:12:31 -06:00
Fjuro
fe9136e7ba
Create cs/short_description.txt 2022-06-04 09:57:28 +02:00
Fjuro
4a0be745a5
Create cs/full-description.txt 2022-06-04 09:53:58 +02:00
Fjuro
67d1668b1d
Update values-cs/strings.xml 2022-06-04 09:47:25 +02:00
OxygenCobalt
08caa01dca
music: add indexer service
Add a dedicated service towards the loading of the music library.

This new service was created for two reasons:
1. Music loading is slow and resource-intensive, so putting it on the
ViewModel layer just didn't seem right and made it vulnerable to the
OS simply stopping the loading process.
2. For automatic rescanning [#72], there must be something watching
the music library and waiting for a change in the background. This
would require a service as that is probably the least insane way to
do that kind of background work.

I have no garuntees how viable the service might be. If anything, it
might be halted by some insane android restriction or issue that
makes it more or less impossible to use for most apps, and I will have
to largely drop truly automatic rescanning.
2022-06-03 20:12:27 -06:00
OxygenCobalt
e3708bf5f5
music: rework loading management
Rework loading management into a new object, Indexer, which should act
as the base for all future loading changes.

Indexer tries to solve a two issues with music loading:
1. The issue of what occurs when tasks must be restarted or cancelled,
which is common with music loading.
2. Trying to find a good strategy to mediate between service and
ViewModel components in a sensible manner.

Indexer also rolls in a lot of the universal music loading code
alongside this, as much of MusicStore's loading state went unused
by app components and only raised technical challenges when reworking
it.
2022-06-03 16:03:08 -06:00
OxygenCobalt
66b95cef42
deps: upgrade
AndroidX core -> 1.8.0
Material Components -> 1.6.1
2022-06-03 14:15:23 -06:00
OxygenCobalt
b0ec6faa33
Version 2.3.1
Ready for version 2.3.1 of Auxio.
2022-06-03 10:44:10 -06:00
OxygenCobalt
a396101bd0
detail: clean up adapters
Clean up the adapter implementations by removing redundant code.
2022-06-02 19:59:51 -06:00
OxygenCobalt
490c291a14
image: rework genre ordering
Rework genre ordering to be alphabetical based on album, but without
all of the mosaic being taken up by one artist.

With the ordering changes that were done previously, genre images
greatly differed compared to previously. May as well use this breakage
as an oppertunity to improve genre ordering. In this case, we want to
order albums alphabetically, as usual, but we also want to prevent
one artist from taking up the whole mosaic. Fix that by deduplicating
artists in the set of grouped albums.
2022-06-02 19:49:57 -06:00
OxygenCobalt
5bc5afa162
fastlane: fix image metadata
Fix slight screenshot discrepancies where shot7 would show the old
song sub-heading.
2022-06-02 17:05:42 -06:00
OxygenCobalt
bb1d660eae
music: add loading progress indicator
Add an indicator to gague the current music loading progress.

This is actually a lot harder to implement than it might seem, not only
due to UI state issues, but also due to the fact that MusicStore needs
to keep it's state sane across a myriad of possible events that could
occur while loading music. This system seems like a good stopgap until
a full service-backed implementation can be created.
2022-06-02 15:16:32 -06:00
OxygenCobalt
14c9bbd4f9
all: cleanup
Miscellanious clean-up.
2022-06-02 13:57:29 -06:00
OxygenCobalt
959a08413c
Merge branch 'qwerty287-patch-1' into dev
Improve German translations.
2022-06-02 10:48:25 -06:00
OxygenCobalt
9aa09620fe
Merge branch 'patch-1' of github.com:qwerty287/Auxio into qwerty287-patch-1
Improve German translations.
2022-06-02 10:48:01 -06:00
OxygenCobalt
e73d10070b
all: use notifyItemChanged everywhere
Apply the notifyItemChanged fix everywhere by making it an explicit
part of the RecyclerView framework.

This way, implementing future selection and rewrite behavior will be
much easier, as the payload argument is available in every adapter
implementation.
2022-06-02 10:42:33 -06:00
OxygenCobalt
10afae0bfc
detail: fix highlighting issues
Fix two major highlighting bugs based around the janky and stupid way
I would handle highlighting previously.

Previously, I would index the views of a RecyclerView in order to
highlight viewholders. In retrospect this was a pretty bad idea,
as viewholders could be in a weird limbo state where they are bound,
but not accessible. I mean, it's in the name. It's a Recycling View.

Fortunately, google actually knew what they were doing and provided
a way to mutate viewholders at runtime using notifyItemChanged.
And the API actually makes sense! Wow! Migrate all detail adapters
to a system that uses notifyItemChanged instead of the terrible
pre-existing system.
2022-06-02 10:20:31 -06:00
OxygenCobalt
182b08ab65
playback: fix state restore regression
Fix a state restore issue that would cause the parent to restore
incorrectly.

At some point, I accidentally used the index for the PlaybackMode field
when restoring the playbackState. This resulted in the playback mode
effectively reverting to ALL_SONGS and causing a number of subtle
issues.
2022-06-02 09:20:31 -06:00
qwerty287
4a2c07f0e5
Improve German translation
Fix some typos in the German translation.
2022-06-02 10:36:33 +02:00
OxygenCobalt
07127403ff
music: fix minor indexer issues
Further refine the Indexer and ExoPlayerBackend implementations.

These fixes were primarily focused on ensuring stable grouping through
stable sorting order, and more graceful handling of edge cases in
ExoPlayerBackend.
2022-06-01 15:50:49 -06:00
OxygenCobalt
a64a4864bd
playback: fix gadgetbridge regression [#62]
Fix a regression where media button controls would no longer work
with GadgetBridge.

In 4a79de4, I assumed that my code was redundant, as there should be
some kind of reciever handling media button events already. I was
completely wrong. Re-add the reciever code (with extra checks) to
make controls work again.
2022-06-01 12:05:38 -06:00
OxygenCobalt
a65d37c421
all: switch to stateflow
Switch from LiveData to StateFlow.

While LiveData is a pretty good data storage/observer mechanism, it has
a few flaws:
- Values are always nullable in LiveData, even if you make them
non-null.
- LiveData can only be mutated on Dispatchers.Main, which frustrates
possible additions like a more fine-grained music status system.
- LiveData's perks are exclusive to ViewModels, which made coupling
with shared objects somewhat cumbersome.

StateFlow solves all of these by being a native coroutine solution with
proper android bindings. Use it instead.
2022-06-01 11:46:00 -06:00