Browse Source

updated gradle, maybe fixed fallback issue

yattoz 4 years ago
parent
commit
e3f1508b50

+ 1 - 1
app/build.gradle View File

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

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

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

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

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
         <item name="android:colorBackground">@color/colorPrimaryDark</item>
11
         <item name="android:colorBackground">@color/colorPrimaryDark</item>
12
     </style>
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
     </style>
22
     </style>
17
 
23
 
18
     <style name="AppTheme.BottomBar" parent="AppTheme">
24
     <style name="AppTheme.BottomBar" parent="AppTheme">

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

1
 <?xml version="1.0" encoding="utf-8"?>
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
     <Preference
5
     <Preference
7
         app:icon="@drawable/ic_alarm"
6
         app:icon="@drawable/ic_alarm"

+ 2 - 2
build.gradle View File

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

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

1
-#Sun Oct 13 11:20:35 CEST 2019
1
+#Sat Aug 08 18:44:30 CEST 2020
2
 distributionBase=GRADLE_USER_HOME
2
 distributionBase=GRADLE_USER_HOME
3
 distributionPath=wrapper/dists
3
 distributionPath=wrapper/dists
4
 zipStoreBase=GRADLE_USER_HOME
4
 zipStoreBase=GRADLE_USER_HOME
5
 zipStorePath=wrapper/dists
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