Skip to content

Commit

Permalink
Fix restore track again
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrave-dev committed Oct 11, 2023
1 parent afe570a commit 7d9b233
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
8 changes: 8 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,12 @@
<action android:name="android.media.action.DISPLAY_AUDIO_EFFECT_CONTROL_PANEL" />
</intent>
</queries>
<queries>
<package android:name="com.maxrave.simpmusic" />
</queries>
<queries>
<intent>
<action android:name="androidx.media3.session.MediaSessionService"/>
</intent>
</queries>
</manifest>
17 changes: 9 additions & 8 deletions app/src/main/java/com/maxrave/simpmusic/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -554,11 +554,13 @@ class MainActivity : AppCompatActivity() {
value = it ?: listOf()
}
}
binding.miniplayer.visibility = View.GONE
result.observe(this) {data ->
val queueData = data
Log.w("Check queue saved", queueData.toString())
binding.miniplayer.visibility = View.VISIBLE
if (queueData.isNotEmpty()) {
Log.w("Check queue saved", queueData.toString())
binding.miniplayer.visibility = View.VISIBLE
Queue.clear()
Queue.addAll(queueData)
viewModel.removeSaveQueue()
Expand All @@ -569,6 +571,7 @@ class MainActivity : AppCompatActivity() {
}
}
else {
binding.miniplayer.visibility = View.GONE
checkForUpdate()
}
}
Expand All @@ -579,13 +582,11 @@ class MainActivity : AppCompatActivity() {
Log.w("MainActivity", "onDestroy: ")
}
private fun startMusicService() {
if (viewModel.isServiceRunning.value == false) {
if (!isMyServiceRunning(SimpleMediaService::class.java)) {
val intent = Intent(this, SimpleMediaService::class.java)
bindService(intent, serviceConnection, BIND_AUTO_CREATE)
viewModel.isServiceRunning.postValue(true)
Log.d("Service", "Service started")
}
if (viewModel.isServiceRunning.value != true) {
val intent = Intent(this, SimpleMediaService::class.java)
bindService(intent, serviceConnection, BIND_AUTO_CREATE)
viewModel.isServiceRunning.postValue(true)
Log.d("Service", "Service started")
}
}
private fun stopService(){
Expand Down

0 comments on commit 7d9b233

Please sign in to comment.