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


Java ContactPictureCache类代码示例

本文整理汇总了Java中com.onegravity.contactpicker.picture.cache.ContactPictureCache的典型用法代码示例。如果您正苦于以下问题:Java ContactPictureCache类的具体用法?Java ContactPictureCache怎么用?Java ContactPictureCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ContactPictureCache类属于com.onegravity.contactpicker.picture.cache包,在下文中一共展示了ContactPictureCache类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: retrievePicture

import com.onegravity.contactpicker.picture.cache.ContactPictureCache; //导入依赖的package包/类
public static Bitmap retrievePicture(Context context, Uri photoUri, boolean roundContactPictures) {
    if (context == null || photoUri == null || Helper.isNullOrEmpty(photoUri.toString())) {
        return null;
    }

    InputStream stream = null;
    Bitmap bitmap = null;

    // read contact picture
    try {
        stream = context.getContentResolver().openInputStream(photoUri);
        bitmap = BitmapFactory.decodeStream(stream);

        if (bitmap != null) {
            // some contact pictures aren't square...
            if (bitmap.getWidth() != bitmap.getHeight()) {
                int w = bitmap.getWidth();
                int h = bitmap.getHeight();
                int indent = Math.abs(w - h) / 2;
                int x = w > h ? indent : 0;
                int y = w < h ? indent : 0;
                int size = Math.min(w, h);
                bitmap = createBitmap(bitmap, x, y, size, size);
            }

            if (roundContactPictures) {
                bitmap = getRoundedBitmap(bitmap);
            }
        }
    } catch (OutOfMemoryError | FileNotFoundException ignore) {
    } finally {
        Helper.closeQuietly(stream);
    }

    // cache contact picture
    if (bitmap != null) {
        ContactPictureCache.getInstance(context).put(photoUri, bitmap);
    }

    return bitmap;
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:42,代码来源:ContactPictureLoader.java

示例2: ContactPictureManager

import com.onegravity.contactpicker.picture.cache.ContactPictureCache; //导入依赖的package包/类
public ContactPictureManager(Context context, boolean roundContactPictures) {
    sPhotoCache = ContactPictureCache.getInstance(context);
    mRoundContactPictures = roundContactPictures;
    EventBus.getDefault().register(this);
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:6,代码来源:ContactPictureManager.java

示例3: retrievePicture

import com.onegravity.contactpicker.picture.cache.ContactPictureCache; //导入依赖的package包/类
public static Bitmap retrievePicture(Context context, Uri photoUri, boolean roundContactPictures) {
    if (context == null || photoUri == null || Helper.isNullOrEmpty(photoUri.toString())) {
        return null;
    }

    InputStream stream = null;
    Bitmap bitmap = null;

    // read contact picture
    try {
        stream = context.getContentResolver().openInputStream(photoUri);
        bitmap = BitmapFactory.decodeStream(stream);

        if (bitmap != null) {
            // some contact pictures aren't square...
            if (bitmap.getWidth() != bitmap.getHeight()) {
                int w = bitmap.getWidth();
                int h = bitmap.getHeight();
                int indent = Math.abs(w - h) / 2;
                int x = w > h ? indent : 0;
                int y = w < h ? indent : 0;
                int size = Math.min(w, h);
                bitmap = createBitmap(bitmap, x, y, size, size);
            }

            if (roundContactPictures) {
                bitmap = getRoundedBitmap(bitmap);
            }
        }
    }
    catch (OutOfMemoryError | FileNotFoundException ignore) {}
    finally {
        Helper.closeQuietly(stream);
    }

    // cache contact picture
    if (bitmap != null) {
        ContactPictureCache.getInstance(context).put(photoUri, bitmap);
    }

    return bitmap;
}
 
开发者ID:1gravity,项目名称:Android-ContactPicker,代码行数:43,代码来源:ContactPictureLoader.java

示例4: ContactPictureManager

import com.onegravity.contactpicker.picture.cache.ContactPictureCache; //导入依赖的package包/类
public ContactPictureManager(Context context, boolean roundContactPictures) {
    sPhotoCache = ContactPictureCache.getInstance( context );
    mRoundContactPictures = roundContactPictures;
    EventBus.getDefault().register(this);
}
 
开发者ID:1gravity,项目名称:Android-ContactPicker,代码行数:6,代码来源:ContactPictureManager.java


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