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
9 changed files with 25 additions and 15 deletions
@@ -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
@@ -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)
}
@@ -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 {
@@ -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
@@ -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) {