From cd447a2914dd554991e2ddcf69e6bfd5bac1015a Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sat, 1 Feb 2014 13:14:46 -0800 Subject: #261 cache visualizer on --- src/github/daneren2005/dsub/fragments/DownloadFragment.java | 3 +++ src/github/daneren2005/dsub/service/DownloadServiceImpl.java | 9 ++++++++- src/github/daneren2005/dsub/util/Constants.java | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/github/daneren2005') diff --git a/src/github/daneren2005/dsub/fragments/DownloadFragment.java b/src/github/daneren2005/dsub/fragments/DownloadFragment.java index cc940945..86e2b94f 100644 --- a/src/github/daneren2005/dsub/fragments/DownloadFragment.java +++ b/src/github/daneren2005/dsub/fragments/DownloadFragment.java @@ -489,6 +489,9 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe visualizerButton.setVisibility(View.GONE); } else { visualizerView = new VisualizerView(context); + if(downloadService.getShowVisualization()) { + visualizerView.setActive(true); + } visualizerViewLayout.addView(visualizerView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT)); } diff --git a/src/github/daneren2005/dsub/service/DownloadServiceImpl.java b/src/github/daneren2005/dsub/service/DownloadServiceImpl.java index a8bb6cd4..e417ce88 100644 --- a/src/github/daneren2005/dsub/service/DownloadServiceImpl.java +++ b/src/github/daneren2005/dsub/service/DownloadServiceImpl.java @@ -205,6 +205,10 @@ public class DownloadServiceImpl extends Service implements DownloadService { if(prefs.getBoolean(Constants.PREFERENCES_EQUALIZER_ON, false)) { getEqualizerController(); } + if(prefs.getBoolean(Constants.PREFERENCES_VISUALIZER_ON, false)) { + getVisualizerController(); + showVisualization = true; + } } @Override @@ -456,7 +460,10 @@ public class DownloadServiceImpl extends Service implements DownloadService { @Override public void setShowVisualization(boolean showVisualization) { this.showVisualization = showVisualization; - } + SharedPreferences.Editor editor = Util.getPreferences(this).edit(); + editor.putBoolean(Constants.PREFERENCES_VISUALIZER_ON, showVisualization); + editor.commit(); + } @Override public synchronized DownloadFile forSong(MusicDirectory.Entry song) { diff --git a/src/github/daneren2005/dsub/util/Constants.java b/src/github/daneren2005/dsub/util/Constants.java index 651f043e..c6dd49f2 100644 --- a/src/github/daneren2005/dsub/util/Constants.java +++ b/src/github/daneren2005/dsub/util/Constants.java @@ -114,6 +114,7 @@ public final class Constants { public static final String PREFERENCES_KEY_KEEP_SCREEN_ON = "keepScreenOn"; public static final String PREFERENCES_KEY_BUFFER_LENGTH = "bufferLength"; public static final String PREFERENCES_EQUALIZER_ON = "equalizerOn"; + public static final String PREFERENCES_VISUALIZER_ON = "visualizerOn"; 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"; -- cgit v1.2.3