Search in sources :

Example 1 with PersistentManager

use of com.eros.framework.manager.impl.PersistentManager in project WeexErosFramework by bmfe.

the class DefaultImageAdapter method openCamera.

public void openCamera(final Context context, UploadImageBean bean) {
    // 设置图片加载器
    imagePicker.setImageLoader(new BMHookGlide());
    // 允许裁剪
    imagePicker.setCrop(bean.allowCrop);
    // 是否按矩形区域保存
    imagePicker.setSaveRectangle(true);
    // 裁剪框的形状
    imagePicker.setStyle(CropImageView.Style.RECTANGLE);
    // 裁剪框的宽度。单位像素(圆形自动取宽高最小值)
    imagePicker.setFocusWidth(Constant.ImageConstants.BIGGESTWIDTH);
    // 裁剪框的高度。单位像素(圆形自动取宽高最小值)
    imagePicker.setFocusHeight(Constant.ImageConstants.BIGGESTWIDTH);
    PersistentManager persistentManager = ManagerFactory.getManagerService(PersistentManager.class);
    persistentManager.setCacheData(Constant.ImageConstants.UPLOAD_IMAGE_BEAN, bean);
    if (context instanceof Activity) {
        // imagePicker.takePicture((Activity) context, 1001);
        Intent intent = new Intent(context, ImageGridActivity.class);
        // 是否是直接打开相机
        intent.putExtra(ImageGridActivity.EXTRAS_TAKE_PICKERS, true);
        ((Activity) context).startActivityForResult(intent, 101);
    }
}
Also used : BMHookGlide(com.eros.framework.utils.BMHookGlide) PersistentManager(com.eros.framework.manager.impl.PersistentManager) ImageGridActivity(com.lzy.imagepicker.ui.ImageGridActivity) Activity(android.app.Activity) Intent(android.content.Intent)

Example 2 with PersistentManager

use of com.eros.framework.manager.impl.PersistentManager in project WeexErosFramework by bmfe.

the class DefaultImageAdapter method pickAvatar.

public void pickAvatar(final Context context, UploadImageBean bean, int requestCode) {
    if (!checkPermission(context))
        return;
    // 设置图片加载器
    imagePicker.setImageLoader(new BMHookGlide());
    // 显示拍照按钮
    imagePicker.setShowCamera(true);
    // 是否是多张
    imagePicker.setMultiMode(false);
    // 允许裁剪
    imagePicker.setCrop(true);
    // 是否按矩形区域保存
    imagePicker.setSaveRectangle(true);
    // 裁剪框的形状
    imagePicker.setStyle(CropImageView.Style.RECTANGLE);
    // 裁剪框的宽度。单位像素(圆形自动取宽高最小值)
    imagePicker.setFocusWidth(Constant.ImageConstants.BIGGESTWIDTH);
    // 裁剪框的高度。单位像素(圆形自动取宽高最小值)
    imagePicker.setFocusHeight(Constant.ImageConstants.BIGGESTWIDTH);
    Intent intent = new Intent(context, ImageGridActivity.class);
    PersistentManager persistentManager = ManagerFactory.getManagerService(PersistentManager.class);
    persistentManager.setCacheData(Constant.ImageConstants.UPLOAD_IMAGE_BEAN, bean);
    ((Activity) context).startActivityForResult(intent, requestCode);
}
Also used : BMHookGlide(com.eros.framework.utils.BMHookGlide) PersistentManager(com.eros.framework.manager.impl.PersistentManager) ImageGridActivity(com.lzy.imagepicker.ui.ImageGridActivity) Activity(android.app.Activity) Intent(android.content.Intent)

Example 3 with PersistentManager

use of com.eros.framework.manager.impl.PersistentManager in project WeexErosFramework by bmfe.

the class DefaultImageAdapter method pickPhoto.

public void pickPhoto(final Context context, UploadImageBean bean, int requestCode) {
    if (!checkPermission(context))
        return;
    // 设置图片加载器
    imagePicker.setImageLoader(new BMHookGlide());
    // 
    imagePicker.setShowCamera(true);
    // 允许裁剪(单选才有效)
    imagePicker.setCrop(false);
    // 是否是多张
    imagePicker.setMultiMode(true);
    // 选中数量限制
    imagePicker.setSelectLimit(bean.maxCount);
    Intent intent = new Intent(context, ImageGridActivity.class);
    PersistentManager persistentManager = ManagerFactory.getManagerService(PersistentManager.class);
    persistentManager.setCacheData(Constant.ImageConstants.UPLOAD_IMAGE_BEAN, bean);
    ((Activity) context).startActivityForResult(intent, requestCode);
}
Also used : BMHookGlide(com.eros.framework.utils.BMHookGlide) PersistentManager(com.eros.framework.manager.impl.PersistentManager) ImageGridActivity(com.lzy.imagepicker.ui.ImageGridActivity) Activity(android.app.Activity) Intent(android.content.Intent)

Aggregations

Activity (android.app.Activity)3 Intent (android.content.Intent)3 PersistentManager (com.eros.framework.manager.impl.PersistentManager)3 BMHookGlide (com.eros.framework.utils.BMHookGlide)3 ImageGridActivity (com.lzy.imagepicker.ui.ImageGridActivity)3