-                path = photoBean.photoPath;
247
-            }
248
-            LogHelper.d(TAG,"SavePhotoTask save photo to phone , photo remote url = "+path);
249
-            FileOutputStream fOut = null;
250
-            HttpURLConnection conn = null;
251
-            InputStream inStream = null;
252
-            try {
253
-                URL url = new URL(path);
254
-                conn = (HttpURLConnection) url.openConnection();
255
-                conn.setConnectTimeout(5 * 1000);
256
-                conn.setRequestMethod("GET");
257
-                inStream = conn.getInputStream();
258
-                if(conn.getResponseCode() == HttpURLConnection.HTTP_OK){
259
-                    String dirPath = Constants.APP_IMAGE_DIR +File.separator+photoBean.sessionId+File.separator+Constants.THUMBNAIL_DIR_NAME;
260
-                    File dir = new File(dirPath);
261
-                    dir.mkdirs();
262
-                    File file = new File(dir, photoBean.photoName);
263
-                    fOut = new FileOutputStream(file);
264
-                    byte[] buffer = new byte[2048];
265
-                    int len ;
266
-                    while((len=inStream.read(buffer))!=-1){
267
-                        fOut.write(buffer,0,len);
268
-                        fOut.flush();
269
-                    }
270
-                    fOut.flush();
271
-                    LogHelper.d(TAG,"SavePhotoTask save photo to local path = "+file.getAbsolutePath()+" photo bytes = "+file.length()+"\n");
272
-                }
273
-                return true;
274
-            } catch (Exception e) {
275
-                LogHelper.e(TAG,"SavePhotoTask exception occurs "+e);
276
-            } finally {
277
-                try{
278
-                    inStream.close();
279
-                    conn.disconnect();
280
-                    fOut.close();
281
-                }catch (Exception e){
282
-                    e.printStackTrace();
283
-                }
284
-            }
285
-            try{
286
-                Thread.sleep(2000);
287
-            }catch (Exception e){
288
-                e.printStackTrace();
289
-            }
290
-            return false;
291
-        }
292
-
293
-        @Override
294
-        protected void onPostExecute(Boolean result) {
295
-            super.onPostExecute(result);
296
-            if (result) {
297
-                LogHelper.d(TAG,"SavePhotoTask onPostExecute success " + photoBean);
298
-                listener.onSessionPhotoCaptured(photoBean);
299
-            }else{
300
-                LogHelper.d(TAG,"SavePhotoTask onPostExecute fail and retry "+photoBean);
301
-                new SavePhotoTask(photoBean).executeOnExecutor(ThreadExecutor.getInstance().getExecutor(),photoBean);
302
-            }
303
-        }
304
-    }
305
-
306 112
 
307 113
     public void endSession(){
308 114
         isWorking = false;
@@ -310,36 +116,14 @@ public class SessionInteractor {
310 116
             timer.cancel();
311 117
             timer = null;
312 118
         }
313
-
314
-        cancelTask(sessionEndTask);
315
-        HashMap<String,String> params = new HashMap<>();
316
-        params.put("lensman",sessionBean.lensmanId);
317
-        params.put("session",randomSessionId);
318
-        sessionEndTask = new HttpPostTask(params);
319
-        sessionEndTask.executeOnExecutor(ThreadExecutor.getInstance().getExecutor(), BoxUrlContainer.SESSION_END_URL);
320
-        LogHelper.d(TAG,"sessionEndTask execute ");
119
+        //TODO
321 120
         listener.onSessionEnd(sessionBean.sessionId);
322 121
     }
323 122
 
324 123
     public void deletePhoto(PhotoBean photoBean){
325
-        HashMap<String,String> params = new HashMap<>();
326
-        params.put("lensman",photoBean.lensmanId);
327
-        params.put("session",photoBean.sessionId);
328
-        params.put("id",String.valueOf(photoBean.photoId));
329
-        params.put("name",photoBean.photoName);
330
-        params.put("path",photoBean.photoPath);
331
-        HttpPostTask deleteTask = new HttpPostTask(params);
332
-        deleteTask.executeOnExecutor(ThreadExecutor.getInstance().getExecutor(), BoxUrlContainer.DELETE_PHOTO_URL);
124
+        //TODO
333 125
         LogHelper.d(TAG,"deletePhoto execute "+photoBean);
334 126
     }
335 127
 
336
-    private void cancelTask(HttpPostTask task){
337
-        if(task==null){
338
-            return;
339
-        }
340
-        if(task.getStatus()== AsyncTask.Status.RUNNING){
341
-            task.cancel(true);
342
-        }
343
-    }
344 128
 
