Browse Source

updated gradle, maybe fixed fallback issue

yattoz 3 years ago
parent
commit
e3f1508b50

+ 1 - 1
app/build.gradle View File

@@ -17,7 +17,7 @@ configurations.all {
17 17
 
18 18
 android {
19 19
     compileSdkVersion 30
20
-    buildToolsVersion "30.0.0"
20
+    buildToolsVersion "30.0.1"
21 21
     compileOptions {
22 22
         sourceCompatibility JavaVersion.VERSION_1_8
23 23
         targetCompatibility JavaVersion.VERSION_1_8

+ 5 - 8
app/src/main/java/fr/forum_thalie/tsumugi/RadioService.kt View File

@@ -499,6 +499,7 @@ class RadioService : MediaBrowserServiceCompat() {
499 499
                 .setUsage(C.USAGE_ALARM)
500 500
                 .build()
501 501
         } else {
502
+            isAlarmStopped = true // if we're not ringing and it tries playing, it means the user opened the app somehow
502 503
             audioAttributes.setUsage(AudioAttributesCompat.USAGE_MEDIA)
503 504
             audioFocusRequestBuilder.setAudioAttributes(audioAttributes.build())
504 505
             audioFocusRequest = audioFocusRequestBuilder.build()
@@ -514,11 +515,6 @@ class RadioService : MediaBrowserServiceCompat() {
514 515
             return
515 516
         }
516 517
 
517
-        // TODO: Remove this
518
-        if (mediaSession.controller.playbackState.state == PlaybackStateCompat.STATE_PLAYING && !isRinging && isAlarmStopped)
519
-             return // nothing to do here
520
-        isAlarmStopped = true
521
-
522 518
         PlayerStore.instance.playbackState.value = PlaybackStateCompat.STATE_PLAYING
523 519
 
524 520
         // Reinitialize media player. Otherwise the playback doesn't resume when beginPlaying. Dunno why.
@@ -534,7 +530,6 @@ class RadioService : MediaBrowserServiceCompat() {
534 530
         }
535 531
 
536 532
         // START PLAYBACK, LET'S ROCK
537
-        player.playWhenReady = true
538 533
         nowPlayingNotification.update(this, isUpdatingNotificationButton =  true, isRinging = isRinging)
539 534
 
540 535
         playbackStateBuilder.setState(
@@ -544,6 +539,8 @@ class RadioService : MediaBrowserServiceCompat() {
544 539
             SystemClock.elapsedRealtime()
545 540
         )
546 541
         mediaSession.setPlaybackState(playbackStateBuilder.build())
542
+        player.playWhenReady = true
543
+
547 544
         //[REMOVE LOG CALLS]Log.d(tag, radioTag + "begin playing")
548 545
     }
549 546
 
@@ -557,8 +554,8 @@ class RadioService : MediaBrowserServiceCompat() {
557 554
     {
558 555
         if (mediaSession.controller.playbackState.state == PlaybackStateCompat.STATE_STOPPED)
559 556
             return // nothing to do here
560
-
561
-        isAlarmStopped = true
557
+        if (PlayerStore.instance.playbackState.value == PlaybackStateCompat.STATE_PLAYING)
558
+            isAlarmStopped = true
562 559
 
563 560
         PlayerStore.instance.playbackState.value = PlaybackStateCompat.STATE_STOPPED
564 561
 

+ 4 - 0
app/src/main/res/drawable/none.xml View File

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

+ 8 - 2
app/src/main/res/values/styles.xml View File

@@ -11,8 +11,14 @@
11 11
         <item name="android:colorBackground">@color/colorPrimaryDark</item>
12 12
     </style>
13 13
 
14
-    <style name="AppTheme.Parameters" parent="AppTheme">
15
-        <item name="icon"/>
14
+    <style name="AppTheme.Parameters" parent="Theme.AppCompat.NoActionBar">
15
+        <!-- Customize your theme here. -->
16
+        <item name="colorPrimary">@color/colorPrimary</item>
17
+        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
18
+        <item name="colorAccent">@color/colorAccent</item>
19
+        <item name="android:textColorHighlight">@color/rblue</item>
20
+        <item name="android:colorBackground">@color/colorPrimaryDark</item>
21
+        <item name="icon">@drawable/none</item>
16 22
     </style>
17 23
 
18 24
     <style name="AppTheme.BottomBar" parent="AppTheme">

+ 2 - 3
app/src/main/res/xml/preferences.xml View File

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

+ 2 - 2
build.gradle View File

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

+ 2 - 2
gradle/wrapper/gradle-wrapper.properties View File

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