Example usage for android.graphics Bitmap getRowBytes

List of usage examples for android.graphics Bitmap getRowBytes

Introduction

In this page you can find the example usage for android.graphics Bitmap getRowBytes.

Prototype

public final int getRowBytes() 

Source Link

Document

Return the number of bytes between rows in the bitmap's pixels.

Usage

From source file:cmu.cconfs.instantMessage.utils.ImageCache.java

private ImageCache() {
    // use 1/8 of available heap size
    cache = new LruCache<String, Bitmap>((int) (Runtime.getRuntime().maxMemory() / 8)) {
        @Override//w  ww . j a va 2 s . com
        protected int sizeOf(String key, Bitmap value) {
            return value.getRowBytes() * value.getHeight();
        }
    };
}

From source file:cn.xcom.helper.chat.easeui.model.EaseImageCache.java

private EaseImageCache() {
    // use 1/8 of available heap size
    cache = new LruCache<String, Bitmap>((int) (Runtime.getRuntime().maxMemory() / 8)) {
        @Override//from w  w  w. ja v a  2s  .  c  o  m
        protected int sizeOf(String key, Bitmap value) {
            return value.getRowBytes() * value.getHeight();
        }
    };
}

From source file:com.aidigame.hisun.imengstar.huanxin.ImageCache1.java

private ImageCache1() {
    // use 1/8 of available heap size
    cache = new LruCache<String, Bitmap>((int) (Runtime.getRuntime().maxMemory() / 8)) {
        @Override/* w w  w.ja  v  a 2  s  .  co  m*/
        protected int sizeOf(String key, Bitmap value) {
            return value.getRowBytes() * value.getHeight();
        }
    };
}

From source file:com.safeness.im.utils.ImageCache8.java

private ImageCache8() {
    // use 1/8 of available heap size
    cache = new LruCache<String, Bitmap>((int) (Runtime.getRuntime().maxMemory() / 8)) {
        @Override//from w  ww . java  2 s .  com
        protected int sizeOf(String key, Bitmap value) {
            return value.getRowBytes() * value.getHeight();
        }
    };
}

From source file:com.sudaotech.chatlibrary.utils.ChatImageCache.java

private ChatImageCache() {
    // use 1/8 of available heap size
    cache = new LruCache<String, Bitmap>((int) (Runtime.getRuntime().maxMemory() / 8)) {
        @Override/*from w w  w.  ja v  a 2  s  . c  o  m*/
        protected int sizeOf(String key, Bitmap value) {
            return value.getRowBytes() * value.getHeight();
        }
    };
}

From source file:com.xxjwd.chat.util.ImageCache.java

 private ImageCache() {
   // use 1/8 of available heap size
   cache = new LruCache<String, Bitmap>((int) (Runtime.getRuntime().maxMemory() / 8)) {
           @Override/*from   w w  w. j ava  2  s . c o  m*/
           protected int sizeOf(String key, Bitmap value) {
               return value.getRowBytes() * value.getHeight();
           }
       };
}

From source file:com.evandroid.musica.utils.CoverCache.java

private CoverCache() {
    // Get the Max available memory
    int maxMemory = (int) Runtime.getRuntime().maxMemory();
    int cacheSize = maxMemory / 8;
    mMemoryCache = new LruCache<String, Bitmap>(cacheSize) {
        @Override/*  w w  w.  j av a  2 s.c  om*/
        protected int sizeOf(String key, Bitmap bitmap) {
            return bitmap.getRowBytes() * bitmap.getHeight();
        }
    };
}

From source file:com.gelakinetic.mtgfam.helpers.lruCache.ImageCache.java

/**
 * Get the size in bytes of a bitmap in a BitmapDrawable. Note that from Android 4.4 (KitKat)
 * onward this returns the allocated memory size of the bitmap which can be larger than the
 * actual bitmap data byte count (in the case it was re-used).
 *
 * @param value//from www .jav  a 2s  .  c  o m
 * @return size in bytes
 */
@TargetApi(VERSION_CODES.KITKAT)
private static int getBitmapSize(BitmapDrawable value) {
    Bitmap bitmap = value.getBitmap();

    // From KitKat onward use getAllocationByteCount() as allocated bytes can potentially be
    // larger than bitmap byte count.
    if (Utils.hasKitKat()) {
        return bitmap.getAllocationByteCount();
    }

    if (Utils.hasHoneycombMR1()) {
        return bitmap.getByteCount();
    }

    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:com.dp.chapter01.part2.cache.MemoryCache.java

public MemoryCache() {
    // ?//from   w ww .  j a  va 2 s  .c o m
    final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
    // ?4?
    final int cacheSize = maxMemory / 4;
    mMemeryCache = new LruCache<String, Bitmap>(cacheSize) {

        @Override
        protected int sizeOf(String key, Bitmap bitmap) {
            return bitmap.getRowBytes() * bitmap.getHeight() / 1024;
        }
    };

}

From source file:com.tz.explore.util.ImageLoader.java

private ImageLoader() {
    TaskPoster.initPoster();/*from w ww  . j  a v a 2s .co m*/
    int maxSize = (int) (Runtime.getRuntime().maxMemory() / 8);

    cache = new LruCache<String, Bitmap>(maxSize) {
        @Override
        protected int sizeOf(String key, Bitmap value) {
            return value.getRowBytes() * value.getHeight() / 1024;
        }
    };
}