From 4a00494647836fa34055a7a10cf8e1cd81a89c6f Mon Sep 17 00:00:00 2001 From: tzugen Date: Wed, 4 May 2022 11:24:07 +0200 Subject: [PATCH] Readd Headphone plug and Bluetooth listeners --- ultrasonic/src/main/AndroidManifest.xml | 8 ++ .../receiver/BluetoothIntentReceiver.java | 100 ++++++++++++++++++ .../ultrasonic/fragment/SettingsFragment.kt | 71 +++++++++++++ .../service/MediaPlayerLifecycleSupport.kt | 46 ++++++++ .../org/moire/ultrasonic/util/Constants.kt | 5 + .../org/moire/ultrasonic/util/Settings.kt | 14 +++ .../moire/ultrasonic/util/SettingsDelegate.kt | 4 + ultrasonic/src/main/res/values-cs/strings.xml | 7 ++ ultrasonic/src/main/res/values-de/strings.xml | 7 ++ ultrasonic/src/main/res/values-es/strings.xml | 7 ++ ultrasonic/src/main/res/values-fr/strings.xml | 7 ++ ultrasonic/src/main/res/values-hu/strings.xml | 7 ++ ultrasonic/src/main/res/values-it/strings.xml | 2 + ultrasonic/src/main/res/values-nl/strings.xml | 7 ++ ultrasonic/src/main/res/values-pl/strings.xml | 7 ++ .../src/main/res/values-pt-rBR/strings.xml | 7 ++ ultrasonic/src/main/res/values-pt/strings.xml | 7 ++ ultrasonic/src/main/res/values-ru/strings.xml | 7 ++ .../src/main/res/values-zh-rCN/strings.xml | 7 ++ .../src/main/res/values-zh-rTW/strings.xml | 1 + ultrasonic/src/main/res/values/arrays.xml | 5 + .../src/main/res/values/setting_keys.xml | 4 + ultrasonic/src/main/res/values/strings.xml | 7 ++ ultrasonic/src/main/res/xml/settings.xml | 14 +++ 24 files changed, 358 insertions(+) create mode 100644 ultrasonic/src/main/java/org/moire/ultrasonic/receiver/BluetoothIntentReceiver.java create mode 100644 ultrasonic/src/main/res/values/setting_keys.xml diff --git a/ultrasonic/src/main/AndroidManifest.xml b/ultrasonic/src/main/AndroidManifest.xml index 27946252..a421856c 100644 --- a/ultrasonic/src/main/AndroidManifest.xml +++ b/ultrasonic/src/main/AndroidManifest.xml @@ -83,6 +83,14 @@ + + + + + + + + diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/receiver/BluetoothIntentReceiver.java b/ultrasonic/src/main/java/org/moire/ultrasonic/receiver/BluetoothIntentReceiver.java new file mode 100644 index 00000000..cf7844e7 --- /dev/null +++ b/ultrasonic/src/main/java/org/moire/ultrasonic/receiver/BluetoothIntentReceiver.java @@ -0,0 +1,100 @@ +/* + This file is part of Subsonic. + + Subsonic is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Subsonic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Subsonic. If not, see . + + Copyright 2010 (C) Sindre Mehus + */ +package org.moire.ultrasonic.receiver; + +import android.annotation.SuppressLint; +import android.bluetooth.BluetoothDevice; +import android.bluetooth.BluetoothProfile; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; + +import org.moire.ultrasonic.util.Constants; +import org.moire.ultrasonic.util.Settings; + +import timber.log.Timber; + +/** + * Resume or pause playback on Bluetooth A2DP connect/disconnect. + * + * @author Sindre Mehus + */ +@SuppressLint("MissingPermission") +public class BluetoothIntentReceiver extends BroadcastReceiver +{ + @Override + public void onReceive(Context context, Intent intent) + { + int state = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, -1); + BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); + String action = intent.getAction(); + String name = device != null ? device.getName() : "Unknown"; + String address = device != null ? device.getAddress() : "Unknown"; + + Timber.d("A2DP State: %d; Action: %s; Device: %s; Address: %s", state, action, name, address); + + boolean actionBluetoothDeviceConnected = false; + boolean actionBluetoothDeviceDisconnected = false; + boolean actionA2dpConnected = false; + boolean actionA2dpDisconnected = false; + + if (BluetoothDevice.ACTION_ACL_CONNECTED.equals(action)) + { + actionBluetoothDeviceConnected = true; + } + else if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action) || BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED.equals(action)) + { + actionBluetoothDeviceDisconnected = true; + } + + if (state == android.bluetooth.BluetoothA2dp.STATE_CONNECTED) actionA2dpConnected = true; + else if (state == android.bluetooth.BluetoothA2dp.STATE_DISCONNECTED) actionA2dpDisconnected = true; + + boolean resume = false; + boolean pause = false; + + switch (Settings.getResumeOnBluetoothDevice()) + { + case Constants.PREFERENCE_VALUE_ALL: resume = actionA2dpConnected || actionBluetoothDeviceConnected; + break; + case Constants.PREFERENCE_VALUE_A2DP: resume = actionA2dpConnected; + break; + } + + switch (Settings.getPauseOnBluetoothDevice()) + { + case Constants.PREFERENCE_VALUE_ALL: pause = actionA2dpDisconnected || actionBluetoothDeviceDisconnected; + break; + case Constants.PREFERENCE_VALUE_A2DP: pause = actionA2dpDisconnected; + break; + } + + if (resume) + { + Timber.i("Connected to Bluetooth device %s address %s, resuming playback.", name, address); + context.sendBroadcast(new Intent(Constants.CMD_RESUME_OR_PLAY).setPackage(context.getPackageName())); + } + + if (pause) + { + Timber.i("Disconnected from Bluetooth device %s address %s, requesting pause.", name, address); + context.sendBroadcast(new Intent(Constants.CMD_PAUSE).setPackage(context.getPackageName())); + } + } +} diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/SettingsFragment.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/SettingsFragment.kt index 70374c21..70bc45d0 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/SettingsFragment.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/SettingsFragment.kt @@ -12,6 +12,7 @@ import android.os.Bundle import android.provider.DocumentsContract import android.provider.SearchRecentSuggestions import android.view.View +import androidx.annotation.StringRes import androidx.fragment.app.DialogFragment import androidx.preference.CheckBoxPreference import androidx.preference.EditTextPreference @@ -78,6 +79,8 @@ class SettingsFragment : private var sharingDefaultDescription: EditTextPreference? = null private var sharingDefaultGreeting: EditTextPreference? = null private var sharingDefaultExpiration: TimeSpanPreference? = null + private var resumeOnBluetoothDevice: Preference? = null + private var pauseOnBluetoothDevice: Preference? = null private var debugLogToFile: CheckBoxPreference? = null private var customCacheLocation: CheckBoxPreference? = null @@ -113,6 +116,9 @@ class SettingsFragment : sharingDefaultGreeting = findPreference(Constants.PREFERENCES_KEY_DEFAULT_SHARE_GREETING) sharingDefaultExpiration = findPreference(Constants.PREFERENCES_KEY_DEFAULT_SHARE_EXPIRATION) + resumeOnBluetoothDevice = + findPreference(Constants.PREFERENCES_KEY_RESUME_ON_BLUETOOTH_DEVICE) + pauseOnBluetoothDevice = findPreference(Constants.PREFERENCES_KEY_PAUSE_ON_BLUETOOTH_DEVICE) debugLogToFile = findPreference(Constants.PREFERENCES_KEY_DEBUG_LOG_TO_FILE) showArtistPicture = findPreference(Constants.PREFERENCES_KEY_SHOW_ARTIST_PICTURE) customCacheLocation = findPreference(Constants.PREFERENCES_KEY_CUSTOM_CACHE_LOCATION) @@ -120,6 +126,7 @@ class SettingsFragment : sharingDefaultGreeting?.text = shareGreeting setupClearSearchPreference() setupCacheLocationPreference() + setupBluetoothDevicePreferences() } override fun onActivityCreated(savedInstanceState: Bundle?) { @@ -253,6 +260,70 @@ class SettingsFragment : startActivityForResult(intent, SELECT_CACHE_ACTIVITY) } + private fun setupBluetoothDevicePreferences() { + val resumeSetting = Settings.resumeOnBluetoothDevice + val pauseSetting = Settings.pauseOnBluetoothDevice + resumeOnBluetoothDevice!!.summary = bluetoothDevicePreferenceToString(resumeSetting) + pauseOnBluetoothDevice!!.summary = bluetoothDevicePreferenceToString(pauseSetting) + resumeOnBluetoothDevice!!.onPreferenceClickListener = + Preference.OnPreferenceClickListener { + showBluetoothDevicePreferenceDialog( + R.string.settings_playback_resume_on_bluetooth_device, + Settings.resumeOnBluetoothDevice + ) { choice: Int -> + Settings.resumeOnBluetoothDevice = choice + resumeOnBluetoothDevice!!.summary = bluetoothDevicePreferenceToString(choice) + } + true + } + pauseOnBluetoothDevice!!.onPreferenceClickListener = + Preference.OnPreferenceClickListener { + showBluetoothDevicePreferenceDialog( + R.string.settings_playback_pause_on_bluetooth_device, + Settings.pauseOnBluetoothDevice + ) { choice: Int -> + Settings.pauseOnBluetoothDevice = choice + pauseOnBluetoothDevice!!.summary = bluetoothDevicePreferenceToString(choice) + } + true + } + } + + private fun showBluetoothDevicePreferenceDialog( + @StringRes title: Int, + defaultChoice: Int, + onChosen: (Int) -> Unit + ) { + val choice = intArrayOf(defaultChoice) + AlertDialog.Builder(activity).setTitle(title) + .setSingleChoiceItems( + R.array.bluetoothDeviceSettingNames, defaultChoice + ) { _: DialogInterface?, i: Int -> choice[0] = i } + .setNegativeButton(R.string.common_cancel) { dialogInterface: DialogInterface, _: Int -> + dialogInterface.cancel() + } + .setPositiveButton(R.string.common_ok) { dialogInterface: DialogInterface, _: Int -> + onChosen(choice[0]) + dialogInterface.dismiss() + } + .create().show() + } + + private fun bluetoothDevicePreferenceToString(preferenceValue: Int): String { + return when (preferenceValue) { + Constants.PREFERENCE_VALUE_ALL -> { + getString(R.string.settings_playback_bluetooth_all) + } + Constants.PREFERENCE_VALUE_A2DP -> { + getString(R.string.settings_playback_bluetooth_a2dp) + } + Constants.PREFERENCE_VALUE_DISABLED -> { + getString(R.string.settings_playback_bluetooth_disabled) + } + else -> "" + } + } + private fun setupClearSearchPreference() { val clearSearchPreference = findPreference(Constants.PREFERENCES_KEY_CLEAR_SEARCH_HISTORY) diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/MediaPlayerLifecycleSupport.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/MediaPlayerLifecycleSupport.kt index dfdbeac3..68701102 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/MediaPlayerLifecycleSupport.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/MediaPlayerLifecycleSupport.kt @@ -7,12 +7,18 @@ package org.moire.ultrasonic.service +import android.content.BroadcastReceiver +import android.content.Context import android.content.Intent +import android.content.IntentFilter +import android.media.AudioManager import android.view.KeyEvent import org.koin.core.component.KoinComponent import org.koin.core.component.inject +import org.moire.ultrasonic.app.UApp.Companion.applicationContext import org.moire.ultrasonic.util.CacheCleaner import org.moire.ultrasonic.util.Constants +import org.moire.ultrasonic.util.Settings import org.moire.ultrasonic.util.Util.ifNotNull import timber.log.Timber @@ -24,6 +30,7 @@ class MediaPlayerLifecycleSupport : KoinComponent { private val mediaPlayerController by inject() private var created = false + private var headsetEventReceiver: BroadcastReceiver? = null fun onCreate() { onCreate(false, null) @@ -40,6 +47,8 @@ class MediaPlayerLifecycleSupport : KoinComponent { restoreLastSession(autoPlay, afterRestore) } + registerHeadsetReceiver() + CacheCleaner().clean() created = true Timber.i("LifecycleSupport created") @@ -73,6 +82,7 @@ class MediaPlayerLifecycleSupport : KoinComponent { ) mediaPlayerController.clear(false) + applicationContext().unregisterReceiver(headsetEventReceiver) mediaPlayerController.onDestroy() created = false @@ -98,6 +108,42 @@ class MediaPlayerLifecycleSupport : KoinComponent { } } + /** + * The Headset Intent Receiver is responsible for resuming playback when a headset is inserted + * and pausing it when it is removed. + * Unfortunately this Intent can't be registered in the AndroidManifest, so it works only + * while Ultrasonic is running. + */ + private fun registerHeadsetReceiver() { + + headsetEventReceiver = object : BroadcastReceiver() { + override fun onReceive(context: Context, intent: Intent) { + val extras = intent.extras ?: return + + Timber.i("Headset event for: %s", extras["name"]) + + val state = extras.getInt("state") + + if (state == 0) { + if (!mediaPlayerController.isJukeboxEnabled) { + mediaPlayerController.pause() + } + } else if (state == 1) { + if (!mediaPlayerController.isJukeboxEnabled && + Settings.resumePlayOnHeadphonePlug && !mediaPlayerController.isPlaying + ) { + mediaPlayerController.prepare() + mediaPlayerController.play() + } + } + } + } + + val headsetIntentFilter = IntentFilter(AudioManager.ACTION_HEADSET_PLUG) + + applicationContext().registerReceiver(headsetEventReceiver, headsetIntentFilter) + } + @Suppress("MagicNumber", "ComplexMethod") private fun handleKeyEvent(event: KeyEvent) { diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/Constants.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/Constants.kt index 687282b3..75b349b4 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/Constants.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/Constants.kt @@ -100,8 +100,13 @@ object Constants { const val PREFERENCES_KEY_HARDWARE_OFFLOAD = "use_hw_offload" const val PREFERENCES_KEY_CATEGORY_NOTIFICATIONS = "notificationsCategory" const val PREFERENCES_KEY_FIRST_RUN_EXECUTED = "firstRunExecuted" + const val PREFERENCES_KEY_RESUME_ON_BLUETOOTH_DEVICE = "resumeOnBluetoothDevice" + const val PREFERENCES_KEY_PAUSE_ON_BLUETOOTH_DEVICE = "pauseOnBluetoothDevice" const val PREFERENCES_KEY_DEBUG_LOG_TO_FILE = "debugLogToFile" const val PREFERENCES_KEY_OVERRIDE_LANGUAGE = "overrideLanguage" + const val PREFERENCE_VALUE_ALL = 0 + const val PREFERENCE_VALUE_A2DP = 1 + const val PREFERENCE_VALUE_DISABLED = 2 const val FILENAME_PLAYLIST_SER = "downloadstate.ser" const val ALBUM_ART_FILE = "folder.jpeg" const val STARRED = "starred" diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/Settings.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/Settings.kt index c62e1ce5..356fca5c 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/Settings.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/Settings.kt @@ -131,6 +131,20 @@ object Settings { @JvmStatic var mediaButtonsEnabled by BooleanSetting(Constants.PREFERENCES_KEY_MEDIA_BUTTONS, true) + var resumePlayOnHeadphonePlug + by BooleanSetting(R.string.setting_keys_resume_play_on_headphones_plug, true) + + @JvmStatic + var resumeOnBluetoothDevice by IntSetting( + Constants.PREFERENCES_KEY_RESUME_ON_BLUETOOTH_DEVICE, + Constants.PREFERENCE_VALUE_DISABLED + ) + + @JvmStatic + var pauseOnBluetoothDevice by IntSetting( + Constants.PREFERENCES_KEY_PAUSE_ON_BLUETOOTH_DEVICE, + Constants.PREFERENCE_VALUE_A2DP + ) @JvmStatic var showNowPlaying diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/SettingsDelegate.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/SettingsDelegate.kt index 3e24864e..03cfbd31 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/SettingsDelegate.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/util/SettingsDelegate.kt @@ -76,4 +76,8 @@ class BooleanSetting(private val key: String, private val defaultValue: Boolean override fun setValue(thisRef: Any, property: KProperty<*>, value: Boolean) = sharedPreferences.edit { putBoolean(key, value) } + + constructor(stringId: Int, defaultValue: Boolean = false) : this( + Util.appContext().getString(stringId), defaultValue + ) } diff --git a/ultrasonic/src/main/res/values-cs/strings.xml b/ultrasonic/src/main/res/values-cs/strings.xml index 5e8dd6ef..70334b12 100644 --- a/ultrasonic/src/main/res/values-cs/strings.xml +++ b/ultrasonic/src/main/res/values-cs/strings.xml @@ -222,6 +222,8 @@ 3 skladby 5 skladeb Neomezeně + Pokračovat po připojení sluchátek + Aplikace spustí pozastavené přehrávání po připojení kabelu sluchátek do přístroje. 1 10 100 @@ -310,6 +312,11 @@ Zobrazit umělce albumArt Vícenásobné roky + Pokračovat v přehrávání po připojení bluetooth přístroje + Pozastavení přehrávání při odpojení bluetooth přístroje + Všechny bluetooth přístroje + Pouze audio (A2DP) přístroje + Vypnuto Možnosti ladění aplikace Zapisovat logy ladění do souboru Soubory logů jsou dostupné v %1$s/%2$s diff --git a/ultrasonic/src/main/res/values-de/strings.xml b/ultrasonic/src/main/res/values-de/strings.xml index b8f35122..a859a80a 100644 --- a/ultrasonic/src/main/res/values-de/strings.xml +++ b/ultrasonic/src/main/res/values-de/strings.xml @@ -260,6 +260,8 @@ 3 Titel 5 Titel Unbegrenzt + Fortsetzen mit Kopfhörer + Die App setzt eine pausierte Wiedergabe beim Anschließen der Kopfhörer fort. Benutzername und Passwort des Scrobble Service(s) müssen im Server gesetzt sein Gespielte Musik scrobbeln 1 @@ -360,6 +362,11 @@ Künstler*in anzeigen Album Cover Mehrere Jahre + Wiedergabe fortsetzen, wenn ein Bluetooth Gerät verbunden wurde + Wiedergabe pausieren, wenn ein Bluetooth Gerät getrennt wurde + Alle Bluetooth Geräte + Nur Audio (A2DP) Geräte + Deaktiviert Debug Optionen Schreibe Debug Log in Datei Die Log Dateien sind unter %1$s/%2$s verfügbar diff --git a/ultrasonic/src/main/res/values-es/strings.xml b/ultrasonic/src/main/res/values-es/strings.xml index 0a6e78d5..d01cbb81 100644 --- a/ultrasonic/src/main/res/values-es/strings.xml +++ b/ultrasonic/src/main/res/values-es/strings.xml @@ -260,6 +260,8 @@ 3 canciónes 5 canciónes Ilimitado + Reanudar al insertar los auriculares + La aplicación reanudará la reproducción en pausa al insertar los auriculares en el dispositivo. Recuerda configurar tu nombre de usuario y contraseña en los servicios de Scrobble en el servidor Hacer Scrobble de mis reproducciones 1 @@ -360,6 +362,11 @@ Mostrar artista Caratula del Álbum Múltiples años + Reanudar al conectar un dispositivo Bluetooth + Pausar al desconectar un dispositivo Bluetooth + Todos los dispositivos Bluetooth + Solo dispositivos de audio (A2DP) + Deshabilitado Opciones de depuración Escribir registro de depuración en un archivo Los archivos de registro están disponibles en %1$s/%2$s diff --git a/ultrasonic/src/main/res/values-fr/strings.xml b/ultrasonic/src/main/res/values-fr/strings.xml index c70bd81b..309c136d 100644 --- a/ultrasonic/src/main/res/values-fr/strings.xml +++ b/ultrasonic/src/main/res/values-fr/strings.xml @@ -240,6 +240,8 @@ 3 morceaux 5 morceaux Illimité + Reprise à l\'insertion des écouteurs + L\'application reprendra la lecture lors de l\'insertion du casque dans l\'appareil. Pensez à configurer votre nom d’utilisateur et votre mot de passe dans le(s) service(s) Scrobble sur le serveur. Scrobbler mes lectures 1 @@ -337,6 +339,11 @@ Afficher l\'artiste Pochette d\'album Années multiples + Reprendre lorsqu’un appareil Bluetooth se connecte + Mettre en pause lorsqu’un appareil Bluetooth se déconnecte + Tous les appareils Bluetooth + Seulement les appareils audio (A2DP) + Désactivé Paramètres de debug Enregistrer les logs de debug dans des fichiers Les fichiers de log sont disponibles dans %1$s/%2$s diff --git a/ultrasonic/src/main/res/values-hu/strings.xml b/ultrasonic/src/main/res/values-hu/strings.xml index 9e508a6c..117ec7bd 100644 --- a/ultrasonic/src/main/res/values-hu/strings.xml +++ b/ultrasonic/src/main/res/values-hu/strings.xml @@ -228,6 +228,8 @@ 3 dal 5 dal Korlátlan + Folytatás a fejhallgató behelyezésekor + Az alkalmazás folytatja a szüneteltetett lejátszást a fejhallgató behelyezésekor a készülékbe. Ne felejtsd el beállítani a Scrobble szolgáltatónál használt felhasználóneved és jelszavad a szervereden Scrobble engedélyezése 1 @@ -318,6 +320,11 @@ Ugrás az előadóhoz albumArt Több év + Folytatás Bluetooth eszköz csatlakozásakor + Szünet Bluetooth eszköz kikapcsolásakor + Minden Bluetooth eszköz + Csak audio (A2DP) eszközök + Kikapcsolva Hibakeresési lehetőségek Hibakeresési napló írása fájlba A naplófájlok elérhetőek a következő helyen: %1$s/%2$s diff --git a/ultrasonic/src/main/res/values-it/strings.xml b/ultrasonic/src/main/res/values-it/strings.xml index 9253f199..b7fe167f 100644 --- a/ultrasonic/src/main/res/values-it/strings.xml +++ b/ultrasonic/src/main/res/values-it/strings.xml @@ -217,6 +217,7 @@ 3 canzoni 5 canzoni Illimitato + Riprendi all\'inserimento delle cuffie 1 10 100 @@ -278,6 +279,7 @@ Commenta \"%s\" è stato rimosso dalla playlist Condividi canzoni via + Disabilitato Elimina Il periodo di prova è terminato. diff --git a/ultrasonic/src/main/res/values-nl/strings.xml b/ultrasonic/src/main/res/values-nl/strings.xml index e5b3e6a7..850d0a53 100644 --- a/ultrasonic/src/main/res/values-nl/strings.xml +++ b/ultrasonic/src/main/res/values-nl/strings.xml @@ -260,6 +260,8 @@ 3 nummers 5 nummers Ongelimiteerd + Hervatten bij aansluiten van hoofdtelefoon + Het afspelen wordt hervat zodra er een hoofdtelefoon wordt aangesloten. Let op: stel je gebruikersnaam en wachtwoord van je scrobble-dienst(en) in op je Subsonic-server Scrobbelen 1 @@ -360,6 +362,11 @@ Artiest tonen Albumhoes Meerdere jaren + Hervatten bij verbinding met bluetoothapparaat + Pauzeren als verbinding met bluetoothapparaat verbroken is + Alle bluetoothapparaten + Alleen audio-apparaten (AD2P) + Uitgeschakeld Foutopsporingsopties Foutopsporingslogboek bijhouden De logboeken worden opgeslagen in %1$s/%2$s diff --git a/ultrasonic/src/main/res/values-pl/strings.xml b/ultrasonic/src/main/res/values-pl/strings.xml index 7e5e6373..c6031dd2 100644 --- a/ultrasonic/src/main/res/values-pl/strings.xml +++ b/ultrasonic/src/main/res/values-pl/strings.xml @@ -222,6 +222,8 @@ 3 utwory 5 utworów Bez limitu + Wznawiaj po podłączeniu słuchawek + Aplikacja wznowi zatrzymane odtwarzanie po podpięciu słuchawek. 1 10 100 @@ -307,6 +309,11 @@ Wyświetlaj artystę Okładka Z różnych lat + Resume when a Bluetooth device is connected + Pause when a Bluetooth device is disconnected + All Bluetooth devices + Only audio (A2DP) devices + Wyłączone Configured servers Are you sure you want to delete the server? Editing server diff --git a/ultrasonic/src/main/res/values-pt-rBR/strings.xml b/ultrasonic/src/main/res/values-pt-rBR/strings.xml index c8201db1..4fafe9e8 100644 --- a/ultrasonic/src/main/res/values-pt-rBR/strings.xml +++ b/ultrasonic/src/main/res/values-pt-rBR/strings.xml @@ -235,6 +235,8 @@ 3 músicas 5 músicas Ilimitado + Retomar ao Inserir Fone de Ouvido + O aplicativo retomará a reprodução em pausa na inserção dos fones de ouvido no dispositivo Lembre-se de configurar usuário e senha nos serviços Scrobble do servidor Registrar Minhas Músicas 1 @@ -329,6 +331,11 @@ Mostrar Artista albumArt Anos Múltiplos + Retomar ao Conectar Dispositivo Bluetooth + Pausar ao Desconectar Dispositivo Bluetooth + Todos os dispositivos Bluetooth + Somente dispositivos de áudio (A2DP) + Desativado Opções de Depuração Log de Depuração em Arquivo Os arquivos com log estão disponíveis em %1$s/%2$s diff --git a/ultrasonic/src/main/res/values-pt/strings.xml b/ultrasonic/src/main/res/values-pt/strings.xml index 373681e2..33821f9b 100644 --- a/ultrasonic/src/main/res/values-pt/strings.xml +++ b/ultrasonic/src/main/res/values-pt/strings.xml @@ -222,6 +222,8 @@ 3 músicas 5 músicas Ilimitado + Retomar ao inserir Auscultadores + O aplicativo retomará a reprodução em pausa na inserção dos auscultadores no dispositivo. 1 10 100 @@ -307,6 +309,11 @@ Mostrar Artista albumArt Múltiplos Anos + Resume when a Bluetooth device is connected + Pause when a Bluetooth device is disconnected + All Bluetooth devices + Only audio (A2DP) devices + Disabilitando Configured servers Are you sure you want to delete the server? Editing server diff --git a/ultrasonic/src/main/res/values-ru/strings.xml b/ultrasonic/src/main/res/values-ru/strings.xml index 2bbb030a..27ae0982 100644 --- a/ultrasonic/src/main/res/values-ru/strings.xml +++ b/ultrasonic/src/main/res/values-ru/strings.xml @@ -246,6 +246,8 @@ 3 песни 5 песен Неограниченный + Возобновить подключение наушников + Приложение возобновит приостановленное воспроизведение после того, как в устройство будут вставлены проводные наушники. Не забудьте установить своего пользователя и пароль в Скроббл сервисах на сервере. Скробблить мои воспроизведения 1 @@ -336,6 +338,11 @@ Показать исполнителей albumArt Несколько лет + Возобновить при подключении устройства Bluetooth + Пауза при отключении устройства Bluetooth + Все устройства Bluetooth + Только аудио (A2DP) устройства + Отключено Настройки отладки Записать журнал отладки в файл Файлы журнала доступны по адресу %1$s/%2$s diff --git a/ultrasonic/src/main/res/values-zh-rCN/strings.xml b/ultrasonic/src/main/res/values-zh-rCN/strings.xml index 6f20b74f..bcb04683 100644 --- a/ultrasonic/src/main/res/values-zh-rCN/strings.xml +++ b/ultrasonic/src/main/res/values-zh-rCN/strings.xml @@ -240,6 +240,8 @@ 3 首歌 5 首歌 不限制 + 插入耳机时恢复播放 + 应用将在有线耳机插入设备时恢复已暂停的播放。 请记得在服务器上的 Scrobble 服务中设置您的用户名和密码 Scrobble我的播放列表 1 @@ -337,6 +339,11 @@ 显示艺术家 albumArt Multiple Years + 连接蓝牙设备时恢复播放 + 断开蓝牙设备时暂停播放 + 所有蓝牙设备 + 仅音频 (A2DP) 设备 + 已禁用 调试选项 将调试日志写入文件 日志文件可在 %1$s/%2$s 获取 diff --git a/ultrasonic/src/main/res/values-zh-rTW/strings.xml b/ultrasonic/src/main/res/values-zh-rTW/strings.xml index 784f9731..d12844da 100644 --- a/ultrasonic/src/main/res/values-zh-rTW/strings.xml +++ b/ultrasonic/src/main/res/values-zh-rTW/strings.xml @@ -54,5 +54,6 @@ 名稱 已停用 註記 + 已停用 刪除 diff --git a/ultrasonic/src/main/res/values/arrays.xml b/ultrasonic/src/main/res/values/arrays.xml index e645bdd6..511d7be6 100644 --- a/ultrasonic/src/main/res/values/arrays.xml +++ b/ultrasonic/src/main/res/values/arrays.xml @@ -231,6 +231,11 @@ @string/settings.share_hours @string/settings.share_days + + @string/settings.playback.bluetooth_all + @string/settings.playback.bluetooth_a2dp + @string/settings.playback.bluetooth_disabled + @string/language.default @string/language.zh_CN diff --git a/ultrasonic/src/main/res/values/setting_keys.xml b/ultrasonic/src/main/res/values/setting_keys.xml new file mode 100644 index 00000000..3378560d --- /dev/null +++ b/ultrasonic/src/main/res/values/setting_keys.xml @@ -0,0 +1,4 @@ + + + playback.resume_play_on_headphones_plug + \ No newline at end of file diff --git a/ultrasonic/src/main/res/values/strings.xml b/ultrasonic/src/main/res/values/strings.xml index 5ca00267..4ace333f 100644 --- a/ultrasonic/src/main/res/values/strings.xml +++ b/ultrasonic/src/main/res/values/strings.xml @@ -256,6 +256,13 @@ Override the language You need to restart the app after changing the language Playback Control Settings + Resume when a Bluetooth device is connected + Pause when a Bluetooth device is disconnected + All Bluetooth devices + Only audio (A2DP) devices + Disabled + Resume on headphones insertion + App will resume paused playback on wired headphones insertion into device. Songs To Preload 1 song 10 songs diff --git a/ultrasonic/src/main/res/xml/settings.xml b/ultrasonic/src/main/res/xml/settings.xml index 7eb7dc81..04f81008 100644 --- a/ultrasonic/src/main/res/xml/settings.xml +++ b/ultrasonic/src/main/res/xml/settings.xml @@ -90,6 +90,20 @@ a:key="incrementTime" a:title="@string/settings.increment_time" app:iconSpaceReserved="false"/> + + +