浏览代码

Merge branch 'devel'

yattoz 4 年前
父节点
当前提交
f42c705bab

+ 0 - 22
.idea/gradle.xml 查看文件

@@ -8,28 +8,6 @@
8 8
         <option name="modules">
9 9
           <set>
10 10
             <option value="$PROJECT_DIR$" />
11
-            <option value="$PROJECT_DIR$/ExoPlayer/extensions/av1" />
12
-            <option value="$PROJECT_DIR$/ExoPlayer/extensions/cast" />
13
-            <option value="$PROJECT_DIR$/ExoPlayer/extensions/cronet" />
14
-            <option value="$PROJECT_DIR$/ExoPlayer/extensions/ffmpeg" />
15
-            <option value="$PROJECT_DIR$/ExoPlayer/extensions/flac" />
16
-            <option value="$PROJECT_DIR$/ExoPlayer/extensions/gvr" />
17
-            <option value="$PROJECT_DIR$/ExoPlayer/extensions/ima" />
18
-            <option value="$PROJECT_DIR$/ExoPlayer/extensions/jobdispatcher" />
19
-            <option value="$PROJECT_DIR$/ExoPlayer/extensions/leanback" />
20
-            <option value="$PROJECT_DIR$/ExoPlayer/extensions/mediasession" />
21
-            <option value="$PROJECT_DIR$/ExoPlayer/extensions/okhttp" />
22
-            <option value="$PROJECT_DIR$/ExoPlayer/extensions/opus" />
23
-            <option value="$PROJECT_DIR$/ExoPlayer/extensions/rtmp" />
24
-            <option value="$PROJECT_DIR$/ExoPlayer/extensions/vp9" />
25
-            <option value="$PROJECT_DIR$/ExoPlayer/extensions/workmanager" />
26
-            <option value="$PROJECT_DIR$/ExoPlayer/library/all" />
27
-            <option value="$PROJECT_DIR$/ExoPlayer/library/core" />
28
-            <option value="$PROJECT_DIR$/ExoPlayer/library/dash" />
29
-            <option value="$PROJECT_DIR$/ExoPlayer/library/hls" />
30
-            <option value="$PROJECT_DIR$/ExoPlayer/library/smoothstreaming" />
31
-            <option value="$PROJECT_DIR$/ExoPlayer/library/ui" />
32
-            <option value="$PROJECT_DIR$/ExoPlayer/testutils" />
33 11
             <option value="$PROJECT_DIR$/app" />
34 12
           </set>
35 13
         </option>

+ 0 - 1
.idea/vcs.xml 查看文件

@@ -2,6 +2,5 @@
2 2
 <project version="4">
3 3
   <component name="VcsDirectoryMappings">
4 4
     <mapping directory="" vcs="Git" />
5
-    <mapping directory="$PROJECT_DIR$/ExoPlayer" vcs="Git" />
6 5
   </component>
7 6
 </project>

+ 0 - 1
ExoPlayer

@@ -1 +0,0 @@
1
-Subproject commit 24a19264dbf35e326bbd7bb36c232eb180e1e26d

+ 6 - 6
app/build.gradle 查看文件

@@ -29,8 +29,8 @@ android {
29 29
         applicationId "fr.forum_thalie.tsumugi"
30 30
         minSdkVersion 16
31 31
         targetSdkVersion 29
32
-        versionCode 113
33
-        versionName "1.1.3"
32
+        versionCode 115
33
+        versionName "1.1.5"
34 34
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
35 35
         vectorDrawables.useSupportLibrary = true
36 36
     }
@@ -69,11 +69,11 @@ dependencies {
69 69
      */
70 70
 
71 71
     implementation "androidx.media:media:1.1.0"
72
-    //implementation 'com.google.android.exoplayer:exoplayer:2.11.1'
73
-    implementation project(':exoplayer-library') // uses local ExoPlayer clone, from dev-v2 branch (fixes ISO-8859-1 ICY metadata
72
+    implementation 'com.google.android.exoplayer:exoplayer:2.11.3'
73
+    //implementation project(':exoplayer-library') // uses local ExoPlayer clone, from dev-v2 branch (fixes ISO-8859-1 ICY metadata
74 74
 
75
-    implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
76
-    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0'
75
+    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
76
+    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
77 77
 
78 78
     implementation 'androidx.recyclerview:recyclerview:1.1.0'
79 79
     implementation 'androidx.preference:preference:1.1.0'

+ 1 - 1
app/src/main/AndroidManifest.xml 查看文件

@@ -48,7 +48,7 @@
48 48
             android:configChanges="orientation|screenSize"
49 49
             android:label="@string/app_name"
50 50
             android:launchMode="singleTask"
51
-            android:screenOrientation="fullSensor">
51
+            android:screenOrientation="fullUser">
52 52
             <intent-filter>
53 53
                 <action android:name="android.intent.action.MAIN" />
54 54
 

+ 1 - 1
app/src/main/assets/planning_example.json 查看文件

@@ -62,5 +62,5 @@
62 62
     }
