@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(); }
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); } }
protected void executeLoadImage() { if (TextUtils.isEmpty(url)) { setImageResource(R.drawable.image_loading_resource); } else { DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.image_loading_resource) .cacheInMemory(true) .cacheOnDisk(true) .displayer(new SimpleBitmapDisplayer()); DisplayImageOptions options = builder.build(); ImageLoader.getInstance().displayImage(url, this, options, imageLoadingListener); } }
/** * Android-Universal-Image-Loader config. * * DON'T COPY THIS CODE TO YOUR REAL PROJECT! * * I would recommend doing it in an overloaded Application.onCreate(). * It is just for test purpose * * */ private void initUniversalImageLoaderLibrary(){ File cacheDir = StorageUtils.getCacheDirectory(getActivity()); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getActivity()) .memoryCache(new LruMemoryCache(2 * 1024 * 1024)) .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) .writeDebugLogs() .build(); ImageLoader.getInstance().init(config); options = new DisplayImageOptions.Builder() .cacheInMemory(true) .displayer(new SimpleBitmapDisplayer()) .showImageOnFail(R.drawable.ic_error_loadingsmall) .build(); }
public static void disPlay(String uri, ImageAware imageAware,int defaultPic){ DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageOnLoading(defaultPic) .showImageForEmptyUri(defaultPic) .showImageOnFail(defaultPic) .cacheInMemory(true) .cacheOnDisc(false) .bitmapConfig(Bitmap.Config.RGB_565) .displayer(new SimpleBitmapDisplayer()) .build(); imageLoader.displayImage(uri, imageAware, options); }
public MyAdapter(Context context, List<LocalImageHelper.LocalFile> paths) { m_context = context; this.paths = paths; options = new DisplayImageOptions.Builder() .cacheInMemory(true) .cacheOnDisk(false) .showImageForEmptyUri(FakeR.getId(context, "drawable", "cb_no_pic_small")) .showImageOnFail(FakeR.getId(context, "drawable", "cb_no_pic_small")) .showImageOnLoading(FakeR.getId(context, "drawable", "cb_no_pic_small")) .bitmapConfig(Bitmap.Config.RGB_565) .setImageSize(new ImageSize(app.getQuarterWidth(), 0)) .displayer(new SimpleBitmapDisplayer()).build(); }
FolderAdapter(Context context, Map<String, List<LocalImageHelper.LocalFile>> folders) { this.folders = folders; this.context = context; folderNames = new ArrayList<String>(); options = new DisplayImageOptions.Builder() .cacheInMemory(true) .cacheOnDisk(false) .showImageForEmptyUri(FakeR.getId(context, "drawable", "cb_no_pic_small")) .showImageOnFail(FakeR.getId(context, "drawable", "cb_no_pic_small")) .showImageOnLoading(FakeR.getId(context, "drawable", "cb_no_pic_small")) .bitmapConfig(Bitmap.Config.RGB_565) .setImageSize(new ImageSize(app.getQuarterWidth(), 0)) .displayer(new SimpleBitmapDisplayer()).build(); Iterator iter = folders.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); String key = (String) entry.getKey(); folderNames.add(key); } //根据文件夹内的图片数量降序显示 Collections.sort(folderNames, new Comparator<String>() { public int compare(String arg0, String arg1) { Integer num1 = helper.getFolder(arg0).size(); Integer num2 = helper.getFolder(arg1).size(); return num2.compareTo(num1); } }); }
/** 播放按钮点击事件 */ public AlbumViewPager(Context context, AttributeSet attrs) { super(context, attrs); localOptions=new DisplayImageOptions.Builder() .cacheInMemory(true) .cacheOnDisk(false) .bitmapConfig(Bitmap.Config.RGB_565) .imageScaleType(ImageScaleType.EXACTLY) .displayer(new SimpleBitmapDisplayer()).build(); //DisplayImageOptions.getDefaltOpitions(0, R.drawable.dangkr_no_picture, //((AppContext)context.getApplicationContext()).getWindowWidth()); }
private void initImageLoader() { File cacheDir = FileUtil.getCacheDirectory(this, FilePathConfig.PATH_IMAGEDOWNLOADER); DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.default_imageview_background) // resource or drawable .showImageForEmptyUri(R.drawable.default_imageview_background) // resource or drawable .showImageOnFail(R.drawable.default_imageview_background) // resource or drawable .resetViewBeforeLoading(false) // default .delayBeforeLoading(200) .cacheInMemory(true) .cacheOnDisk(true) .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) // default .bitmapConfig(Bitmap.Config.ARGB_8888) // default .displayer(new SimpleBitmapDisplayer()) // default .build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()) .memoryCacheExtraOptions(480, 800) // default = device screen dimensions .diskCacheExtraOptions(480, 800, null) .threadPoolSize(3) // default .threadPriority(Thread.NORM_PRIORITY - 2) // default .tasksProcessingOrder(QueueProcessingType.FIFO) // default .denyCacheImageMultipleSizesInMemory() .memoryCache(new LruMemoryCache(20 * 1024 * 1024)) .memoryCacheSize(2 * 1024 * 1024) .memoryCacheSizePercentage(13) // default .diskCache(new UnlimitedDiskCache(cacheDir)) // default .diskCacheSize(50 * 1024 * 1024) .diskCacheFileCount(100) .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default .imageDownloader(new BaseImageDownloader(getApplicationContext())) // default .imageDecoder(new BaseImageDecoder(false)) // default .defaultDisplayImageOptions(options) .build(); ImageLoader.getInstance().init(config); }
private void initIDs() { lv = (ListView) this.findViewById(R.id.firststep_lv); fixed_view = (LinearLayout) this.findViewById(R.id.fixed_to_top); viewPager = (ViewPager) headview1.findViewById(R.id.firststep_viewpage); btn_opendrawer = (Button) this.findViewById(R.id.btn_opendrawer); btn_openMyLove = (Button) this.findViewById(R.id.btn_openmylove); drawerlayout = (DrawerLayout) this.findViewById(R.id.drawerlayout); btn_restaurant = (Button) headview2.findViewById(R.id.btn_restaurant); btn_cuisine = (Button) headview2.findViewById(R.id.btn_cuisine); btn_district = (Button) headview2.findViewById(R.id.btn_district); btn_restaurant1 = (Button) this.findViewById(R.id.btn_restaurant1); btn_cuisine1 = (Button) this.findViewById(R.id.btn_cuisine1); btn_district1 = (Button) this.findViewById(R.id.btn_district1); btn_opendrawer.setOnClickListener(this); btn_openMyLove.setOnClickListener(this); btn_restaurant.setOnClickListener(this); btn_cuisine.setOnClickListener(this); btn_district.setOnClickListener(this); btn_restaurant1.setOnClickListener(this); btn_cuisine1.setOnClickListener(this); btn_district1.setOnClickListener(this); //获取登录帐号 SharedPreferences sp = MainActivity.this.getSharedPreferences("userMessage", MODE_PRIVATE); loginName = sp.getString("loginName", ""); //先定义一个加载图片的option options = new DisplayImageOptions.Builder().showImageOnLoading(R.mipmap.loadingpic) .showImageOnFail(R.mipmap.loadingfailed).cacheInMemory(true).cacheOnDisk(true).displayer(new SimpleBitmapDisplayer()).build(); }
public BannerAdapter(Context context, List<String> datas) { super(context, datas); mDisplayImageOptions = new DisplayImageOptions.Builder() .cacheInMemory(true)//设置下载的图片是否缓存在内存中 .cacheOnDisk(true)//设置下载的图片是否缓存在SD卡中 .considerExifParams(true) //是否考虑JPEG图像EXIF参数(旋转,翻转) .imageScaleType(ImageScaleType.NONE)//设置图片以如何的编码方式显示 .bitmapConfig(Bitmap.Config.RGB_565)//设置图片的解码类型 .resetViewBeforeLoading(true)//设置图片在下载前是否重置,复位 .displayer(new SimpleBitmapDisplayer())//是否图片加载好后渐入的动画时间 .build();//构建完成 mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mViewCache = new ArrayBlockingQueue<>(2); }
public static DisplayImageOptions getDefaultDisplayImageOptions() { DisplayImageOptions options = new DisplayImageOptions.Builder() .resetViewBeforeLoading(false).delayBeforeLoading(100) .considerExifParams(false) .imageScaleType(ImageScaleType.IN_SAMPLE_INT) .bitmapConfig(Bitmap.Config.RGB_565) .displayer(new SimpleBitmapDisplayer()).handler(new Handler()) .cacheInMemory(true).cacheOnDisk(true) // .showImageForEmptyUri(R.drawable.default_pic) // .showImageOnFail(R.drawable.default_pic) .build(); return options; }
public static DisplayImageOptions getAvatarDisplayImageOptions() { DisplayImageOptions options = new DisplayImageOptions.Builder() .resetViewBeforeLoading(false).delayBeforeLoading(100) .considerExifParams(false) .imageScaleType(ImageScaleType.IN_SAMPLE_INT) .bitmapConfig(Bitmap.Config.RGB_565) .displayer(new SimpleBitmapDisplayer()).handler(new Handler()) .cacheInMemory(true).cacheOnDisk(true) .showImageForEmptyUri(R.drawable.ic_protrait_solid) .showImageOnFail(R.drawable.ic_protrait_solid) .build(); return options; }
/** * 初始化 ImageLoader * * @param context */ public static ImageLoader initNoCacheImageLoader(Context context) { DisplayImageOptions options = new DisplayImageOptions.Builder() .resetViewBeforeLoading(false).delayBeforeLoading(100) .considerExifParams(false) .imageScaleType(ImageScaleType.IN_SAMPLE_INT) .bitmapConfig(Bitmap.Config.RGB_565) .displayer(new SimpleBitmapDisplayer()).handler(new Handler()) .cacheInMemory(false).cacheOnDisk(false) // .showImageForEmptyUri(R.drawable.default_pic) // .showImageOnFail(R.drawable.default_pic) .build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder( context.getApplicationContext()) .threadPoolSize(10) .threadPriority(Thread.NORM_PRIORITY - 2) .tasksProcessingOrder(QueueProcessingType.FIFO) .denyCacheImageMultipleSizesInMemory() .memoryCache(new UsingFreqLimitedMemoryCache(3 * 1024 * 1024)) .imageDownloader( new BaseImageDownloader(context.getApplicationContext())) .defaultDisplayImageOptions(options) // .writeDebugLogs() .build(); ImageLoader imageLoader = ImageLoader.getInstance(); imageLoader.init(config); return imageLoader; }
public static DisplayImageOptions getDisplayImageOptions(Drawable drawableEmpty, Drawable drawableFail) { DisplayImageOptions options = new DisplayImageOptions.Builder() .resetViewBeforeLoading(false).delayBeforeLoading(100) .considerExifParams(false) .imageScaleType(ImageScaleType.IN_SAMPLE_INT) .bitmapConfig(Bitmap.Config.RGB_565) .displayer(new SimpleBitmapDisplayer()).handler(new Handler()) .cacheInMemory(true).cacheOnDisk(true) .showImageForEmptyUri(drawableEmpty) .showImageOnFail(drawableFail) .build(); return options; }
public DisplayImageOptions getOptions() { return new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.app_logo) .showImageForEmptyUri(R.drawable.app_logo) .showImageOnFail(R.drawable.app_logo) .cacheInMemory(true) .cacheOnDisk(true) .imageScaleType(ImageScaleType.EXACTLY) // default .bitmapConfig(Bitmap.Config.ARGB_4444) // default .displayer(new SimpleBitmapDisplayer()) .build(); }
public static final void setImage(Context ctx, final ImageView imgView, final int roundRadius, String url) { DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.ic_dots_horizontal_white_48dp) .showImageOnFail(R.drawable.ic_close_white_48dp) .cacheInMemory(true) .cacheOnDisk(true) .displayer(roundRadius > 0 ? new RoundedBitmapDisplayer(roundRadius) : new SimpleBitmapDisplayer()) .build(); ImageUtil.getImageLoader(ctx).displayImage(url, imgView, options, new SimpleImageLoadingListener() { public void onLoadingComplete(String uri, View view, Bitmap loadedImage) { if (roundRadius > 0) { imgView.setPadding(0, 0, 0, 0); } } }); }
public static DisplayImageOptions.Builder getDefaultImageOptionsBuilder() { DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder() .resetViewBeforeLoading(false) // default // .delayBeforeLoading(1000) .showImageOnLoading(R.drawable.titanic_wave_black) .considerExifParams(false) // default .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) // default .bitmapConfig(Bitmap.Config.ARGB_8888) // default .displayer(new SimpleBitmapDisplayer()) // default .handler(new Handler()) // default .cacheInMemory(true) .cacheOnDisc(true); return builder; }
/** * Return default DisplayImageOptions.Builder * @return */ public static DisplayImageOptions.Builder getDefaultImageOptionsBuilder() { DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder() .resetViewBeforeLoading(false) // default // .delayBeforeLoading(1000) // .showImageOnLoading(R.drawable.titanic_wave_black) .considerExifParams(false) // default .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) // default .bitmapConfig(Bitmap.Config.ARGB_8888) // default .displayer(new SimpleBitmapDisplayer()) // default .handler(new Handler()) // default .cacheInMemory(true) .cacheOnDisk(true); return builder; }
/** Creates default implementation of {@link BitmapDisplayer} - {@link SimpleBitmapDisplayer} */ public static BitmapDisplayer createBitmapDisplayer() { return new SimpleBitmapDisplayer(); }
public static BitmapDisplayer createBitmapDisplayer() { return new SimpleBitmapDisplayer(); }
public void init(Context context, LetvThumbnailUtils letvThumbnailUtils) { LetvCacheConfiguration.initCacheLibrary(context, letvThumbnailUtils); this.options = new Builder().cacheInMemory(true).cacheOnDisk(true).resetViewBeforeLoading(false).displayer(new SimpleBitmapDisplayer()).bitmapConfig(Config.RGB_565).imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2).build(); }
private BitmapDisplayer getDisplayer() { if (VERSION.SDK_INT >= 9) { return new FadeInBitmapDisplayer(200); } return new SimpleBitmapDisplayer(); }
@Override public void onCreate() { super.onCreate(); Fabric.with(this, new Crashlytics()); setDebugMode(); Analytics.Lifecycle.Application.onCreate(this); // StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() // .detectDiskReads() // .detectDiskWrites() // .detectNetwork() // or .detectAll() for all detectable problems // .penaltyLog() // .detectAll() // .build()); // StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() // .detectAll() // .detectLeakedSqlLiteObjects() // .detectLeakedClosableObjects() // .penaltyLog() // .build()); createShortcutOnFirstRun(); context = getApplicationContext(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .defaultDisplayImageOptions(new DisplayImageOptions.Builder() .displayer(new SimpleBitmapDisplayer()) .cacheOnDisc(true) .cacheInMemory(true) .showStubImage(android.R.drawable.sym_def_app_icon) .resetViewBeforeLoading(true) .build()) .discCache(new UnlimitedDiscCache(new File(ICON_CACHE_PATH))) .memoryCache(new LruMemoryCache(20 * 1024 * 1024)) .threadPriority(Thread.MIN_PRIORITY) .build(); ImageLoader.getInstance().init(config); }
/** Creates default implementation of {@link com.nostra13.universalimageloader.core.display.BitmapDisplayer} - {@link com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer} */ public static BitmapDisplayer createBitmapDisplayer() { return new SimpleBitmapDisplayer(); }