ui: fix insane background issue

Fix an issue where the background will remain the system default theme
because...reasons.

I don't even know what I did wrong.
This commit is contained in:
OxygenCobalt 2022-07-09 09:00:36 -06:00
parent 6f8dc3c311
commit 35f05ed902
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
9 changed files with 25 additions and 15 deletions

View file

@ -57,7 +57,6 @@ I primarily built Auxio for myself, but you can use it too, I guess.
## To come in the future:
- Automatic music rescanning
- Even better metadata support
- Playlists
- Liked songs

View file

@ -116,7 +116,7 @@ abstract class BaseFetcher : Fetcher {
private fun fetchAospMetadataCovers(context: Context, album: Album): InputStream? {
MediaMetadataRetriever().apply {
// This call is time-consuming but it also doesn't seem to hold up the main thread,
// so it's probably fine not to wrap it.
// so it's probably fine not to wrap it.rmt
setDataSource(context, album.songs[0].uri)
// Get the embedded picture from MediaMetadataRetriever, which will return a full

View file

@ -51,7 +51,7 @@ class IndexingNotification(private val context: Context) :
setSilent(true)
setContentIntent(context.newMainPendingIntent())
setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
setContentTitle(context.getString(R.string.info_indexer_channel_name))
setContentTitle(context.getString(R.string.lbl_indexing))
setContentText(context.getString(R.string.lbl_indexing_desc))
setProgress(0, 0, true)
}

View file

@ -217,7 +217,7 @@ class IndexerService : Service(), Indexer.Controller, Settings.Callback {
}
}
/** Internal content observer intended to work with the automatic reloading framework. */
/** Internal content observer intended to work with the automatic reloading system. */
private inner class SystemContentObserver(
private val handler: Handler = Handler(Looper.getMainLooper())
) : ContentObserver(handler), Runnable {

View file

@ -468,16 +468,18 @@ class Api21MediaStoreBackend : MediaStoreBackend() {
* @author OxygenCobalt
*/
@RequiresApi(Build.VERSION_CODES.Q)
open class VolumeAwareMediaStoreBackend : MediaStoreBackend() {
open class BaseApi29MediaStoreBackend : MediaStoreBackend() {
private var volumeIndex = -1
private var relativePathIndex = -1
private var dateTakenIndex = -1
override val projection: Array<String>
get() =
super.projection +
arrayOf(
MediaStore.Audio.AudioColumns.VOLUME_NAME,
MediaStore.Audio.AudioColumns.RELATIVE_PATH)
MediaStore.Audio.AudioColumns.RELATIVE_PATH,
MediaStore.Audio.AudioColumns.DATE_TAKEN)
override val dirSelector: String
get() =
@ -498,6 +500,7 @@ open class VolumeAwareMediaStoreBackend : MediaStoreBackend() {
volumeIndex = cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.VOLUME_NAME)
relativePathIndex =
cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.RELATIVE_PATH)
dateTakenIndex = cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.DATE_TAKEN)
}
val volumeName = cursor.getString(volumeIndex)
@ -510,6 +513,9 @@ open class VolumeAwareMediaStoreBackend : MediaStoreBackend() {
audio.dir = Directory(volume, relativePath.removeSuffix(File.separator))
}
// If the YEAR value is empty, see if DATE_TAKEN can fill in.
logD("${audio.title} ${cursor.getString(dateTakenIndex)}")
return audio
}
}
@ -520,11 +526,14 @@ open class VolumeAwareMediaStoreBackend : MediaStoreBackend() {
* @author OxygenCobalt
*/
@RequiresApi(Build.VERSION_CODES.Q)
open class Api29MediaStoreBackend : VolumeAwareMediaStoreBackend() {
open class Api29MediaStoreBackend : BaseApi29MediaStoreBackend() {
private var trackIndex = -1
override val projection: Array<String>
get() = super.projection + arrayOf(MediaStore.Audio.AudioColumns.TRACK)
get() =
super.projection +
arrayOf(
MediaStore.Audio.AudioColumns.TRACK, MediaStore.Audio.AudioColumns.DATE_TAKEN)
override fun buildAudio(context: Context, cursor: Cursor): Audio {
val audio = super.buildAudio(context, cursor)
@ -551,7 +560,7 @@ open class Api29MediaStoreBackend : VolumeAwareMediaStoreBackend() {
* @author OxygenCobalt
*/
@RequiresApi(Build.VERSION_CODES.R)
class Api30MediaStoreBackend : VolumeAwareMediaStoreBackend() {
class Api30MediaStoreBackend : BaseApi29MediaStoreBackend() {
private var trackIndex: Int = -1
private var discIndex: Int = -1

View file

@ -70,7 +70,7 @@ class PlaybackStateManager private constructor() {
notifyPlayingChanged()
}
/** The current playback progress */
var positionMs = 0L
private var positionMs = 0L
/** The current [RepeatMode] */
var repeatMode = RepeatMode.NONE
set(value) {

View file

@ -6,6 +6,7 @@
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
app:defaultNavHost="true"
app:navGraph="@navigation/nav_main"
tools:layout="@layout/fragment_main" />

View file

@ -9,9 +9,10 @@
<!-- Label Namespace | Static Labels -->
<string name="lbl_retry">Retry</string>
<string name="lbl_grant">Grant</string>
<string name="lbl_indexing">Loading music</string>
<string name="lbl_indexing_desc">Loading your music library…</string>
<string name="lbl_observing">Automatic reloading</string>
<string name="lbl_observing_desc">Monitoring your music library for changes… (You can disable this in settings)</string>
<string name="lbl_observing">Monitoring music library</string>
<string name="lbl_observing_desc">Monitoring your music library for changes…</string>
<string name="lbl_genres">Genres</string>
<string name="lbl_artists">Artists</string>
@ -150,7 +151,7 @@
<string name="set_quality_tags">Ignore MediaStore tags</string>
<string name="set_quality_tags_desc">Increases tag quality, but requires longer loading times (Experimental)</string>
<string name="set_observing">Automatic reloading</string>
<string name="set_observing_desc">Reload music whenever your audio files change (Experimental)</string>
<string name="set_observing_desc">Reload your music library whenever it changes (Experimental)</string>
<!-- Error Namespace | Error Labels -->
<string name="err_no_music">No music found</string>

View file

@ -20,8 +20,6 @@
<item name="android:colorBackground">?attr/colorSurface</item>
<item name="android:windowBackground">?attr/colorSurface</item>
<item name="android:scrollbars">none</item>
<item name="toolbarNavigationButtonStyle">@style/Widget.Auxio.Toolbar.Navigation</item>
<item name="actionOverflowButtonStyle">@style/Widget.Auxio.Button.Overflow</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
@ -35,6 +33,8 @@
<item name="sliderStyle">@style/Widget.Auxio.Slider</item>
<item name="linearProgressIndicatorStyle">@style/Widget.Auxio.LinearProgressIndicator</item>
<item name="textInputStyle">@style/Widget.Material3.TextInputLayout.OutlinedBox</item>
<item name="toolbarNavigationButtonStyle">@style/Widget.Auxio.Toolbar.Navigation</item>
<item name="actionOverflowButtonStyle">@style/Widget.Auxio.Button.Overflow</item>
<item name="textAppearanceDisplayLarge">@style/TextAppearance.Auxio.DisplayLarge</item>
<item name="textAppearanceDisplayMedium">@style/TextAppearance.Auxio.DisplayMedium</item>