updated name of the preference to use 'FocusLoss' rather than 'Notifications' to more accurately reflect what it does

This commit is contained in:
Tom Hennen 2013-08-14 12:47:04 -04:00
parent 3f8e6c26a3
commit bd4c365c11
4 changed files with 13 additions and 13 deletions

View File

@ -250,7 +250,7 @@
<string name="folder_not_empty_dialog_title">Folder is not empty</string> <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="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="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_pausePlaybackForFocusLoss_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_title">Pause for interruptions</string>
</resources> </resources>

View File

@ -20,9 +20,9 @@
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
android:enabled="true" android:enabled="true"
android:key="prefPauseForNotifications" android:key="prefPauseForFocusLoss"
android:summary="@string/pref_pausePlaybackForNotifications_sum" android:summary="@string/pref_pausePlaybackForFocusLoss_sum"
android:title="@string/pref_pausePlaybackForNotifications_title" /> android:title="@string/pref_pausePlaybackForFocusLoss_title" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/network_pref" > <PreferenceCategory android:title="@string/network_pref" >
<ListPreference <ListPreference

View File

@ -41,7 +41,7 @@ public class UserPreferences implements
public static final String PREF_ENABLE_AUTODL_WIFI_FILTER = "prefEnableAutoDownloadWifiFilter"; public static final String PREF_ENABLE_AUTODL_WIFI_FILTER = "prefEnableAutoDownloadWifiFilter";
private static final String PREF_AUTODL_SELECTED_NETWORKS = "prefAutodownloadSelectedNetworks"; private static final String PREF_AUTODL_SELECTED_NETWORKS = "prefAutodownloadSelectedNetworks";
public static final String PREF_EPISODE_CACHE_SIZE = "prefEpisodeCacheSize"; 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; private static int EPISODE_CACHE_SIZE_UNLIMITED = -1;
@ -61,7 +61,7 @@ public class UserPreferences implements
private boolean enableAutodownloadWifiFilter; private boolean enableAutodownloadWifiFilter;
private String[] autodownloadSelectedNetworks; private String[] autodownloadSelectedNetworks;
private int episodeCacheSize; private int episodeCacheSize;
private boolean pauseForNotifications; private boolean pauseForFocusLoss;
private UserPreferences(Context context) { private UserPreferences(Context context) {
this.context = context; this.context = context;
@ -110,7 +110,7 @@ public class UserPreferences implements
episodeCacheSize = readEpisodeCacheSize(sp.getString( episodeCacheSize = readEpisodeCacheSize(sp.getString(
PREF_EPISODE_CACHE_SIZE, "20")); PREF_EPISODE_CACHE_SIZE, "20"));
enableAutodownload = sp.getBoolean(PREF_ENABLE_AUTODL, false); 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) { private int readThemeValue(String valueFromPrefs) {
@ -214,9 +214,9 @@ public class UserPreferences implements
return instance.enableAutodownload; return instance.enableAutodownload;
} }
public static boolean shouldPauseForNotifications() { public static boolean shouldPauseForFocusLoss() {
instanceAvailable(); instanceAvailable();
return instance.pauseForNotifications; return instance.pauseForFocusLoss;
} }
@Override @Override
@ -258,8 +258,8 @@ public class UserPreferences implements
PREF_EPISODE_CACHE_SIZE, "20")); PREF_EPISODE_CACHE_SIZE, "20"));
} else if (key.equals(PREF_ENABLE_AUTODL)) { } else if (key.equals(PREF_ENABLE_AUTODL)) {
enableAutodownload = sp.getBoolean(PREF_ENABLE_AUTODL, false); enableAutodownload = sp.getBoolean(PREF_ENABLE_AUTODL, false);
} else if (key.equals(PREF_PAUSE_PLAYBACK_FOR_NOTIFICATIONS)) { } else if (key.equals(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS)) {
pauseForNotifications = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_NOTIFICATIONS, false); pauseForFocusLoss = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS, false);
} }
} }

View File

@ -353,7 +353,7 @@ public class PlaybackService extends Service {
break; break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK: case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
if (status == PlayerStatus.PLAYING) { if (status == PlayerStatus.PLAYING) {
if (!UserPreferences.shouldPauseForNotifications()) { if (!UserPreferences.shouldPauseForFocusLoss()) {
if (AppConfig.DEBUG) if (AppConfig.DEBUG)
Log.d(TAG, "Lost audio focus temporarily. Ducking..."); Log.d(TAG, "Lost audio focus temporarily. Ducking...");
audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC,