Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
fast4x committed Sep 2, 2024
1 parent 3c79f16 commit f906ae6
Show file tree
Hide file tree
Showing 57 changed files with 561 additions and 187 deletions.
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@
android:resource="@xml/shortcuts" />
</activity>

<receiver android:name=".ui.widgets.PlayerEssentialReceiver"
<receiver android:name=".ui.widgets.PlayerVerticalWidgetReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/player_essential_widget_info" />
android:resource="@xml/player_vertical_widget_info" />
</receiver>

<service
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/kotlin/it/fast4x/rimusic/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ class MainActivity :

val launchedFromNotification =
intent?.extras?.getBoolean("expandPlayerBottomSheet") == true
|| intent?.extras?.getBoolean("fromWidget") == true

println("MainActivity.onCreate launchedFromNotification: $launchedFromNotification intent $intent.action")

intentUriData = intent.data ?: intent.getStringExtra(Intent.EXTRA_TEXT)?.toUri()

Expand Down
14 changes: 9 additions & 5 deletions app/src/main/kotlin/it/fast4x/rimusic/service/PlayerService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ import it.fast4x.rimusic.models.asMediaItem
import it.fast4x.rimusic.query
import it.fast4x.rimusic.transaction
import it.fast4x.rimusic.ui.components.themed.SmartMessage
import it.fast4x.rimusic.ui.widgets.PlayerEssentialWidget
import it.fast4x.rimusic.ui.widgets.PlayerVerticalWidget
import it.fast4x.rimusic.utils.InvincibleService
import it.fast4x.rimusic.utils.RingBuffer
import it.fast4x.rimusic.utils.TimerJob
Expand Down Expand Up @@ -351,7 +351,7 @@ class PlayerService : InvincibleService(),

private lateinit var notificationActionReceiver: NotificationActionReceiver
//private lateinit var audioQualityFormat: AudioQualityFormat
private val playerEssentialWidget = PlayerEssentialWidget()
private val playerVerticalWidget = PlayerVerticalWidget()

/*
private val media = MutableStateFlow<MediaItem?>(null)
Expand Down Expand Up @@ -925,6 +925,8 @@ class PlayerService : InvincibleService(),
updateMediaSessionQueue(player.currentTimeline)
}

updateWidgets()

}

override fun onTimelineChanged(timeline: Timeline, reason: Int) {
Expand Down Expand Up @@ -2006,12 +2008,14 @@ class PlayerService : InvincibleService(),


fun updateWidgets() {
val songName = player.mediaMetadata.title.toString()
val songTitle = player.mediaMetadata.title.toString()
val songArtist = player.mediaMetadata.artist.toString()
val isPlaying = player.isPlaying
coroutineScope.launch {
playerEssentialWidget.updateInfo(
playerVerticalWidget.updateInfo(
context = applicationContext,
songName = songName,
songTitle = songTitle,
songArtist = songArtist,
isPlaying = isPlaying,
bitmap = bitmapProvider.bitmap,
player = player
Expand Down

This file was deleted.

Loading

0 comments on commit f906ae6

Please sign in to comment.