63 63
   ],
64 64
   "regular_programme" : "Programmation habituelle",
65
-  "timezone": "GMT+1"
65
+  "timezone": "Europe/Paris"
66 66
 }

+ 2 - 2
app/src/main/java/fr/forum_thalie/tsumugi/NowPlayingNotification.kt 查看文件

@@ -39,7 +39,7 @@ class NowPlayingNotification(
39 39
 
40 40
         mediaStyle = androidx.media.app.NotificationCompat.DecoratedMediaCustomViewStyle().also {
41 41
             it.setMediaSession(m.sessionToken)
42
-            it.setShowActionsInCompactView(0) // index 0 = show actions 0 and 1 (show action #0 (play/pause))
42
+            it.setShowActionsInCompactView(0, 1) // index 0 = show actions 0 and 1 (show action #0 (play/pause))
43 43
             it.setCancelButtonIntent(deleteIntent)
44 44
         }
45 45
         builder.setStyle(mediaStyle)
@@ -83,7 +83,7 @@ class NowPlayingNotification(
83 83
             val intent2 = Intent(c, RadioService::class.java)
84 84
             intent2.putExtra("action", Actions.KILL.name)
85 85
             val pendingButtonIntent = PendingIntent.getService(c, 2, intent2, PendingIntent.FLAG_UPDATE_CURRENT)
86
-            val stopAction = NotificationCompat.Action.Builder(R.drawable.ic_stop,"Stop", pendingButtonIntent).build()
86
+            val stopAction = NotificationCompat.Action.Builder(R.drawable.ic_close,"Stop", pendingButtonIntent).build()
87 87
             builder.addAction(stopAction)
88 88
 
89 89
             if (isRinging) {

+ 1 - 1
app/src/main/java/fr/forum_thalie/tsumugi/RadioService.kt 查看文件

@@ -72,7 +72,7 @@ class RadioService : MediaBrowserServiceCompat() {
72 72
                 }
73 73
                 1 -> {
74 74
                     //[REMOVE LOG CALLS]Log.d(tag, radioTag + "Headset is plugged")
75
-                    headsetPluggedIn = true
75
+                    headsetPluggedIn = true && PreferenceManager.getDefaultSharedPreferences(context).getBoolean("autoStartOnPlug", false)
76 76
                 }
77 77
                 else -> {
78 78
                     //[REMOVE LOG CALLS]Log.d(tag, radioTag + "I have no idea what the headset state is")

+ 2 - 1
app/src/main/java/fr/forum_thalie/tsumugi/playerstore/PlayerStore.kt 查看文件

@@ -12,6 +12,7 @@ import org.json.JSONObject
12 12
 import java.net.URL
13 13
 import java.text.ParseException
14 14
 import java.text.SimpleDateFormat
15
+import java.time.format.TextStyle
15 16
 import java.util.*
16 17
 import kotlin.collections.ArrayList
17 18
 
@@ -61,7 +62,7 @@ class PlayerStore {
61 62
     {
62 63
         val dateFormat = SimpleDateFormat("yyyy-MM-dd hh:mm:ss z", Locale.getDefault())
63 64
         try {
64
-            val t: Date? = dateFormat.parse("$s ${Planning.instance.timeZone.id}")
65
+            val t: Date? = dateFormat.parse("$s ${Planning.instance.timeZone.getDisplayName(Planning.instance.timeZone.useDaylightTime(), TimeZone.SHORT)}")
65 66
             //[REMOVE LOG CALLS]Log.d(tag, "date: $s -> $t")
66 67
             return t!!.time
67 68
         } catch (e: ParseException) {

+ 8 - 0
app/src/main/java/fr/forum_thalie/tsumugi/preferences/AlarmFragment.kt 查看文件

@@ -1,8 +1,10 @@
1 1
 package fr.forum_thalie.tsumugi.preferences
2 2
 
3 3
 import android.app.TimePickerDialog
4
+import android.content.Context
4 5
 import android.os.Bundle
5 6
 import android.util.Log
7
+import androidx.appcompat.app.AppCompatActivity
6 8
 import androidx.core.content.edit
7 9
 import androidx.preference.*
8 10
 import fr.forum_thalie.tsumugi.*
@@ -11,6 +13,12 @@ import fr.forum_thalie.tsumugi.alarm.RadioAlarm
11 13
 import java.util.*
12 14
 
13 15
 class AlarmFragment : PreferenceFragmentCompat() {
16
+
17
+    override fun onAttach(context: Context) {
18
+        (activity as AppCompatActivity).supportActionBar?.title = context.getString(R.string.setupAlarmClock)
19
+        super.onAttach(context)
20
+    }
21
+
14 22
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
15 23
         setPreferencesFromResource(R.xml.alarm_preferences, rootKey)
16 24
 

+ 7 - 0
app/src/main/java/fr/forum_thalie/tsumugi/preferences/CustomizeFragment.kt 查看文件

@@ -1,12 +1,19 @@
1 1
 package fr.forum_thalie.tsumugi.preferences
2 2
 
3
+import android.content.Context
3 4
 import android.os.Bundle
4 5
 import androidx.appcompat.app.AlertDialog
6
+import androidx.appcompat.app.AppCompatActivity
5 7
 import androidx.preference.*
6 8
 import fr.forum_thalie.tsumugi.R
7 9
 import fr.forum_thalie.tsumugi.preferenceStore
8 10
 
9 11
 class CustomizeFragment : PreferenceFragmentCompat() {
12
+    override fun onAttach(context: Context) {
13
+        (activity as AppCompatActivity).supportActionBar?.title = context.getString(R.string.customizeAppBehavior)
14
+        super.onAttach(context)
15
+    }
16
+
10 17
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
11 18
         setPreferencesFromResource(R.xml.customize_preferences, rootKey)
12 19
 

+ 5 - 0
app/src/main/java/fr/forum_thalie/tsumugi/preferences/MainPreferenceFragment.kt 查看文件

@@ -5,9 +5,14 @@ import android.net.Uri
5 5
 import android.os.Bundle
6 6
 import fr.forum_thalie.tsumugi.R
7 7
 import android.annotation.SuppressLint
8
+import androidx.appcompat.app.AppCompatActivity
8 9
 import androidx.preference.*
9 10
 
10 11
 class MainPreferenceFragment : PreferenceFragmentCompat() {
12
+    override fun onResume() {
13
+        super.onResume()
14
+        (activity as AppCompatActivity).supportActionBar?.title = context?.getString(R.string.settings)
15
+    }
11 16
 
12 17
     @SuppressLint("ApplySharedPref")
13 18
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {

+ 7 - 0
app/src/main/java/fr/forum_thalie/tsumugi/preferences/SleepFragment.kt 查看文件

@@ -1,13 +1,20 @@
1 1
 package fr.forum_thalie.tsumugi.preferences
2 2
 
3
+import android.content.Context
3 4
 import android.os.Bundle
4 5
 import androidx.preference.*
5 6
 import fr.forum_thalie.tsumugi.R
6 7
 import android.text.InputType
8
+import androidx.appcompat.app.AppCompatActivity
7 9
 import fr.forum_thalie.tsumugi.alarm.RadioSleeper
8 10
 
9 11
 
10 12
 class SleepFragment : PreferenceFragmentCompat() {
13
+    override fun onAttach(context: Context) {
14
+        (activity as AppCompatActivity).supportActionBar?.title = context.getString(R.string.setSleepTimer)
15
+        super.onAttach(context)
16
+    }
17
+
11 18
     override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
12 19
         setPreferencesFromResource(R.xml.sleep_preference, rootKey)
13 20
 

+ 6 - 0
app/src/main/java/fr/forum_thalie/tsumugi/ui/nowplaying/NowPlayingViewModel.kt 查看文件

@@ -1,9 +1,11 @@
1 1
 package fr.forum_thalie.tsumugi.ui.nowplaying
2 2
 
3 3
 import android.widget.SeekBar
4
+import androidx.core.content.edit
4 5
 import androidx.lifecycle.MutableLiveData
5 6
 import androidx.lifecycle.ViewModel
6 7
 import fr.forum_thalie.tsumugi.playerstore.PlayerStore
8
+import fr.forum_thalie.tsumugi.preferenceStore
7 9
 
8 10
 class NowPlayingViewModel: ViewModel() {
9 11
 
@@ -21,6 +23,10 @@ class NowPlayingViewModel: ViewModel() {
21 23
             override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
22 24
                 // updated continuously as the user slides the thumb
23 25
                 PlayerStore.instance.volume.value = progress
26
+                preferenceStore.edit {
27
+                    putInt("volume", progress)
28
+                    commit()
29
+                }
24 30
             }
25 31
 
26 32
             override fun onStartTrackingTouch(seekBar: SeekBar) {

+ 4 - 4
app/src/main/java/fr/forum_thalie/tsumugi/ui/programme/ProgrammeAdapter.kt 查看文件

@@ -1,18 +1,18 @@
1 1
 package fr.forum_thalie.tsumugi.ui.programme
2 2
 
3 3
 import android.annotation.SuppressLint
4
-import android.util.TypedValue
5 4
 import android.view.LayoutInflater
6 5
 import android.view.ViewGroup
7 6
 import android.widget.TextView
8 7
 import androidx.constraintlayout.widget.ConstraintLayout
9
-import androidx.core.widget.TextViewCompat
10 8
 import androidx.recyclerview.widget.RecyclerView
11
-import fr.forum_thalie.tsumugi.*
9
+import fr.forum_thalie.tsumugi.R
10
+import fr.forum_thalie.tsumugi.colorAccent
11
+import fr.forum_thalie.tsumugi.colorWhited
12 12
 import fr.forum_thalie.tsumugi.planning.Planning
13 13
 import fr.forum_thalie.tsumugi.planning.Programme
14
+import fr.forum_thalie.tsumugi.weekdaysSundayFirst
14 15
 import java.util.*
15
-import kotlin.collections.ArrayList
16 16
 
17 17
 class ProgrammeAdapter(private val dataSet: ArrayList<Programme>, private val day: String
18 18
     /*,

+ 11 - 0
app/src/main/res/drawable-anydpi/ic_close.xml 查看文件

@@ -0,0 +1,11 @@
1
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
2
+    android:width="24dp"
3
+    android:height="24dp"
4
+    android:viewportWidth="24"
5
+    android:viewportHeight="24"
6
+    android:tint="#FFFFFF"
7
+    android:alpha="0.8">
8
+    <path
9
+        android:fillColor="#FF000000"
10
+        android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
11
+</vector>

二进制
app/src/main/res/drawable-hdpi/ic_close.png 查看文件


二进制
app/src/main/res/drawable-mdpi/ic_close.png 查看文件


二进制
app/src/main/res/drawable-xhdpi/ic_close.png 查看文件


二进制
app/src/main/res/drawable-xxhdpi/ic_close.png 查看文件


+ 6 - 4
app/src/main/res/values-fr/strings.xml 查看文件

@@ -37,16 +37,16 @@
37 37
     <string name="lp">Derniers titres</string>
38 38
     <string name="programme">Planning</string>
39 39
     <string name="regular_programme">Programme régulier</string>
40
-    <string name="useAlarmClock">Activer l\'alarme</string>
40
+    <string name="useAlarmClock">Activer le réveil</string>
41 41
     <string name="setTime">Choisir l\'heure</string>
42 42
     <string name="selectDaysOfWeek">Choisir les jours</string>
43 43
     <string name="SetSnoozeDuration">Choisir le délai de répétition d\'alarme (minutes)</string>
44 44
     <string name="volumeAtStartup">Volume au démarrage</string>
45 45
     <string name="useHorizontalSplitLayout">Utiliser une disposition horizontale adaptée</string>
46 46
     <string name="makeSnackbarsPersistent">Rendre les barres d\information persistantes</string>
47
-    <string name="setupAlarmClock">Configurer l\'alarme</string>
48
-    <string name="setSleepTimer">Configurer la minuterie avant extinction</string>
49
-    <string name="costumizeAppBehavior">Paramètres de l\'application</string>
47
+    <string name="setupAlarmClock">Réveil</string>
48
+    <string name="setSleepTimer">Minuterie avant extinction</string>
49
+    <string name="customizeAppBehavior">Comportement de l\'application</string>
50 50
     <string name="submitABug">Reporter un bug</string>
51 51
     <string name="sleepClosesApp">Minuterie avant fermeture de l\'application</string>
52 52
     <string name="setSleepDuration">Choisir une durée (en minutes)</string>
@@ -54,5 +54,7 @@
54 54
     <string name="fetchPeriod">Choisir la fréquence de mise à jour quand la radio est stoppée</string>
55 55
     <string name="refreshing">Actualisation…</string>
56 56
     <string name="action_refresh">Raffraîchir les données</string>
57
+    <string name="autoPlay">\"Play\" au branchement de la prise casque</string>
58
+    <string name="settings">Paramètres</string>
57 59
 
58 60
 </resources>

+ 5 - 3
app/src/main/res/values/strings.xml 查看文件

@@ -64,9 +64,9 @@
64 64
     <string name="volumeAtStartup">Volume at startup</string>
65 65
     <string name="useHorizontalSplitLayout">Use horizontal split layout</string>
66 66
     <string name="makeSnackbarsPersistent">Make Snackbars persistent</string>
67
-    <string name="setupAlarmClock">Set up alarm clock</string>
68
-    <string name="setSleepTimer">Set sleep timer</string>
69
-    <string name="costumizeAppBehavior">Customize app behavior</string>
67
+    <string name="setupAlarmClock">Alarm</string>
68
+    <string name="setSleepTimer">Sleep timer</string>
69
+    <string name="customizeAppBehavior">Customize app behavior</string>
70 70
     <string name="submitABug">Submit a bug (opens GitHub in a web browser)</string>
71 71
     <string name="sleepClosesApp">Sleep - close app after some time</string>
72 72
     <string name="setSleepDuration">Set duration (minutes)</string>
@@ -74,5 +74,7 @@
74 74
     <string name="fetchPeriod">Set update period when stopped</string>
75 75
     <string name="refreshing">Refreshing data…</string>
76 76
     <string name="action_refresh">Refresh data</string>
77
+    <string name="autoPlay">Auto play when plugging headphones</string>
78
+    <string name="settings">Settings</string>
77 79
 
78 80
 </resources>

+ 9 - 1
app/src/main/res/xml/customize_preferences.xml 查看文件

@@ -1,7 +1,7 @@
1 1
 <?xml version="1.0" encoding="utf-8"?>
2 2
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
3 3
     xmlns:app="http://schemas.android.com/apk/res-auto">
4
-
4
+<!--
5 5
     <SeekBarPreference
6 6
         app:key="volume"
7 7
         app:iconSpaceReserved="false"
@@ -12,6 +12,14 @@
12 12
         android:defaultValue="100"
13 13
         app:showSeekBarValue="true"
14 14
         />
15
+-->
16
+    <SwitchPreferenceCompat
17
+        app:key="autoStartOnPlug"
18
+        app:iconSpaceReserved="false"
19
+        app:title="@string/autoPlay"
20
+        app:singleLineTitle="false"
21
+        app:defaultValue="false"
22
+    />
15 23
 
16 24
     <SwitchPreferenceCompat
17 25
         app:key="splitLayout"

+ 1 - 1
app/src/main/res/xml/preferences.xml 查看文件

@@ -20,7 +20,7 @@
20 20
     <Preference
21 21
         app:icon="@drawable/ic_customize"
22 22
         app:key="CustomizeFragment"
23
-        app:title="@string/costumizeAppBehavior"
23
+        app:title="@string/customizeAppBehavior"
24 24
         app:fragment="fr.forum_thalie.tsumugi.preferences.CustomizeFragment"
25 25
         />
26 26
 

+ 0 - 4
settings.gradle 查看文件

@@ -1,6 +1,2 @@
1 1
 include ':app'
2 2
 rootProject.name='Tsumugi-app'
3
-
4
-gradle.ext.exoplayerRoot = './ExoPlayer'
5
-gradle.ext.exoplayerModulePrefix = 'exoplayer-'
6
-apply from: new File(gradle.ext.exoplayerRoot, 'core_settings.gradle')