aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-05-01 19:21:31 -0700
committerScott Jackson <daneren2005@gmail.com>2013-05-01 19:21:31 -0700
commit372feb754c4ac74d50383d926764b5b500acba26 (patch)
treefb4ee27aed2ba4fdd4d28048a1963632e6875b57
parentb5c7529ed34139e382376d090e9f933e2c3ede18 (diff)
downloaddsub-372feb754c4ac74d50383d926764b5b500acba26.tar.gz
dsub-372feb754c4ac74d50383d926764b5b500acba26.tar.bz2
dsub-372feb754c4ac74d50383d926764b5b500acba26.zip
Added a setting for gapless playback
-rw-r--r--subsonic-android/res/values/strings.xml2
-rw-r--r--subsonic-android/res/xml/settings.xml6
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java5
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/util/Constants.java1
4 files changed, 13 insertions, 1 deletions
diff --git a/subsonic-android/res/values/strings.xml b/subsonic-android/res/values/strings.xml
index 839a3e49..90e455eb 100644
--- a/subsonic-android/res/values/strings.xml
+++ b/subsonic-android/res/values/strings.xml
@@ -266,6 +266,8 @@
<string name="settings.temp_loss_nothing">Do Nothing</string>
<string name="settings.persistent_title">Persistent Notification</string>
<string name="settings.persistent_summary">Show the notification even after pausing. Press the stop button to clear it away.</string>
+ <string name="settings.gapless_playback">Gapless Playback</string>
+ <string name="settings.gapless_playback_summary">The Galaxy S3 seems to be experiencing freezes/other weird issue since the introduction of gapless playback. Turn this off to fix the issue.</string>
<string name="shuffle.startYear">Start Year:</string>
<string name="shuffle.endYear">End Year:</string>
diff --git a/subsonic-android/res/xml/settings.xml b/subsonic-android/res/xml/settings.xml
index a2ae7b20..d21f928f 100644
--- a/subsonic-android/res/xml/settings.xml
+++ b/subsonic-android/res/xml/settings.xml
@@ -239,6 +239,12 @@
android:key="screenLitOnDownload"
android:defaultValue="true"/>
+ <CheckBoxPreference
+ android:title="@string/settings.gapless_playback"
+ android:summary="@string/settings.gapless_playback_summary"
+ android:key="gaplessPlayback"
+ android:defaultValue="true"/>
+
<Preference
android:key="clearSearchHistory"
android:title="@string/settings.clear_search_history"
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java
index f6d3f769..bdd1d4e1 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java
@@ -1076,7 +1076,10 @@ public class DownloadServiceImpl extends Service implements DownloadService {
public void onPrepared(MediaPlayer mp) {
try {
setNextPlayerState(PREPARED);
- if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && (playerState == PlayerState.STARTED || playerState == PlayerState.PAUSED)) {
+
+ SharedPreferences prefs = Util.getPreferences(DownloadServiceImpl.this);
+ boolean gaplessPlayback = prefs.getBoolean(Constants.PREFERENCES_KEY_GAPLESS_PLAYBACK, true);
+ if(gaplessPlayback && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && (playerState == PlayerState.STARTED || playerState == PlayerState.PAUSED)) {
mediaPlayer.setNextMediaPlayer(nextMediaPlayer);
nextSetup = true;
}
diff --git a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java
index ae88a2ef..a35573a6 100644
--- a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java
+++ b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java
@@ -91,6 +91,7 @@ public final class Constants {
public static final String PREFERENCES_EQUALIZER_ON = "equalizerOn";
public static final String PREFERENCES_EQUALIZER_SETTINGS = "equalizerSettings";
public static final String PREFERENCES_KEY_PERSISTENT_NOTIFICATION = "persistentNotification";
+ public static final String PREFERENCES_KEY_GAPLESS_PLAYBACK = "gaplessPlayback";
// Name of the preferences file.
public static final String PREFERENCES_FILE_NAME = "github.daneren2005.dsub_preferences";