aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-08-22 10:56:13 -0700
committerScott Jackson <daneren2005@gmail.com>2014-08-22 10:56:13 -0700
commita978bd86b4f29cd2638fda716603e4bf9cc85c0e (patch)
treef94d868f297ab0afeba6ec2368ceaaa366df8cd4 /src/github
parent29ad797be05e562a77ce0203506bceb24b25150a (diff)
downloaddsub-a978bd86b4f29cd2638fda716603e4bf9cc85c0e.tar.gz
dsub-a978bd86b4f29cd2638fda716603e4bf9cc85c0e.tar.bz2
dsub-a978bd86b4f29cd2638fda716603e4bf9cc85c0e.zip
Add session start up method, refresh bookmarks on startup
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index 30cabd76..a3a65a72 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -73,6 +73,7 @@ import github.daneren2005.dsub.view.ChangeLog;
public class SubsonicFragmentActivity extends SubsonicActivity {
private static String TAG = SubsonicFragmentActivity.class.getSimpleName();
private static boolean infoDialogDisplayed;
+ private static boolean sessionInitialized = false;
private ScheduledExecutorService executorService;
private View bottomBar;
private View coverArtView;
@@ -119,7 +120,9 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
if("".equals(fragmentType) || fragmentType == null || firstRun) {
// Initial startup stuff
- loadSettings();
+ if(!sessionInitialized) {
+ loadSession();
+ }
}
currentFragment.setPrimaryFragment(true);
@@ -465,6 +468,12 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
}
}
+ private void loadSession() {
+ loadSettings();
+ loadBookmarks();
+
+ sessionInitialized = true;
+ }
private void loadSettings() {
PreferenceManager.setDefaultValues(this, R.xml.settings, false);
SharedPreferences prefs = Util.getPreferences(this);
@@ -502,6 +511,22 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
editor.putString(Constants.PREFERENCES_KEY_CACHE_LOCATION, FileUtil.getDefaultMusicDirectory(this).getPath());
editor.commit();
}
+
+ private void loadBookmarks() {
+ final Context context = this;
+ new SilentBackgroundTask<Void>(context) {
+ @Override
+ public Void doInBackground() {
+ MusicService musicService = MusicServiceFactory.getMusicService(context);
+ musicService.getBookmarks(true, context, null);
+ }
+
+ @Override
+ public void error(Throwable error) {
+ Log.e(TAG, "Failed to get bookmarks", error);
+ }
+ }.execute();
+ }
private void createAccount() {
final Context context = this;