本文整理匯總了Java中com.nostra13.universalimageloader.core.assist.ImageScaleType類的典型用法代碼示例。如果您正苦於以下問題:Java ImageScaleType類的具體用法?Java ImageScaleType怎麽用?Java ImageScaleType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ImageScaleType類屬於com.nostra13.universalimageloader.core.assist包,在下文中一共展示了ImageScaleType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: prepareDecodingOptions
import com.nostra13.universalimageloader.core.assist.ImageScaleType; //導入依賴的package包/類
protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) {
ImageScaleType scaleType = decodingInfo.getImageScaleType();
int scale;
if (scaleType == ImageScaleType.NONE) {
scale = 1;
} else if (scaleType == ImageScaleType.NONE_SAFE) {
scale = ImageSizeUtils.computeMinImageSampleSize(imageSize);
} else {
ImageSize targetSize = decodingInfo.getTargetSize();
boolean powerOf2 = scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2;
scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2);
}
if (scale > 1 && loggingEnabled) {
L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), scale, decodingInfo.getImageKey());
}
Options decodingOptions = decodingInfo.getDecodingOptions();
decodingOptions.inSampleSize = scale;
return decodingOptions;
}
示例2: onCreateView
import com.nostra13.universalimageloader.core.assist.ImageScaleType; //導入依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.cacheOnDisk(true)
.imageScaleType(ImageScaleType.NONE)
.showImageOnLoading(R.drawable.screenshot_placeholder)
.showImageForEmptyUri(R.drawable.screenshot_placeholder)
.bitmapConfig(Bitmap.Config.RGB_565)
.build();
View rootView = inflater.inflate(R.layout.activity_screenshots_page, container, false);
ImageView screenshotView = (ImageView) rootView.findViewById(R.id.screenshot);
ImageLoader.getInstance().displayImage(screenshotUrl, screenshotView, displayImageOptions);
return rootView;
}
示例3: CategoryController
import com.nostra13.universalimageloader.core.assist.ImageScaleType; //導入依賴的package包/類
CategoryController(final Activity activity, LoaderManager loaderManager, View itemView) {
super(itemView);
this.activity = activity;
this.loaderManager = loaderManager;
appCardsAdapter = new AppPreviewAdapter(activity);
viewAll = (Button) itemView.findViewById(R.id.button);
viewAll.setOnClickListener(onViewAll);
heading = (TextView) itemView.findViewById(R.id.name);
image = (FeatureImage) itemView.findViewById(R.id.category_image);
background = (FrameLayout) itemView.findViewById(R.id.category_background);
RecyclerView appCards = (RecyclerView) itemView.findViewById(R.id.app_cards);
appCards.setAdapter(appCardsAdapter);
appCards.addItemDecoration(new ItemDecorator(activity));
displayImageOptions = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.imageScaleType(ImageScaleType.NONE)
.displayer(new FadeInBitmapDisplayer(100, true, true, false))
.bitmapConfig(Bitmap.Config.RGB_565)
.build();
}
示例4: onAfterViews
import com.nostra13.universalimageloader.core.assist.ImageScaleType; //導入依賴的package包/類
@Override
public void onAfterViews() {
initToolbar();
mContext = this;
mContentResolver = getContentResolver();
mImageLoader = ImageLoader.getInstance();
options = new DisplayImageOptions.Builder()
.showImageOnLoading(R.mipmap.ic_launcher)
.showImageForEmptyUri(R.mipmap.ic_launcher)
.showImageOnFail(R.mipmap.ic_launcher)
.cacheInMemory(false)
.cacheOnDisk(true)
.considerExifParams(true)
.imageScaleType(ImageScaleType.EXACTLY)
.bitmapConfig(Bitmap.Config.RGB_565).build();
initViews();
}
示例5: getDefaultConfig
import com.nostra13.universalimageloader.core.assist.ImageScaleType; //導入依賴的package包/類
/**
* 獲取圖片加載器的圖片的配置
*
* @param isRound 是否是加載圓形圖片
* @param defaultRes 默認圖片ID
* @return 返回配置
*/
public static DisplayImageOptions getDefaultConfig(boolean isRound,int defaultRes) {
DisplayImageOptions.Builder builder=new DisplayImageOptions.Builder();
// 設置緩存到內存和SD卡中,設置圖片的解碼格式
builder.cacheInMemory(true).cacheOnDisk(true).bitmapConfig(Bitmap.Config.RGB_565);
// 考慮JPEG圖像EXIF參數(旋轉和翻轉)
builder.imageScaleType(ImageScaleType.EXACTLY_STRETCHED);
// 設置圓形圖片
if (isRound) {
builder.considerExifParams(true).displayer(new RoundedBitmapDisplayer(12));
}
// 設置下載前圖片重置複位
builder.resetViewBeforeLoading(true);
// 設置圖片下載失敗的時候加載默認的圖片
if (defaultRes != 0) {
builder.showImageForEmptyUri(defaultRes).showImageOnFail(defaultRes);
}
return builder.build();
}
示例6: Builder
import com.nostra13.universalimageloader.core.assist.ImageScaleType; //導入依賴的package包/類
public Builder() {
this.imageResOnLoading = 0;
this.imageResForEmptyUri = 0;
this.imageResOnFail = 0;
this.imageOnLoading = null;
this.imageForEmptyUri = null;
this.imageOnFail = null;
this.resetViewBeforeLoading = false;
this.cacheInMemory = false;
this.cacheOnDisk = false;
this.imageScaleType = ImageScaleType.IN_SAMPLE_POWER_OF_2;
this.decodingOptions = new Options();
this.delayBeforeLoading = 0;
this.considerExifParams = false;
this.extraForDownloader = null;
this.preProcessor = null;
this.postProcessor = null;
this.displayer = DefaultConfigurationFactory.createBitmapDisplayer();
this.handler = null;
this.isSyncLoading = false;
this.decodingOptions.inPurgeable = true;
this.decodingOptions.inInputShareable = true;
}
示例7: resizeAndSaveImage
import com.nostra13.universalimageloader.core.assist.ImageScaleType; //導入依賴的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;
}
示例8: prepareDecodingOptions
import com.nostra13.universalimageloader.core.assist.ImageScaleType; //導入依賴的package包/類
protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) {
int scale;
ImageScaleType scaleType = decodingInfo.getImageScaleType();
if (scaleType == ImageScaleType.NONE) {
scale = 1;
} else if (scaleType == ImageScaleType.NONE_SAFE) {
scale = ImageSizeUtils.computeMinImageSampleSize(imageSize);
} else {
boolean powerOf2;
ImageSize targetSize = decodingInfo.getTargetSize();
if (scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2) {
powerOf2 = true;
} else {
powerOf2 = false;
}
scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2);
}
if (scale > 1 && this.loggingEnabled) {
L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), Integer.valueOf(scale), decodingInfo.getImageKey());
}
Options decodingOptions = decodingInfo.getDecodingOptions();
decodingOptions.inSampleSize = scale;
return decodingOptions;
}
示例9: TitlePopupMenu
import com.nostra13.universalimageloader.core.assist.ImageScaleType; //導入依賴的package包/類
@SuppressLint({"InflateParams"})
public TitlePopupMenu(Context context, int width, int height) {
this.LIST_PADDING = 10;
this.mRect = new Rect();
this.mLocation = new int[2];
this.popupGravity = 0;
this.menus = new ArrayList();
this.menusAdapter = new MenusAdapter();
this.mContext = context;
this.options = new Builder().showImageOnLoading(R.drawable.lemallsdk_icon_default).showImageForEmptyUri(R.drawable.lemallsdk_icon_default).showImageOnFail(R.drawable.lemallsdk_icon_default).cacheInMemory(true).cacheOnDisc(true).bitmapConfig(Config.RGB_565).imageScaleType(ImageScaleType.IN_SAMPLE_INT).displayer(new SimpleBitmapDisplayer()).build();
setFocusable(true);
setTouchable(true);
setOutsideTouchable(true);
this.mScreenWidth = ScreenUtil.getScreenWidth(this.mContext);
this.mScreenHeight = ScreenUtil.getScreenHeight(this.mContext);
setWidth(width);
setHeight(height);
setAnimationStyle(R.style.AnimationPreview);
update();
setBackgroundDrawable(new BitmapDrawable());
setContentView(LayoutInflater.from(this.mContext).inflate(R.layout.lemallsdk_title_popup_menu, null));
initUI();
}
示例10: getListDisplayImageOptions
import com.nostra13.universalimageloader.core.assist.ImageScaleType; //導入依賴的package包/類
/**
* ListView GridView RecyclerView時 ImageLoader使用該配置
* @param image_default
* @return
*/
public static DisplayImageOptions getListDisplayImageOptions(int image_default) {
DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder();
DisplayImageOptions options=builder
//.showImageOnLoading(R.drawable.loading) //設置圖片在下載期間顯示的圖片
.showImageForEmptyUri(image_default)//設置圖片Uri為空或是錯誤的時候顯示的圖片
.showImageOnFail(image_default) //設置圖片加載/解碼過程中錯誤時候顯示的圖片
.cacheInMemory(true)//設置下載的圖片是否緩存在內存中
.cacheOnDisc(true)//設置下載的圖片是否緩存在SD卡中
.considerExifParams(true) //是否考慮JPEG圖像EXIF參數(旋轉,翻轉)
.imageScaleType(ImageScaleType.EXACTLY)//設置圖片以如何的編碼方式顯示
.bitmapConfig(Bitmap.Config.RGB_565)//設置圖片的解碼類型
//.decodingOptions(BitmapFactory.Options decodingOptions)//設置圖片的解碼配置
.delayBeforeLoading(0)//int delayInMillis為你設置的下載前的延遲時間
//設置圖片加入緩存前,對bitmap進行設置
//.preProcessor(BitmapProcessor preProcessor)
.resetViewBeforeLoading(false)//設置圖片在下載前是否重置,複位
//.displayer(new RoundedBitmapDisplayer(20))//不推薦用!!!!是否設置為圓角,弧度為多少
//.displayer(new FadeInBitmapDisplayer(100))//是否圖片加載好後漸入的動畫時間,可能會出現閃動
.build();//構建完成
return options;
}
示例11: resizeAndSaveImage
import com.nostra13.universalimageloader.core.assist.ImageScaleType; //導入依賴的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;
}
示例12: prepareDecodingOptions
import com.nostra13.universalimageloader.core.assist.ImageScaleType; //導入依賴的package包/類
protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) {
int scale;
ImageScaleType scaleType = decodingInfo.getImageScaleType();
if (scaleType == ImageScaleType.NONE) {
scale = 1;
} else if (scaleType == ImageScaleType.NONE_SAFE) {
scale = ImageSizeUtils.computeMinImageSampleSize(imageSize);
} else {
boolean powerOf2;
ImageSize targetSize = decodingInfo.getTargetSize();
if (scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2) {
powerOf2 = true;
} else {
powerOf2 = false;
}
scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo
.getViewScaleType(), powerOf2);
}
if (scale > 1 && this.loggingEnabled) {
L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), Integer.valueOf
(scale), decodingInfo.getImageKey());
}
Options decodingOptions = decodingInfo.getDecodingOptions();
decodingOptions.inSampleSize = scale;
return decodingOptions;
}
示例13: initImageLoader
import com.nostra13.universalimageloader.core.assist.ImageScaleType; //導入依賴的package包/類
public static void initImageLoader(Context context) {
b = new DisplayImageOptions.Builder();
b.cacheOnDisc(true)
.cacheInMemory(false)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT)
.bitmapConfig(Bitmap.Config.RGB_565);
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
config.threadPriority(Thread.NORM_PRIORITY - 2);
config.denyCacheImageMultipleSizesInMemory();
config.discCacheFileNameGenerator(new Md5FileNameGenerator());
config.memoryCacheSize(20 * 1024 * 1024); // 20 MiB
config.discCacheSize(100 * 1024 * 1024); // 100 MiB
config.tasksProcessingOrder(QueueProcessingType.LIFO);
config.defaultDisplayImageOptions(b.build());
config.writeDebugLogs();
ImageLoader.getInstance().init(config.build());
}
示例14: initImageLoader
import com.nostra13.universalimageloader.core.assist.ImageScaleType; //導入依賴的package包/類
private void initImageLoader() {
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheInMemory(false)
.imageScaleType(ImageScaleType.EXACTLY)
.cacheOnDisk(true)
.build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.threadPriority(Thread.NORM_PRIORITY - 2)
.defaultDisplayImageOptions(defaultOptions)
.denyCacheImageMultipleSizesInMemory()
.diskCacheFileNameGenerator(new Md5FileNameGenerator())
.diskCache(new UnlimitedDiskCache(StorageUtils.getOwnCacheDirectory(this, Constant.APP_IMAGE)))
.diskCacheSize(100 * 1024 * 1024).tasksProcessingOrder(QueueProcessingType.LIFO)
.memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024)
.threadPoolSize(3)
.build();
ImageLoader.getInstance().init(config);
}
示例15: BaseDataAdapter
import com.nostra13.universalimageloader.core.assist.ImageScaleType; //導入依賴的package包/類
public BaseDataAdapter(Context context, List<? extends BmobObject> mDatas) {
this.context = context;
this.mDatas = mDatas;
options = new DisplayImageOptions.Builder()
.showImageOnLoading(R.mipmap.icon_live_item_default)
.showImageForEmptyUri(R.mipmap.icon_live_item_default)
.showImageOnFail(R.mipmap.icon_live_item_default)
.cacheInMemory(false)
.cacheOnDisk(true)
.considerExifParams(true)
.bitmapConfig(Bitmap.Config.RGB_565)
.displayer(new SimpleBitmapDisplayer())
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
.build();
if (this.context == null) {
System.out.println("this.context is null");
} else {
mlayoutInflate = LayoutInflater.from(this.context);
}
}