aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-10-01 14:35:59 -0700
committerScott Jackson <daneren2005@gmail.com>2014-10-01 14:35:59 -0700
commite34688b0366f9ac17e8c9c55877d83d4acd7fb0d (patch)
treea8d0742a89dcfddf28748fa097a52050542334fa /src/github/daneren2005
parent9675c980d2478000abe24ce5f4b062448dd88fc7 (diff)
downloaddsub-e34688b0366f9ac17e8c9c55877d83d4acd7fb0d.tar.gz
dsub-e34688b0366f9ac17e8c9c55877d83d4acd7fb0d.tar.bz2
dsub-e34688b0366f9ac17e8c9c55877d83d4acd7fb0d.zip
Reduce work done in main thread to mitigate choppy fragment transition
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index 824d4f33..cc38ad69 100644
--- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -615,22 +615,21 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
protected Pair<MusicDirectory, Boolean> doInBackground() throws Throwable {
MusicService musicService = MusicServiceFactory.getMusicService(context);
MusicDirectory dir = load(musicService);
- boolean valid = musicService.isLicenseValid(context, this);
- return new Pair<MusicDirectory, Boolean>(dir, valid);
+ licenseValid = musicService.isLicenseValid(context, this);
+
+ albums = dir.getChildren(true, false);
+ if(largeAlbums) {
+ entries = dir.getChildren(false, true);
+ } else {
+ entries = dir.getChildren();
+ }
+
+ return new Pair<MusicDirectory, Boolean>(dir, licenseValid);
}
@Override
protected void done(Pair<MusicDirectory, Boolean> result) {
- if(largeAlbums) {
- albums = result.getFirst().getChildren(true, false);
- entries = result.getFirst().getChildren(false, true);
- } else {
- albums = result.getFirst().getChildren(true, false);
- entries = result.getFirst().getChildren();
- }
- licenseValid = result.getSecond();
- finishLoading();
-
+ finishLoading();
currentTask = null;
}
}
@@ -646,7 +645,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
} else {
showHeader = false;
if(!"root".equals(id) && (entries.size() == 0 || !largeAlbums && albums.size() == entries.size())) {
- hideButtons = true;
+ hideButtons = true;
}
}
@@ -699,7 +698,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
if(validData) {
entryList.setVisibility(View.VISIBLE);
}
- context.supportInvalidateOptionsMenu();
+ context.supportInvalidateOptionsMenu();
if(lookupEntry != null) {
for(int i = 0; i < entries.size(); i++) {
@@ -711,12 +710,12 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
}
}
- Bundle args = getArguments();
- boolean playAll = args.getBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, false);
- if (playAll && !restoredInstance) {
- playAll(args.getBoolean(Constants.INTENT_EXTRA_NAME_SHUFFLE, false), false);
- }
- }
+ Bundle args = getArguments();
+ boolean playAll = args.getBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, false);
+ if (playAll && !restoredInstance) {
+ playAll(args.getBoolean(Constants.INTENT_EXTRA_NAME_SHUFFLE, false), false);
+ }
+ }
private void setupAlbumList() {
albumList.setOnItemClickListener(new AdapterView.OnItemClickListener() {