diff options
author | Jorge Ruesga <jorge@ruesga.com> | 2013-08-09 21:35:27 +0200 |
---|---|---|
committer | Jorge Ruesga <jorge@ruesga.com> | 2013-08-09 21:35:27 +0200 |
commit | 5d5a51436b6e7790765c48a2d636171dbc031d4c (patch) | |
tree | 09fdd4c87cafb15d4bfd0495c7ad2538b3a64627 /src/org/cyanogenmod/wallpapers/photophase/preferences | |
parent | 2462ea677d376f86d587717b006f6a0034762092 (diff) | |
download | android_packages_wallpapers_PhotoPhase-5d5a51436b6e7790765c48a2d636171dbc031d4c.tar.gz android_packages_wallpapers_PhotoPhase-5d5a51436b6e7790765c48a2d636171dbc031d4c.tar.bz2 android_packages_wallpapers_PhotoPhase-5d5a51436b6e7790765c48a2d636171dbc031d4c.zip |
Use an asynchronous model to communicate media partial results (#19)
ChoosePictureFragment(2/2)
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'src/org/cyanogenmod/wallpapers/photophase/preferences')
-rw-r--r-- | src/org/cyanogenmod/wallpapers/photophase/preferences/ChoosePicturesFragment.java | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/org/cyanogenmod/wallpapers/photophase/preferences/ChoosePicturesFragment.java b/src/org/cyanogenmod/wallpapers/photophase/preferences/ChoosePicturesFragment.java index eb6128c..72a0fed 100644 --- a/src/org/cyanogenmod/wallpapers/photophase/preferences/ChoosePicturesFragment.java +++ b/src/org/cyanogenmod/wallpapers/photophase/preferences/ChoosePicturesFragment.java @@ -90,12 +90,8 @@ public class ChoosePicturesFragment extends PreferenceFragment { if (album == null || album.getPath().compareTo(path.getAbsolutePath()) != 0) { if (album != null) { mAlbums.add(album); + mOriginalAlbums.add((Album)album.clone()); this.publishProgress(album); - try { - Thread.sleep(50L); - } catch (InterruptedException e) { - // Ignore - } } album = new Album(); album.setPath(path.getAbsolutePath()); @@ -109,6 +105,7 @@ public class ChoosePicturesFragment extends PreferenceFragment { if (isSelectedItem(f.getAbsolutePath())) { album.getSelectedItems().add(f.getAbsolutePath()); } + Thread.yield(); } } } @@ -116,6 +113,7 @@ public class ChoosePicturesFragment extends PreferenceFragment { // Add the last album if (album != null) { mAlbums.add(album); + mOriginalAlbums.add((Album)album.clone()); this.publishProgress(album); } @@ -123,7 +121,7 @@ public class ChoosePicturesFragment extends PreferenceFragment { c.close(); } } - +//this.publishProgress(mAlbums.toArray(new Album[mAlbums.size()])); return null; } @@ -134,7 +132,6 @@ public class ChoosePicturesFragment extends PreferenceFragment { protected void onProgressUpdate(Album... values) { for (Album album : values) { addAlbum(album); - mOriginalAlbums.add((Album)album.clone()); } } }; |