Add synchronized calls to all mutations in PlaybackStateManager.
I mean, it is global mutable state modified on several threads. This is
the safest option to remove a bunch of horrible bugs.
Add a controller role to PlaybackStateManager.
The controller manages the internal player, and acts as an intermediary
between other internal objects that want to modify the player, but
don't actually have access to it.
This makes a bunch of future changes far easier.
Add a shortcut to shuffle all songs.
This is likely the only static shortcut Auxio will have. Top tracks
and recently added are completely useless for me, so I will never
add them. I may add more dynamic shortcuts for recently played items,
however.
Note that we use a basic black shuffle icon here. I will not add icon
customization to these shortcuts.
Fix a visual issue with the queue animation where the playback view
will still slightly show.
This was caused by the lack of a background in the queue fragment UI.
Fix an issue where a seam might appear on some covers when rounded
covers was enabled.
This was caused by a poor usage of clipToOutline. Replace with simply
stacking existing image instances on top of eachother.
Remove the temporary 28dp hack that was applied to the playback bar.
This finally puts the playback bar in line with all other icon
components. The playback panel is still weird, but that's okay since
it's a full screen view and the buttons can take up more space.
Since I absolutely hate change, I had to effectively frog-boil myself
in order to do this, first downsizing the icon from 32dp to 28dp, and
then from 28dp down to 24dp. I can't believe I care about this so much.
Use ServiceCompat.stopForeground instead of stopForeground.
This is preliminary preparation for Android 13. I can only change SDK
versions however when the Android Gradle Plugin makes a new release
though.
Remove the animated indicator, replacing it with a static one.
I wish I could have kept this, but once again android is a sh******ed
mess and makes it impossible to dynamically animate something depending
on the playing state. It will restart the animation, ignore calls to
stop, or just flat out now run the code path in the first place due to
race conditions.
Further separate backend implementations to remove redundant tasks.
Generally, if I have not encountered an issue where a field is not
present/sane, I don't want to put in a "well, maybe" fallback, as
that would tank performance. Only do it when we need to.
Introduce MenuFragment in order to replace ActionMenu.
ActionMenu was a terrible class filled with hacks. Introduce a new
fragment called MenuFragment that enables the same features, plus:
1. Requiring consumers the specify the menu, which prevents issues
from one-size-fits-all menus (unless absolutely necessary)
2. Fixing an issue where multiple menus appear at once
Switch the excluded directory system to StorageVolume.
This finally removes dependence on the in-house Volume constructs, and
also completely extends fully music folder selection support to all
versions that Auxio supports.
This is possibly one of the most invasive and risky reworks I have done
with Auxio's music loader, but it's also somewhat exciting, as no other
music player I know of handles Volumes like I do.
Leverage StorageVolume when working with file paths.
StorageVolume is android's navive API for handling external volumes.
Ideally, we would want to replace our built-in volume class with this
new API, however doing so is somewhat complicated as some methods only
exist on newer API levels. This is only the first step until we are
able to migrate the excluded directory system to this as well.
Make some ViewModel instances AndroidViewModels in order to make some
code less insane.
I don't like doing this, as I want to keep ViewModel instances clean of
android things, but this just makes a lot of functionality easier to
implement.
Fix an issue where the collapsing toolbar would not preserve it's state
when navigating.
Apparently you need to add an ID to a view to get it's state to be
restored. There is no warning for this at all. Android, everyone.
Only show codecs in the "format" field, if we are able to extract them.
This is primarily for consistency, as there is no way for us to
determine the container format outside of an extension (which could not
be sane).
Fix an API 21-specific bug that could result in covers not loading when
quality covers was enabled.
This stemmed from a use of `use` on MediaMetadataRetriever, which
relied on an interface not present on the class on API 21.
Completely rework the excluded directory system into a new
"Music Folders" system.
This is implemented alongside a new "Include" mode. This mode
allows the user to restrict music indexing to a parsicular folder.
I've been reluctant to add this feature, as having two separate
options seemed bad. This resolves it by effectively packing whether
to include/exclude directories into a single option.
Resolves#154.
Add a non-queue version of the song menu to the playback panel.
While the original UI flow of clicking on each TextView to navigate
to a particular item is still present, this simply makes the action
more clear to a first-time user.
Heavily improve the way Auxio handles shows formats in the song
properties view.
This is composed of the following:
- Using ExoPlayer to find a format-specific mime type before having to
fall back to other solutions
- Keeping around the format and extension mime types so that each is
picked in the best circumstances
- Using MediaFormat to also retrieve a format-specific mime type in the
case that ExoPlayer parsing is disabled
- Adding special names for the most common formats
Remove scientific notation from the auxio icon, allowing me to
reintroduce it to the notification icon.
API 21 does not support scientific notation in vector drawables, so we
need to remove them from the icon for it to not crash the system ui.
Use basic scroll indicators when a dialog shows a list.
Mostly for material guidelines. Excluded dialogs and int pref dialog
have not been modified, as I am still working on revamping those.
Make it so that the rounded covers option is not dependent on the show
covers option.
Rounded covers has no relation to whether to show covers (at least not
anymore with the new cover style), so it makes no sense to disable it
when show covers is turned off.
Resolves#152.
Remove malformed songs that have a size of 0 bytes, but are still
present in MediaStore.
This issue only seems to occur when files are transferred via MTP, but
are not loaded due to storage issues.
Add support for file size, format, and parent directory values to the
MediaStore backend.
I hope that this handles API boundaries properly, especially regarding
path parsing. As a side-note, I have learned of a way to extend
external volume support to even earlier versions. Maybe.
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.
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.
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!
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.
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).
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.
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.
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.
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.
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.
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".
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Move the loading screen into the home view.
Previously, we would use a Snackbar to track the music loading state.
This ended up being a pretty stupid and buggy idea, and would get even
worse with the new music loader changes. Instead, we re-implement the
loading screen into the home view to generally be more sane and
extendable compared to previously.
Make addCallback calls (or similar) initalize the caller by calling the
specific callback methods.
This is primarily intended as a fix to an issue where the music library
would actually reload during a warm start. This is extremely bad, but I
hope it doesn't make the app too unusable until the next version.
Add an ExoPlayer-based metadata backend.
This backend finally allows Auxio to parse metadata internally, which
has been a highly requested feature given how many unfixable MediaStore
issues it would fix.
However, this is not fully ready for production yet. The loading
process becomes much larger with manual parsing, the current
implementation still allocates picture metadata (terrible for
efficiency), and there is no good indicator in the app to keep
track of music loading.
As a result, this backend is disabled until it can be fully integrated
into Auxio's architecture.
Move out the MediaStoreCompat interface into a full interface called
Backend.
In preparation for direct metadata parsing, it would be useful to
create some kind of object system to properly handle the capabilities
of each metadata indexing mode. Backend fulfills that by allowing
each object to implement their own query and then loading routine.
This system is designed somewhat strangely. This is firstly because
the ExoPlayer metadata backend will have to plug in to the original
MediaStore backend, so making methods more granular allows the
ExoPlayer backend to avoid some of the stupid inefficiencies from
the actual MediaStore backend, such as the genre loading process.
We also want to separate the steps of loading music in order to
more adequately show the current loading process to the user in
a future change.
Implement a safe slider wrapper that does not crash with invalid values
as often.
Slider is a terrible component that is not designed with Auxio's
use-case in the slightest. Instead of gracefully degrading with invalid
values, it just crashes the entire app, which is horrible for UX.
Since SeekBar is a useless buggy version-specific sh******ed mess too,
we have no choice but to wrap Slider in a safe view layout that
hopefully hacks with the input enough to not crash the app when doing
simple seeking actions.
I hate android so much.
Resolves#140.
Add disc number sorting to sorts that originally sorted by track.
Forgot to add disc sorting to the other sort modes when adding disc
number support. Fix that.
Create separate routines to parse disc and track numbers in the most
optimal manner.
On API 30 (Android R) and above, ensure that we are using the superior
CD_TRACK_NUMBER and DISC_NUMBER database fields, while below API 30,
stick with the normal TRACK field.
Revert the introduction of the thin/tiny widgets, but keep the new
cover layout I created while working on them.
There is simply no way I can cram controls and metadata within the
size bucket that the thin widget occupies. I have decided to give up
and revert the widget to it's old form.
I understand why the thin widget is not appealing. However, the sizing
at which a widget can properly accomodate a taller widget is just too
precise and not really large enough to justify it's existance.
Also use the gesture insets on playback panel.
Turns out when the panel uses normal insets, the playback panel is
extremely close to the system bars. Fix this by using the bigger
gesture insets.
Resolves#137.
Rework the smallest widgets to have no textual metadata, alongside
adding a new widget size class.
Turns out the last tiny widget redesign made the controls far too
small. Instead, remove the textual metadata and make these widgets
more akin to the small and wide widgets. This also introduces a new
side class alongside that with more controls, again to make it
similar to the other size classes.
Re-add accent customization on Android 12 and above.
Previously, I disabled accent customization since I thought they were
more or less useless with the new Material You dynamic colors system.
Turns out I severely underestimated how horribly OEMs would botch the
dynamic colors system. Guess I was blinded by my adherence to the pixel
line. Re-add the accent customization for those who do not have a good
dynamic color palette at all.
Resolves#131.
Rework the tiny widget to cram even more information into it.
The tiny widget is nominally meant for edge cases like exceptionally
small screens or landscape mode, but apparently it's triggered on some
devices in normal use because of platform fragmentation and OEM insanity.
Update the tiny widget layout with some new buttons in order to make it
more usable in mnormal use. This is still nowehre near ideal. For
example, when triggering the layout on my device, it ends up squishing
the buttons. But it should probably work better outside of those edge
cases.
Hack around more insane lollipop bugs, such as:
- The angular auxio icon crashing the system UI
- Optimized icons being corrupted
- Setting image alpha not working properly
I really wish I could drop support for this horrible version, but I
either have to wait for a major library to drop support or for the
usage numbers to reach 1%.
Replace the hodge-podge framework of state restoration and URI playing
with a single "delayed action" system.
Auxio's initialization routine is a total cluster----. This is mostly
because it involves multiple asynchronous operations such as music
loading, state restore, and service starting which tend to make it
highly prone to race conditions and other insanity.
In particular, the way Auxio would attempt to restore playback and
handle file opening was a spaghetti pile of bad API boundaries and
dubious UI code. This has not changed. I want to move this routine
to the service, but it's lifecycle is also sh------ed to such an
extent where that would be nearly impossible. Instead, this commit
introduces a new "delayed action" system that bites the bullet and
allowes PlaybackViewModel to accept a context and an action in
return for initializing playback...eventually.
I tried my best to eliminate as much memory leaks as I physically
could here, but could only go so far. Still though, even this insane
system is better than the UI-level LiveData shenanigans I did
previously, and actually works compared to the broken android
components that google keeps wanting you to use.
Remove references to android system strings, in favor of in-house
translations.
Previously Auxio would use the `android.R.string.ok` and
`android.R.string.cancel` strings to represent Ok and Cancel
respectively, but these system strings are actually untranslated on
some devices, so it is better for i18n if we use our own strings
for such.
Implement a UI frontend for customizing the ReplayGain pre-amp value.
This finally completes Auxio's ReplayGain implementation. Not only
that, it also shows how Auxio can use positive ReplayGain values,
unlike other apps.
As a side-note, this also fiddles with the dialog style somewhat.
I got carried away.
Resolves#114.
Implement an internal setting for a ReplayGain pre-amp setting.
Pre-amp is a lot like above reference volume regarding Auxio's
ReplayGain implementation, where I want to implement it in order
to allow ReplayGain to graduate from being labeled "experimental".
No UI frontend has been implemented just yet.
Add sorting modes for duration and song count.
This was requested previously in the now-closed UI/UX changes
megathread, however I have only gotten to it now.
Add recovery code to the music indexer in the case that Android doesn't
provide the DISPLAY_NAME field.
Nominally this should never happen, but OEMs will OEM and apparently
this does happen on some devices. Try to recover by grokking DATA for
a file name.
Rework the sort implementation to allow Auxio to leverage it's sorting
capabilities in a more powerful manner.
This is mostly the removal of stupid redunant methods and the change of
Sort overrides to sort in-place. This just gives us the option to avoid
full blown list copies in cases where such is reasonable.
Finalize the disc number implementation within Auxio.
This is probably one of the most widely-requested features outside
of playlisting. This implementation also adds some more fine grained
sorting modes for disc numbers in particular, which actually removes
some of the quirkiness of the Sort class.
Resolves#96.
Change the indexer to parse out the disc number field from
AudioColumns.TRACK.
On newer versions, I hope to further modify the loader to use
the API 30+ CD_TRACK_NUMBER field, as it is more versatile than
TRACK.
Add the UI and data components for a disc number value within the album
detail view.
This is the first-step of a multi-step addition to finally implement
disc numbers.
Make MediaButtonReceiver an empty class without any behavior.
The previous manner in which Auxio would handle media button events
was actually bad, as in certain cases (like a rewind or if there was
no song playing) Auxio would actually crash, as the service would
not start a foreground state in time.
Fix this by removing that functionality. This should hopefully still
retain the current state.
Try to rework the playback service components to reduce race conditions
and improve readability.
This changeset has gone through a number of changes. I originally
wanted to unify all cover loading under a single "Component Manager",
but this turned out to be stupid given that the three service components
are different in nearly every way. Instead I just reworked them all
individually by introducing a new less-data race-prone image loading
framework, and moving around a bunch of code I was planning to move
around.
Do some miscellanious formatting reworks.
1. Remove all instances of m in favor of _. _ is only used when names
collide or if something should be internal.
2. Make fragments apply their own click listeners.
3. Remove instances of inc/dec and replace them with the more
straightfoward + 1 or - 1.
Split off the "songs loaded" about item into it's own card called
"library statistics"
This card includes the song, album, artist, and genre counts,
alongside a total duration of the music library. This is just more
informative and useful to the user.
Resolves#121.
Rework state restore to be more coherent and in line with the new
member layout of the general
This primarily involves making the index the primary database attribute
in favor of song, with the old song id field becoming a sanity check
field.
Fix miscellanious bugs and clean the component code.
Currently the components are in a strange state. They are a big ball of
mud with inconsistent lifecycles and callbacks. I want to find a way to
unify them under a single lifecycle, but the competing nature of them
makes this extremely difficult.
Rename LoopMode to RepeatMode, which is generally much clearer
than the previous name.
This changes all non-breaking instances of "loop" in the app with
"repeat".
Rework the asynchronous aspects of MusicStore to rely on a more
conventional callback system.
In preparation for automatic rescanning, it would be more elegant
for music consumers to use a callback, so that updates can be
registered easier than if a co-routine continued to be used.
Convert MusicStore to this new model and rework the accesses of
MusicStore in-app to line up with this new system.
Create a ViewModel for the more complicated navigation pathways.
Normally, navigation was fragmented along a complicated stretch of
fragment hacks and DetailViewModel's navToItem attitbute, both of which
were not really that ideal. Dumpster them for a single, unified
viewmodel for the more complicated navigation situations. This removes
much of the duplicate navigation logic and is likely much more
maintainable for future situations.
Rework the style of all album covers in the app to be more in line with
the new track number style.
This is mostly comprised of adding a new background to all cover views
and rescaling error icons to be smaller than they would normally be.
This also includes a change in the cover/track background color from
colorSurfaceVariant to colorOnSurfaceInverse, which seems to provide
the best visibility in all cases.
These changes also apply to the track number views.
Update the album song layout to be more alike to other songs.
Recently I migrated the TextView in the album songs to use 48dp sizing,
like the other song views. However, this resulted in a lot of empty
space that felt off. Fix this by adding a light background to the track
number, which fills the room it takes up a bit more. It also hopefully
primes the track number to take an indicator once multi-select is
added.
Remove extraneous encodings from ReplayGainAudioProcessor.
According to the ExoPlayer developers, an AudioProcessor is only
provided 16-bit PCM data. This makes all of the other encodings I
had implemented in ReplayGainAudioProcessor useless, as their
cases would never run. Remove those extraneous encodings and just
just 16-bit PCM.
Implement support for positive ReplayGain values.
Turns out the blocker for this with the new AudioProcessor was that
I did not properly clamp PCM data when I manipulated the data,
resulting in target samples like 75491 being truncated to lower
values like 9955, which resulted in popping. This is a niche addition,
but also puts Auxio in a category that no other (FOSS) android music
player currently occupies. Yay.
Resolves#115.
Create an AudioProcessor implementation for ReplayGain.
Now that ExoPlayer handles AudioFocus, the ReplayGain implementation
would conflict with the changes that ducking would make to the volume.
To fix this, migrate the ReplayGain implementation to a dedicated
audio processor. This not only resolves this system, but also opens the
door for positive ReplayGain values in the future. Currently however,
our method for modifying the bitstream results in popping with values
above the reference volume, so some more work must be done in that
regard.
Rework audio focus to rely on the native ExoPlayer implementation
instead of a custom implementation.
Previously, we avoided ExoPlayer's AudioFocus system as it never
played after a transient lost. A few versions later now through,
now it does, so we may as well switch to it. This does introduce
a bug where ReplayGain functionality will conflict with audio
focus, but I hope to eliminate this with #115 as I switch to
an AudioProcessor instead of a callback.
Audit null safety to remove extraneous and stupid calls while
optimizing certain checks here and there.
This commit is primarily centered around the introduction of a new
utility: unlikelyToBeNull. This call uses requireNotNull on debug
builds and !! on release builds, which allows for bug catching in
an easier manner on normal builds while also allowing for
optimizations on the release builds.
Migrate all esoteric adapters to the new RecyclerView framework.
One of the shortcomings with the previous RecyclerView utilities was
how more esoteric adapters with data that does not implement Item
could not use the utlities. The new system, by comparison, is capable
of taking any type of data, so we can no migrate all of the esoteric
adapters to the new system.
Fix an issue where album covers fail to load when not explicitly
specifying a size.
At some point, Coil changed some internal scaling logic to depend on
this weird pseudo-screen size value that caused the bitmap to fail
to load only on in widget creation process. Who knows why. Fix this
by explicitly specifying the size in all cases.
Spin off the data instances into their own class called BackingData.
This is to isolate the sane adapters that rely on one type of diffing
from the insane adapters that use synchronous and asynchronous diffing
simultaniously. It also allows some of the more esoteric adapters to
implement their own backing data without much trouble or leaky
abstractions.
Completely rework the base adapter class to require less boilerplate
and properly handle cases such as diffing. The major adapters have
been migrated to this system, but the other adapters have not been
changed so far.
This is only part 1 of a multi-part rework, as this is an incredibly
complex system.
Remove databinding entirely.
Databinding was a terrible idea for Auxio. I rarely leveraged it, and
when I did, it produced messy code and bloated build times. Dumpster it
for just viewbinding, which is good. This reduces building times by
nearly 2/3, and generally makes the codebase more coherent and usable.
Move all fragment instances to the new ViewBindingFragment paradigm,
which should help immensely with reducing memory leaks from list
bindings and to really alleviate the overloaded onCreate functions.
Rework the playback views to follow the new idioms I want to use for
Auxio.
This change mostly consists of flattening away some of the custom
views, removing databinding, and using a general viewbinding
fragment that I hope to extend to the entire app.
Rework the playback slide up implementation to be more straightfoward.
This is really composed of stylistic improvements, very little in
actual behavior changes. This does re-introduce a regression when
nothing is playing where the scroll position will become off when
rotating, but that desynchronization happens often so unless I were
to completely migrate both the panel and the bar to a view, I don't
really see it as an issue.
Migrate to a centralized constant table for easier management.
Previously, Auxio would tie constants to the class itself, which
led to a largely disjointed system that relied on an internal table
so that it would stay sane. This commit moves all of those constants
to a single table for easier usage and management.
Completely refactor the Sort class to be more efficient and
straightforward.
The original Sort class had *major* shortcomings, it was slow,
poorly organized, and relied on abusing compareBy to implement
special things like article sort. This rework eliminates all of
that in favor of a new system relying on custom comparators and
chaining to achieve something much faster and maintainable.
Make resolvedName the standard name to use across all music items.
Previously, the way Auxio differentiated between names in UIs was to
use name for normal items and resolvedName for parents. This was odd
and disjointed, as it muddled the meanings of the two fields and lead
to a lot of bugs. Fix this by making resolvedName *the* standard name
to use across all music items, even in ones that don't have to resolve
their name.
Switch to the spotless linter with ktfmt used as a backend instead of
ktlint.
This switch was done for two reasons:
1. ktfmt is more thorough than ktlint
2. License headers can be added more effectively with spotless than
the default Android Studio behavior.
Dump all of the changes now so I don't have to deal with it over a long
period of time. I don't care.
Disable the default long-press action in the ItemTouchHelper usages.
ItemTouchHelper provides a long-press action to start an item drag by
default. However, because Auxio adds a drag handle on top of this
action, this actually results in a conflict with the default behavior
in certain cases. Replace it with a custom version of the long-press
action within the viewholders themselves.
Fix a crash that stemmed from the use of the API 30+ database field
CD_TRACK_NUMBER.
I switched to CD_TRACK_NUMBER in 1e39ceb to fix [#88], however I did
not realize that CD_TRACK_NUMBER was actually only supported on API
30 onwards. This led to a load failure on versions before API 30.
Fix an esoteric crash with queue synchronization during the playback
restore process.
Auxio will attempt to re-synchronize the queue index whenever it is
desynchronized, however during the check for if it's desynchronized,
Auxio would do a direct index of the queue, which could result in a
crash in situations where the desynchronized index is outside of the
queue bounds.
Fix this by replacing that unprotected access with a protected access,
which not only fixes the crash but also still correctly detects
desynchronization in that case.
Resolves#89.
Turn the headset focus setting into the headset autoplay setting.
The way auxio handles headsets is...odd. Sometimes the MediaSession
handles it and Auxio could not care less, and sometimes Auxio actually
needs to handle it. As a result, the idea of being able to disable
headset focus is more or less moot because it will only apply to some
devices and not others.
On the other end, the way Auxio automatically begins playback once a
headset is plugged in is also quite weird. It only works on wired
headsets, and when it does, it overrides all other apps that might
also be playing audio. It's not to say that it's a bad feature, but
it's also one that I don't want to make the defualt. Auxio should
still play along within the confines of Android's expectations, after
all.
Replacing the existing "Headset focus" setting with a new "Headset
autoplay" setting solves both of these issues, as it prevents a
mis-guided disabling of the setting that doesn't actually disable
the feature and it relegates the quirky autoplay behavior to an
setting not enabled by default.
Fix an issue where headset focus would result in unexpected playback
whenever the service started.
AudioManager.ACTION_HEADSET_PLUG seems to always fire when the initial
BroadcastReceiver is set up, which results in a weird bug where if a
wired headset is connected while PlaybackService is started, playback
will start immediately, which was not user friendly.
I fear that this may result in an edge case that results in headset
focus not firing in an unrelated situation, which in that case I would
be forced to remove headset autoplay entirely (or at least relegate it
to a quirk option).
Add even more checks and guards to the music loading process to ensure
proper metadata loading.
Auxio has always had issues handling track numbers and years, mostly
with ensuring their validity. This change resolves them by more or less
surrounding them with gobs of null-checks and fallible parsing
routines, which should help avoid frustrating bugs and crashes with
metadata in the future.
Resolves#88.
Resolves#84.
Revert the removal of the song/artist values from list items for now.
The current plan of removing extraneous values from songs and albums
only works if I add multi-select and a dedicated menu button, but that
is still in the air, and in general I want feedback before I go ahead.
Aside from reverting the previous changes, this actually standardizes
all item descriptions under a single bullet point formatting system,
instead of the mix of commas and bullet points that existed beforehand.
Remove the album name from the main song item in favor of a duration
value.
Auxio has traditionally used "Artist . Album" for song items. However,
this had some shortcomings:
1. The way the artist and album names are packed probably results in
truncation on small screens, which I doubt is very helpful.
2. All other items in Auxio have only one specific "subject" per line,
which makes the song items a bit of an outlier since it has two (the
artist and the album)
3. The empty space available could be used for another UI element,
such as a duration or maybe a menu button in the future.
For consistency, this also removes the song count from all album items
as well.
Remove all usages of memberBinding from the app.
For some reason, certain devices running Android 10 and lower will
have a lifecycle race condition whenever the theme is mis-matched.
This ends up resulting in an invalid state whenever memberBinder was
used. Since we can't replace memberBinder with a better solution,
just dumpster the whole thing. This platform is so god damn broken,
jesus christ.
Resolves#80.
Change createMosaic to use SquareFrameTransform.
This should help fix a theoretical bug where non-1:1 album covers will
be oddly stretched in a generated mosaic, as all album covers will be
forcefully cropped to a 1:1 ratio.
Create a custom view for rounded images, making them more nuanced in
the process.
The previous method for applying rounded images in-app was generally
clunky and fragile. Introduce a new custom view that actually takes a
cornerRadius attribute from the ImageView itself that then applies it
whenever the user enables the setting. This also allows rounded images
to be more nuanced, as typical 8dp elevation can be used for small
views and a more fitting 16dp radius can be used for large views.
Rework how the fab's adaptive functionality works.
Handle fab adaptiveness by using a style instead of a fully custom
view. This helps eliminate a usage of private resources.
Rework logging to be clearer and more standardized.
Rework all usages of lossing to follow a single unified style,
introducing a new "warn" option alongside this.
Crop all images to a 1:1 aspect ratio.
Sometimes cover art will not be a square. I never realized this because
all covers in my music library are square. This led to many strange bugs
that I would rather avoid, so create a new transformation that crops the
image to a 1:1 aspect ratio.
The reason why we use a transformation is that it won't be dependent on
the actual state of the ImageView, which is what would happen if we
used ScaleType.CENTER_CROP. In the case that we use a very weird hacky
ImageView like in the widgets, doing such would result in any cropping
not actually working correctly. It's better to do it in the
Transformation stage simply to ensure consistency.
Allow the material library to handle dynamic colors.
Turns out I was mis-understanding how DynamicColor themes were meant to
be used by the material library. Turns out you can just inherit from it
and it will work perfectly fine. Refactor the V31 styles to remove our
insane shims and finally fix the slapdash dynamic color usage across
the main theme and widgets.
Add a circular indicator to playback icons.
Sometimes it can be too difficult to tell apart the active and inactive
states of the shuffle/loop icons. However, there is really no good way
to improve the contrast on these icons without some kind of muddled UX
fragmentation, or god-awful design. Try to settle on the okay-est
version, which is to use colorPrimary with a dot indicator on views we
control, and use a more muddled semi-transparent icon on views we don't
control, like notifications and widgets.
Copy-paste some extra fields onto the file opening intent filter as to
[hopefully] get Auxio to be recognized by OEM skins better.
Some OEM skins don't seem to do a basic query for an app that matches
the APP_MUSIC category. Instead, they do some insane query for apps
that match this specific file intent structure that Auxio does not fit
for whatever reason. Try to graft some manifest features from the MPV
android app to make Auxio correctly expose this. I have no idea if this
will actually do anything.
Disable the ability to customize audio focus on Android 12 and up.
Android 12 automatically regulates audio streams even further than it
did in previous versions, to the point where the audio focus setting
no longer makes sense on that version. I may extend the removal to all
versions in the future.
Fix an issue where headset focus would restart playback unexpectedly.
At some point during the broadcast refactor, I accidentally switched
the values of CONNECTED and DISCONNECTED when handling
AudioManager.ACTION_HEADSET_PLUG. This resulted in playback starting
for no reason in some situations.
Use body typography in more places, reworking the letter spacing as to
make it more pleasent to use with the inter typeface.
This should hopefully be the last time I fret over typography.
Everything should line up in the way desired by M3.
Remove the elevation component from all toolbars and the bottom bar.
Material3 states that top and bottom app bars should not cast a drop
shadow. Auxio ignored this and used one anyway. This largely stemmed
from incorrect use of the AppBarLayout styles, which were mostly just
incorrect M2 styles with a new background plastered over. Fix this
by creating a new style that inherits the proper M3 styles and then
using that on all AppBarLayout instances in the app.
Do a couple things to the music models:
1. Make the genre field non-nullable. This is because I beleive I've
largely eliminated the genre bugs in previous versions and future ones
can be caught with a crash screen I plan to add.
2. Make the initial album grouping process use hashCode instead of a
pair of names. This just helps with loading speed in general, albeit I
am slightly worried that it may result in improper grouping if some
edge case appears.
Apply body typography in new places in the app.
For awhile, Body and Title typography were used interchangeably, as
they occupy the same text size range. This commit defines the Body
text as to be used for one-line widgets or tertiary widgets, while
the Title text is defined to be used for multi-line or heading widgets.
Fix an issue with M3SwitchPreference where the switch would not update
properly.
When reacing M3SwitchPreference, I wanted to make an optimization
regarding updating the switch to M3, so I decided to make the
preference check if they have already applied the switch, and then
ignore it if that's the case. However, I ended up forgetting that
ViewHolders tend to need to be re-bound, which resulted in this
optimization leading to inconsistent application of the M3 switches.
Fix this by removing that optimization.
Update the contribution information and templates.
The contribution information and templates were growing a bit stale,
given that they haven't gotten a refresh since ~1.3.0. This commit
reworks them to be more thorough and straightfoward.
Add a CHANGELOG document that keeps track of the past and current
release notes.
Making all of our releases rely on GitHub to keep track of them is not
really a good idea, so this document serves as a record of past release
changelogs just as a pre-caution. It also allows a live preview of the
next version whenever something is changed.
Improve the way track numbers are handled in the album detail view.
Previously, Auxio would show track numbers by simplying stringifying
the integer and then showing it in a TextView. This was problematic for
two reasons:
- Numerics from other languages like Arabic would not be respected
- Invalid track numbers [e.g 0] would be shown regardless of the
situation.
This commit fixes that by placing all track numbers through a format
string first, and showing a generic song icon instead of a number
whenever the track number is 0.
Completely rework the Context extensions for resources.
Previously, Auxio has used a strange hodge-podge of context extensions
and verbose code to get resources. Fix this by unifying most of the
resource accesses under a single, unified set of extensions. The only
ones excluded for now is the getString call, as that is used in far too
many places to effectively replace.
Re-add index correction, albeit with a new system that accomodates the
single queue mechanism.
The issue with using the previous queue mechanism for the single queue
was that it risked using the index of an incorrect duplicate song, as
the search would always start at index 0. Fix this by implementing a
sort of "wobbly" search that starts at the current index and moves back
and forth, checking the closest items first and the furthest items
last.
Add an option to force-reload the app.
Currently, Auxio will load music once and then never re-load it. This
is a really decision I made early on and now regret completely. The
only way to remedy this properly is to create an automatic rescanning
system, but that is a major technical undertaking that I want to save
for later.
Resolves#71.
Improve the russian translations for this app.
These translations were proposed by lisiczka43 with the following
rationale:
"[use] less literal translations, [use] shorter wording to fit into UI
elements, [correct] mistranslations, [improve] consistency of
terminolgy, [enforce] strict ё, [add] missing new strings"
Apparently the previous russian translations were quite Amateurish.
This should make them better.
Completely refactor the way music is grouped up into artists and
albums.
The issue with previous attempts at implementing better artist
management was the reliance on MediaStore IDs in many parts of the
program. Dumpster this by merging the hash and ID values into a
single field that is garunteed to be unique enough. This allows songs
to be adequately grouped into case-insensitive artists while also
deduplicating albums that may have been split my MediaStore due to
heterogeneous formats.
Resolves#66.
Move all duplicate checking to the album creation stage, adding a new
check for duplicate albums.
Album names can be similarly duplicated as artist names, most often
when one has an album consisting of multiple differing file formats.
This commit fixes that by grouping albums up by their ID as usual,
but then merging together albums that have the same (lowercase) album
name and (lowercase) artist name.
Use a proper composition of the "many" and "other" fields in the plural
fields of specific languages.
In the french/czech plural configuration, both "many" and "other" are
used for string fields. The lint does not make this obvious, so in
d7f34e6 I ended up switching the "other" field to "many". This resulted
in some devices on those languages crashing. To fix this, we define
the "many" and "other" fields with the same value to avoid a crash.
Resolves#69.
Re-add the inter typeface.
It's not good design to have two similar typefaces, so I may as well
revert back to Inter once and for all. It's too good of a typeface
compared to the mess of Roboto and other native fonts.
Group up album artists case-insensitively.
Music files from the same artist may format the artist differently, such as being
in uppercase/lowercase forms. If we have already built an artist that has a
functionally identical name to another artist, then simply merge the artists
instead of keeping them separate.
Modify the music loader to use the normal artist name when using song
titles while still retaining album artist functionality.
Oftentimes music files will be tagged as to use the artist tag to
specify performers, collaborators, and others, and then use the album
artist tag to group them up into a single artist. Previously, Auxio
would only use the album artist tag, which flattened the collaborator
information out for consistency. Resolve this by implementing a sort
of "resolved artist name" for songs that is used in the UI and nowhere
else. This seems to work well, but at the same time further ruins the
API surface for handling music objects. An acceptable price to pay
for a better UX.
Migrate to the native roboto typeface on body elements.
Migrating to the native typeface saves on APK size, contributes to a
more native look and feel, and create a more compact UI for smaller
devices. Inter Semibold remains as the "Flair" type that distinguishes
Auxio from other apps.
Bundle our custom ExoPlayer components into aar instead of directly
depending on the project. This just makes things far better regarding
ease of use and reproducible builds.
Actually migrate to API 32 [Android 12L], co-inciding with the upgrade
of my studio install and the android gradle plugin. Alongside this, add
a bunch of fixes for lints that the new studio picked up.
Expose a custom MediaButtonReceiver that handles the media button
intent. This is not because I wanted to implement this. Some apps
like gadgetbridge just blindly query ACTION_MEDIA_BUTTON instead of
relying on the more modern MediaController API, which I expected
most apps would use instead.
Resolves#62.
I want to hold off with this migration actually. I feel like it's too
jarring of a change to be included as of right now.
This reverts commit 50170f202e.
Wrap the basic fetchArt call in a try statement to prevent exceptions
from being unable to open a file from propagating outwards. This allows
us to safely degrade when creating mosaics.
Some apps query for media apps by checking for apps that have a
BroadcastReciever that handles the ACTION_MEDIA_BUTTON intent. However,
Auxio does not have a custom media button reciever, instead relying on
the androidx media button reciever. This resulted in Auxio not showing
up in apps like GadgetBridge. Fix this by exposing the androidx media
button reciever in the manifest, which allows this app to be detected.
Implement a facimile of the new Material 3/You switches in the settings
menu. There's no defined spec for this yet, so I just shamelessly ripped
the implementation from Doodle.
Dumpster Inter in favor of Roboto. This is mostly for three reasons:
1. Reduces the insane typography setup that Auxio uses
2. Reduces total app size since .ttf files are pretty large and the
dynamic fonts feature was proprietary.
3. Creates a more cohesive look and feel given that nearly every
android app also uses Roboto.
When using gesture navigation, swipe up events might conflict with the
slide up behavior of the playback layout. To fix this, inset the
playback bar based on the gesture insets instead of the system bar
insets.
Extend edge-to-edge to versions below Android Oreo. This is done
through tinting the navigation bar colors on those versions,
circumventing the coloring issue.
Fix an issue where with queues of one-song, adding another song with
"Play next" results in it going behind the current song. This stemmed
from a fix for a crash with empty queues, so instead of doing some
insane min/max logic we just check if the queue is empty and just don't
add the item if it is. It will only get overwritten anyway.
Add a "Dynamic" replaygain mode inspired by the FooBar2000 plugin. This
will automatically determine whether the playback is in an album or not
and use the album gain or track gain accordingly.
Use a custom ExoPlayer fork with the FLAC extension enabled. This
greatly improves the listening experience, as it enables metadata
support on OGG files and FLAC files to be played below API 27.
Make it so that the keyboard is only opened on the search view when
it's initially created instead of when it's loaded from the
backstack. This is just nice for overall UX.
Fix an edge case where if the total duration ends up being zero,
the app will end up crashing at the playback screen. Thank SeekBar
for deciding that it's perfectly okay to crash instead of decay
gracefully when valueTo is 0.
Move all replaygain functionality into AudioReactor, alongside moving
all volume management into the class. This allows volume state to stay
sane throughout.
Add ReplayGain support leveraging ExoPlayer. This was a widely
requested feature, but since I thought I needed MediaStore to
expose the fields, I never considered it. Turns out ExoPlayer
automatically exposes metadata for ID3v2 and Xiph tags, so we
can implement it just fine.
Resolves#7.
I just spent 5 days trying to implement gapless playback using
ExoPlayer and Hopium. That's 5 days I'm never getting back. Heres
what I did add in the process though.
Switch auxio to a single-queue system. "Play next" adds songs to the top
of the queue, similar to before, and then "Add to queue" adds songs to
the bottom of the queue. This enables many more enhancements to be made
to the playback experience, at the cost of a feature I preferred.
Resolves#44.
Split screen layouts in android are completely borked. You can
resize Auxio down to the point where the UI is completely
unusable, and there is NO WAY TO SET A MINIMUM HEIGHT. This is
also not to mention that smallestScreenWidthDp is completely
busted too and still uses the size of the whole screen! Just
band-aid the first issue so that when the layout becomes so
small as to result in a messed up UI, just show a splash that
says that the app can't work at the specific window size.
Forgot that coil's RoundedCornerTransformation is dependent on the
resolution of the image, resulting in inconsistent rounded corners.
Fix this by just doing the plain clipToOutline to round album covers.
Re-add the ability for content to fade out as the playback or queue
view slides up. This also migrates the queue slide animation to also
fade out content, which allows for the stylistic cohesion I desire.
Add an option to round album covers for people who might want more
visual cohesion with apps that have completely drunken the "Round
Everything!" kool-aid. Covers will still be hard-edged by default.
Use the image size provided by coil when creating our mosaics. This
allows both better transformations and better-quality mosaics in the
detail view itself.
Turns out playback controls wouldn't actually work because the view
would detach but not the actual fragment, resulting in onCreateView
never being called and the entire system falling apart. This fixes
it by just giving PlaybackLayout the viewmodel instance it needs.
I'll need to release a hotfix for this issue since this is really
easy the trigger and really hard to fix unless you know why it
occurs. Android lifecycles suck so much.
Add a new layout that handles the edge-case where splitscreen is used
on a sufficently small device. Previously it would result in a squashed
landscape layout, but now it will show a layout that should fit fine in
most situations.
Use a layered background in the playback panel, with a colorSurface layer
behind the elevated MaterialShapeDrawable. This is for safety, as there
might be cases where a fully transparent MaterialShapeDrawable results in
unexpected behavior.
Improve the way the compact playback view transforms into the full
playback view by splitting their view animations in two. This makes
the transition more akin to the Android 12 notification menu, which
due to the nature of how I'm fading views really does make it more
user friendly. Also re-add the "Now Playing" title and a new subtitle
displaying the currently playing artist.
Completely refactor PlaybackBarLayout into PlaybackLayout, which now
not only handles the bar behavior but also allows for one to slide
up the bar layout into the full playback layout. This was largely
adapted from umano's AndroidSlidingUpPanel, albeit heavily minified
and mixed with the previous window inset tricks of the previous layout.
There are still some tweaks to be made, but this implementation seems
to be really good.
Refactor sorting again to support free-floating ascending/descending
values on every single sort mode. This enables greater freedom in how
users can sort their music and allows me to finally get rid of the
old legacy sematic sorting modes that chose their ascending/decending
order depending on how they wanted it.