/[projects]/android/Side9/src/dk/thoerup/side9/ImageAdapter.java
ViewVC logotype

Diff of /android/Side9/src/dk/thoerup/side9/ImageAdapter.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1228 by torben, Wed Feb 9 17:39:54 2011 UTC revision 1229 by torben, Tue Feb 15 09:21:17 2011 UTC
# Line 75  public class ImageAdapter extends BaseAd Line 75  public class ImageAdapter extends BaseAd
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                    
# Line 115  public class ImageAdapter extends BaseAd Line 130  public class ImageAdapter extends BaseAd
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            

Legend:
Removed from v.1228  
changed lines
  Added in v.1229

  ViewVC Help
Powered by ViewVC 1.1.20