all: general cleanup

General cleanup. About to do another major playback change, so
push these changes now so they are not changed later.
This commit is contained in:
OxygenCobalt 2022-01-09 08:22:14 -07:00
parent d4904136c0
commit 5e3569d173
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
10 changed files with 12 additions and 14 deletions

View file

@ -39,7 +39,6 @@ import org.oxycblt.auxio.util.systemBarsCompat
/** /**
* A [Fragment] that displays more information about the song, along with more media controls. * A [Fragment] that displays more information about the song, along with more media controls.
* Instantiation is done by the navigation component, **do not instantiate this fragment manually.** * Instantiation is done by the navigation component, **do not instantiate this fragment manually.**
* TODO: Show playing from on this screen now
* @author OxygenCobalt * @author OxygenCobalt
*/ */
class PlaybackFragment : Fragment() { class PlaybackFragment : Fragment() {

View file

@ -80,7 +80,7 @@ class PlaybackViewModel : ViewModel(), PlaybackStateManager.Callback {
/** The current [PlaybackMode] that also determines the queue */ /** The current [PlaybackMode] that also determines the queue */
val playbackMode: LiveData<PlaybackMode> get() = mMode val playbackMode: LiveData<PlaybackMode> get() = mMode
private val playbackManager = PlaybackStateManager.maybeGetInstance() private val playbackManager = PlaybackStateManager.getInstance()
private val settingsManager = SettingsManager.getInstance() private val settingsManager = SettingsManager.getInstance()
init { init {

View file

@ -40,7 +40,7 @@ import kotlin.math.min
* - If you want to use the playback state in the UI, use [org.oxycblt.auxio.playback.PlaybackViewModel] as it can withstand volatile UIs. * - If you want to use the playback state in the UI, use [org.oxycblt.auxio.playback.PlaybackViewModel] as it can withstand volatile UIs.
* - If you want to use the playback state with the ExoPlayer instance or system-side things, use [org.oxycblt.auxio.playback.system.PlaybackService]. * - If you want to use the playback state with the ExoPlayer instance or system-side things, use [org.oxycblt.auxio.playback.system.PlaybackService].
* *
* All access should be done with [PlaybackStateManager.maybeGetInstance]. * All access should be done with [PlaybackStateManager.getInstance].
* @author OxygenCobalt * @author OxygenCobalt
*/ */
class PlaybackStateManager private constructor() { class PlaybackStateManager private constructor() {
@ -522,7 +522,6 @@ class PlaybackStateManager private constructor() {
) )
) )
// TODO: Re-add state saving
database.writeQueue(mQueue) database.writeQueue(mQueue)
this@PlaybackStateManager.logD( this@PlaybackStateManager.logD(
@ -643,7 +642,7 @@ class PlaybackStateManager private constructor() {
/** /**
* Get/Instantiate the single instance of [PlaybackStateManager]. * Get/Instantiate the single instance of [PlaybackStateManager].
*/ */
fun maybeGetInstance(): PlaybackStateManager { fun getInstance(): PlaybackStateManager {
val currentInstance = INSTANCE val currentInstance = INSTANCE
if (currentInstance != null) { if (currentInstance != null) {

View file

@ -43,7 +43,7 @@ class AudioReactor(
) : AudioManager.OnAudioFocusChangeListener, SettingsManager.Callback { ) : AudioManager.OnAudioFocusChangeListener, SettingsManager.Callback {
private data class Gain(val track: Float, val album: Float) private data class Gain(val track: Float, val album: Float)
private val playbackManager = PlaybackStateManager.maybeGetInstance() private val playbackManager = PlaybackStateManager.getInstance()
private val settingsManager = SettingsManager.getInstance() private val settingsManager = SettingsManager.getInstance()
private val audioManager = context.getSystemServiceSafe(AudioManager::class) private val audioManager = context.getSystemServiceSafe(AudioManager::class)

View file

@ -46,8 +46,9 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.conflate
import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.conflate
import kotlinx.coroutines.flow.takeWhile import kotlinx.coroutines.flow.takeWhile
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.oxycblt.auxio.BuildConfig import org.oxycblt.auxio.BuildConfig
@ -74,7 +75,6 @@ import org.oxycblt.auxio.widgets.WidgetProvider
* @author OxygenCobalt * @author OxygenCobalt
*/ */
class PlaybackService : Service(), Player.Listener, PlaybackStateManager.Callback, SettingsManager.Callback { class PlaybackService : Service(), Player.Listener, PlaybackStateManager.Callback, SettingsManager.Callback {
// Player components // Player components
private lateinit var player: ExoPlayer private lateinit var player: ExoPlayer
private lateinit var mediaSession: MediaSessionCompat private lateinit var mediaSession: MediaSessionCompat
@ -90,7 +90,7 @@ class PlaybackService : Service(), Player.Listener, PlaybackStateManager.Callbac
private val systemReceiver = SystemEventReceiver() private val systemReceiver = SystemEventReceiver()
// Managers // Managers
private val playbackManager = PlaybackStateManager.maybeGetInstance() private val playbackManager = PlaybackStateManager.getInstance()
private val settingsManager = SettingsManager.getInstance() private val settingsManager = SettingsManager.getInstance()
// State // State

View file

@ -39,7 +39,7 @@ class PlaybackSessionConnector(
private val player: Player, private val player: Player,
private val mediaSession: MediaSessionCompat private val mediaSession: MediaSessionCompat
) : PlaybackStateManager.Callback, Player.Listener, MediaSessionCompat.Callback() { ) : PlaybackStateManager.Callback, Player.Listener, MediaSessionCompat.Callback() {
private val playbackManager = PlaybackStateManager.maybeGetInstance() private val playbackManager = PlaybackStateManager.getInstance()
private val emptyMetadata = MediaMetadataCompat.Builder().build() private val emptyMetadata = MediaMetadataCompat.Builder().build()
init { init {

View file

@ -33,7 +33,7 @@ import org.oxycblt.auxio.settings.SettingsManager
class WidgetController(private val context: Context) : class WidgetController(private val context: Context) :
PlaybackStateManager.Callback, PlaybackStateManager.Callback,
SettingsManager.Callback { SettingsManager.Callback {
private val playbackManager = PlaybackStateManager.maybeGetInstance() private val playbackManager = PlaybackStateManager.getInstance()
private val settingsManager = SettingsManager.getInstance() private val settingsManager = SettingsManager.getInstance()
private val widget = WidgetProvider() private val widget = WidgetProvider()

View file

@ -66,7 +66,7 @@
<string name="set_alt_shuffle">"Preferovat akci náhodného přehrávání"</string> <string name="set_alt_shuffle">"Preferovat akci náhodného přehrávání"</string>
<string name="set_audio">"Zvuk"</string> <string name="set_audio">"Zvuk"</string>
<string name="set_focus">"Zaměření zvuku"</string> <string name="set_focus">"Zaměření zvuku"</string>
<string name="set_focus_desc">"Pozastavit při přehrávání jiného zvuku [např. hovor]"</string> <string name="set_focus_desc">Pozastavit při přehrávání jiného zvuku (např. hovor)</string>
<string name="set_plug_mgt">"Zaměření sluchátek"</string> <string name="set_plug_mgt">"Zaměření sluchátek"</string>
<string name="set_plug_mgt_desc">"Přehrát/pozastavit při změně připojení sluchátek"</string> <string name="set_plug_mgt_desc">"Přehrát/pozastavit při změně připojení sluchátek"</string>
<string name="set_behavior">"Chování"</string> <string name="set_behavior">"Chování"</string>

View file

@ -71,7 +71,7 @@
<string name="set_audio">Audio</string> <string name="set_audio">Audio</string>
<string name="set_focus">Audiofocus</string> <string name="set_focus">Audiofocus</string>
<string name="set_focus_desc">Pauze wanneer andere audio speelt [ex. Gesprekken]</string> <string name="set_focus_desc">Pauze wanneer andere audio speelt (ex. Gesprekken)</string>
<string name="set_plug_mgt">Headset-pluggen</string> <string name="set_plug_mgt">Headset-pluggen</string>
<string name="set_plug_mgt_desc">Afspelen/Pauzeren wanneer de headsetaansluiting verandert</string> <string name="set_plug_mgt_desc">Afspelen/Pauzeren wanneer de headsetaansluiting verandert</string>

View file

@ -82,7 +82,7 @@
<string name="set_audio">Audio</string> <string name="set_audio">Audio</string>
<string name="set_focus">Audio focus</string> <string name="set_focus">Audio focus</string>
<string name="set_focus_desc">Pause when other audio plays [ex. Calls]</string> <string name="set_focus_desc">Pause when other audio plays (ex. Calls)</string>
<string name="set_plug_mgt">Headset focus</string> <string name="set_plug_mgt">Headset focus</string>
<string name="set_plug_mgt_desc">Play/Pause when the headset connection changes</string> <string name="set_plug_mgt_desc">Play/Pause when the headset connection changes</string>
<string name="set_replay_gain">ReplayGain (MP3/FLAC Only)</string> <string name="set_replay_gain">ReplayGain (MP3/FLAC Only)</string>