-num-new"> 201
}
};
fetchThumbnailTask.executeOnExecutor(ThreadExecutor.getInstance().getExecutor(), BoxUrlContainer.FETCH_THUMBNAIL_URL);
+ LogHelper.d(TAG,"fetchThumbnailTask starts");
}
@@ -210,7 +219,7 @@ public class SessionInteractor {
if(BuildConfig.isTestMode){
path = photoBean.photoPath;
}
- LogHelper.d(TAG,"保存照片到本地,图片链接地址为"+path);
+ LogHelper.d(TAG,"SavePhotoTask save photo to phone , photo remote url = "+path);
FileOutputStream fOut = null;
HttpURLConnection conn = null;
InputStream inStream = null;
@@ -233,11 +242,11 @@ public class SessionInteractor {
fOut.flush();
}
fOut.flush();
- LogHelper.d(TAG,"保存照片到本地,图片保存至"+file.getAbsolutePath()+"图片大小为"+file.length()+"字节\n\n");
+ LogHelper.d(TAG,"SavePhotoTask save photo to local path = "+file.getAbsolutePath()+" photo bytes = "+file.length()+"\n");
}
return true;
} catch (Exception e) {
- e.printStackTrace();
+ LogHelper.e(TAG,"SavePhotoTask exception occurs "+e);
} finally {
try{
inStream.close();
@@ -247,6 +256,11 @@ public class SessionInteractor {
e.printStackTrace();
}
}
+ try{
+ Thread.sleep(2000);
+ }catch (Exception e){
+ e.printStackTrace();
+ }
return false;
}
@@ -254,8 +268,10 @@ public class SessionInteractor {
protected void onPostExecute(Boolean result) {
super.onPostExecute(result);
if (result) {
+ LogHelper.d(TAG,"SavePhotoTask onPostExecute success " + photoBean);
listener.onSessionPhotoCaptured(photoBean);
}else{
+ LogHelper.d(TAG,"SavePhotoTask onPostExecute fail and retry "+photoBean);
new SavePhotoTask(photoBean).executeOnExecutor(ThreadExecutor.getInstance().getExecutor(),photoBean);
}
}
@@ -275,7 +291,7 @@ public class SessionInteractor {
params.put("session",randomSessionId);
sessionEndTask = new HttpPostTask(params);
sessionEndTask.executeOnExecutor(ThreadExecutor.getInstance().getExecutor(), BoxUrlContainer.SESSION_END_URL);
-
+ LogHelper.d(TAG,"sessionEndTask execute ");
listener.onSessionEnd(sessionBean.sessionId);
}
@@ -288,6 +304,7 @@ public class SessionInteractor {
params.put("path",photoBean.photoPath);
HttpPostTask deleteTask = new HttpPostTask(params);
deleteTask.executeOnExecutor(ThreadExecutor.getInstance().getExecutor(), BoxUrlContainer.DELETE_PHOTO_URL);
+ LogHelper.d(TAG,"deletePhoto execute "+photoBean);
}
private void cancelTask(HttpPostTask task){
@@ -23,7 +23,7 @@ public class SessionPresenter implements SessionContract.Presenter, SessionInter |
||
23 | 23 |
private SessionBean sessionBean; |
24 | 24 |
private boolean isWorking; |
25 | 25 |
|
26 |
- |
|
26 |
+ private static final String TAG = "SessionPresenter"; |
|
27 | 27 |
|
28 | 28 |
public SessionPresenter(SessionBean sessionBean, SessionContract.View view) { |
29 | 29 |
this.sessionView = view; |
@@ -32,11 +32,14 @@ public class SessionPresenter implements SessionContract.Presenter, SessionInter |
||
32 | 32 |
|
33 | 33 |
@Override |
34 | 34 |
public void start() { |
35 |
+ LogHelper.d(TAG,"SessionPresenter start "+sessionBean); |
|
35 | 36 |
interactor = new SessionInteractor(sessionBean, this); |
36 | 37 |
photoList = DBService.getInstance().getPhotoListBySessionId(sessionBean.sessionId); |
37 | 38 |
if (photoList.size() == 0) { |
39 |
+ LogHelper.d(TAG,"SessionPresenter start and found no old photos"); |
|
38 | 40 |
sessionView.showEmptyView(); |
39 | 41 |
} else { |
42 |
+ LogHelper.d(TAG,"SessionPresenter start and found old photos, size = "+photoList.size()); |
|
40 | 43 |
sessionView.showPhotoRecyclerView(); |
41 | 44 |
for (PhotoBean photoBean : photoList) { |
42 | 45 |
sessionView.addNewPhoto(photoBean); |
@@ -51,12 +54,14 @@ public class SessionPresenter implements SessionContract.Presenter, SessionInter |
||
51 | 54 |
interactor.endSession(); |
52 | 55 |
Preferences.getInstance().setCurrentSession(""); |
53 | 56 |
isWorking = false; |
57 |
+ LogHelper.d(TAG,"stop"); |
|
54 | 58 |
} |
55 | 59 |
|
56 | 60 |
@Override |
57 | 61 |
public void onSessionStartSuccess(String session) { |
58 | 62 |
isWorking = true; |
59 | 63 |
sessionView.showToast("session启动成功"); |
64 |
+ LogHelper.d(TAG,"onSessionStartSuccess session启动成功"+session); |
|
60 | 65 |
} |
61 | 66 |
|
62 | 67 |
@Override |
@@ -66,6 +71,7 @@ public class SessionPresenter implements SessionContract.Presenter, SessionInter |
||
66 | 71 |
} |
67 | 72 |
sessionView.showToast("session启动失败,自动重试中"); |
68 | 73 |
interactor.startSession(); |
74 |
+ LogHelper.d(TAG,"onSessionStartError session启动失败,自动重试中"); |
|
69 | 75 |
} |
70 | 76 |
|
71 | 77 |
@Override |
@@ -78,6 +84,7 @@ public class SessionPresenter implements SessionContract.Presenter, SessionInter |
||
78 | 84 |
return; |
79 | 85 |
} |
80 | 86 |
} |
87 |
+ LogHelper.d(TAG,"onSessionPhotoCaptured "+bean); |
|
81 | 88 |
DBService.getInstance().addPhotoBean(bean); |
82 | 89 |
sessionView.showPhotoRecyclerView(); |
83 | 90 |
sessionView.addNewPhoto(bean); |
@@ -87,7 +94,7 @@ public class SessionPresenter implements SessionContract.Presenter, SessionInter |
||
87 | 94 |
|
88 | 95 |
@Override |
89 | 96 |
public void onSessionEnd(String session) { |
90 |
- |
|
97 |
+ LogHelper.d(TAG,"onSessionEnd "+session); |
|
91 | 98 |
} |
92 | 99 |
|
93 | 100 |
@Override |
@@ -103,7 +110,7 @@ public class SessionPresenter implements SessionContract.Presenter, SessionInter |
||
103 | 110 |
|
104 | 111 |
@Override |
105 | 112 |
public void change2QRCodeSessionId(String sessionId) { |
106 |
- LogHelper.d("czy","change2QRCodeSessionId ="+sessionId); |
|
113 |
+ LogHelper.d(TAG,"change2QRCodeSessionId 使用新sessionId = "+sessionId); |
|
107 | 114 |
this.sessionBean.sessionId = sessionId; |
108 | 115 |
stop(); |
109 | 116 |
start(); |