Fixed a bug where the notification may not stay gone. Also upgraded

Exoplayer and Kotlin versions.
This commit is contained in:
casey langen 2018-03-03 15:52:21 -08:00
parent ae80169713
commit 4b9d554662
4 changed files with 20 additions and 12 deletions

View File

@ -21,8 +21,8 @@ android {
applicationId "io.casey.musikcube.remote"
minSdkVersion 21
targetSdkVersion 26
versionCode 30
versionName "0.26.0"
versionCode 31
versionName "0.27.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
@ -88,8 +88,8 @@ dependencies {
implementation 'io.reactivex.rxjava2:rxjava:2.1.6'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxkotlin:2.1.0'
implementation 'com.google.android.exoplayer:exoplayer:2.6.1'
implementation 'com.google.android.exoplayer:extension-okhttp:2.6.1'
implementation 'com.google.android.exoplayer:exoplayer:2.7.0'
implementation 'com.google.android.exoplayer:extension-okhttp:2.7.0'
implementation 'com.simplecityapps:recyclerview-fastscroll:1.0.16'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.github.wooplr:Spotlight:1.2.3'

View File

@ -213,7 +213,7 @@ class GaplessExoPlayerWrapper : PlayerWrapper() {
}
private var eventListener = object : Player.EventListener {
override fun onTimelineChanged(timeline: Timeline, manifest: Any?) {
override fun onTimelineChanged(timeline: Timeline, manifest: Any?, reason: Int) {
}
override fun onTracksChanged(trackGroups: TrackGroupArray, trackSelections: TrackSelectionArray) {

View File

@ -57,6 +57,8 @@ class SystemService : Service() {
private val sessionData = SessionMetadata()
override fun onCreate() {
RUNNING = true
super.onCreate()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@ -82,6 +84,7 @@ class SystemService : Service() {
}
override fun onDestroy() {
RUNNING = false
super.onDestroy()
unregisterReceivers()
}
@ -548,6 +551,7 @@ class SystemService : Service() {
var ACTION_WAKE_UP = "io.casey.musikcube.remote.WAKE_UP"
var ACTION_SHUT_DOWN = "io.casey.musikcube.remote.SHUT_DOWN"
var ACTION_SLEEP = "io.casey.musikcube.remote.SLEEP"
var RUNNING = false
private val BITMAP_OPTIONS = RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL)
@ -565,15 +569,19 @@ class SystemService : Service() {
}
fun shutdown() {
val c = Application.instance
ContextCompat.startForegroundService(
c, Intent(c, SystemService::class.java).setAction(ACTION_SHUT_DOWN))
if (RUNNING) {
val c = Application.instance
ContextCompat.startForegroundService(
c, Intent(c, SystemService::class.java).setAction(ACTION_SHUT_DOWN))
}
}
fun sleep() {
val c = Application.instance
ContextCompat.startForegroundService(
c, Intent(c, SystemService::class.java).setAction(ACTION_SLEEP))
if (RUNNING) {
val c = Application.instance
ContextCompat.startForegroundService(
c, Intent(c, SystemService::class.java).setAction(ACTION_SLEEP))
}
}
}
}

View File

@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.2.21'
ext.kotlin_version = '1.2.30'
repositories {
jcenter()