Fix : autoplay as setting, sensor to fullUser, close button, keep volume
parent
177acaddfe
commit
f2f338f1d4
|
|
@ -48,7 +48,7 @@
|
|||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="fullSensor">
|
||||
android:screenOrientation="fullUser">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class NowPlayingNotification(
|
|||
|
||||
mediaStyle = androidx.media.app.NotificationCompat.DecoratedMediaCustomViewStyle().also {
|
||||
it.setMediaSession(m.sessionToken)
|
||||
it.setShowActionsInCompactView(0) // index 0 = show actions 0 and 1 (show action #0 (play/pause))
|
||||
it.setShowActionsInCompactView(0, 1) // index 0 = show actions 0 and 1 (show action #0 (play/pause))
|
||||
it.setCancelButtonIntent(deleteIntent)
|
||||
}
|
||||
builder.setStyle(mediaStyle)
|
||||
|
|
@ -83,7 +83,7 @@ class NowPlayingNotification(
|
|||
val intent2 = Intent(c, RadioService::class.java)
|
||||
intent2.putExtra("action", Actions.KILL.name)
|
||||
val pendingButtonIntent = PendingIntent.getService(c, 2, intent2, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val stopAction = NotificationCompat.Action.Builder(R.drawable.ic_stop,"Stop", pendingButtonIntent).build()
|
||||
val stopAction = NotificationCompat.Action.Builder(R.drawable.ic_close,"Stop", pendingButtonIntent).build()
|
||||
builder.addAction(stopAction)
|
||||
|
||||
if (isRinging) {
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class RadioService : MediaBrowserServiceCompat() {
|
|||
}
|
||||
1 -> {
|
||||
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "Headset is plugged")
|
||||
headsetPluggedIn = true
|
||||
headsetPluggedIn = true && PreferenceManager.getDefaultSharedPreferences(context).getBoolean("autoStartOnPlug", false)
|
||||
}
|
||||
else -> {
|
||||
//[REMOVE LOG CALLS]Log.d(tag, radioTag + "I have no idea what the headset state is")
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
package fr.forum_thalie.tsumugi.ui.nowplaying
|
||||
|
||||
import android.widget.SeekBar
|
||||
import androidx.core.content.edit
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import fr.forum_thalie.tsumugi.playerstore.PlayerStore
|
||||
import fr.forum_thalie.tsumugi.preferenceStore
|
||||
|
||||
class NowPlayingViewModel: ViewModel() {
|
||||
|
||||
|
|
@ -21,6 +23,10 @@ class NowPlayingViewModel: ViewModel() {
|
|||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||
// updated continuously as the user slides the thumb
|
||||
PlayerStore.instance.volume.value = progress
|
||||
preferenceStore.edit {
|
||||
putInt("volume", progress)
|
||||
commit()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="#FFFFFF"
|
||||
android:alpha="0.8">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
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"/>
|
||||
</vector>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 205 B |
Binary file not shown.
|
After Width: | Height: | Size: 157 B |
Binary file not shown.
|
After Width: | Height: | Size: 235 B |
Binary file not shown.
|
After Width: | Height: | Size: 318 B |
|
|
@ -54,5 +54,6 @@
|
|||
<string name="fetchPeriod">Choisir la fréquence de mise à jour quand la radio est stoppée</string>
|
||||
<string name="refreshing">Actualisation…</string>
|
||||
<string name="action_refresh">Raffraîchir les données</string>
|
||||
<string name="autoPlay">\"Play\" au branchement de la prise casque</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -74,5 +74,6 @@
|
|||
<string name="fetchPeriod">Set update period when stopped</string>
|
||||
<string name="refreshing">Refreshing data…</string>
|
||||
<string name="action_refresh">Refresh data</string>
|
||||
<string name="autoPlay">Auto play when plugging headphones</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<!--
|
||||
<SeekBarPreference
|
||||
app:key="volume"
|
||||
app:iconSpaceReserved="false"
|
||||
|
|
@ -12,6 +12,14 @@
|
|||
android:defaultValue="100"
|
||||
app:showSeekBarValue="true"
|
||||
/>
|
||||
-->
|
||||
<SwitchPreferenceCompat
|
||||
app:key="autoStartOnPlug"
|
||||
app:iconSpaceReserved="false"
|
||||
app:title="@string/autoPlay"
|
||||
app:singleLineTitle="false"
|
||||
app:defaultValue="false"
|
||||
/>
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:key="splitLayout"
|
||||
|
|
|
|||
Loading…
Reference in New Issue