本文整理汇总了Java中com.nostra13.universalimageloader.core.download.ImageDownloader类的典型用法代码示例。如果您正苦于以下问题:Java ImageDownloader类的具体用法?Java ImageDownloader怎么用?Java ImageDownloader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageDownloader类属于com.nostra13.universalimageloader.core.download包,在下文中一共展示了ImageDownloader类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ImageDecodingInfo
import com.nostra13.universalimageloader.core.download.ImageDownloader; //导入依赖的package包/类
public ImageDecodingInfo(String imageKey, String imageUri, String originalImageUri, ImageSize targetSize, ViewScaleType viewScaleType,
ImageDownloader downloader, DisplayImageOptions displayOptions) {
this.imageKey = imageKey;
this.imageUri = imageUri;
this.originalImageUri = originalImageUri;
this.targetSize = targetSize;
this.imageScaleType = displayOptions.getImageScaleType();
this.viewScaleType = viewScaleType;
this.downloader = downloader;
this.extraForDownloader = displayOptions.getExtraForDownloader();
considerExifParams = displayOptions.isConsiderExifParams();
decodingOptions = new Options();
copyOptions(displayOptions.getDecodingOptions(), decodingOptions);
}
示例2: getStickerBitmapUri
import com.nostra13.universalimageloader.core.download.ImageDownloader; //导入依赖的package包/类
public String getStickerBitmapUri(String categoryName, String stickerName) {
StickerManager manager = StickerManager.getInstance();
StickerCategory category = manager.getCategory(categoryName);
if (category == null) {
return null;
}
if (isSystemSticker(categoryName)) {
if (!stickerName.contains(".png")) {
stickerName += ".png";
}
String path = "sticker/" + category.getName() + "/" + stickerName;
return ImageDownloader.Scheme.ASSETS.wrap(path);
}
return null;
}
示例3: tryLoadBitmap
import com.nostra13.universalimageloader.core.download.ImageDownloader; //导入依赖的package包/类
Bitmap tryLoadBitmap(ImageViewAware imageAware) {
Bitmap bitmap = null;
try {
java.io.File imageFile = diskCache.get(getMessage().get_id());
if (imageFile != null && imageFile.exists() && imageFile.length() > 0) {
ViewScaleType viewScaleType = imageAware.getScaleType();
ImageSize imageSize = ImageSizeUtils.defineTargetSizeForView(imageAware, new ImageSize(MainApp.CONTEXT.getResources().getDisplayMetrics().widthPixels, MainApp.CONTEXT.getResources().getDisplayMetrics().heightPixels));
ImageDecodingInfo decodingInfo = new ImageDecodingInfo(getMessage().get_id(),
ImageDownloader.Scheme.FILE.wrap(imageFile.getAbsolutePath()), getMessage().get_id(), imageSize, viewScaleType,
new BaseImageDownloader(MainApp.CONTEXT), options);
bitmap = decoder.decode(decodingInfo);
MainApp.memoryCache.put(getMessage().get_id(), bitmap);
}
} catch (Exception ignored) {
ignored.printStackTrace();
}
return bitmap;
}
示例4: ImageDecodingInfo
import com.nostra13.universalimageloader.core.download.ImageDownloader; //导入依赖的package包/类
public ImageDecodingInfo(String imageKey, String imageUri, ImageSize targetSize, ViewScaleType viewScaleType,
ImageDownloader downloader, DisplayImageOptions displayOptions) {
this.imageKey = imageKey;
this.imageUri = imageUri;
this.targetSize = targetSize;
this.imageScaleType = displayOptions.getImageScaleType();
this.viewScaleType = viewScaleType;
this.downloader = downloader;
this.extraForDownloader = displayOptions.getExtraForDownloader();
considerExifParams = displayOptions.isConsiderExifParams();
decodingOptions = new Options();
copyOptions(displayOptions.getDecodingOptions(), decodingOptions);
}
示例5: getUri
import com.nostra13.universalimageloader.core.download.ImageDownloader; //导入依赖的package包/类
@Nullable
public static String getUri(@Nullable File file) {
if (file == null) return null;
final String uri;
if (file.exists()) {
uri = ImageDownloader.Scheme.FILE.wrap(file.getAbsolutePath());
} else {
String name = file.getName();
if (sAssets.contains(name)) {
uri = ImageDownloader.Scheme.ASSETS.wrap(name);
} else if (sApkExpansionZipFile != null && sApkExpansionZipFile.contains(name)) {
uri = BaseImageDownloaderImpl.obbScheme + name;
} else {
Log.w(TAG, "File " + file.getAbsolutePath() + " doesn't exist on ext or assets!");
uri = null;
}
}
return uri;
}
示例6: getDownloader
import com.nostra13.universalimageloader.core.download.ImageDownloader; //导入依赖的package包/类
private ImageDownloader getDownloader() {
ImageDownloader d;
if (engine.isNetworkDenied()) {
d = networkDeniedDownloader;
} else if (engine.isSlowNetwork()) {
d = slowNetworkDownloader;
} else {
d = downloader;
}
return d;
}
示例7: getDownloader
import com.nostra13.universalimageloader.core.download.ImageDownloader; //导入依赖的package包/类
private ImageDownloader getDownloader() {
if (this.engine.isNetworkDenied()) {
return this.networkDeniedDownloader;
}
if (this.engine.isSlowNetwork()) {
return this.slowNetworkDownloader;
}
return this.downloader;
}
示例8: ImageDecodingInfo
import com.nostra13.universalimageloader.core.download.ImageDownloader; //导入依赖的package包/类
public ImageDecodingInfo(String imageKey, String imageUri, String originalImageUri, ImageSize targetSize, ViewScaleType viewScaleType, ImageDownloader downloader, DisplayImageOptions displayOptions) {
this.imageKey = imageKey;
this.imageUri = imageUri;
this.originalImageUri = originalImageUri;
this.targetSize = targetSize;
this.imageScaleType = displayOptions.getImageScaleType();
this.viewScaleType = viewScaleType;
this.downloader = downloader;
this.extraForDownloader = displayOptions.getExtraForDownloader();
this.considerExifParams = displayOptions.isConsiderExifParams();
copyOptions(displayOptions.getDecodingOptions(), this.decodingOptions);
}
示例9: getDownloader
import com.nostra13.universalimageloader.core.download.ImageDownloader; //导入依赖的package包/类
private ImageDownloader getDownloader() {
ImageDownloader d;
if (engine.isNetworkDenied()) {
d = networkDeniedDownloader;
} else if (engine.isSlowNetwork()) {
d = slowNetworkDownloader;
} else {
d = downloader;
}
return d;
}
示例10: ImageDecodingInfo
import com.nostra13.universalimageloader.core.download.ImageDownloader; //导入依赖的package包/类
public ImageDecodingInfo(String imageKey, String imageUri, String originalImageUri, ImageSize
targetSize, ViewScaleType viewScaleType, ImageDownloader downloader,
DisplayImageOptions displayOptions) {
this.imageKey = imageKey;
this.imageUri = imageUri;
this.originalImageUri = originalImageUri;
this.targetSize = targetSize;
this.imageScaleType = displayOptions.getImageScaleType();
this.viewScaleType = viewScaleType;
this.downloader = downloader;
this.extraForDownloader = displayOptions.getExtraForDownloader();
this.considerExifParams = displayOptions.isConsiderExifParams();
copyOptions(displayOptions.getDecodingOptions(), this.decodingOptions);
}
示例11: defineExifOrientation
import com.nostra13.universalimageloader.core.download.ImageDownloader; //导入依赖的package包/类
protected ExifInfo defineExifOrientation(String imageUri) {
int rotation = 0;
boolean flip = false;
try {
ExifInterface exif = new ExifInterface(ImageDownloader.Scheme.FILE.crop(imageUri));
int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
switch (exifOrientation) {
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
flip = true;
case ExifInterface.ORIENTATION_NORMAL:
rotation = 0;
break;
case ExifInterface.ORIENTATION_TRANSVERSE:
flip = true;
case ExifInterface.ORIENTATION_ROTATE_90:
rotation = 90;
break;
case ExifInterface.ORIENTATION_FLIP_VERTICAL:
flip = true;
case ExifInterface.ORIENTATION_ROTATE_180:
rotation = 180;
break;
case ExifInterface.ORIENTATION_TRANSPOSE:
flip = true;
case ExifInterface.ORIENTATION_ROTATE_270:
rotation = 270;
break;
}
} catch (IOException e) {
L.w("Can't read EXIF tags from file [%s]", imageUri);
}
return new ExifInfo(rotation, flip);
}
示例12: getImageByteByPath
import com.nostra13.universalimageloader.core.download.ImageDownloader; //导入依赖的package包/类
public static byte[] getImageByteByPath(String imagePath, ImageSize imageSize) {
try {
DisplayImageOptions options = new DisplayImageOptions.Builder()
.cacheInMemory(false).cacheOnDisk(false)
.considerExifParams(true).bitmapConfig(Bitmap.Config.RGB_565)
.imageScaleType(ImageScaleType.EXACTLY).build();
Bitmap upbitmap = ImageLoader.getInstance().loadImageSync(ImageDownloader.Scheme.FILE.wrap(imagePath), imageSize, options);
if (upbitmap == null) {
return null;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
upbitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
int option = 100;
while (baos.toByteArray().length / 1024 > 120) {
baos.reset();
option -= 10;
upbitmap.compress(Bitmap.CompressFormat.JPEG, option, baos);
}
byte[] result = baos.toByteArray();
IoUtils.closeSilently(baos);
upbitmap.recycle();
return result;
} catch (Throwable e) {
e.printStackTrace();
}
return null;
}
示例13: displayImage_local_string
import com.nostra13.universalimageloader.core.download.ImageDownloader; //导入依赖的package包/类
public static void displayImage_local_string(String imgStr, ImageView image){
DisplayImageOptions options = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.showImageOnLoading(R.drawable.loading_bg_cn_2_1)
.showImageOnFail(R.drawable.loading_fail_bg_cn_2_1)
.showImageForEmptyUri(R.drawable.loading_none_bg_cn_2_1)
.cacheOnDisk(true).considerExifParams(true)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT).resetViewBeforeLoading(true)
.displayer(new FadeInBitmapDisplayer(FADEINTIME)).bitmapConfig(Bitmap.Config.RGB_565)
.build();
String imagePath = "/mnt/sdcard/image.png";
String imageUrl = ImageDownloader.Scheme.FILE.wrap(imagePath);
ImageLoader.getInstance().displayImage(imgStr, image, options);
}
示例14: displayImage_local_string
import com.nostra13.universalimageloader.core.download.ImageDownloader; //导入依赖的package包/类
public static void displayImage_local_string(String string,ImageView image){
DisplayImageOptions options = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.showImageOnLoading(R.drawable.loading_bg_cn_2_1)
.showImageOnFail(R.drawable.loading_fail_bg_cn_2_1)
.showImageForEmptyUri(R.drawable.loading_none_bg_cn_2_1)
.cacheOnDisk(true).considerExifParams(true)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT).resetViewBeforeLoading(true)
.displayer(new FadeInBitmapDisplayer(FADEINTIME)).bitmapConfig(Bitmap.Config.RGB_565)
.build();
String imagePath = "/mnt/sdcard/image.png";
String imageUrl = ImageDownloader.Scheme.FILE.wrap(imagePath);
ImageLoader.getInstance().displayImage(string, image, options);
}