List of usage examples for android.media ThumbnailUtils OPTIONS_RECYCLE_INPUT
int OPTIONS_RECYCLE_INPUT
To view the source code for android.media ThumbnailUtils OPTIONS_RECYCLE_INPUT.
Click Source Link
From source file:com.ape.transfer.util.FileIconLoader.java
public static Bitmap getMyVideoThumbnail(String videoPath, int width, int height) { File file = new File(videoPath); if (!file.exists()) return null; Bitmap bitmap = null;//from www . j a v a 2 s .co m bitmap = ThumbnailUtils.createVideoThumbnail(videoPath, Images.Thumbnails.MICRO_KIND); bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height, ThumbnailUtils.OPTIONS_RECYCLE_INPUT); return bitmap; }
From source file:org.chromium.chrome.browser.ntp.snippets.SnippetArticleViewHolder.java
private void fadeThumbnailIn(SnippetArticle snippet, Bitmap thumbnail) { mImageCallback = null;//ww w .j a v a 2 s . c o m if (thumbnail == null) return; // Nothing to do, we keep the placeholder. // We need to crop and scale the downloaded bitmap, as the ImageView we set it on won't be // able to do so when using a TransitionDrawable (as opposed to the straight bitmap). // That's a limitation of TransitionDrawable, which doesn't handle layers of varying sizes. Resources res = mThumbnailView.getResources(); int targetSize = res.getDimensionPixelSize(R.dimen.snippets_thumbnail_size); Bitmap scaledThumbnail = ThumbnailUtils.extractThumbnail(thumbnail, targetSize, targetSize, ThumbnailUtils.OPTIONS_RECYCLE_INPUT); // Store the bitmap to skip the download task next time we display this snippet. snippet.setThumbnailBitmap(scaledThumbnail); // Cross-fade between the placeholder and the thumbnail. Drawable[] layers = { mThumbnailView.getDrawable(), new BitmapDrawable(mThumbnailView.getResources(), scaledThumbnail) }; TransitionDrawable transitionDrawable = new TransitionDrawable(layers); mThumbnailView.setImageDrawable(transitionDrawable); transitionDrawable.startTransition(FADE_IN_ANIMATION_TIME_MS); }
From source file:com.atwal.wakeup.battery.util.Utilities.java
public static Bitmap getFbBitmap(Drawable drawable, int width, int height) { Bitmap bitmap = drawableToBitmap(drawable); Bitmap resizeBitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height, ThumbnailUtils.OPTIONS_RECYCLE_INPUT); return resizeBitmap; }
From source file:com.ibuildapp.romanblack.FanWallPlugin.FanWallPlugin.java
/** * Sets up image after it was taken from camera or chosen from gallery. *//*w w w.j a v a 2s .c o m*/ private void setImage() { Bitmap input = Statics.resizeBitmapToMaxSize(imagePath, (int) (IMAGE_ADDED_SIZE * density)); Bitmap avaBtm = ThumbnailUtils.extractThumbnail(input, (int) (IMAGE_ADDED_SIZE * density), (int) (IMAGE_ADDED_SIZE * density), ThumbnailUtils.OPTIONS_RECYCLE_INPUT); imageHolder.setVisibility(View.VISIBLE); userImage.setImageBitmap(avaBtm); }