Browse Source

拍照入库验证

guilin 8 months ago
parent
commit
295676b6e4

+ 3 - 1
app/src/main/java/com/fxy/base/StorageApplication.java

@@ -202,12 +202,14 @@ public class StorageApplication extends Application {
         loggingInterceptor.setColorLevel(Level.INFO);
         builder.addInterceptor(loggingInterceptor);         //添加OkGo默认debug日志
 
+
+
         OkGo.getInstance().init(this)                       //必须调用初始化
 
                 .setOkHttpClient(builder.build())               //建议设置OkHttpClient,不设置将使用默认的
                 .setCacheMode(CacheMode.NO_CACHE)               //全局统一缓存模式,默认不使用缓存,可以不传
                 .setCacheTime(CacheEntity.CACHE_NEVER_EXPIRE)   //全局统一缓存时间,默认永不过期,可以不传
-                .setRetryCount(1);                             //全局统一超时重连次数,默认为三次,那么最差的情况会请求4次(一次原始请求,三次重连请求),不需要可以设置为0
+                .setRetryCount(3);                             //全局统一超时重连次数,默认为三次,那么最差的情况会请求4次(一次原始请求,三次重连请求),不需要可以设置为0
 //                .addCommonHeaders(headers)                      //全局公共头
 //                .addCommonParams(params)
 

+ 89 - 27
app/src/main/java/com/fxy/common/AsyncUpload.java

@@ -47,6 +47,7 @@ import com.luck.picture.lib.permissions.RxPermissions;
 import com.lzy.okgo.OkGo;
 import com.lzy.okgo.model.Response;
 
+import org.greenrobot.eventbus.EventBus;
 import org.json.JSONObject;
 
 import java.lang.reflect.Type;
@@ -102,16 +103,9 @@ public class AsyncUpload {
 
     //
     private List<LocalMedia> selectList = new ArrayList<>();
+    //上传图片路径
+    private ArrayList<String> ossPhotoList =new ArrayList<>();
 
-//
-    // 图片上传目录    //等待上传
-////    private List<LocalMedia> awaitUploadList=new ArrayList<>();
-////    //已失败
-////    private List<LocalMedia> failUploadList=new ArrayList<>();
-////    //已上传好的
-////    private List<LocalMedia> selectList = new ArrayList<>();
-////    //已上传
-////    private ArrayList<String> ossPhotoList =new ArrayList<>();
     private String mPrefix="tally";
 
     //是否停止上传
@@ -119,15 +113,19 @@ public class AsyncUpload {
 
     private String resourceType = "";
 
-    private String resourcePrefix = "";
+    private String resourcePrefix = "/fxy";
 
     private OssService ossService;
 
     private CosService cosService;
 
+    //是自动上传
+    private boolean isAutoUpload = true;
 
+    private boolean allowUpload = false;
 
-    public AsyncUpload(Activity activity, RecyclerView rvShowImg, String prefix,String fileKey, String notifyUrl){
+
+    public AsyncUpload(Activity activity, RecyclerView rvShowImg, String prefix,String fileKey, String notifyUrl,boolean isAutoUpload){
 
         mActivity = activity;
         mContext  = activity.getBaseContext();
@@ -135,6 +133,10 @@ public class AsyncUpload {
         this.fileKey = fileKey;
         this.mPrefix = prefix;
         this.notifyUrl = notifyUrl;
+        this.isAutoUpload = isAutoUpload;
+
+        //自动上传则允许继续上次
+        this.allowUpload  = isAutoUpload;
         initAdapter();
         initData();
     }
@@ -210,8 +212,16 @@ public class AsyncUpload {
         return  selectList;
     }
 
+
+    public List<String> getOssPhotoList (){
+        return  ossPhotoList;
+    }
+
+
+
     public void emptyRemake(){
         selectList.clear();
+        ossPhotoList.clear();
         adapter.clearData();
         uniqueTag =  this.fileKey+UUID.randomUUID().toString();
     }
@@ -234,9 +244,15 @@ public class AsyncUpload {
             addUploadFile(fileList.get(i));
             selectList.add(fileList.get(i));
         }
-        asyncUpload();
+
         adapter.setList(selectList);
         adapter.notifyDataSetChanged();
+
+        //设置自动
+        if (isAutoUpload){
+            asyncUpload();
+        }
+
     }
 
     public String getUniqueTag(){
@@ -282,7 +298,7 @@ public class AsyncUpload {
                         break;
                     case 3:
                         //设置进度条
-
+                        EventBus.getDefault().post(new UploadProgressEvent(msg.arg2));
                         //progressDialog.show();
                         return;
                     case 4:
@@ -356,17 +372,27 @@ public class AsyncUpload {
             return;
         }
 
-        String fileSuffix = "";
-        if (urlPath.lastIndexOf(".")>-1) {
-            // 获取文件后缀名
-            fileSuffix = urlPath.substring(urlPath.lastIndexOf("."));
+
+        String fileName = "";
+        String path_prefix = "";
+
+        String ossUrl = awaitUploadList.get(num).getOssUrl();
+        if (!ossUrl.isEmpty()){
+            // 找到最后一个斜杠的位置
+            int lastSlashIndex = ossUrl.lastIndexOf('/');
+            // 如果找到了斜杠,则从斜杠之后的位置开始切割
+            fileName = ossUrl.substring(lastSlashIndex + 1);
+            path_prefix = ossUrl.substring(0,lastSlashIndex+ 1);
+
+        }else{
+            path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+RxTimeTool.getYestoryDate("yyyyMMd")+"/";
+            String fileSuffix = urlPath.lastIndexOf(".")>-1 ? urlPath.substring(urlPath.lastIndexOf(".")) : "";
+            fileName = UUID.randomUUID().toString() + fileSuffix;
         }
 
-        String fileName= UUID.randomUUID().toString() + fileSuffix;
 
         if (resourceType.equals("tencent")){
             if (cosService==null){
-                String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+RxTimeTool.getYestoryDate("yyyyMMd")+"/";
                 cosService  = new CosService(mActivity.getBaseContext(),path_prefix);
             }
             //new cosThread(urlPath, fileName , num).start();
@@ -374,7 +400,8 @@ public class AsyncUpload {
 
         }else{
             if (ossService ==null){
-                ossService = new OssService(mActivity,mPrefix);
+                ossService = new OssService(mActivity,path_prefix);
+
             }
 
 
@@ -383,6 +410,8 @@ public class AsyncUpload {
         }
         // task.cancel(); // 可以取消任务
         // task.waitUntilFinished(); // 可以等待直到任务完成
+
+        EventBus.getDefault().post(new UploadProgressEvent(0));
     }
 
 
@@ -642,7 +671,7 @@ public class AsyncUpload {
 
 
     //存储数据问题
-    public void asyncUpload(){
+    private void asyncUpload(){
 
         if (!getIsNetwork()){
             //无网络时在请求检查是否有网络
@@ -653,7 +682,7 @@ public class AsyncUpload {
             RealmResults<AsyncUploadRealm> realmResults  = mRealm.where(AsyncUploadRealm.class)
                     .equalTo("isDelete",0)
                     .equalTo("pushStatus",0)
-                    .equalTo("notifyKey",fileKey)
+//                    .equalTo("notifyKey",fileKey)
                     .equalTo("uploadType",uploadType)
                     .sort("pushStatus").findAll();
             realmResults.load();
@@ -666,6 +695,24 @@ public class AsyncUpload {
         }
     }
 
+    //取消任务
+    public void taskCancel(){
+
+    }
+
+    public void setStartUpload(){
+        allowUpload = true;
+        asyncUpload();
+    }
+
+    public void setStopUpload(){
+        if(ossService !=null){
+            ossService.taskCancel();
+        }
+        allowUpload = false;
+        EventBus.getDefault().post(new UploadProgressEvent(0));
+    }
+
     private void addUploadFile(LocalMedia localMedia){
         String realmId = UUID.randomUUID().toString();
         String scan_date = DateUtil.getCurDateStr(DateUtil.FORMAT_YMDHMS);
@@ -683,6 +730,14 @@ public class AsyncUpload {
         takePhotosRealm.setNotifyParam(gson.toJson(notifyParam));
         takePhotosRealm.setNotifyUrl(notifyUrl);
         takePhotosRealm.setUniqueTag(uniqueTag);
+
+
+        String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+RxTimeTool.getYestoryDate("yyyyMMd")+"/";
+        String urlPath = isCompress && localMedia.getCompressPath()!=null ? localMedia.getCompressPath() :  localMedia.getPath();
+        String fileSuffix = urlPath.lastIndexOf(".")>-1 ? urlPath.substring(urlPath.lastIndexOf(".")) : "";
+        String fileName = UUID.randomUUID().toString() + fileSuffix;
+        takePhotosRealm.setOssUrl(path_prefix+fileName);
+        ossPhotoList.add("/"+path_prefix+fileName);
         //
 
         Date date = new Date();
@@ -734,18 +789,25 @@ public class AsyncUpload {
             //更新值
             mRealm.beginTransaction();
             AsyncUploadRealm myObject = mRealm.where(AsyncUploadRealm.class).equalTo("id",tmpRealmId).findFirst();
+            assert myObject != null;
             myObject.setPushStatus(pushStatus);
+            if (pushStatus == 1){
+                myObject.setIsFinish(pushStatus);
+            }
             myObject.setOssUrl(photoPath);
             if (getIsNetwork() && status==0 ){
                 myObject.setRePush(myObject.getRePush()+1);
             }
             mRealm.commitTransaction();
-            if (status == 1){
-                asyncNotify(myObject);
-            }
+
         }
-        //上传完,继续执行
-        asyncUpload();
+
+        //可以允许上传
+        if (allowUpload){
+            //上传完,继续执行
+            asyncUpload();
+        }
+
     }
 
     //异步通知结果

+ 2 - 2
app/src/main/java/com/fxy/common/FiledUpload.java

@@ -207,15 +207,15 @@ public class FiledUpload {
      */
     public void filedUpload(String localPath,Handler handler,int sort){
         String fileName = getFileName(localPath);
+        String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+ RxTimeTool.getYestoryDate("yyyyMMd")+"/";
         if (resourceType.equals("tencent")){
             if (cosService==null){
-                String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+ RxTimeTool.getYestoryDate("yyyyMMd")+"/";
                 cosService  = new CosService(mActivity.getBaseContext(),path_prefix);
             }
             cosService.cosUpload(localPath, fileName , sort,handler);
         }else{
             if (ossService ==null){
-                ossService = new OssService(mActivity,mPrefix);
+                ossService = new OssService(mActivity,path_prefix);
             }
             ossService.ossUpload(localPath, fileName , sort,handler);
         }

+ 2 - 4
app/src/main/java/com/fxy/common/OssService.java

@@ -59,12 +59,10 @@ public class OssService {
     public OSS getOSS(){
         return oss;
     }
-    public OssService(Context context, String prefix){
+    public OssService(Context context, String filePath){
         mContext = context;
         initData();
-        prefix = prefix.isEmpty()?"default/":prefix+"/";
-        filePath = filePath+prefix+RxTimeTool.getYestoryDate("yyyyMMd")+"/";
-
+        this.filePath = filePath;
         creationOss();
     }
 

+ 3 - 2
app/src/main/java/com/fxy/common/PictureSelectorUpload.java

@@ -462,9 +462,10 @@ public class PictureSelectorUpload {
 
         String fileName= UUID.randomUUID().toString() + fileSuffix;
 
+        String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+RxTimeTool.getYestoryDate("yyyyMMd")+"/";
         if (resourceType.equals("tencent")){
             if (cosService==null){
-                String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+RxTimeTool.getYestoryDate("yyyyMMd")+"/";
+
                 cosService  = new CosService(mActivity.getBaseContext(),path_prefix);
             }
             //new cosThread(urlPath, fileName , num).start();
@@ -472,7 +473,7 @@ public class PictureSelectorUpload {
 
         }else{
             if (ossService ==null){
-                ossService = new OssService(mActivity,mPrefix);
+                ossService = new OssService(mActivity,path_prefix);
             }
             ossService.ossUpload(urlPath, fileName , num,uploadHandler);
             //new ossThread(urlPath, fileName , num).start();

+ 13 - 0
app/src/main/java/com/fxy/common/UploadProgressEvent.java

@@ -0,0 +1,13 @@
+package com.fxy.common;
+
+public class UploadProgressEvent {
+    private int progress;
+
+    public UploadProgressEvent(int progress) {
+        this.progress = progress;
+    }
+
+    public int getProgress() {
+        return progress;
+    }
+}

+ 325 - 60
app/src/main/java/com/fxy/detection/DetectionPutInMainActivity.java

@@ -1,8 +1,10 @@
 package com.fxy.detection;
 
 import android.annotation.SuppressLint;
+import android.app.AlertDialog;
 import android.content.BroadcastReceiver;
 import android.content.Context;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.os.Bundle;
@@ -17,6 +19,7 @@ import android.view.inputmethod.EditorInfo;
 import android.widget.EditText;
 import android.widget.ImageButton;
 import android.widget.LinearLayout;
+import android.widget.ProgressBar;
 import android.widget.TextView;
 import android.widget.Toast;
 
@@ -31,8 +34,11 @@ import com.fxy.bean.ActionBean;
 import com.fxy.bean.ScanBean;
 import com.fxy.common.AsyncUpload;
 import com.fxy.common.PictureSelectorUpload;
+import com.fxy.common.UploadProgressEvent;
 import com.fxy.constant.BaseConfig;
 import com.fxy.constant.EventCode;
+import com.fxy.detection.bean.NeedPhotoBean;
+import com.fxy.detection.bean.TakePictureBean;
 import com.fxy.net.MyDialogCallback;
 import com.fxy.net.Urls;
 import com.fxy.view.FloatingImageView;
@@ -43,6 +49,8 @@ import com.luck.picture.lib.entity.LocalMedia;
 import com.lzy.okgo.OkGo;
 import com.lzy.okgo.model.Response;
 
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
 import org.json.JSONException;
 import org.json.JSONObject;
 
@@ -74,7 +82,12 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
     @BindView(R.id.et_tracking_number)
     EditText etTrackingNumber;
 
+    @BindView(R.id.et_unit_code)
+    EditText etUnitCode;
 
+    //拍照区域
+    @BindView(R.id.ll_camera_picture_module)
+    LinearLayout llCameraPictureModule;
 
 
     @BindView(R.id.ll_label_picture)
@@ -97,12 +110,30 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
     TextView tvAwaitNum;
 
 
+    @BindView(R.id.pb_progressbar)
+    ProgressBar pbProgressbar;
+
+    @BindView(R.id.percentage_text_view)
+    TextView tvPercentageTextView;
+
+
+    @BindView(R.id.btn_start_upload)
+    TextView btnStartUpload;
+
+    @BindView(R.id.ll_upload_progressbar)
+    LinearLayout llUploadProgressbar;
+
+
     private HashMap<String, Object> postData  = new HashMap<>();
 
+    private HashMap<String,AsyncUpload> mapPictureSelector = new HashMap<>();
+
+    private List<TakePictureBean> takePictureBeanList = new ArrayList<>();
+
 
-    private AsyncUpload labelPictureSelectorUpload;
-    private AsyncUpload weighPictureSelectorUpload;
     private String currentPictureType= "";
+
+    private boolean currentUploadStatus = false;
     //
     //扫码扫码动作
     private ScanBean scanBean;
@@ -111,6 +142,8 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
     private boolean showWeightImg = false;
 
     private boolean isRequiredShow = false;
+
+    private  ArrayList<String> baseImgList = new ArrayList<>();
     protected String action;
 
 
@@ -153,14 +186,12 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
         if (resultCode == RESULT_OK) {
             // 图片选择结果回调
             if (requestCode == PictureConfig.CHOOSE_REQUEST) {
-                if (currentPictureType.equals("weight_img")){
-                    weighPictureSelectorUpload.setNotifyParam(getNotifyParam());
-                    weighPictureSelectorUpload.getSelectImg(data);
-                }else {
-                    labelPictureSelectorUpload.setNotifyParam(getNotifyParam());
-                    labelPictureSelectorUpload.getSelectImg(data);
+                if (mapPictureSelector.containsKey(currentPictureType)){
+                    mapPictureSelector.get(currentPictureType).setNotifyParam(getNotifyParam());
+                    mapPictureSelector.get(currentPictureType).getSelectImg(data);
                 }
                 totalAwaitNum();
+                checkSubmit();
             }
         }
     }
@@ -194,10 +225,11 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
         iniData();
         RecyclerView rvLabelShowImg = (RecyclerView)llLabelPicture.findViewById(R.id.rv_show_img);
         RecyclerView rvWeighShowImg = (RecyclerView)llWeighPicture.findViewById(R.id.rv_show_img);
-        labelPictureSelectorUpload  = setItemPicture("label_img",rvLabelShowImg);
-        weighPictureSelectorUpload  = setItemPicture("weight_img",rvWeighShowImg);
+        mapPictureSelector.put("label_img",setItemPicture("label_img",rvLabelShowImg,9));
+        mapPictureSelector.put("weight_img",setItemPicture("weight_img",rvWeighShowImg,9));
 
         iniPhoto();
+        totalAwaitNum();
     }
 
 
@@ -207,15 +239,15 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
      * @param uploadType String
      * @param showImg RecyclerView
      */
-    private AsyncUpload setItemPicture(String uploadType,RecyclerView showImg){
+    private AsyncUpload setItemPicture(String uploadType,RecyclerView showImg,int num){
 
         String notifyUrl = Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN;
-        AsyncUpload pictureUpload = new AsyncUpload(DetectionPutInMainActivity.this,showImg,"detection",uploadType,notifyUrl);
+        AsyncUpload pictureUpload = new AsyncUpload(DetectionPutInMainActivity.this,showImg,"detection",uploadType,notifyUrl,false);
         pictureUpload.setUploadType(uploadType);
         pictureUpload.setCompress(true,100,100);
         pictureUpload.setOnlyCamera(true);
-        pictureUpload.setMaxSelectNum(9);
-        pictureUpload.asyncUpload();//
+        pictureUpload.setMaxSelectNum(num);
+
         //showImg.onTouchEvent()
 
         pictureUpload.setOnChangeListener(new AsyncUpload.UploadChangeListener() {
@@ -236,6 +268,23 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
     }
 
 
+    private void setCameraPicture(){
+        llCameraPictureModule.removeAllViews();;
+        for (int i=0;i<takePictureBeanList.size();i++){
+            addPictureSelectorUpload(llCameraPictureModule,takePictureBeanList.get(i));
+        }
+    }
+
+    public void addPictureSelectorUpload(LinearLayout linearLayout, TakePictureBean takePictureBean){
+        View itemPictureSelector = View.inflate(mContext, R.layout.item_picture_selector, null);
+        TextView tvPicturesTitle = itemPictureSelector.findViewById(R.id.tv_pictures_title);
+        tvPicturesTitle.setText(takePictureBean.getField());
+        RecyclerView rvLabelShowImg = (RecyclerView)itemPictureSelector.findViewById(R.id.recyclerview);
+        linearLayout.addView(itemPictureSelector);
+        AsyncUpload tmpPictureSelector  = setItemPicture(takePictureBean.getField(),rvLabelShowImg,takePictureBean.getNumber());
+        mapPictureSelector.put(takePictureBean.getField(),tmpPictureSelector);
+    }
+
     @Override
     public boolean dispatchKeyEvent(KeyEvent event) {
         //XLog.e("event:"+event.getKeyCode());
@@ -249,11 +298,14 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
     public HashMap<String, Object> getNotifyParam(){
         postData.put("box_number",etOrderNumber.getText().toString().trim());
         postData.put("tracking_number",etTrackingNumber.getText().toString().trim());
-        labelPictureSelectorUpload.setNotifyParam(postData);
-        weighPictureSelectorUpload.setNotifyParam(postData);
+        postData.put("unit_code",etUnitCode.getText().toString().trim());
+        mapPictureSelector.get(currentPictureType).setNotifyParam(postData);
+        mapPictureSelector.get(currentPictureType).setNotifyParam(postData);
         return postData;
     }
 
+
+
     //监听按键
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         XLog.e("监听按键:"+keyCode);XLog.e(event);
@@ -363,6 +415,7 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
         List<EditText> list = new ArrayList<>();
         list.add(etTrackingNumber);
         list.add(etOrderNumber);
+        list.add(etUnitCode);
         unifyEdit(list);
         llResult.setVisibility(View.GONE);
         llWeighPicture.setVisibility(View.GONE);
@@ -370,17 +423,24 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
 
 
     private void iniData(){
-
+        baseImgList.add("label_img");
+        baseImgList.add("weight_img");
     }
 
     //getAwaitNum
     private void totalAwaitNum(){
-        int awaitNum = labelPictureSelectorUpload.getAwaitNum();
+        int awaitNum = mapPictureSelector.get("label_img").getAwaitNum();
         tvAwaitNum.setText(String.valueOf(awaitNum));
+        if (awaitNum == 0){
+            operateStopUpload();
+        }
     }
 
     //统一按钮回调
+    @SuppressLint("NonConstantResourceId")
     public void callbackEditor(View v){
+        XLog.e("获取:"+v.getId());
+        XLog.e("id:"+R.id.et_tracking_number);
         switch (v.getId()) {
             case R.id.et_tracking_number:
                 getInboundTrack();
@@ -394,9 +454,28 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
                     etOrderNumber.requestFocus();
                     return;
                 }
+                etUnitCode.requestFocus();
+                etUnitCode.setSelection(etUnitCode.getText().toString().length());
+                break;
+            case R.id.et_unit_code:
+                for (int i=0;i<baseImgList.size();i++){
+                    String tmpKey = baseImgList.get(0);
+                    if (mapPictureSelector.containsKey(tmpKey) && mapPictureSelector.get(tmpKey).getOssPhotoList().size()==0){
+                        mapPictureSelector.get(tmpKey).authCamera();
+                        return;
+                    }
+                }
 
-                labelPictureSelectorUpload.authCamera();
+                for (int i=0;i<takePictureBeanList.size();i++){
+                    String tmpKey = takePictureBeanList.get(0).getField();
+                    if (mapPictureSelector.containsKey(tmpKey) && mapPictureSelector.get(tmpKey).getOssPhotoList().size()==0){
+                        mapPictureSelector.get(tmpKey).authCamera();
+                        return;
+                    }
+                }
+                pictureInbound();
                 break;
+
             default:
         }
 
@@ -507,22 +586,31 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
         {
             ((EditText) view).setText(scanResult);
             showSuccessToast("扫描成功");
-            switch (view.getId()) {
-                case R.id.et_tracking_number:
-                    getInboundTrack();
-                    break;
-                case R.id.et_order_number:
-                    showSuccessToast("扫描成功");
-                    break;
-                default:
-            }
-
-
+            callbackEditor(view);
         }
     }
 
     private void getInboundTrack(){
+        int awaitNum = mapPictureSelector.get("label_img").getAwaitNum();
+        if (currentUploadStatus  && awaitNum>0){
+            new AlertDialog.Builder(mContext).setTitle(R.string.dl_hint)
+                    .setMessage("当前正在上传图片。是否需要停止上传继续操作")
+                    .setNegativeButton(R.string.str_cancel, new DialogInterface.OnClickListener() {
+                        @Override
+                        public void onClick(DialogInterface dialogInterface, int i) {
+                            if (!currentUploadStatus){
+                                operateStartUpload();
+                            }
+                            dialogInterface.dismiss();
+                        }
+                    }).setPositiveButton(R.string.str_submit, new DialogInterface.OnClickListener() {
+
+                @Override
+                public void onClick(DialogInterface dialogInterface, int i) {
 
+                }
+            }).show();
+        }
 
         if (etTrackingNumber.getText().toString().isEmpty()){
             showErrorToast(etTrackingNumber.getHint().toString());
@@ -558,18 +646,20 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
                             String show_weight_img = result.has("show_weight_img") ? result.getString("show_weight_img"):"";
 
 
+                            if (result.has("need_photo")){
+                                takePictureBeanList = JsonUtil.jsonString2Beans(result.getString("need_photo"),TakePictureBean.class);
+                            }
 
                             showWeightImg = show_weight_img.contains("1");
                             llWeighPicture.setVisibility(showWeightImg ? View.VISIBLE:View.GONE);
                             llResult.setVisibility(showText.isEmpty() ? View.GONE:View.VISIBLE);
                             tvResult.setText(showText);
 
-
+                            setCameraPicture();
 
                             if(bean.code == 1){
                                 showSuccessToast(bean.msg,voiceName);
-                                etOrderNumber.requestFocus();
-                                etOrderNumber.setSelection(etOrderNumber.getText().toString().length());
+
                             }else{
                                 showWarningToast(bean.msg,voiceName);
                             }
@@ -579,6 +669,29 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
                         }
                     }
                 });
+
+        etOrderNumber.requestFocus();
+        etOrderNumber.setSelection(etOrderNumber.getText().toString().length());
+    }
+
+    private void checkSubmit(){
+        if (mapPictureSelector.get("label_img").getOssPhotoList().size()==0){
+            return;
+        }
+
+        if (showWeightImg && mapPictureSelector.get("weight_img").getOssPhotoList().size()==0){
+            return;
+        }
+
+        if (takePictureBeanList.size()>0){
+            for (int i=0;i<takePictureBeanList.size();i++){
+                if (mapPictureSelector.get(takePictureBeanList.get(i).getField()).getOssPhotoList().size()==0){
+                    return;
+                }
+            }
+        }
+        pictureInbound();
+        initUnitCode();
     }
 
     private void pictureInbound(){
@@ -587,21 +700,43 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
             return;
         }
 
+//        if (!checkRepeat(Urls.FXY_DETECTION_PUTIN+(postParam.toString()))){
+//            Toast.makeText(this, getString(R.string.error_data_processed), Toast.LENGTH_LONG).show();
+//            return;
+//        }
 
-
+        OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN).upJson(postParam)
+                .execute(new MyDialogCallback(this, true, false) {
+                    @Override
+                    public void onSuccess(Response<String> response) {
+                        super.onSuccess(response);
+                    }
+                });
 
         //假成功
-        initFinish();
+
         showSuccessToast("success");
+    }
 
-//        if (!checkRepeat(Urls.FXY_DETECTION_PUTIN+(postParam.toString()))){
-//            Toast.makeText(this, getString(R.string.error_data_processed), Toast.LENGTH_LONG).show();
-//            return;
-//        }
+    //完成入库
+    private void finishInbound(){
+        isRequiredShow = true;
+        if (etTrackingNumber.getText().toString().isEmpty()){
+            showWarningToast(etTrackingNumber.getHint().toString());
+            return ;
+        }
 
+        if (etOrderNumber.getText().toString().isEmpty()){
+            showWarningToast(etOrderNumber.getHint().toString());
+            return ;
+        }
+        HashMap<String,Object> postData = new HashMap<>();
+        postData.put("box_number",etOrderNumber.getText().toString().trim());
+        postData.put("tracking_number",etTrackingNumber.getText().toString().trim());
 
+        String body = (new Gson()).toJson(postData);
 
-        OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN).upJson(postParam)
+        OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN).upJson(body)
                 .execute(new MyDialogCallback(this, true, false) {
                     @Override
                     public void onSuccess(Response<String> response) {
@@ -619,17 +754,43 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
                         }
                     }
                 });
+
+        //假成功
+
+        showSuccessToast("success");
+        initFinish();
     }
 
-    private void initFinish(){
+    public void initUnitCode(){
         isRequiredShow = false;
-        labelPictureSelectorUpload.emptyRemake();//清空图片
-        weighPictureSelectorUpload.emptyRemake();
-        etOrderNumber.setText("");
-        etTrackingNumber.setText("");
-        etTrackingNumber.requestFocus();
+        for (String key : mapPictureSelector.keySet()) {
+            if (!baseImgList.contains(key)){
+                mapPictureSelector.get(key).emptyRemake();
+            }
+        }
+
+        etUnitCode.setText("");
+        etUnitCode.requestFocus();
+        llLabelPicture.setVisibility(View.GONE);
+    }
+
+    private void initFinish(){
+        initUnitCode();
+        for (int i=0;i<baseImgList.size();i++){
+            if (mapPictureSelector.containsKey(baseImgList.get(i))){
+                mapPictureSelector.get(baseImgList.get(i)).emptyRemake();
+            }
+
+        }
         llResult.setVisibility(View.GONE);
         llWeighPicture.setVisibility(View.GONE);
+        llLabelPicture.setVisibility(View.VISIBLE);
+
+        takePictureBeanList.clear();
+        setCameraPicture();
+        etTrackingNumber.setText("");
+        etOrderNumber.setText("");
+        etTrackingNumber.requestFocus();
     }
 
     /*
@@ -648,33 +809,59 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
             return  false;
         }
 
+        if (etUnitCode.getText().toString().isEmpty()){
+            showWarningToast(etUnitCode.getHint().toString());
+            return  false;
+        }
+
         try {
             postParam = new JSONObject();
             Gson gson = new Gson();
 
-            List<LocalMedia>  labelPhotoList = labelPictureSelectorUpload.getSelectList();
-
-
-            //检查是否拍照  工单处理时拍照拍照非必传
-            if (labelPhotoList.size()==0){
+            List<String> stringList = mapPictureSelector.get("label_img").getOssPhotoList();
+            if (stringList.size()==0){
                 showWarningToast("面单照片不能为空");
                 return false;
             }
-            postParam.put("label_img_tag",labelPictureSelectorUpload.getUniqueTag());
+            postParam.put("label_img_tag",mapPictureSelector.get("label_img").getUniqueTag());
+            postParam.put("label_img",gson.toJson(stringList));
 
 
-            if (showWeightImg){
-                List<LocalMedia> weighPhotoList = weighPictureSelectorUpload.getSelectList();
+            AsyncUpload weightUpload = mapPictureSelector.get("weight_img");
+            if (showWeightImg && weightUpload!=null){
+                List<String> weighPhotoList = weightUpload.getOssPhotoList();
                 if (weighPhotoList.size()==0){
                     showWarningToast("内件照片不能为空");
                     return false;
                 }
-                postParam.put("weight_img_tag",weighPictureSelectorUpload.getUniqueTag());
-             }
+                postParam.put("weight_img_tag",weightUpload.getUniqueTag());
+                postParam.put("weight_img",gson.toJson(weighPhotoList));
+            }
+
+            //拍照
+            if (takePictureBeanList.size()>0){
+
+                JSONObject otherObject = new JSONObject();
+                for (int i=0; i < takePictureBeanList.size();i++){
+                    String name = takePictureBeanList.get(i).getField();
+                    if (!mapPictureSelector.containsKey(name) ){
+                        showErrorToast("页面渲染异常,请更新操作");
+                    }
+
+                    List<String> tmpList = mapPictureSelector.get(name).getOssPhotoList();
+                    if (tmpList.size() == 0){
+                        showWarningToast("请上传".concat(takePictureBeanList.get(i).getTitle()).concat("拍照"));
+                    }
+                    otherObject.put(name,gson.toJson(tmpList));
+                }
+                postParam.put("other_img",otherObject);
+            }
 
 
             postParam.put("box_number",etOrderNumber.getText().toString().trim());
             postParam.put("tracking_number",etTrackingNumber.getText().toString().trim());
+            postParam.put("unit_code",etUnitCode.getText().toString().trim());
+
 
         } catch (JSONException e) {
             showWarningToast("系统异常"+e.getMessage());
@@ -693,23 +880,101 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
     }
 
     //sIsGoodinfoMatch,sIsBattery,sIsMagnetic,sIsWood,sIsExtra,sIsOther
-    @OnClick({R.id.btn_confirm})
+    @OnClick({R.id.btn_confirm,R.id.btn_start_upload})
     public void onViewClicked(View view) {
         Bundle bundle = new Bundle();
         switch (view.getId()) {
             case R.id.btn_confirm:
-                pictureInbound();
+                finishInbound();
                 break;
+            case R.id.btn_start_upload:
+
+                if (currentUploadStatus) {
+                    operateStopUpload();
+                } else {
+                    operateStartUpload();
+                }
             default:
                 break;
         }
     }
 
+    private void operateStopUpload(){
+        if (currentUploadStatus){
+            mapPictureSelector.get("label_img").setStopUpload();
+            currentUploadStatus = false;
+            btnStartUpload.setText("开始上传");
+            llUploadProgressbar.setVisibility(View.GONE);
+        }
+    }
+    private void operateStartUpload(){
+        if (!currentUploadStatus){
+            mapPictureSelector.get("label_img").setStartUpload();
+            currentUploadStatus = true;
+            btnStartUpload.setText("停止上传");
+            llUploadProgressbar.setVisibility(View.VISIBLE);
+        }
+    }
+
+    protected void showBack() {
+        super.showBack();
+        tb_iv_left.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+
+                int num = mapPictureSelector.get("label_img").getAwaitNum();
+
+                if (num>0){
+                    new AlertDialog.Builder(mContext).setTitle(R.string.dl_hint)
+                            .setMessage("返回会取消上传还有"+num+"条数据未上传,确定要返回吗")
+                            .setNegativeButton(R.string.str_cancel, new DialogInterface.OnClickListener() {
+                                @Override
+                                public void onClick(DialogInterface dialogInterface, int i) {
+                                    if (!currentUploadStatus){
+                                        operateStartUpload();
+                                    }
+                                    dialogInterface.dismiss();
+                                }
+                            }).setPositiveButton(R.string.str_submit, new DialogInterface.OnClickListener() {
+
+                        @Override
+                        public void onClick(DialogInterface dialogInterface, int i) {
+                                if (isShowBackDialog) {
+                                    onBackPressedSupport();
+                                } else {
+                                    finish();
+                                }
+                        }
+                    }).show();
+
+                }else{
+                    if (isShowBackDialog) {
+                        onBackPressedSupport();
+                    } else {
+                        finish();
+                    }
+                }
+
+            }
+        });
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    public void onUploadProgress(UploadProgressEvent event) {
+        // 更新进度条或其他 UI 元素
+        int num = event.getProgress();
+        pbProgressbar.setProgress(num);
+        tvPercentageTextView.setText(String.valueOf(num).concat("%"));
+    }
+
     @Override
     protected void onDestroy() {
         unbinder.unbind();
-        labelPictureSelectorUpload.removeHandler();
-        weighPictureSelectorUpload.removeHandler();
+
+         for (AsyncUpload asyncUpload : mapPictureSelector.values()) {
+             asyncUpload.removeHandler();
+        }
+
         super.onDestroy();
     }
     @Override

+ 67 - 0
app/src/main/java/com/fxy/detection/bean/TakePictureBean.java

@@ -0,0 +1,67 @@
+package com.fxy.detection.bean;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class TakePictureBean implements Parcelable {
+    private String field = ""; //key
+    private String title = ""; //名称
+    private int number = 1; //默认显示张数
+
+    public TakePictureBean(){
+
+    }
+    protected TakePictureBean(Parcel in) {
+        field = in.readString();
+        title = in.readString();
+        number = in.readInt();
+    }
+
+    public static final Creator<TakePictureBean> CREATOR = new Creator<TakePictureBean>() {
+        @Override
+        public TakePictureBean createFromParcel(Parcel in) {
+            return new TakePictureBean(in);
+        }
+
+        @Override
+        public TakePictureBean[] newArray(int size) {
+            return new TakePictureBean[size];
+        }
+    };
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel parcel, int i) {
+        parcel.writeString(field);
+        parcel.writeString(title);
+        parcel.writeInt(number);
+    }
+
+    public String getField() {
+        return field;
+    }
+
+    public void setField(String field) {
+        this.field = field;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public int getNumber() {
+        return number;
+    }
+
+    public void setNumber(int number) {
+        this.number = number;
+    }
+}

+ 1 - 0
app/src/main/java/com/fxy/putIn/PutinPhotosMainActivity.java

@@ -96,6 +96,7 @@ public class PutinPhotosMainActivity extends  BaseActivity implements StoJNI.Sca
 
     @BindView(R.id.pb_progressbar)
     ProgressBar pbProgressbar;
+
     @BindView(R.id.percentage_text_view)
     TextView tvPercentageTextView;
 

+ 90 - 6
app/src/main/res/layout/activity_fxy_detection_putin.xml

@@ -27,9 +27,7 @@
                     android:id="@+id/et_tracking_number"
                     android:hint="扫描或者输入跟踪单号"
                     android:text=""/>
-                <ImageButton
-                    android:id="@+id/ib_tracking_number_clear"
-                    style="@style/ClearImg" />
+                <include layout="@layout/item_image_close" />
 
             </LinearLayout>
 
@@ -42,11 +40,12 @@
                     android:id="@+id/et_order_number"
                     android:hint="扫描或者输入箱号"
                     android:text=""/>
-                <ImageButton
-                    android:id="@+id/ib_order_number_clear"
-                    style="@style/ClearImg" />
+                <include layout="@layout/item_image_close" />
 
             </LinearLayout>
+
+
+
             <LinearLayout
                 android:id="@+id/ll_label_picture"
                 android:layout_width="match_parent"
@@ -99,6 +98,27 @@
                 <include layout="@layout/fragment_show_img"/>
             </LinearLayout>
 
+            <LinearLayout
+                android:id="@+id/ll_unit_code"
+                style="@style/FromLinearLayoutItem"
+                android:orientation="horizontal">
+                <EditText
+                    style="@style/EditTextStyle"
+                    android:id="@+id/et_unit_code"
+                    android:hint="扫描或者输入内件码"
+                    android:text=""/>
+                <include layout="@layout/item_image_close" />
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/ll_camera_picture_module"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:visibility="visible"
+                android:orientation="vertical">
+            </LinearLayout>
+
+
 
             <LinearLayout
                 android:id="@+id/ll_result"
@@ -152,6 +172,70 @@
                     android:visibility="visible" />
             </LinearLayout>
 
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="@dimen/dp_10"
+                android:layout_marginTop="@dimen/dp_10"
+                android:layout_marginRight="@dimen/dp_10"
+                android:layout_marginBottom="@dimen/dp_4"
+                android:background="@drawable/bg_white_et"
+                android:gravity="center_vertical"
+                android:orientation="horizontal"
+                android:layout_gravity="bottom"
+                android:padding="10dp">
+                <TextView
+                    style="@style/fontSize"
+                    android:id="@+id/btn_start_upload"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="@dimen/dp_10"
+                    android:layout_marginRight="@dimen/dp_10"
+                    android:background="@drawable/bg_orange_item"
+                    android:gravity="center"
+                    android:text="开始上传"
+                    android:padding="10dp"
+                    android:textColor="@color/white"
+                    android:visibility="visible" />
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/ll_upload_progressbar"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="@dimen/dp_10"
+                android:layout_marginRight="@dimen/dp_10"
+                android:gravity="center_vertical"
+                android:padding="@dimen/dp_10"
+                android:orientation="horizontal">
+                <TextView
+
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="上传进度:"
+                    android:textStyle="bold" />
+                <ProgressBar
+                    android:id="@+id/pb_progressbar"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:progress="0"
+                    android:secondaryProgress="0"
+                    android:max="100"
+                    style="?android:attr/progressBarStyleHorizontal"
+                    android:progressDrawable="@drawable/video_progress" />
+                <TextView
+                    android:id="@+id/percentage_text_view"
+                    android:layout_width="wrap_content"
+                    android:gravity="center_vertical"
+                    android:layout_marginStart="@dimen/dp_4"
+                    android:text="0%"
+                    android:layout_height="match_parent">
+                </TextView>
+
+
+            </LinearLayout>
+
             <LinearLayout
                 android:id="@+id/ll_await_num"
                 android:layout_width="match_parent"

+ 189 - 0
app/src/main/res/layout/activity_fxy_detection_putin_check.xml

@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:background="@color/md_grey_100"
+    android:orientation="vertical">
+    <ScrollView
+        android:id="@+id/ll_scroll_view"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:fitsSystemWindows="true"
+        android:scrollbars="none">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical">
+
+            <LinearLayout
+                android:id="@+id/ll_order_number"
+                style="@style/FromLinearLayoutItem"
+                android:orientation="horizontal">
+                <EditText
+                    style="@style/EditTextStyle"
+                    android:id="@+id/et_order_number"
+                    android:hint="扫描或者输入箱号"
+                    android:text=""/>
+                <include layout="@layout/item_image_close" />
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/ll_customer_code"
+                style="@style/FromLinearLayoutItem"
+                android:orientation="horizontal">
+                <EditText
+                    style="@style/EditTextStyle"
+                    android:id="@+id/et_customer_code"
+                    android:hint="扫描或者输入客户代码"
+                    android:text=""/>
+                <include layout="@layout/item_image_close" />
+
+
+            </LinearLayout>
+
+
+            <LinearLayout
+                android:id="@+id/ll_internals_cod"
+                style="@style/FromLinearLayoutItem"
+                android:orientation="horizontal">
+                <EditText
+                    style="@style/EditTextStyle"
+                    android:id="@+id/et_internals_code"
+                    android:hint="扫描或者输入内件码"
+                    android:text=""/>
+                <include layout="@layout/item_image_close" />
+            </LinearLayout>
+
+
+            <LinearLayout
+                android:id="@+id/ll_camera_picture_module"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:visibility="visible"
+                android:orientation="vertical">
+            </LinearLayout>
+
+
+            <LinearLayout
+                android:id="@+id/ll_picture_module"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:visibility="visible"
+                android:orientation="vertical">
+            </LinearLayout>
+
+
+
+
+            <LinearLayout
+                android:id="@+id/ll_weigh_picture"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical">
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="@dimen/dp_10"
+                    android:layout_marginRight="@dimen/dp_10"
+                    android:background="@null"
+                    android:padding="@dimen/dp_10"
+                    android:gravity="center_vertical"
+                    android:orientation="vertical">
+                    <TextView
+                        style="@style/fontSize"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:textStyle="bold"
+                        android:text="内件拍照">
+                    </TextView>
+                </LinearLayout>
+                <include layout="@layout/fragment_show_img"/>
+            </LinearLayout>
+
+
+            <LinearLayout
+                android:id="@+id/ll_result"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:background="@drawable/bg_white_et"
+                android:layout_marginLeft="@dimen/dp_10"
+                android:layout_marginRight="@dimen/dp_10"
+                android:layout_marginTop="20dp"
+                android:layout_marginBottom="20dp"
+                android:paddingBottom="10dp"
+                android:paddingTop="10dp"
+                android:gravity="center"
+                android:visibility="gone"
+                android:orientation="horizontal">
+                <TextView
+                    android:id="@+id/tv_result"
+                    style="@style/tvLeftStyle"
+                    android:paddingStart="20dp"
+                    android:paddingEnd="20dp"
+                    android:textSize="50sp"/>
+            </LinearLayout>
+
+
+
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="@dimen/dp_10"
+                android:layout_marginTop="@dimen/dp_10"
+                android:layout_marginRight="@dimen/dp_10"
+                android:layout_marginBottom="@dimen/dp_4"
+                android:background="@drawable/bg_white_et"
+                android:gravity="center_vertical"
+                android:orientation="horizontal"
+                android:layout_gravity="bottom"
+                android:padding="10dp">
+                <TextView
+                    style="@style/fontSize"
+                    android:id="@+id/btn_confirm"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="@dimen/dp_10"
+                    android:layout_marginRight="@dimen/dp_10"
+                    android:background="@drawable/bg_orange_item"
+                    android:gravity="center"
+                    android:text="确认入库"
+                    android:padding="10dp"
+                    android:textColor="@color/white"
+                    android:visibility="visible" />
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/ll_await_num"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="@dimen/dp_10"
+                android:layout_marginRight="@dimen/dp_10"
+                android:background="@null"
+                android:padding="@dimen/dp_10"
+                android:gravity="center_vertical"
+                android:orientation="horizontal">
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                     android:text="待上传文件:">
+                </TextView>
+                <TextView
+                    android:id="@+id/tv_await_num"
+                    android:textColor="@color/md_red_900"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="0">
+                </TextView>
+            </LinearLayout>
+        </LinearLayout>
+
+
+    </ScrollView>
+
+
+</LinearLayout>

+ 12 - 0
app/src/main/res/layout/item_image_close.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/ima_clear"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_marginEnd="3dp"
+    android:background="@android:color/transparent"
+    android:padding="6dp"
+    android:src="@drawable/ic_clear"
+    android:visibility="invisible"
+    android:textSize="@dimen/sp_14" >
+</ImageButton>

+ 1 - 0
app/src/main/res/layout/item_picture_selector.xml

@@ -33,6 +33,7 @@
             android:id="@+id/recyclerview"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
+            android:padding="@dimen/dp_10"
             android:background="#fff"
             android:overScrollMode="never"/>
     </LinearLayout>

+ 1 - 1
config.gradle

@@ -8,7 +8,7 @@ ext {
             minSdkVersion    : 17,
             targetSdkVersion : 23,
             versionCode      : 1,
-            versionName      : "2.8.0",
+            versionName      : "2.8.1",
             versionApi       : "2.8",
             versionRealm     : 2,
     ]