guilin 1 месяц назад
Родитель
Сommit
27991cb000

+ 21 - 1
app/src/main/java/com/fxy/common/AsyncPictureSelector.java

@@ -3,13 +3,16 @@ package com.fxy.common;
 import android.Manifest;
 import android.annotation.SuppressLint;
 import android.app.Activity;
+import android.app.AlertDialog;
 import android.bluetooth.BluetoothSocket;
 import android.content.Context;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.graphics.Color;
 import android.graphics.drawable.ColorDrawable;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
+import android.os.Build;
 import android.os.Handler;
 import android.os.Message;
 import android.support.v7.widget.GridLayoutManager;
@@ -21,6 +24,8 @@ import android.widget.PopupWindow;
 import android.widget.TextView;
 import android.widget.Toast;
 
+import androidx.annotation.RequiresApi;
+
 import com.elvishew.xlog.XLog;
 import com.fxy.R;
 import com.fxy.adapter.GridImageAdapter;
@@ -505,7 +510,7 @@ public class AsyncPictureSelector {
             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();
@@ -514,10 +519,25 @@ public class AsyncPictureSelector {
             //提交事务,操作就被执行
             mRealm.commitTransaction();
 
+            ossPhotoList.add("/"+path_prefix+fileName);
         }catch (Exception e) {
             // 如果事务不能提交,则在这里处理错误
             e.printStackTrace();
             // 如果需要的话,可以回滚事务
+            new AlertDialog.Builder(mContext)
+                    .setTitle(R.string.dl_hint)
+                    .setMessage("保存图片失败,需要重新拍照")
+                    .setNegativeButton(R.string.str_submit, new DialogInterface.OnClickListener() {
+                        @RequiresApi(api = Build.VERSION_CODES.KITKAT)
+                        @Override
+                        public void onClick(DialogInterface dialogInterface, int i) {
+
+                        }
+                    }).setPositiveButton(R.string.str_cancel, new DialogInterface.OnClickListener() {
+                @Override
+                public void onClick(DialogInterface dialogInterface, int i) {
+                }
+            }).show();
         }
         return checkDataExists(realmId);
 

+ 4 - 1
app/src/main/java/com/fxy/main/fragment/HomePagerFragment.java

@@ -284,7 +284,10 @@ public class HomePagerFragment extends BaseFragment implements View.OnClickListe
     public void onDestroy() {
         super.onDestroy();
         bind.unbind();
-        uploadDialog.unregister();
+        if(uploadDialog!=null){
+            uploadDialog.unregister();
+        }
+
     }
 
 

+ 1 - 1
app/src/main/res/layout/fragment_homepager.xml

@@ -98,7 +98,7 @@
                             style="@style/ImageViewWithTextStyle.FontSize"
                             android:drawableTop="@drawable/ic_mapan"
                             android:drawablePadding="5dp"
-                            android:text="打板操作" />
+                            android:text="快递打板" />
                         <TextView
                             android:id="@+id/ivt_putin_pallet"
                             style="@style/ImageViewWithTextStyle.FontSize"