ui: fix app theme

Make the app theme (Shows before activity startup) the blue theme
instead of the default material purple.
This commit is contained in:
OxygenCobalt 2022-07-15 12:13:13 -06:00
parent adc4055b2c
commit 4d283bc91d
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
15 changed files with 55 additions and 52 deletions

View file

@ -10,6 +10,12 @@ at the cost of longer loading times
- Added Last Added sorting
- Search now takes sort tags and file names in account [#184]
#### What's Fixed
- Fixed default material theme being used before app shows up
#### What's Changed
- Updated music hashing (Will wipe playback state)
## 2.5.0
#### What's New

View file

@ -14,12 +14,6 @@
<queries />
<!--
Note: We have to simultaneously define the fullBackupContent and dataExtractionRules
fields, as there is no way to make version-specific manifests. This should be okay,
as devices before Android 12 should just use fullBackupContent and devices beyond it
should use dataExtractionRules.
-->
<application
android:name=".AuxioApp"
android:allowBackup="true"

View file

@ -293,8 +293,8 @@ data class Genre(override val rawName: String?, override val songs: List<Song>)
* An ISO-8601/RFC 3339 Date.
*
* Unlike a typical Date within the standard library, this class just represents the ID3v2/Vorbis
* date format, which is largely assumed to be a subset of ISO-8601. No validation outside of
* format validation is done.
* date format, which is largely assumed to be a subset of ISO-8601. No validation outside of format
* validation is done.
*
* The reasoning behind Date is that Auxio cannot trust any kind of metadata date to actually make
* sense in a calendar, due to bad tagging, locale-specific issues, or simply from the limited
@ -345,7 +345,6 @@ class Date private constructor(private val tokens: List<Int>) : Comparable<Date>
private val second: Int?
get() = tokens.getOrNull(5)
override fun hashCode() = tokens.hashCode()
override fun equals(other: Any?) = other is Date && tokens == other.tokens

View file

@ -318,9 +318,9 @@ abstract class MediaStoreBackend : Indexer.Backend {
}
/**
* Represents a song as it is represented by MediaStore. This is progressively mutated over
* several steps of the music loading process until it is complete enough to be transformed into
* an immutable song.
* Represents a song as it is represented by MediaStore. This is progressively mutated in the
* chain of Backend instances until it is complete enough to be transformed into an immutable
* song.
*/
data class Audio(
var id: Long? = null,
@ -348,8 +348,7 @@ abstract class MediaStoreBackend : Indexer.Backend {
fun toSong() =
Song(
// Assert that the fields that should always exist are present. I can't confirm
// that
// every device provides these fields, but it seems likely that they do.
// that every device provides these fields, but it seems likely that they do.
rawName = requireNotNull(title) { "Malformed audio: No title" },
rawSortName = sortTitle,
path =

View file

@ -137,7 +137,9 @@ class SearchViewModel(application: Application) :
search(lastQuery)
}
/** Searches the song list by the normalized name, then the sort name, and then the file name. */
/**
* Searches the song list by the normalized name, then the sort name, and then the file name.
*/
private fun List<Song>.filterSongsBy(value: String) =
baseFilterBy(value) { it.path.name.contains(value) }.ifEmpty { null }
@ -145,17 +147,17 @@ class SearchViewModel(application: Application) :
private fun <T : MusicParent> List<T>.filterParentsBy(value: String) =
baseFilterBy(value) { false }.ifEmpty { null }
private inline fun <T : Music> List<T>.baseFilterBy(
value: String,
additional: (T) -> Boolean
) = filter {
// The basic comparison is first by the *normalized* name, as that allows a non-unicode
// search to match with some unicode characters. If that fails, we if there is a sort name
// we can leverage, as those are often used to make non-unicode variants of unicode titles.
it.resolveNameNormalized(application).contains(value, ignoreCase = true) ||
it.rawSortName?.contains(value, ignoreCase = true) == true ||
additional(it)
}
private inline fun <T : Music> List<T>.baseFilterBy(value: String, additional: (T) -> Boolean) =
filter {
// The basic comparison is first by the *normalized* name, as that allows a non-unicode
// search to match with some unicode characters. If that fails, we if there is a sort
// name
// we can leverage, as those are often used to make non-unicode variants of unicode
// titles.
it.resolveNameNormalized(application).contains(value, ignoreCase = true) ||
it.rawSortName?.contains(value, ignoreCase = true) == true ||
additional(it)
}
private fun Music.resolveNameNormalized(context: Context): String {
// This method normalizes strings so that songs with accented characters will show

View file

@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:theme="@style/Theme.Widget"
android:theme="@style/Theme.Auxio.Widget"
tools:ignore="Overdraw">
<android.widget.ImageView

View file

@ -6,7 +6,7 @@
android:layout_height="match_parent"
android:background="@drawable/ui_widget_bg"
android:backgroundTint="?attr/colorSurface"
android:theme="@style/Theme.Widget">
android:theme="@style/Theme.Auxio.Widget">
<!--
See widget_small.xml for an explanation for the ImageView setup.

View file

@ -6,7 +6,7 @@
android:layout_height="match_parent"
android:background="@drawable/ui_widget_bg"
android:backgroundTint="?attr/colorSurface"
android:theme="@style/Theme.Widget">
android:theme="@style/Theme.Auxio.Widget">
<!--
See widget_small.xml for an explanation for the ImageView setup.

View file

@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:theme="@style/Theme.Widget">
android:theme="@style/Theme.Auxio.Widget">
<!--
For our widgets to work, we need to scale the ImageView across a 1:1 aspect ratio.

View file

@ -8,7 +8,7 @@
android:backgroundTint="?attr/colorSurface"
android:baselineAligned="false"
android:orientation="horizontal"
android:theme="@style/Theme.Widget">
android:theme="@style/Theme.Auxio.Widget">
<!--
Wrapping the 1:1 ImageView hack in a LinearLayout allows the view to measure greedily

View file

@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:theme="@style/Theme.Widget">
android:theme="@style/Theme.Auxio.Widget">
<!--
See widget_small.xml for an explanation for the ImageView setup.

View file

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Auxio.App" parent="Theme.Auxio.Base" />
<style name="Theme.Widget" parent="@android:style/Theme.DeviceDefault.DayNight">
<style name="Theme.Auxio.Widget" parent="@android:style/Theme.DeviceDefault.DayNight">
<item name="colorSurface">@color/widget_surface</item>
<item name="colorPrimary">?android:attr/colorAccent</item>
<item name="colorOnPrimary">?attr/colorSurface</item>

View file

@ -10,7 +10,7 @@
</style>
<!-- Base theme -->
<style name="Theme.Auxio.App" parent="Theme.Auxio.V27">
<style name="Theme.Auxio.Base" parent="Theme.Auxio.V27">
<!-- Values -->
<item name="colorAccent">?attr/colorSecondary</item>
<item name="colorOutline">@color/overlay_stroke</item>
@ -58,9 +58,11 @@
<item name="textAppearanceBodySmall">@style/TextAppearance.Auxio.BodySmall</item>
</style>
<style name="Theme.Auxio.App" parent="@style/Theme.Auxio.Blue" />
<!--
Theming widgets is technically possible below Android 12, but I *really* don't care enough
to bother with it.
-->
<style name="Theme.Widget" parent="@style/Theme.Auxio.Blue" />
<style name="Theme.Auxio.Widget" parent="@style/Theme.Auxio.Blue" />
</resources>

View file

@ -3,7 +3,7 @@
<!--
All the base themes/accents.
-->
<style name="Theme.Auxio.Red" parent="Theme.Auxio.App">
<style name="Theme.Auxio.Red" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/red_primary</item>
<item name="colorOnPrimary">@color/red_on_primary</item>
<item name="colorPrimaryInverse">@color/red_primary_inverse</item>
@ -33,7 +33,7 @@
<item name="colorOnSurfaceVariant">@color/red_on_surface_variant</item>
</style>
<style name="Theme.Auxio.Pink" parent="Theme.Auxio.App">
<style name="Theme.Auxio.Pink" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/pink_primary</item>
<item name="colorOnPrimary">@color/pink_on_primary</item>
<item name="colorPrimaryInverse">@color/pink_primary_inverse</item>
@ -63,7 +63,7 @@
<item name="colorOnSurfaceVariant">@color/pink_on_surface_variant</item>
</style>
<style name="Theme.Auxio.Purple" parent="Theme.Auxio.App">
<style name="Theme.Auxio.Purple" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/purple_primary</item>
<item name="colorOnPrimary">@color/purple_on_primary</item>
<item name="colorPrimaryInverse">@color/purple_primary_inverse</item>
@ -93,7 +93,7 @@
<item name="colorOnSurfaceVariant">@color/purple_on_surface_variant</item>
</style>
<style name="Theme.Auxio.DeepPurple" parent="Theme.Auxio.App">
<style name="Theme.Auxio.DeepPurple" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/deep_purple_primary</item>
<item name="colorOnPrimary">@color/deep_purple_on_primary</item>
<item name="colorPrimaryInverse">@color/deep_purple_primary_inverse</item>
@ -123,7 +123,7 @@
<item name="colorOnSurfaceVariant">@color/deep_purple_on_surface_variant</item>
</style>
<style name="Theme.Auxio.Indigo" parent="Theme.Auxio.App">
<style name="Theme.Auxio.Indigo" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/indigo_primary</item>
<item name="colorOnPrimary">@color/indigo_on_primary</item>
<item name="colorPrimaryInverse">@color/indigo_primary_inverse</item>
@ -153,7 +153,7 @@
<item name="colorOnSurfaceVariant">@color/indigo_on_surface_variant</item>
</style>
<style name="Theme.Auxio.Blue" parent="Theme.Auxio.App">
<style name="Theme.Auxio.Blue" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/blue_primary</item>
<item name="colorOnPrimary">@color/blue_on_primary</item>
<item name="colorPrimaryInverse">@color/blue_primary_inverse</item>
@ -183,7 +183,7 @@
<item name="colorOnSurfaceVariant">@color/blue_on_surface_variant</item>
</style>
<style name="Theme.Auxio.DeepBlue" parent="Theme.Auxio.App">
<style name="Theme.Auxio.DeepBlue" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/deep_blue_primary</item>
<item name="colorOnPrimary">@color/deep_blue_on_primary</item>
<item name="colorPrimaryInverse">@color/deep_blue_primary_inverse</item>
@ -213,7 +213,7 @@
<item name="colorOnSurfaceVariant">@color/deep_blue_on_surface_variant</item>
</style>
<style name="Theme.Auxio.Cyan" parent="Theme.Auxio.App">
<style name="Theme.Auxio.Cyan" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/cyan_primary</item>
<item name="colorOnPrimary">@color/cyan_on_primary</item>
<item name="colorPrimaryInverse">@color/cyan_primary_inverse</item>
@ -243,7 +243,7 @@
<item name="colorOnSurfaceVariant">@color/cyan_on_surface_variant</item>
</style>
<style name="Theme.Auxio.Teal" parent="Theme.Auxio.App">
<style name="Theme.Auxio.Teal" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/teal_primary</item>
<item name="colorOnPrimary">@color/teal_on_primary</item>
<item name="colorPrimaryInverse">@color/teal_primary_inverse</item>
@ -273,7 +273,7 @@
<item name="colorOnSurfaceVariant">@color/teal_on_surface_variant</item>
</style>
<style name="Theme.Auxio.Green" parent="Theme.Auxio.App">
<style name="Theme.Auxio.Green" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/green_primary</item>
<item name="colorOnPrimary">@color/green_on_primary</item>
<item name="colorPrimaryInverse">@color/green_primary_inverse</item>
@ -303,7 +303,7 @@
<item name="colorOnSurfaceVariant">@color/green_on_surface_variant</item>
</style>
<style name="Theme.Auxio.DeepGreen" parent="Theme.Auxio.App">
<style name="Theme.Auxio.DeepGreen" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/deep_green_primary</item>
<item name="colorOnPrimary">@color/deep_green_on_primary</item>
<item name="colorPrimaryInverse">@color/deep_green_primary_inverse</item>
@ -333,7 +333,7 @@
<item name="colorOnSurfaceVariant">@color/deep_green_on_surface_variant</item>
</style>
<style name="Theme.Auxio.Lime" parent="Theme.Auxio.App">
<style name="Theme.Auxio.Lime" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/lime_primary</item>
<item name="colorOnPrimary">@color/lime_on_primary</item>
<item name="colorPrimaryInverse">@color/lime_primary_inverse</item>
@ -363,7 +363,7 @@
<item name="colorOnSurfaceVariant">@color/lime_on_surface_variant</item>
</style>
<style name="Theme.Auxio.Yellow" parent="Theme.Auxio.App">
<style name="Theme.Auxio.Yellow" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/yellow_primary</item>
<item name="colorOnPrimary">@color/yellow_on_primary</item>
<item name="colorPrimaryInverse">@color/yellow_primary_inverse</item>
@ -393,7 +393,7 @@
<item name="colorOnSurfaceVariant">@color/yellow_on_surface_variant</item>
</style>
<style name="Theme.Auxio.Orange" parent="Theme.Auxio.App">
<style name="Theme.Auxio.Orange" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/orange_primary</item>
<item name="colorOnPrimary">@color/orange_on_primary</item>
<item name="colorPrimaryInverse">@color/orange_primary_inverse</item>
@ -423,7 +423,7 @@
<item name="colorOnSurfaceVariant">@color/orange_on_surface_variant</item>
</style>
<style name="Theme.Auxio.Brown" parent="Theme.Auxio.App">
<style name="Theme.Auxio.Brown" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/brown_primary</item>
<item name="colorOnPrimary">@color/brown_on_primary</item>
<item name="colorPrimaryInverse">@color/brown_primary_inverse</item>
@ -453,7 +453,7 @@
<item name="colorOnSurfaceVariant">@color/brown_on_surface_variant</item>
</style>
<style name="Theme.Auxio.Grey" parent="Theme.Auxio.App">
<style name="Theme.Auxio.Grey" parent="Theme.Auxio.Base">
<item name="colorPrimary">@color/grey_primary</item>
<item name="colorOnPrimary">@color/grey_on_primary</item>
<item name="colorPrimaryInverse">@color/grey_primary_inverse</item>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Auxio.Black" parent="Theme.Auxio.App">
<style name="Theme.Auxio.Black" parent="Theme.Auxio.Base">
<item name="colorSurface">@android:color/black</item>
</style>