75 |
|
|
76 |
Collections.sort(mImages, new ImageEntry.PathComparator() ); |
Collections.sort(mImages, new ImageEntry.PathComparator() ); |
77 |
|
|
78 |
|
preloadImages(0,18); |
79 |
|
|
80 |
thumbSize = getSize(); |
thumbSize = getSize(); |
81 |
} |
} |
82 |
|
|
83 |
public void cleanUp() { |
public void cleanUp() { |
84 |
mImages.clear(); |
mImages.clear(); |
85 |
} |
} |
86 |
|
|
87 |
|
|
88 |
|
public void preloadImages(int offset, int count) { |
89 |
|
final int max = mImages.size(); |
90 |
|
|
91 |
|
for (int i=offset; i<(offset+count) && i<max; i++) { |
92 |
|
ImageEntry entry = mImages.get(i); |
93 |
|
|
94 |
|
if (entry.thumb == null) { |
95 |
|
entry.thumb = generateAndLoadThumb( new File(entry.path) ); |
96 |
|
} |
97 |
|
} |
98 |
|
} |
99 |
|
|
100 |
public static Bitmap generateAndLoadThumb(File image) { |
public static Bitmap generateAndLoadThumb(File image) { |
101 |
|
|
130 |
|
|
131 |
public void orderByPath() { |
public void orderByPath() { |
132 |
Collections.sort(mImages, new ImageEntry.PathComparator()); |
Collections.sort(mImages, new ImageEntry.PathComparator()); |
133 |
|
preloadImages(0,18); |
134 |
this.notifyDataSetChanged(); |
this.notifyDataSetChanged(); |
135 |
} |
} |
136 |
|
|
137 |
public void orderByCaption() { |
public void orderByCaption() { |
138 |
Collections.sort(mImages, new ImageEntry.CaptionComparator()); |
Collections.sort(mImages, new ImageEntry.CaptionComparator()); |
139 |
|
preloadImages(0,18); |
140 |
this.notifyDataSetChanged(); |
this.notifyDataSetChanged(); |
141 |
} |
} |
142 |
|
|