Skip to content
This repository has been archived by the owner on Feb 1, 2025. It is now read-only.

Commit

Permalink
fixes #363 (Notification drawer/lockscreen buttons don't work)
Browse files Browse the repository at this point in the history
  • Loading branch information
y20k committed Aug 12, 2021
1 parent d7b5af4 commit 1ae5e1f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 25 deletions.
10 changes: 5 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId 'org.y20k.transistor'
minSdkVersion 25
targetSdkVersion 30
versionCode 86
versionName '4.0.15'
versionCode 87
versionName '4.0.16'
resConfigs "en", "ar", "ca", "cs", "de", "el", "eo", "es", "eu", "fr", "fy", "he", "hr", "id", "in", "it", "ja", "kab", "nb-rNO", "nl", "pa", "pl", "pt", "pt-rBR", "ru", "sk", "sl", "sr", "th", "tr", "uk", "zh-rCN"
}

Expand Down Expand Up @@ -70,9 +70,9 @@ dependencies {
implementation "com.google.android.material:material:1.4.0"
implementation "android.arch.work:work-runtime-ktx:1.0.1"

implementation "androidx.activity:activity-ktx:1.2.4"
implementation "androidx.activity:activity-ktx:1.3.1"
implementation "androidx.appcompat:appcompat:1.3.1"
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
implementation "androidx.constraintlayout:constraintlayout:2.1.0"
implementation "androidx.core:core-ktx:1.6.0"
implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.preference:preference-ktx:1.1.1"
Expand All @@ -82,7 +82,7 @@ dependencies {
implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
implementation "androidx.navigation:navigation-ui-ktx:$navigationVersion"

def exoplayerVersion = "2.14.2"
def exoplayerVersion = "2.15.0"
implementation "com.google.android.exoplayer:exoplayer:$exoplayerVersion"
implementation "com.google.android.exoplayer:extension-mediasession:$exoplayerVersion"

Expand Down
36 changes: 18 additions & 18 deletions app/src/main/java/org/y20k/transistor/helpers/NotificationHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,17 @@ class NotificationHelper(private val context: Context, sessionToken: MediaSessio

/* Constructor */
init {
notificationManager = PlayerNotificationManager.createWithNotificationChannel(
context,
Keys.NOW_PLAYING_NOTIFICATION_CHANNEL_ID,
R.string.notification_now_playing_channel_name,
R.string.notification_now_playing_channel_description,
Keys.NOW_PLAYING_NOTIFICATION_ID,
DescriptionAdapter(mediaController),
notificationListener
).apply {
// create a notification builder
val notificationBuilder = PlayerNotificationManager.Builder(context, Keys.NOW_PLAYING_NOTIFICATION_ID, Keys.NOW_PLAYING_NOTIFICATION_CHANNEL_ID)
notificationBuilder.apply {
setChannelNameResourceId(R.string.notification_now_playing_channel_name)
setChannelDescriptionResourceId(R.string.notification_now_playing_channel_description)
setMediaDescriptionAdapter(DescriptionAdapter(mediaController))
setNotificationListener(notificationListener)
}
// create and configure the notification manager
notificationManager = notificationBuilder.build()
notificationManager.apply {
// note: notification icons are customized in values.xml
setMediaSessionToken(sessionToken)
setSmallIcon(R.drawable.ic_notification_app_icon_white_24dp)
Expand Down Expand Up @@ -114,16 +116,14 @@ class NotificationHelper(private val context: Context, sessionToken: MediaSessio
}

override fun dispatchPrevious(player: Player): Boolean {
return super.dispatchPrevious(player)
mediaController.sendCommand(Keys.CMD_PREVIOUS_STATION, null, null)
return true
}

override fun dispatchNext(player: Player): Boolean {
mediaController.sendCommand(Keys.CMD_NEXT_STATION, null, null)
return true
}
// override fun dispatchPrevious(player: Player): Boolean {
// mediaController.sendCommand(Keys.CMD_PREVIOUS_STATION, null, null)
// return true
// }
// override fun dispatchNext(player: Player): Boolean {
// mediaController.sendCommand(Keys.CMD_NEXT_STATION, null, null)
// return true
// }
}
/*
* End of inner class
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.android.tools.build:gradle:7.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
5 changes: 5 additions & 0 deletions metadata/en-US/changelogs/87.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# v4.0.16 - Andy Warhol

**2021-08-12**

- fixes previous and next buttons in the playback notification

0 comments on commit 1ae5e1f

Please sign in to comment.