diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2016-04-12 22:19:33 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-04-12 22:19:33 -0700 |
| commit | d2a63a15f7cccee6567502059b8555e692e96e1f (patch) | |
| tree | 19414258ef373bbce8cfd8ef2efddbfdfc391555 | |
| parent | 9ecf6fb115f0e411b5344bf8364abdec3594b90e (diff) | |
| parent | 0555d4c8b28ee879cc5f4b53550c99cc510f0f06 (diff) | |
| download | android_packages_apps_Gallery2-d2a63a15f7cccee6567502059b8555e692e96e1f.tar.gz android_packages_apps_Gallery2-d2a63a15f7cccee6567502059b8555e692e96e1f.tar.bz2 android_packages_apps_Gallery2-d2a63a15f7cccee6567502059b8555e692e96e1f.zip | |
Merge "Gallery: improve timeline loading performance" into android_ui.lnx.1.2-dev
| -rw-r--r-- | src/com/android/gallery3d/data/TimeClustering.java | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/com/android/gallery3d/data/TimeClustering.java b/src/com/android/gallery3d/data/TimeClustering.java index 87111f29d..db47c40d9 100644 --- a/src/com/android/gallery3d/data/TimeClustering.java +++ b/src/com/android/gallery3d/data/TimeClustering.java @@ -98,14 +98,12 @@ public class TimeClustering extends Clustering { @Override public void run(MediaSet baseSet) { - final int total = baseSet.getTotalMediaItemCount(); - final SmallItem[] buf = new SmallItem[total]; final double[] latLng = new double[2]; + final ArrayList<SmallItem> items = new ArrayList<>(); baseSet.enumerateTotalMediaItems(new MediaSet.ItemConsumer() { @Override public void consume(int index, MediaItem item) { - if (index < 0 || index >= total) return; SmallItem s = new SmallItem(); s.path = item.getPath(); s.mediaType = item.getMediaType(); @@ -113,17 +111,10 @@ public class TimeClustering extends Clustering { item.getLatLong(latLng); s.lat = latLng[0]; s.lng = latLng[1]; - buf[index] = s; + items.add(s); } }); - ArrayList<SmallItem> items = new ArrayList<SmallItem>(total); - for (int i = 0; i < total; i++) { - if (buf[i] != null) { - items.add(buf[i]); - } - } - Collections.sort(items, sDateComparator); int n = items.size(); |
