From 4d283bc91d8278ebdd1d180c8928b4d4ba8066aa Mon Sep 17 00:00:00 2001 From: OxygenCobalt Date: Fri, 15 Jul 2022 12:13:13 -0600 Subject: [PATCH] ui: fix app theme Make the app theme (Shows before activity startup) the blue theme instead of the default material purple. --- CHANGELOG.md | 6 ++++ app/src/main/AndroidManifest.xml | 6 ---- .../java/org/oxycblt/auxio/music/Music.kt | 5 ++- .../auxio/music/system/MediaStoreBackend.kt | 9 +++--- .../oxycblt/auxio/search/SearchViewModel.kt | 26 ++++++++------- app/src/main/res/layout/widget_default.xml | 2 +- app/src/main/res/layout/widget_large.xml | 2 +- app/src/main/res/layout/widget_medium.xml | 2 +- app/src/main/res/layout/widget_small.xml | 2 +- app/src/main/res/layout/widget_thin.xml | 2 +- app/src/main/res/layout/widget_wide.xml | 2 +- app/src/main/res/values-v31/styles_core.xml | 3 +- app/src/main/res/values/styles_core.xml | 6 ++-- app/src/main/res/values/themes.xml | 32 +++++++++---------- app/src/main/res/values/themes_black.xml | 2 +- 15 files changed, 55 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da542f0e2..add8aa646 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 1177fc4b3..675d4c529 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -14,12 +14,6 @@ - ) * 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) : Comparable private val second: Int? get() = tokens.getOrNull(5) - override fun hashCode() = tokens.hashCode() override fun equals(other: Any?) = other is Date && tokens == other.tokens diff --git a/app/src/main/java/org/oxycblt/auxio/music/system/MediaStoreBackend.kt b/app/src/main/java/org/oxycblt/auxio/music/system/MediaStoreBackend.kt index 0ed809f1f..47d4bc82c 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/system/MediaStoreBackend.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/system/MediaStoreBackend.kt @@ -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 = diff --git a/app/src/main/java/org/oxycblt/auxio/search/SearchViewModel.kt b/app/src/main/java/org/oxycblt/auxio/search/SearchViewModel.kt index 5de47cfb0..f5210927c 100644 --- a/app/src/main/java/org/oxycblt/auxio/search/SearchViewModel.kt +++ b/app/src/main/java/org/oxycblt/auxio/search/SearchViewModel.kt @@ -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.filterSongsBy(value: String) = baseFilterBy(value) { it.path.name.contains(value) }.ifEmpty { null } @@ -145,17 +147,17 @@ class SearchViewModel(application: Application) : private fun List.filterParentsBy(value: String) = baseFilterBy(value) { false }.ifEmpty { null } - private inline fun List.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 List.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 diff --git a/app/src/main/res/layout/widget_default.xml b/app/src/main/res/layout/widget_default.xml index a270f5822..a51b36977 100644 --- a/app/src/main/res/layout/widget_default.xml +++ b/app/src/main/res/layout/widget_default.xml @@ -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:theme="@style/Theme.Auxio.Widget"> - + - - - - - - - - - - - - - - -