updated gradle, maybe fixed fallback issue

remotes/origin/devel
yattoz 2020-08-08 20:33:22 +02:00
parent 0b7b5dd2f1
commit e3f1508b50
7 changed files with 24 additions and 18 deletions

View File

@ -17,7 +17,7 @@ configurations.all {
android { android {
compileSdkVersion 30 compileSdkVersion 30
buildToolsVersion "30.0.0" buildToolsVersion "30.0.1"
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8

View File

@ -499,6 +499,7 @@ class RadioService : MediaBrowserServiceCompat() {
.setUsage(C.USAGE_ALARM) .setUsage(C.USAGE_ALARM)
.build() .build()
} else { } else {
isAlarmStopped = true // if we're not ringing and it tries playing, it means the user opened the app somehow
audioAttributes.setUsage(AudioAttributesCompat.USAGE_MEDIA) audioAttributes.setUsage(AudioAttributesCompat.USAGE_MEDIA)
audioFocusRequestBuilder.setAudioAttributes(audioAttributes.build()) audioFocusRequestBuilder.setAudioAttributes(audioAttributes.build())
audioFocusRequest = audioFocusRequestBuilder.build() audioFocusRequest = audioFocusRequestBuilder.build()
@ -514,11 +515,6 @@ class RadioService : MediaBrowserServiceCompat() {
return return
} }
// TODO: Remove this
if (mediaSession.controller.playbackState.state == PlaybackStateCompat.STATE_PLAYING && !isRinging && isAlarmStopped)
return // nothing to do here
isAlarmStopped = true
PlayerStore.instance.playbackState.value = PlaybackStateCompat.STATE_PLAYING PlayerStore.instance.playbackState.value = PlaybackStateCompat.STATE_PLAYING
// Reinitialize media player. Otherwise the playback doesn't resume when beginPlaying. Dunno why. // Reinitialize media player. Otherwise the playback doesn't resume when beginPlaying. Dunno why.
@ -534,7 +530,6 @@ class RadioService : MediaBrowserServiceCompat() {
} }
// START PLAYBACK, LET'S ROCK // START PLAYBACK, LET'S ROCK
player.playWhenReady = true
nowPlayingNotification.update(this, isUpdatingNotificationButton = true, isRinging = isRinging) nowPlayingNotification.update(this, isUpdatingNotificationButton = true, isRinging = isRinging)
playbackStateBuilder.setState( playbackStateBuilder.setState(
@ -544,6 +539,8 @@ class RadioService : MediaBrowserServiceCompat() {
SystemClock.elapsedRealtime() SystemClock.elapsedRealtime()
) )
mediaSession.setPlaybackState(playbackStateBuilder.build()) mediaSession.setPlaybackState(playbackStateBuilder.build())
player.playWhenReady = true
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "begin playing") //[REMOVE LOG CALLS]Log.d(tag, radioTag + "begin playing")
} }
@ -557,8 +554,8 @@ class RadioService : MediaBrowserServiceCompat() {
{ {
if (mediaSession.controller.playbackState.state == PlaybackStateCompat.STATE_STOPPED) if (mediaSession.controller.playbackState.state == PlaybackStateCompat.STATE_STOPPED)
return // nothing to do here return // nothing to do here
if (PlayerStore.instance.playbackState.value == PlaybackStateCompat.STATE_PLAYING)
isAlarmStopped = true isAlarmStopped = true
PlayerStore.instance.playbackState.value = PlaybackStateCompat.STATE_STOPPED PlayerStore.instance.playbackState.value = PlaybackStateCompat.STATE_STOPPED

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
</selector>

View File

@ -11,8 +11,14 @@
<item name="android:colorBackground">@color/colorPrimaryDark</item> <item name="android:colorBackground">@color/colorPrimaryDark</item>
</style> </style>
<style name="AppTheme.Parameters" parent="AppTheme"> <style name="AppTheme.Parameters" parent="Theme.AppCompat.NoActionBar">
<item name="icon"/> <!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColorHighlight">@color/rblue</item>
<item name="android:colorBackground">@color/colorPrimaryDark</item>
<item name="icon">@drawable/none</item>
</style> </style>
<style name="AppTheme.BottomBar" parent="AppTheme"> <style name="AppTheme.BottomBar" parent="AppTheme">

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen <PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android">
>
<Preference <Preference
app:icon="@drawable/ic_alarm" app:icon="@drawable/ic_alarm"

View File

@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.3.61' ext.kotlin_version = '1.3.72'
repositories { repositories {
google() google()
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.5.3' classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files

View File

@ -1,6 +1,6 @@
#Sun Oct 13 11:20:35 CEST 2019 #Sat Aug 08 18:44:30 CEST 2020
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip