Commit graph

152 commits

Author SHA1 Message Date
OxygenCobalt
a9515e19c0
all: cleanup
Clean up the slightly rushed changes I made as I worked on the split
UI.
2022-08-03 19:54:14 -06:00
OxygenCobalt
0212887610
info: update docs
Update information here and there.
2022-07-20 17:38:20 -06:00
OxygenCobalt
51b9b0e734
widgets: dont use system padding in size compat
Don't take the app widget host padding into account when trying to
calculate the widget sizing.

Doing such produces bad results, at least on my devices. At least, it
does now for some reason.
2022-07-17 16:05:53 -06:00
OxygenCobalt
7f07764b68
playback: fix delayed actions not working
Fix an issue on some devices where the delayed actions system would
not work on startup.

Apparently onStart can be called several times with the same intent.
No, I am not joking. What the actual hell. This would cause any
delayed action other than Restore to be overwritten. The only hard
rule about android is that there are no rules. I hate this platform
so much.
2022-07-17 16:00:17 -06:00
OxygenCobalt
60b637e1ce
all: cleanup
Semi-major code cleanup.
2022-07-11 11:29:34 -06:00
OxygenCobalt
94f2d28936
music: rework indexer thread safety
Move the switch from IO to Main to within Indexer itself, through
withContext.

This is much easier to work with than the previous system of a separate
"update" coroutine, which isn't really needed anymore given that I no
longer need to do IO work when sanitizing the playback state.
2022-07-07 16:47:21 -06:00
OxygenCobalt
1730a73eac
settings: add option to force-restore state
Add an option to restore the previous playback state.

This allows me to avoid having to use force stop to restore a previous
state.
2022-07-04 14:22:49 -06:00
OxygenCobalt
3663396b97
ui: remove windowinsetscompat
Remove WindowInsetsCompat from the project, as it is a pile of garbage.

WindowInsetsCompat refuses to actually update the correct fields when
you transform it back into a WindowInsets. This makes it impossible to
use in Auxio. The fact that Google decided to make such an
overengineered wrapper to some version-specific methods is an absolute
joke. All you needed were some extension functions, but no, let's make
an entire wrapper class filled with so many gotchas as to be unusable.
2022-07-02 10:19:46 -06:00
OxygenCobalt
630950ea5d
playback: force LTR on timeline controls
Force LTR on timeline controls, as per the Material Design guidelines.

The guidelines state that while "directional" UIs should be LTR/RTL
depending on locale, "timeline" UIs should always by LTR, as the
direction of time is universal. Auxio did not do this, and so the
timeline controls would be RTL on other elements. Fix this by forcing
LTR on the UI elements that correspond to timelines.

Now, this is not the best system. To ensure that the rest of the layout
remains sane, much of the directional views have to be wrapped in a
redundant layout, which is somewhat in-efficient. However, the impact
seems to be at least negligable.
2022-06-22 12:38:00 -06:00
OxygenCobalt
b041fe68d0
ui: add util for fragment objects
Add a utility to easily work with lifecycle-dependent fragment objects.

This reduces the code duplication required to maintain objects that
would leak after the destruction of a fragment. We normally would not
do this as a delegate, as that usually entails some lifecycle wizardry
that can easily break and crash the app in esoteric situations.
However, this this just extends the normal lifecycle without watching
any state, it seems to be pretty safe to use.
2022-06-20 12:03:57 -06:00
OxygenCobalt
532a30325a
settings: revamp settingsmanager into settings
Revamp the shared object SettingsManager into a standalone utility
called Settings.

This makes many things easier in Auxio. It completely unifies the key
format that we use (Android Strings instead of Java consts), eliminates
the pretty dumb initialization method that we use, and eliminates the
dubiousness of holding a Context-related utility in a global field.

