Fix theme bug

Fix an issue where setting the theme from AuxioApp will make the theme default to Theme.Base for...some reason...
This commit is contained in:
OxygenCobalt 2021-01-17 07:49:08 -07:00
parent fc33e01b89
commit 1e102e9d5d
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
4 changed files with 6 additions and 4 deletions

View file

@ -1,7 +1,6 @@
package org.oxycblt.auxio
import android.app.Application
import androidx.appcompat.app.AppCompatDelegate
import coil.ImageLoader
import coil.ImageLoaderFactory
import coil.request.CachePolicy
@ -14,9 +13,7 @@ class AuxioApp : Application(), ImageLoaderFactory {
// Init SettingsManager here so that there aren't any race conditions
// [e.g Service gets SettingsManager before activity can init SettingsManager]
val settingsManager = SettingsManager.init(applicationContext)
AppCompatDelegate.setDefaultNightMode(settingsManager.theme)
SettingsManager.init(applicationContext)
}
override fun newImageLoader(): ImageLoader {

View file

@ -6,6 +6,7 @@ import android.os.Bundle
import android.view.View
import android.view.WindowInsets
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.databinding.DataBindingUtil
import org.oxycblt.auxio.databinding.ActivityMainBinding
import org.oxycblt.auxio.playback.PlaybackService
@ -27,6 +28,8 @@ class MainActivity : AppCompatActivity() {
val settingsManager = SettingsManager.getInstance()
AppCompatDelegate.setDefaultNightMode(settingsManager.theme)
accent = settingsManager.accent
// Apply the theme

View file

@ -20,6 +20,7 @@ import org.oxycblt.auxio.music.processing.MusicLoader
/**
* An intermediary [Fragment] that asks for the READ_EXTERNAL_STORAGE permission and runs
* the music loading process in the background.
* FIXME: Leak that occurs when skipping load
* @author OxygenCobalt
*/
class LoadingFragment : Fragment(R.layout.fragment_loading) {

View file

@ -133,6 +133,7 @@ class PlaybackService : Service(), Player.EventListener, PlaybackStateManager.Ca
// Set up callback for system events
systemReceiver = SystemEventReceiver()
IntentFilter().apply {
addAction(NotificationUtils.ACTION_LOOP)
addAction(NotificationUtils.ACTION_SHUFFLE)