前言
封装一个全功能的相机组件,便于上层调用。
1. 集成相关依赖
api 'com.github.yalantis:ucrop:2.2.2-native'
api 'com.github.hotchemi:permissionsdispatcher:3.0.1'
annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:3.0.1'
2. public class RequestCodes
类RequestCodes存储统一的请求码
package com.qilu.core.ui.camera;
import com.yalantis.ucrop.UCrop;
//请求码存储
public class RequestCodes {
public static final int TAKE_PHOTO = 4;
public static final int PICK_PHOTO = 5;
public static final int CROP_PHOTO = UCrop.REQUEST_CROP;
public static final int CROP_ERROR = UCrop.RESULT_ERROR;
}
3. public final class CameraImageBean
类CameraImageBean存储一些中间值