本文整理匯總了Java中com.android.volley.toolbox.ImageLoader.ImageCache方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageLoader.ImageCache方法的具體用法?Java ImageLoader.ImageCache怎麽用?Java ImageLoader.ImageCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.android.volley.toolbox.ImageLoader
的用法示例。
在下文中一共展示了ImageLoader.ImageCache方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
preferences = getSharedPreferences("org.team1515.morscout", MODE_PRIVATE);
queue = Volley.newRequestQueue(this);
imageLoader = new CookieImageLoader(queue, new ImageLoader.ImageCache() {
private final LruCache<String, Bitmap> cache = new LruCache<>(50);
@Override
public Bitmap getBitmap(String url) {
return cache.get(url);
}
@Override
public void putBitmap(String url, Bitmap bitmap) {
cache.put(url, bitmap);
}
});
}
示例2: getView
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent, LayoutInflater inflater, ImageLoader.ImageCache cache) {
if (convertView == null) {
convertView = inflater.inflate(R.layout.media_item_wp_video, parent, false);
}
if (convertView != null) {
MediaItem mediaItem = mMediaItems.get(position);
Uri imageSource = mediaItem.getPreviewSource();
ImageView imageView = (ImageView) convertView.findViewById(R.id.wp_video_view_background);
if (imageView != null) {
if (imageSource != null) {
Bitmap imageBitmap = null;
if (cache != null) {
imageBitmap = cache.getBitmap(imageSource.toString());
}
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
if (imageBitmap == null) {
imageView.setImageDrawable(placeholderDrawable(convertView.getContext()));
WordPressMediaUtils.BackgroundDownloadWebImage bgDownload =
new WordPressMediaUtils.BackgroundDownloadWebImage(imageView);
imageView.setTag(bgDownload);
bgDownload.execute(mediaItem.getPreviewSource());
} else {
org.wordpress.mediapicker.MediaUtils.fadeInImage(imageView, imageBitmap);
}
} else {
imageView.setTag(null);
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
imageView.setImageResource(R.drawable.video_thumbnail);
}
}
}
return convertView;
}
示例3: getView
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent, LayoutInflater inflater, ImageLoader.ImageCache cache) {
if (convertView == null) {
convertView = inflater.inflate(R.layout.media_item_wp_image, parent, false);
}
if (convertView != null) {
MediaItem mediaItem = mVerifiedItems.get(position);
Uri imageSource = mediaItem.getPreviewSource();
ImageView imageView = (ImageView) convertView.findViewById(R.id.wp_image_view_background);
if (imageView != null) {
if (imageSource != null) {
Bitmap imageBitmap = null;
if (cache != null) {
imageBitmap = cache.getBitmap(imageSource.toString());
}
if (imageBitmap == null) {
imageView.setImageDrawable(placeholderDrawable(convertView.getContext()));
WordPressMediaUtils.BackgroundDownloadWebImage bgDownload =
new WordPressMediaUtils.BackgroundDownloadWebImage(imageView);
imageView.setTag(bgDownload);
bgDownload.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, mediaItem.getPreviewSource());
} else {
imageView.setImageBitmap(imageBitmap);
}
} else {
imageView.setTag(null);
imageView.setImageResource(R.color.grey_darken_10);
}
}
}
return convertView;
}
示例4: provideImageLoader
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
@Provides
@Singleton
public ImageLoader provideImageLoader(
RequestQueue requestQueue,
ImageLoader.ImageCache imageCache
) {
return new ImageLoader(requestQueue, imageCache);
}
示例5: getImageCache
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
public ImageLoader.ImageCache getImageCache() {
return mImageCache;
}
示例6: getImageCache
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
@Override
public ImageLoader.ImageCache getImageCache() {
return WordPress.getBitmapCache();
}
示例7: provideImageCache
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
@Provides
@Singleton
public ImageLoader.ImageCache provideImageCache() {
return new ImageCache();
}
示例8: getLruBitmapCache
import com.android.volley.toolbox.ImageLoader; //導入方法依賴的package包/類
/**
* Provides LruBitmapCache implementation to use in ImageLoader
* override this method if you want to provide another implementation
*/
protected ImageLoader.ImageCache getLruBitmapCache() {
return new LruBitmapCache();
}