+ int uploadQuality = 90;
+ LogHelper.d("czy","upload default width = "+uploadWidth+"uploadQuality="+uploadQuality);
+ Bitmap bmp = ImageUtils.decodeBitmapWithSize(f.getAbsolutePath(), uploadWidth,uploadHeight);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ bmp.compress(Bitmap.CompressFormat.JPEG, uploadQuality, baos);
+ return baos.toByteArray();
+ }
+
+ //把文件转换成字节数组
private byte[] getBytes(File f) throws Exception {
FileInputStream in = new FileInputStream(f);
ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -15,7 +15,7 @@ import ai.pai.lensman.utils.UrlContainer; |
||
| 15 | 15 |
|
| 16 | 16 |
public class UploadTask extends AsyncTask<Void, Integer, Boolean> {
|
| 17 | 17 |
|
| 18 |
- private static final String TAG = "UploadTask"; |
|
| 18 |
+ private static final String TAG = "czy"; |
|
| 19 | 19 |
private PhotoBean bean; |
| 20 | 20 |
private OnPhotoUploadListener listener; |
| 21 | 21 |
|
@@ -41,13 +41,16 @@ public class UploadTask extends AsyncTask<Void, Integer, Boolean> {
|
||
| 41 | 41 |
photoUploadUtils.addTextParameter("photo_id", String.valueOf(bean.photoId));
|
| 42 | 42 |
photoUploadUtils.addTextParameter("nickname",Preferences.getInstance().getUserName());
|
| 43 | 43 |
photoUploadUtils.addTextParameter("lensman_type",bean.lensmanType);
|
| 44 |
- String result = new String(photoUploadUtils.send(), "UTF-8"); |
|
| 44 |
+ String result = new String(bean.priority == 1 ? photoUploadUtils.sendThumb():photoUploadUtils.send(), "UTF-8"); |
|
| 45 | 45 |
JSONObject resultObj = new JSONObject(result); |
| 46 | 46 |
if (resultObj.getInt("status") == 200) {
|
| 47 | 47 |
LogHelper.d(TAG, "上传 UploadTask upload result ok "); |
| 48 | 48 |
return true; |
| 49 |
+ }else {
|
|
| 50 |
+ LogHelper.d(TAG, "上传 UploadTask status not 200 "+result); |
|
| 49 | 51 |
} |
| 50 | 52 |
} else {
|
| 53 |
+ LogHelper.d(TAG, "上传 UploadTask本地文件不存在 "); |
|
| 51 | 54 |
return false; |
| 52 | 55 |
} |
| 53 | 56 |
|
@@ -100,7 +100,7 @@ public class PhotoRecyclerAdapter extends RecyclerView.Adapter<PhotoRecyclerAdap |
||
| 100 | 100 |
holder.photo.setLayoutParams(lp); |
| 101 | 101 |
long timeLeft = delay - (System.currentTimeMillis() - item.captureTime) / 1000; |
| 102 | 102 |
|
| 103 |
- if (timeLeft < 0) {
|
|
| 103 |
+ if (timeLeft < 0 || item.uploadStatus!=PhotoBean.UploadStatus.STATUS_NO_BEGIN) {
|
|
| 104 | 104 |
item.canDelete = false; |
| 105 | 105 |
if (item.uploadStatus == PhotoBean.UploadStatus.STATUS_ERROR) {
|
| 106 | 106 |
holder.uploadStatusText.setText(context.getString(R.string.upload_error) + "," + context.getString(R.string.click_to_retry)); |
@@ -109,6 +109,9 @@ public class SessionPresenter implements SessionContract.Presenter, SessionInter |
||
| 109 | 109 |
} |
| 110 | 110 |
LogHelper.d(TAG,"onSessionPhotoCaptured "+bean); |
| 111 | 111 |
bean.groupId = groupId; |
| 112 |
+ if(photoList.size()==0){
|
|
| 113 |
+ bean.priority = 1; |
|
| 114 |
+ } |
|
| 112 | 115 |
DBService.getInstance().addPhotoBean(bean); |
| 113 | 116 |
sessionView.showPhotoRecyclerView(); |
| 114 | 117 |
sessionView.addNewPhoto(bean); |