playback: replace headset focus with headset autoplay

Turn the headset focus setting into the headset autoplay setting.

The way auxio handles headsets is...odd. Sometimes the MediaSession
handles it and Auxio could not care less, and sometimes Auxio actually
needs to handle it. As a result, the idea of being able to disable
headset focus is more or less moot because it will only apply to some
devices and not others.

On the other end, the way Auxio automatically begins playback once a
headset is plugged in is also quite weird. It only works on wired
headsets, and when it does, it overrides all other apps that might
also be playing audio. It's not to say that it's a bad feature, but
it's also one that I don't want to make the defualt. Auxio should
still play along within the confines of Android's expectations, after
all.

Replacing the existing "Headset focus" setting with a new "Headset
autoplay" setting solves both of these issues, as it prevents a
mis-guided disabling of the setting that doesn't actually disable
the feature and it relegates the quirky autoplay behavior to an
setting not enabled by default.
This commit is contained in:
OxygenCobalt
2022-03-05 20:34:12 -07:00
parent 6d003c308b
commit 1b791074ec
29 changed files with 140 additions and 166 deletions
@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layout>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:parentTag="android.widget.FrameLayout">
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/shuffle_fab"
style="@style/Widget.Auxio.FloatingActionButton.Adaptive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/spacing_medium"
android:contentDescription="@string/desc_shuffle_all"
android:src="@drawable/ic_shuffle"
app:icon="@drawable/ic_shuffle" />
</merge>
</layout>
+1 -3
View File
@@ -83,10 +83,8 @@
<string name="set_audio">صوتيات</string>
<string name="set_focus">تركيز الصوت</string>
<string name="set_focus_desc">ايقاف مؤقت عند تشغيل صوت آخر (كالمكالمات)</string>
<string name="set_plug_mgt">تركيز السماعة</string>
<string name="set_plug_mgt_desc">تشغيل/ايقاف مؤقت عند حدوث تغيير في اتصال السماعة</string>
<string name="set_replay_gain">صخب الصوت (تجريبي)</string>
<string name="set_replay_gain_off">اطفاء</string>
<string name="set_off">اطفاء</string>
<string name="set_replay_gain_track">تفضيل المقطع</string>
<string name="set_replay_gain_album">تفضيل الالبوم</string>
<string name="set_replay_gain_dynamic">ديناميكي</string>
-2
View File
@@ -67,8 +67,6 @@
<string name="set_audio">"Zvuk"</string>
<string name="set_focus">"Zaměření zvuku"</string>
<string name="set_focus_desc">Pozastavit při přehrávání jiného zvuku (např. hovor)</string>
<string name="set_plug_mgt">"Zaměření sluchátek"</string>
<string name="set_plug_mgt_desc">"Přehrát/pozastavit při změně připojení sluchátek"</string>
<string name="set_behavior">"Chování"</string>
<string name="set_song_mode">"Když je vybrána skladba"</string>
<string name="set_keep_shuffle">"Zapamatovat si náhodné přehrávání"</string>
+2 -5
View File
@@ -71,10 +71,8 @@
<string name="set_audio">Audio</string>
<string name="set_focus">Audiofokus</string>
<string name="set_focus_desc">Pausieren wenn andere Töne abspielt wird [Bsp. Anrufe]</string>
<string name="set_plug_mgt">Kopfhörerfokus</string>
<string name="set_plug_mgt_desc">Abspielen/Pausieren wenn sich die Kopfhörerverbindung ändert</string>
<string name="set_replay_gain">ReplayGain (Experimentell)</string>
<string name="set_replay_gain_off">Aus</string>
<string name="set_off">Aus</string>
<string name="set_replay_gain_track">Titel bevorzugen</string>
<string name="set_replay_gain_album">Album bevorzugen</string>
@@ -151,7 +149,7 @@
<item quantity="other">%d Alben</item>
</plurals>
<string name="info_app_desc">Ein einfacher, rationaler Musikplayer für Android.</string>
<string name="info_widget_desc">Spielende Musik anzeigen und kontrollieren</string>
<string name="info_widget_desc">Musikwiedergabe anzeigen und kontrollieren</string>
<string name="lbl_sort_artist">Künstler</string>
<string name="lbl_sort_album">Album</string>
<string name="lbl_sort_year">Jahr</string>
@@ -173,5 +171,4 @@
<string name="desc_clear_queue_item">Lied in der Warteschlange löschen</string>
<string name="desc_tab_handle">Tab versetzen</string>
<string name="def_artist">Unbekannter Künstler</string>
</resources>
+1 -3
View File
@@ -83,10 +83,8 @@
<string name="set_audio">Sonido</string>
<string name="set_focus">Enfoque de sonido</string>
<string name="set_focus_desc">Pausar cuando se reproduce otro sonido (Ej: llamadas)</string>
<string name="set_plug_mgt">Enfoque de auriculares</string>
<string name="set_plug_mgt_desc">Reproducir/Pausar dependiendo de la conexión de auriculares</string>
<string name="set_replay_gain">ReplayGain (Experimental)</string>
<string name="set_replay_gain_off">Desactivado</string>
<string name="set_off">Desactivado</string>
<string name="set_replay_gain_track">Por pista</string>
<string name="set_replay_gain_album">Por álbum</string>
<string name="set_replay_gain_dynamic">Dinámico</string>
-1
View File
@@ -50,7 +50,6 @@
<string name="set_audio">Audio</string>
<string name="set_focus">Audio Focus</string>
<string name="set_plug_mgt">Branchement du casque</string>
<string name="set_behavior">Comportement</string>
-1
View File
@@ -41,7 +41,6 @@
<string name="set_audio">ऑडियो</string>
<string name="set_focus">ऑडियो फोकस</string>
<string name="set_plug_mgt">हेडसेट प्लग</string>
<string name="set_behavior">चाल चलन</string>
-1
View File
@@ -49,7 +49,6 @@
<string name="set_audio">Hang</string>
<string name="set_focus">Hangfókusz</string>
<string name="set_plug_mgt">Fejhallgató csatlakozó</string>
<string name="set_behavior">Működés</string>
-1
View File
@@ -50,7 +50,6 @@
<string name="set_audio">Audio</string>
<string name="set_focus">Focus audio</string>
<string name="set_plug_mgt">Inserimento cuffie</string>
<string name="set_behavior">Comportamento</string>
<string name="set_keep_shuffle">Ricorda casuale</string>
-1
View File
@@ -48,7 +48,6 @@
<string name="set_audio">오디오</string>
<string name="set_focus">오디오 포커스</string>
<string name="set_plug_mgt">헤드셋 연결</string>
<string name="set_behavior">동작</string>
-2
View File
@@ -72,8 +72,6 @@
<string name="set_audio">Audio</string>
<string name="set_focus">Audiofocus</string>
<string name="set_focus_desc">Pauze wanneer andere audio speelt (ex. Gesprekken)</string>
<string name="set_plug_mgt">Headset-pluggen</string>
<string name="set_plug_mgt_desc">Afspelen/Pauzeren wanneer de headsetaansluiting verandert</string>
<string name="set_behavior">Gedrag</string>
<string name="set_song_mode">Wanneer een liedje is geselecteerd</string>
-1
View File
@@ -49,7 +49,6 @@
<string name="set_audio">Dźwięk</string>
<string name="set_focus">Wyciszanie otoczenia</string>
<string name="set_plug_mgt">Podłączanie słuchawek</string>
<string name="set_behavior">Zachowanie</string>
@@ -49,7 +49,6 @@
<string name="set_audio">Áudio</string>
<string name="set_focus">Foco do áudio</string>
<string name="set_plug_mgt">Entrada do fone de ouvido</string>
<string name="set_behavior">Comportamento</string>
<string name="set_keep_shuffle">Memorizar aleatorização</string>
@@ -50,7 +50,6 @@
<string name="set_audio">Áudio</string>
<string name="set_focus">Foco de áudio</string>
<string name="set_plug_mgt">Entrada do fone de ouvido</string>
<string name="set_behavior">Comportamento</string>
<string name="set_keep_shuffle">Memorizar aleatorização</string>
-1
View File
@@ -50,7 +50,6 @@
<string name="set_audio">Audio</string>
<string name="set_focus">Concentrare audio</string>
<string name="set_plug_mgt">Conexiune cu cască</string>
<string name="set_behavior">Comportament</string>
+1 -3
View File
@@ -83,10 +83,8 @@
<string name="set_audio">Звук</string>
<string name="set_focus">Аудио-фокус</string>
<string name="set_focus_desc">Ставить на паузу при звонках</string>
<string name="set_plug_mgt">Гарнитурный фокус</string>
<string name="set_plug_mgt_desc">Ставить на паузу при отключении гарнитуры</string>
<string name="set_replay_gain">ReplayGain (экспериментально)</string>
<string name="set_replay_gain_off">Выкл.</string>
<string name="set_off">Выкл.</string>
<string name="set_replay_gain_track">По треку</string>
<string name="set_replay_gain_album">По альбому</string>
<string name="set_replay_gain_dynamic">Динамический</string>
+1 -3
View File
@@ -83,10 +83,8 @@
<string name="set_audio">音频</string>
<string name="set_focus">音频焦点</string>
<string name="set_focus_desc">有其它音频播放(比如电话)时暂停</string>
<string name="set_plug_mgt">设备焦点</string>
<string name="set_plug_mgt_desc">设备连接状态改变时播放/暂停</string>
<string name="set_replay_gain">回放增益</string>
<string name="set_replay_gain_off">关</string>
<string name="set_off">关</string>
<string name="set_replay_gain_track">偏好曲目</string>
<string name="set_replay_gain_album">偏好专辑</string>
<string name="set_replay_gain_dynamic">动态</string>
@@ -48,7 +48,6 @@
<string name="set_audio">音訊</string>
<string name="set_focus">音頻焦點</string>
<string name="set_plug_mgt">耳機插頭</string>
<string name="set_behavior">行為</string>
<string name="set_keep_shuffle">記住隨機播放</string>
+1 -1
View File
@@ -30,7 +30,7 @@
</string-array>
<array name="entries_replay_gain">
<item>@string/set_replay_gain_off</item>
<item>@string/set_off</item>
<item>@string/set_replay_gain_track</item>
<item>@string/set_replay_gain_album</item>
<item>@string/set_replay_gain_dynamic</item>
+5 -5
View File
@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
<!-- Info namespace | App labels -->
<string name="info_app_desc">A simple, rational music player for android.</string>
<string name="info_channel_name">Music Playback</string>
<string name="info_widget_desc">View and control playing music</string>
<string name="info_widget_desc">View and control music playback</string>
<!-- Label Namespace | Static Labels -->
<string name="lbl_retry">Retry</string>
@@ -83,10 +82,9 @@
<string name="set_audio">Audio</string>
<string name="set_focus">Audio focus</string>
<string name="set_focus_desc">Pause when other audio plays (ex. Calls)</string>
<string name="set_plug_mgt">Headset focus</string>
<string name="set_plug_mgt_desc">Play/Pause when the headset connection changes</string>
<string name="set_headset_autoplay">Headset autoplay</string>
<string name="set_headset_autoplay_desc">Always start playing when a headset is connected (may not work on all devices)</string>
<string name="set_replay_gain">ReplayGain (Experimental)</string>
<string name="set_replay_gain_off">Off</string>
<string name="set_replay_gain_track">Prefer track</string>
<string name="set_replay_gain_album">Prefer album</string>
<string name="set_replay_gain_dynamic">Dynamic</string>
@@ -108,6 +106,8 @@
<string name="set_excluded">Excluded folders</string>
<string name="set_excluded_desc">The content of excluded folders is hidden from your library</string>
<string name="set_off">Off</string>
<!-- Error Namespace | Error Labels -->
<string name="err_no_music">No music found</string>
<string name="err_load_failed">Music loading failed</string>
+4 -4
View File
@@ -87,11 +87,11 @@
app:title="@string/set_focus" />
<org.oxycblt.auxio.settings.pref.M3SwitchPreference
app:defaultValue="true"
app:defaultValue="false"
app:iconSpaceReserved="false"
app:key="KEY_PLUG_MGT"
app:summary="@string/set_plug_mgt_desc"
app:title="@string/set_plug_mgt" />
app:key="auxio_headset_autoplay"
app:summary="@string/set_headset_autoplay_desc"
app:title="@string/set_headset_autoplay" />
<org.oxycblt.auxio.settings.pref.IntListPreference
app:defaultValue="@integer/replay_gain_off"