Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
preparing release
Browse files Browse the repository at this point in the history
  • Loading branch information
y20k committed Feb 25, 2021
1 parent 16e73c8 commit b9d8415
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
targetSdkVersion 30
versionCode 82
versionName '4.0.11'
resConfigs "en", "ar", "ca", "cs","de", "el", "eo","es", "eu", "fr", "he", "hr", "id", "in", "it", "ja", "kab", "nb-rNO", "nl", "pa", "pl", "pt", "pt-rBR", "ru", "sk", "sl", "sr", "th", "tr", "uk", "zh-rCN"
resConfigs "en", "ar", "ca", "cs","de", "el", "eo", "es", "eu", "fr", "he", "hr", "id", "in", "it", "ja", "kab", "nb-rNO", "nl", "pa", "pl", "pt", "pt-rBR", "ru", "sk", "sl", "sr", "th", "tr", "uk", "zh-rCN"
}

kotlinOptions {
Expand Down
25 changes: 20 additions & 5 deletions app/src/main/java/org/y20k/transistor/playback/PlayerService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class PlayerService(): MediaBrowserServiceCompat() {
mediaSessionConnector.setQueueNavigator(object : TimelineQueueNavigator(mediaSession) {
override fun getMediaDescription(player: Player, windowIndex: Int): MediaDescriptionCompat {
// create media description - used in notification
return CollectionHelper.buildStationMediaDescription(this@PlayerService, station, metadataHistory.last())
return CollectionHelper.buildStationMediaDescription(this@PlayerService, station, getCurrentMetadata())
}
override fun onSkipToPrevious(player: Player, controlDispatcher: ControlDispatcher) {
LogHelper.d(TAG, "onSkipToPrevious called") // todo remove
Expand Down Expand Up @@ -378,6 +378,9 @@ class PlayerService(): MediaBrowserServiceCompat() {
// update media session connector
mediaSessionConnector.setPlayer(player)

// reset metadata to station name
updateMetadata(station.name)

// set playWhenReady state
player.playWhenReady = playWhenReady
}
Expand Down Expand Up @@ -487,7 +490,7 @@ class PlayerService(): MediaBrowserServiceCompat() {
// wait for result and update collection
collection = deferred.await()
// special case: trigger metadata view update for stations that have no metadata
if (playerState.playbackState == PlaybackState.STATE_PLAYING && station.name == metadataHistory.last()) {
if (playerState.playbackState == PlaybackState.STATE_PLAYING && station.name == getCurrentMetadata()) {
station = CollectionHelper.getStation(collection, station.uuid)
updateMetadata(null)
}
Expand All @@ -505,6 +508,18 @@ class PlayerService(): MediaBrowserServiceCompat() {
}


/* Gets the most current metadata string */
private fun getCurrentMetadata(): String {
val metadataString: String
if (metadataHistory.isEmpty()) {
metadataString = station.name
} else {
metadataString = metadataHistory.last()
}
return metadataString
}


/* Load next station and start playback */
private fun skipToNextStation() {
// stop current playback, if necessary
Expand Down Expand Up @@ -627,11 +642,11 @@ class PlayerService(): MediaBrowserServiceCompat() {
val event: KeyEvent? = mediaButtonEvent.getParcelableExtra(Intent.EXTRA_KEY_EVENT)
when (event?.keyCode) {
KeyEvent.KEYCODE_MEDIA_NEXT -> {
skipToNextStation()
if (event.action == KeyEvent.ACTION_UP) skipToNextStation()
return true
}
KeyEvent.KEYCODE_MEDIA_PREVIOUS -> {
skipToPreviousStation()
if (event.action == KeyEvent.ACTION_UP) skipToPreviousStation()
return true
}
else -> return false
Expand All @@ -648,7 +663,7 @@ class PlayerService(): MediaBrowserServiceCompat() {
// */
// private val metadataProvider = object : MediaSessionConnector.MediaMetadataProvider {
// override fun getMetadata(player: Player): MediaMetadataCompat {
// return CollectionHelper.buildStationMediaMetadata(this@PlayerService, station, metadataHistory.last())
// return CollectionHelper.buildStationMediaMetadata(this@PlayerService, station, getCurrentMetadata())
// }
// }
// /*
Expand Down
1 change: 1 addition & 0 deletions metadata/en-US/changelogs/82.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

- Esperanto language version
- updated translations
- changed notification behavior

0 comments on commit b9d8415

Please sign in to comment.