345 129
 }

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

@@ -78,12 +78,7 @@ public class SessionPresenter implements SessionContract.Presenter, SessionInter
78 78
 
79 79
     @Override
80 80
     public void onSessionStartError(String session) {
81
-//        if (!isWorking) {
82
-//            return;
83
-//        }
84 81
         sessionView.showToast("session启动失败");
85
-//        interactor.startSession();
86
-//        LogHelper.d(TAG,"onSessionStartError session启动失败,自动重试中");
87 82
     }
88 83
 
89 84
     @Override

+ 0 - 5
app/src/main/java/ai/pai/lensman/settings/SettingsActivity.java

@@ -3,17 +3,12 @@ package ai.pai.lensman.settings;
3 3
 import android.content.Intent;
4 4
 import android.os.Bundle;
5 5
 import android.support.annotation.Nullable;
6
-import android.view.View;
7
-import android.widget.EditText;
8
-import android.widget.Toast;
9 6
 
10 7
 import ai.pai.lensman.R;
11 8
 import ai.pai.lensman.activities.AboutUsActivity;
12 9
 import ai.pai.lensman.activities.FeedbackActivity;
13 10
 import ai.pai.lensman.activities.WebViewActivity;
14 11
 import ai.pai.lensman.base.BaseActivity;
15
-import ai.pai.lensman.utils.BoxUrlContainer;
16
-import butterknife.BindView;
17 12
 import butterknife.ButterKnife;
18 13
 import butterknife.OnClick;
19 14
 

+ 0 - 26
app/src/main/java/ai/pai/lensman/utils/BoxUrlContainer.java

@@ -1,26 +0,0 @@
1
-package ai.pai.lensman.utils;
2
-
3
-public class BoxUrlContainer {
4
-
5
-    public static String BOX_IP = "192.168.8.101";
6
-
7
-    private static String BASE_URL = "http://" + BOX_IP + ":8002/";
8
-
9
-    public static String SESSION_START_URL = BASE_URL + "session_start";
10
-
11
-    public static String SESSION_END_URL = BASE_URL + "session_end";
12
-
13
-    public static String DELETE_PHOTO_URL = BASE_URL + "delete_photo";
14
-
15
-    public static String FETCH_THUMBNAIL_URL = BASE_URL + "fetch_thumbnail";
16
-
17
-    public static String PHOTO_PATH_PREFIX_URL = BASE_URL + "static/";
18
-
19
-    /**
20
-     * lensman  # 摄影师唯一标识
21
-     * session  # Session
22
-     * name  # fetch_thumbnail 返回
23
-     */
24
-    public static String FETCH_ORIGIN_URL = BASE_URL +"fetch_origin";
25
-
26
-}

+ 0 - 40
app/src/main/res/layout/layout_bt_device_list_item.xml

@@ -1,40 +0,0 @@
1
-<?xml version="1.0" encoding="utf-8"?>
2
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
-    android:layout_width="match_parent"
4
-    android:layout_height="wrap_content"
5
-    android:orientation="horizontal"
6
-    android:paddingBottom="4dp"
7
-    android:paddingTop="4dp">
8
-
9
-    <LinearLayout
10
-        android:layout_width="0dp"
11
-        android:layout_height="wrap_content"
12
-        android:layout_gravity="center_vertical"
13
-        android:orientation="vertical"
14
-        android:layout_weight="1">
15
-
16
-        <TextView
17
-            android:id="@+id/tv_device_name"
18
-            android:layout_width="wrap_content"
19
-            android:layout_height="wrap_content"
20
-            android:textColor="@color/dark_grey"
21
-            android:textSize="14sp" />
22
-
23
-        <TextView
24
-            android:id="@+id/tv_device_mac"
25
-            android:layout_width="wrap_content"
26
-            android:layout_height="wrap_content"
27
-            android:paddingTop="3dp"
28
-            android:textColor="@color/grey"
29
-            android:textSize="12sp" />
30
-    </LinearLayout>
31
-
32
-    <TextView
33
-        android:id="@+id/tv_device_status"
34
-        android:layout_width="wrap_content"
35
-        android:layout_height="wrap_content"
36
-        android:layout_marginRight="12dp"
37
-        android:layout_gravity="center_vertical"
38
-        android:textColor="@color/grey"
39
-        android:textSize="14sp" />
40
-</LinearLayout>

Kodo/kodo - Gogs: Go Git Service

1 Commits (3db17fe49d4f10ddb29a43d02811b3f8f213aa5a)

Autore SHA1 Messaggio Data
  Brightcells a078341431 Preauth page 7 anni fa