当前位置: 首页>>代码示例>>Java>>正文


Java ImageScaleType类代码示例

本文整理汇总了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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:BaseImageDecoder.java

示例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;
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:22,代码来源:ScreenShotsActivity.java

示例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();
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:27,代码来源:CategoryController.java

示例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();
}
 
开发者ID:jpaijh,项目名称:TYT,代码行数:21,代码来源:SelectPictureActivity.java

示例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();
        }
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:26,代码来源:DisplayConfig.java

示例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;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:24,代码来源:DisplayImageOptions.java

示例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;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:21,代码来源:LoadAndDisplayImageTask.java

示例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;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:25,代码来源:BaseImageDecoder.java

示例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();
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:24,代码来源:TitlePopupMenu.java

示例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;
}
 
开发者ID:qsyj,项目名称:ShortcutMenu,代码行数:27,代码来源:BitmapOptions.java

示例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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:LoadAndDisplayImageTask.java

示例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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:27,代码来源:BaseImageDecoder.java

示例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());
}
 
开发者ID:shenhuanet,项目名称:OpenEyesReading-android,代码行数:18,代码来源:App.java

示例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);
}
 
开发者ID:macyuan,项目名称:TAG,代码行数:20,代码来源:DemoApplication.java

示例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);
    }
}
 
开发者ID:wanliyang1990,项目名称:WliveTV,代码行数:21,代码来源:BaseDataAdapter.java


注:本文中的com.nostra13.universalimageloader.core.assist.ImageScaleType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。