本文整理汇总了Java中com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme类的典型用法代码示例。如果您正苦于以下问题:Java Scheme类的具体用法?Java Scheme怎么用?Java Scheme使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Scheme类属于com.nostra13.universalimageloader.core.download.ImageDownloader包,在下文中一共展示了Scheme类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resizeAndSaveImage
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme; //导入依赖的package包/类
private boolean resizeAndSaveImage(int maxWidth, int maxHeight) throws IOException {
File targetFile = this.configuration.diskCache.get(this.uri);
if (targetFile == null || !targetFile.exists()) {
return false;
}
Bitmap bmp = this.decoder.decode(new ImageDecodingInfo(this.memoryCacheKey, Scheme.FILE.wrap(targetFile.getAbsolutePath()), this.uri, new ImageSize(maxWidth, maxHeight), ViewScaleType.FIT_INSIDE, getDownloader(), new Builder().cloneFrom(this.options).imageScaleType(ImageScaleType.IN_SAMPLE_INT).build()));
if (!(bmp == null || this.configuration.processorForDiskCache == null)) {
L.d(LOG_PROCESS_IMAGE_BEFORE_CACHE_ON_DISK, this.memoryCacheKey);
bmp = this.configuration.processorForDiskCache.process(bmp);
if (bmp == null) {
L.e(ERROR_PROCESSOR_FOR_DISK_CACHE_NULL, this.memoryCacheKey);
}
}
if (bmp == null) {
return false;
}
boolean saved = this.configuration.diskCache.save(this.uri, bmp);
bmp.recycle();
return saved;
}
示例2: getStream
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme; //导入依赖的package包/类
public InputStream getStream(String imageUri, Object extra) throws IOException {
switch (Scheme.ofUri(imageUri)) {
case HTTP:
case HTTPS:
return getStreamFromNetwork(imageUri, extra);
case FILE:
return getStreamFromFile(imageUri, extra);
case CONTENT:
return getStreamFromContent(imageUri, extra);
case ASSETS:
return getStreamFromAssets(imageUri, extra);
case DRAWABLE:
return getStreamFromDrawable(imageUri, extra);
default:
return getStreamFromOtherSource(imageUri, extra);
}
}
示例3: resizeAndSaveImage
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme; //导入依赖的package包/类
private boolean resizeAndSaveImage(int maxWidth, int maxHeight) throws IOException {
File targetFile = this.configuration.diskCache.get(this.uri);
if (targetFile == null || !targetFile.exists()) {
return false;
}
Bitmap bmp = this.decoder.decode(new ImageDecodingInfo(this.memoryCacheKey, Scheme.FILE
.wrap(targetFile.getAbsolutePath()), this.uri, new ImageSize(maxWidth, maxHeight)
, ViewScaleType.FIT_INSIDE, getDownloader(), new Builder().cloneFrom(this
.options).imageScaleType(ImageScaleType.IN_SAMPLE_INT).build()));
if (!(bmp == null || this.configuration.processorForDiskCache == null)) {
L.d(LOG_PROCESS_IMAGE_BEFORE_CACHE_ON_DISK, this.memoryCacheKey);
bmp = this.configuration.processorForDiskCache.process(bmp);
if (bmp == null) {
L.e(ERROR_PROCESSOR_FOR_DISK_CACHE_NULL, this.memoryCacheKey);
}
}
if (bmp == null) {
return false;
}
boolean saved = this.configuration.diskCache.save(this.uri, bmp);
bmp.recycle();
return saved;
}
示例4: onCreate
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme; //导入依赖的package包/类
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.zg_activity_media_camera_preview);
findViewById(R.id.iv_left).setOnClickListener(this);
findViewById(R.id.tv_right).setOnClickListener(this);
((TextView) findViewById(R.id.title))
.setText(R.string.zg_content_media_pic_preview);
mProgress = (ProgressBar) findViewById(R.id.progressBar);
mImageView = (ImageView) findViewById(R.id.imageview);
mMediaInfo = (MediaInfo) getIntent().getExtras().getSerializable(
MediaConstants.MEDIA_REQUEST_DATAS);
ViewerImageLoader.getInstance().displayImage(
Scheme.FILE.wrap(mMediaInfo.filePath), mImageView, this);
}
示例5: resizeAndSaveImage
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme; //导入依赖的package包/类
/** Decodes image file into Bitmap, resize it and save it back */
private boolean resizeAndSaveImage(int maxWidth, int maxHeight) throws IOException {
// Decode image file, compress and re-save it
boolean saved = false;
File targetFile = configuration.diskCache.get(uri);
if (targetFile != null && targetFile.exists()) {
ImageSize targetImageSize = new ImageSize(maxWidth, maxHeight);
DisplayImageOptions specialOptions = new DisplayImageOptions.Builder().cloneFrom(options)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT).build();
ImageDecodingInfo decodingInfo = new ImageDecodingInfo(memoryCacheKey,
Scheme.FILE.wrap(targetFile.getAbsolutePath()), uri, targetImageSize, ViewScaleType.FIT_INSIDE,
getDownloader(), specialOptions);
Bitmap bmp = decoder.decode(decodingInfo);
if (bmp != null && configuration.processorForDiskCache != null) {
L.d(LOG_PROCESS_IMAGE_BEFORE_CACHE_ON_DISK, memoryCacheKey);
bmp = configuration.processorForDiskCache.process(bmp);
if (bmp == null) {
L.e(ERROR_PROCESSOR_FOR_DISK_CACHE_NULL, memoryCacheKey);
}
}
if (bmp != null) {
saved = configuration.diskCache.save(uri, bmp);
bmp.recycle();
}
}
return saved;
}
示例6: defineExifOrientation
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme; //导入依赖的package包/类
protected ExifInfo defineExifOrientation(String imageUri) {
int rotation = 0;
boolean flip = false;
try {
ExifInterface exif = new ExifInterface(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);
}
示例7: testSchemeHttp
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme; //导入依赖的package包/类
@Test
public void testSchemeHttp() throws Exception {
String uri = "http://image.com/1.png";
Scheme result = Scheme.ofUri(uri);
Scheme expected = Scheme.HTTP;
Assertions.assertThat(result).isEqualTo(expected);
}
示例8: testSchemeHttps
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme; //导入依赖的package包/类
@Test
public void testSchemeHttps() throws Exception {
String uri = "https://image.com/1.png";
Scheme result = Scheme.ofUri(uri);
Scheme expected = Scheme.HTTPS;
Assertions.assertThat(result).isEqualTo(expected);
}
示例9: testSchemeContent
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme; //导入依赖的package包/类
@Test
public void testSchemeContent() throws Exception {
String uri = "content://path/to/content";
Scheme result = Scheme.ofUri(uri);
Scheme expected = Scheme.CONTENT;
Assertions.assertThat(result).isEqualTo(expected);
}
示例10: testSchemeAssets
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme; //导入依赖的package包/类
@Test
public void testSchemeAssets() throws Exception {
String uri = "assets://folder/1.png";
Scheme result = Scheme.ofUri(uri);
Scheme expected = Scheme.ASSETS;
Assertions.assertThat(result).isEqualTo(expected);
}
示例11: testSchemeDrawables
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme; //导入依赖的package包/类
@Test
public void testSchemeDrawables() throws Exception {
String uri = "drawable://123456890";
Scheme result = Scheme.ofUri(uri);
Scheme expected = Scheme.DRAWABLE;
Assertions.assertThat(result).isEqualTo(expected);
}
示例12: testSchemeFile
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme; //导入依赖的package包/类
@Test
public void testSchemeFile() throws Exception {
String uri = "file://path/on/the/device/1.png";
Scheme result = Scheme.ofUri(uri);
Scheme expected = Scheme.FILE;
Assertions.assertThat(result).isEqualTo(expected);
}
示例13: testSchemeUnknown
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme; //导入依赖的package包/类
@Test
public void testSchemeUnknown() throws Exception {
String uri = "other://image.com/1.png";
Scheme result = Scheme.ofUri(uri);
Scheme expected = Scheme.UNKNOWN;
Assertions.assertThat(result).isEqualTo(expected);
}
示例14: getStream
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme; //导入依赖的package包/类
public InputStream getStream(String imageUri, Object extra) throws IOException {
switch (Scheme.ofUri(imageUri)) {
case HTTP:
case HTTPS:
throw new IllegalStateException();
default:
return this.wrappedDownloader.getStream(imageUri, extra);
}
}
示例15: resizeAndSaveImage
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme; //导入依赖的package包/类
/**
* Decodes image file into Bitmap, resize it and save it back
*/
private boolean resizeAndSaveImage(int maxWidth, int maxHeight) throws IOException {
// Decode image file, compress and re-save it
boolean saved = false;
File targetFile = configuration.diskCache.get(uri);
if (targetFile != null && targetFile.exists()) {
ImageSize targetImageSize = new ImageSize(maxWidth, maxHeight);
DisplayImageOptions specialOptions = new DisplayImageOptions.Builder().cloneFrom(options)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT).build();
ImageDecodingInfo decodingInfo = new ImageDecodingInfo(memoryCacheKey,
Scheme.FILE.wrap(targetFile.getAbsolutePath()), uri, targetImageSize, ViewScaleType.FIT_INSIDE,
getDownloader(), specialOptions);
Bitmap bmp = decoder.decode(decodingInfo);
if (bmp != null && configuration.processorForDiskCache != null) {
L.d(LOG_PROCESS_IMAGE_BEFORE_CACHE_ON_DISK, memoryCacheKey);
bmp = configuration.processorForDiskCache.process(bmp);
if (bmp == null) {
L.e(ERROR_PROCESSOR_FOR_DISK_CACHE_NULL, memoryCacheKey);
}
}
if (bmp != null) {
saved = configuration.diskCache.save(uri, bmp);
bmp.recycle();
}
}
return saved;
}