="diff-5a6df96309a72aebabdaeed77cc5a520fd68c98fR95">95
     public byte[] send(boolean isCompress) throws Exception {
76 96
         initConnection();
77 97
         conn.connect();
@@ -118,6 +138,27 @@ public class PhotoUploadUtils {
118 138
             ds.writeBytes(encode(value) + "\r\n");
119 139
         }
120 140
     }
141
+
142
+    //文件数据
143
+    private void writeThumbFileParams() throws Exception {
144
+        Set<String> keySet = fileparams.keySet();
145
+        for (Iterator<String> it = keySet.iterator(); it.hasNext();) {
146
+            String name = it.next();
147
+            File value = fileparams.get(name);
148
+            ds.writeBytes("--" + boundary + "\r\n");
149
+            ds.writeBytes("Content-Disposition: form-data; name=\"" + name
150
+                    + "\"; filename=\"" + encode(value.getName()) + "\"\r\n");
151
+            ds.writeBytes("Content-Type: " + getContentType(value) + "\r\n");
152
+            ds.writeBytes("\r\n");
153
+            byte[] bmp = getThumbBitmapBytes(value);
154
+            ds.write(bmp);
155
+            LogHelper.d("czy","upload final file length="+bmp.length);
156
+            LogHelper.d("czy","Upload bitmap size:"+bmp.length);
157
+            ds.writeBytes("\r\n");
158
+//            saveUploadFile(value,bmp);
159
+        }
160
+    }
161
+
121 162
     //文件数据
122 163
     private void writeFileParams() throws Exception {
123 164
         Set<String> keySet = fileparams.keySet();
@@ -214,6 +255,18 @@ public class PhotoUploadUtils {
214 255
     }
215 256
 
216 257
     //把文件转换成字节数组
258
+    private byte[] getThumbBitmapBytes(File f) throws Exception {
259
+        int uploadWidth = UPLOAD_THUMB_PHOTO_WIDTH;
260
+        int uploadHeight = UPLOAD_THUMB_PHOTO_HEIGHT;
261
+        int uploadQuality = 90;
262
+        LogHelper.d("czy","upload default width = "+uploadWidth+"uploadQuality="+uploadQuality);
263
+        Bitmap bmp = ImageUtils.decodeBitmapWithSize(f.getAbsolutePath(), uploadWidth,uploadHeight);
264
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
265
+        bmp.compress(Bitmap.CompressFormat.JPEG, uploadQuality, baos);
266
+        return baos.toByteArray();
267
+    }
268
+
269
+    //把文件转换成字节数组
217 270
     private byte[] getBytes(File f) throws Exception {
218 271
         FileInputStream in = new FileInputStream(f);
219 272
         ByteArrayOutputStream out = new ByteArrayOutputStream();

+ 5 - 2
app/src/main/java/ai/pai/lensman/service/UploadTask.java

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

+ 1 - 1
app/src/main/java/ai/pai/lensman/session/PhotoRecyclerAdapter.java

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

+ 3 - 0
app/src/main/java/ai/pai/lensman/session/SessionPresenter.java

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

pai2 - Gogs: Go Git Service

拍爱

Brightcells: c7071ae7f1 wx_uid to openid 10 lat temu
..
0001_initial.py 4defb80fdc gogs first init 11 lat temu
0002_auto_20151202_2251.py 434468279f add api of lesman login & update other api 11 lat temu
0003_auto_20151202_2313.py 434468279f add api of lesman login & update other api 11 lat temu
0004_auto_20151207_1811.py 4a8b4f8819 add watermark 11 lat temu
0005_auto_20151209_1638.py 3454610bb7 add api of user signup/login 11 lat temu
0006_auto_20151223_1533.py 5ef425fee7 add api wx_authorize_api 10 lat temu
0007_auto_20160120_1830.py a121b75ff2 add db_index=True for status field 10 lat temu
0008_userinfo_unionid.py 8aeca53563 record unionid for wx_authorize user 10 lat temu
0009_auto_20160428_1410.py 269576f8b9 add guest user 10 lat temu
0010_userinfo_uuid.py 63eaee0951 modify guest_login_api 10 lat temu
0011_auto_20160627_1411.py 6d6c8485ce bind LensmanInfo and UserInfo 10 lat temu
0012_auto_20160627_1419.py 6d6c8485ce bind LensmanInfo and UserInfo 10 lat temu
0013_auto_20160711_1436.py d0affd4b01 add lensman_oauth page 10 lat temu
0014_lensmaninfo_refused_reason.py 30d24179d9 add refused relative 10 lat temu
0015_auto_20160713_1646.py 30d24179d9 add refused relative 10 lat temu
0016_auto_20160718_1258.py c7071ae7f1 wx_uid to openid 10 lat temu
__init__.py 4defb80fdc gogs first init 11 lat temu