updated name of the preference to use 'FocusLoss' rather than 'Notifications' to more accurately reflect what it does
This commit is contained in:
parent
3f8e6c26a3
commit
bd4c365c11
|
@ -250,7 +250,7 @@
|
|||
<string name="folder_not_empty_dialog_title">Folder is not empty</string>
|
||||
<string name="folder_not_empty_dialog_msg">The folder you have selected is not empty. Media downloads and other files will be placed directly in this folder. Continue anyway?</string>
|
||||
<string name="set_to_default_folder">Choose default folder</string>
|
||||
<string name="pref_pausePlaybackForNotifications_sum">Pause playback instead of lowering volume when another app wants to play sounds</string>
|
||||
<string name="pref_pausePlaybackForNotifications_title">Pause for notifications</string>
|
||||
<string name="pref_pausePlaybackForFocusLoss_sum">Pause playback instead of lowering volume when another app wants to play sounds</string>
|
||||
<string name="pref_pausePlaybackForFocusLoss_title">Pause for interruptions</string>
|
||||
|
||||
</resources>
|
|
@ -20,9 +20,9 @@
|
|||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:enabled="true"
|
||||
android:key="prefPauseForNotifications"
|
||||
android:summary="@string/pref_pausePlaybackForNotifications_sum"
|
||||
android:title="@string/pref_pausePlaybackForNotifications_title" />
|
||||
android:key="prefPauseForFocusLoss"
|
||||
android:summary="@string/pref_pausePlaybackForFocusLoss_sum"
|
||||
android:title="@string/pref_pausePlaybackForFocusLoss_title" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/network_pref" >
|
||||
<ListPreference
|
||||
|
|
|
@ -41,7 +41,7 @@ public class UserPreferences implements
|
|||
public static final String PREF_ENABLE_AUTODL_WIFI_FILTER = "prefEnableAutoDownloadWifiFilter";
|
||||
private static final String PREF_AUTODL_SELECTED_NETWORKS = "prefAutodownloadSelectedNetworks";
|
||||
public static final String PREF_EPISODE_CACHE_SIZE = "prefEpisodeCacheSize";
|
||||
public static final String PREF_PAUSE_PLAYBACK_FOR_NOTIFICATIONS = "prefPauseForNotifications";
|
||||
public static final String PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS = "prefPauseForFocusLoss";
|
||||
|
||||
private static int EPISODE_CACHE_SIZE_UNLIMITED = -1;
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class UserPreferences implements
|
|||
private boolean enableAutodownloadWifiFilter;
|
||||
private String[] autodownloadSelectedNetworks;
|
||||
private int episodeCacheSize;
|
||||
private boolean pauseForNotifications;
|
||||
private boolean pauseForFocusLoss;
|
||||
|
||||
private UserPreferences(Context context) {
|
||||
this.context = context;
|
||||
|
@ -110,7 +110,7 @@ public class UserPreferences implements
|
|||
episodeCacheSize = readEpisodeCacheSize(sp.getString(
|
||||
PREF_EPISODE_CACHE_SIZE, "20"));
|
||||
enableAutodownload = sp.getBoolean(PREF_ENABLE_AUTODL, false);
|
||||
pauseForNotifications = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_NOTIFICATIONS, false);
|
||||
pauseForFocusLoss = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS, false);
|
||||
}
|
||||
|
||||
private int readThemeValue(String valueFromPrefs) {
|
||||
|
@ -214,9 +214,9 @@ public class UserPreferences implements
|
|||
return instance.enableAutodownload;
|
||||
}
|
||||
|
||||
public static boolean shouldPauseForNotifications() {
|
||||
public static boolean shouldPauseForFocusLoss() {
|
||||
instanceAvailable();
|
||||
return instance.pauseForNotifications;
|
||||
return instance.pauseForFocusLoss;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -258,8 +258,8 @@ public class UserPreferences implements
|
|||
PREF_EPISODE_CACHE_SIZE, "20"));
|
||||
} else if (key.equals(PREF_ENABLE_AUTODL)) {
|
||||
enableAutodownload = sp.getBoolean(PREF_ENABLE_AUTODL, false);
|
||||
} else if (key.equals(PREF_PAUSE_PLAYBACK_FOR_NOTIFICATIONS)) {
|
||||
pauseForNotifications = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_NOTIFICATIONS, false);
|
||||
} else if (key.equals(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS)) {
|
||||
pauseForFocusLoss = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -353,7 +353,7 @@ public class PlaybackService extends Service {
|
|||
break;
|
||||
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
|
||||
if (status == PlayerStatus.PLAYING) {
|
||||
if (!UserPreferences.shouldPauseForNotifications()) {
|
||||
if (!UserPreferences.shouldPauseForFocusLoss()) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Lost audio focus temporarily. Ducking...");
|
||||
audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC,
|
||||
|
|
Loading…
Reference in New Issue