The only cost was having to migrate even more ViewModels to Android
ViewModels. Whatever.
2022-06-20 09:12:19 -06:00
OxygenCobalt
29fe849565
playback: add shuffle shortcut
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.
2022-06-18 11:20:22 -06:00
OxygenCobalt
2f85d694d1
ui: remove actionmenu for menufragment
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
2022-06-15 10:05:08 -06:00
OxygenCobalt
ad87c72cd6
image: fix error on api 21
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.
2022-06-12 17:31:22 -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
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
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
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
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
ae62572760
strings: update german translations
Update german translations for the strings I can translate at least
okay.
2022-05-25 13:20:50 -06:00
OxygenCobalt
e1e032d254
ui: re-add accent customization >api 31
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.
2022-05-24 12:52:09 -06:00
OxygenCobalt
eb293022e8
widgets: rework tiny widget
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.
2022-05-24 10:08:12 -06:00
OxygenCobalt
485c35d74c
all: hack around more lollipop issues
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%.
2022-05-22 17:12:49 -06:00
OxygenCobalt
594fa3597e
playback: add delayed action system
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.
2022-05-22 11:55:17 -06:00
OxygenCobalt
2d7dbd19cd
ui: rework custom ui components
Refactor the package structure and implementation of custom UI
components.
2022-05-21 14:52:08 -06:00
OxygenCobalt
28feebcec3
sort: add duration and count sorts
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.
2022-05-20 18:33:56 -06:00
OxygenCobalt
d296a3aed9
all: rework formatting
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.
2022-05-11 19:03:56 -06:00
OxygenCobalt
a645c3a217
deps: upgrade deps
aaaaaaa
coil -> 2.0.0-rc03
material -> 1.7.0-alpha01
leakcanary -> 2.9.1
navigation -> 2.4.2
kotlin -> 1.6.21
agp -> 7.1.3
2022-04-29 20:14:17 -06:00
OxygenCobalt
60367c45c3
nit: fix typos
Fix miscellanious typos.
2022-04-28 22:03:15 -06:00
OxygenCobalt
3a19d822ce
music: rework name heirarchy
Once again rework the naming system for music, this time with it being
much easier to localize (hopefully).
2022-04-03 12:54:29 -06:00
OxygenCobalt
05a5ef5c3f
ui: migrate esoteric adapters to framework
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.
2022-03-27 09:59:35 -06:00
OxygenCobalt
d79592e029
all: remove databinding
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.
2022-03-23 10:59:01 -06:00
OxygenCobalt
90f10f2a84
home: clean up fast scroller
Clean up the fast scroller implementation to remove dead code and
be more coherent in general.
2022-03-19 10:59:13 -06:00
OxygenCobalt
0417a77b33
music: make resolvedName standard
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.
2022-03-13 20:22:19 -06:00
OxygenCobalt
2ff7d93263
all: view cleanup
Do even more cleanup regarding views.
2022-03-13 18:56:24 -06:00
OxygenCobalt
33da09a08a
all: switch to spotless
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.
2022-03-13 17:38:19 -06:00
OxygenCobalt
6d003c308b
playback: fix headset focus autoplay issue
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).
2022-03-03 18:47:55 -07:00
OxygenCobalt
1e39ceb9fc
music: add more failsafes to loading process
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.
2022-03-01 19:52:28 -07:00
OxygenCobalt
dbe0bd1bb3
ui: revert list item changes
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.
2022-02-28 19:27:57 -07:00
OxygenCobalt
9171f9a3b4
coil: make mosaics use squareframetransform
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.
2022-02-24 14:58:59 -07:00
OxygenCobalt
3aaa2ab0e0
all: rework logging
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.
2022-02-22 17:24:51 -07:00
OxygenCobalt
d4513293a7
all: cleanup
General app cleanup.
2022-02-18 19:03:25 -07:00
OxygenCobalt
d7f34e6b94
all: migrate to api 32
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.
2022-01-25 18:59:16 -07:00
OxygenCobalt
47fca7819f
ui: disable queue adding if no playback
If theres no playback going on, disable the play next/add to queue
options, as they will have no effect. This mostly for QoL purposes.
2022-01-19 06:52:05 -07:00
OxygenCobalt
e5901fa9e2
playback: use gesture insets in playback layout
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.
2022-01-18 19:51:06 -07:00
OxygenCobalt
95e8b06f19
style: extend edge-to-edge on all versions
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.
2022-01-15 20:12:23 -07:00
OxygenCobalt
2d3fc47d7c
main: band-aid split screen mode layouts
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.
2021-12-17 17:00:19 -07:00
OxygenCobalt
8e1da1bfc7
home: make tabs adaptive
Make tabs on the home page adapt to screen configuration changes, using
only icons when the width is small and icons + text when the width
is large.
2021-12-17 14:32:14 -07:00
OxygenCobalt
6b355d6416
theme: re-add black theme on android 12
Re-add the black theme on Android 12. It still has use, unlike the
other theme options made obsolete by dynamic colors.
2021-12-06 06:22:13 -07:00