loopj / android-smart-image-view

Android ImageView replacement which allows image loading from URLs or contact address book, with caching
http://loopj.com/android-smart-image-view/
1.29k stars 502 forks source link

VideoThumbnailImage #26

Open commonsguy opened 11 years ago

commonsguy commented 11 years ago

I just posted a sample project that uses SmartImageView to display video thumbnails obtained from MediaStore. The SmartImage implementation is fairly straightforward:

  private static class VideoThumbnailImage implements SmartImage {
    private int videoId;
    private int thumbnailKind;

    VideoThumbnailImage(int videoId, int thumbnailKind) {
      this.videoId=videoId;
      this.thumbnailKind=thumbnailKind;
    }

    @Override
    public Bitmap getBitmap(Context ctxt) {
      return(MediaStore.Video.Thumbnails.getThumbnail(ctxt.getContentResolver(),
                                                      videoId,
                                                      thumbnailKind,
                                                      null));
    }
  }

My code is licensed Apache License 2.0, and I have no qualms if you want to add this code to your project.