소스 검색

Fix : autoplay as setting, sensor to fullUser, close button, keep volume

yattoz 4 년 전
부모
커밋
f2f338f1d4

+ 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
 

+ 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")

+ 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) {

+ 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>

BIN
app/src/main/res/drawable-hdpi/ic_close.png 파일 보기


BIN
app/src/main/res/drawable-mdpi/ic_close.png 파일 보기


BIN
app/src/main/res/drawable-xhdpi/ic_close.png 파일 보기


BIN
app/src/main/res/drawable-xxhdpi/ic_close.png 파일 보기


+ 1 - 0
app/src/main/res/values-fr/strings.xml 파일 보기

@@ -54,5 +54,6 @@
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>
57 58
 
58 59
 </resources>

+ 1 - 0
app/src/main/res/values/strings.xml 파일 보기

@@ -74,5 +74,6 @@
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>
77 78
 
78 79
 </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"