Search in sources :

Example 21 with ImageSize

use of com.nostra13.universalimageloader.core.assist.ImageSize in project Android-Universal-Image-Loader by nostra13.

the class ImageLoaderConfiguration method getMaxImageSize.

ImageSize getMaxImageSize() {
    DisplayMetrics displayMetrics = resources.getDisplayMetrics();
    int width = maxImageWidthForMemoryCache;
    if (width <= 0) {
        width = displayMetrics.widthPixels;
    }
    int height = maxImageHeightForMemoryCache;
    if (height <= 0) {
        height = displayMetrics.heightPixels;
    }
    return new ImageSize(width, height);
}
Also used : ImageSize(com.nostra13.universalimageloader.core.assist.ImageSize) DisplayMetrics(android.util.DisplayMetrics)

Example 22 with ImageSize

use of com.nostra13.universalimageloader.core.assist.ImageSize in project QiDict by timqi.

the class MainActivity method setBackgroundColor.

private void setBackgroundColor(int bgNum) {
    int[] bgArr = new int[] { 0, R.drawable.bg1, R.drawable.bg2, R.drawable.bg3, R.drawable.bg4, R.drawable.bg5, R.drawable.bg6, R.drawable.bg7, R.drawable.bg8, R.drawable.bg9, R.drawable.bg10, R.drawable.bg11, R.drawable.bg12 };
    String imgUri = "drawable://" + bgArr[bgNum];
    ImageSize imageSize = new ImageSize(mRelativeLayout.getWidth(), mRelativeLayout.getHeight());
    Bitmap bitmap = ImageLoader.getInstance().loadImageSync(imgUri, imageSize);
    mRelativeLayout.setBackgroundDrawable(new BitmapDrawable(bitmap));
}
Also used : Bitmap(android.graphics.Bitmap) ImageSize(com.nostra13.universalimageloader.core.assist.ImageSize) BitmapDrawable(android.graphics.drawable.BitmapDrawable)

Aggregations

ImageSize (com.nostra13.universalimageloader.core.assist.ImageSize)20 Bitmap (android.graphics.Bitmap)11 View (android.view.View)5 Options (android.graphics.BitmapFactory.Options)4 ImageScaleType (com.nostra13.universalimageloader.core.assist.ImageScaleType)4 File (java.io.File)4 ImageView (android.widget.ImageView)3 SimpleImageLoadingListener (com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener)3 Matrix (android.graphics.Matrix)2 BitmapDrawable (android.graphics.drawable.BitmapDrawable)2 DisplayMetrics (android.util.DisplayMetrics)2 RemoteViews (android.widget.RemoteViews)2 DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)2 FailReason (com.nostra13.universalimageloader.core.assist.FailReason)2 ImageDecodingInfo (com.nostra13.universalimageloader.core.decode.ImageDecodingInfo)2 NonViewAware (com.nostra13.universalimageloader.core.imageaware.NonViewAware)2 Intent (android.content.Intent)1 Canvas (android.graphics.Canvas)1 Point (android.graphics.Point)1 Drawable (android.graphics.drawable.Drawable)1