|
@@ -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);
|
|
|
|