|
|
@@ -87,43 +105,50 @@ public class SessionInteractor {
|
87
|
105
|
return;
|
88
|
106
|
}
|
89
|
107
|
|
90
|
|
- if(BuildConfig.isTestMode){
|
91
|
|
- PhotoBean bean = new PhotoBean();
|
92
|
|
- long milisec = System.currentTimeMillis();
|
93
|
|
- bean.photoName = milisec+".jpg";
|
94
|
|
- bean.photoId = milisec;
|
95
|
|
-
|
96
|
|
- bean.captureTime = bean.photoId;
|
97
|
|
- bean.isRawPhoto = false;
|
98
|
|
- bean.uploadStatus = PhotoBean.UploadStatus.STATUS_NO_BEGIN;
|
99
|
|
- bean.sessionId = sessionBean.sessionId;
|
100
|
|
- bean.lensmanId = sessionBean.lensmanId;
|
101
|
|
- bean.sessionSeq = sessionBean.sessionSeq;
|
102
|
|
- bean.sessionDate = sessionBean.sessionDate;
|
103
|
|
- bean.sessionCreateTime = sessionBean.createTime;
|
104
|
|
- //TODO
|
105
|
|
- return;
|
|
108
|
+ isLastQueryReturned = false;
|
|
109
|
+ String photoName = CameraJNIInterface.getInstance().mygpcamerawaitforevent(sessionWorkingDirPath);
|
|
110
|
+ if(photoName!=null && photoName.length()>0){
|
|
111
|
+ String sub = photoName.substring(0,1);
|
|
112
|
+ if(TextUtils.isDigitsOnly(sub)){
|
|
113
|
+ LogHelper.d(TAG,"fetchPhotoTask new photo found");
|
|
114
|
+ PhotoBean bean = new PhotoBean();
|
|
115
|
+ bean.photoName = photoName;
|
|
116
|
+ bean.photoId = Long.parseLong(photoName.substring(0,photoName.lastIndexOf(".")));
|
|
117
|
+ bean.captureTime = bean.photoId;
|
|
118
|
+ bean.isRawPhoto = true;
|
|
119
|
+ bean.uploadStatus = PhotoBean.UploadStatus.STATUS_NO_BEGIN;
|
|
120
|
+ bean.sessionId = sessionBean.sessionId;
|
|
121
|
+ bean.lensmanId = sessionBean.lensmanId;
|
|
122
|
+ bean.sessionSeq = sessionBean.sessionSeq;
|
|
123
|
+ bean.sessionDate = sessionBean.sessionDate;
|
|
124
|
+ bean.sessionCreateTime = sessionBean.createTime;
|
|
125
|
+ bean.photoPath = Constants.APP_IMAGE_DIR+File.separator+photoName;
|
|
126
|
+ listener.onSessionPhotoCaptured(bean);
|
|
127
|
+ }
|
106
|
128
|
}
|
107
|
129
|
|
108
|
|
- isLastQueryReturned = false;
|
109
|
|
- LogHelper.d(TAG,"fetchPhotoTask starts");
|
|
130
|
+ isLastQueryReturned = true;
|
110
|
131
|
}
|
111
|
132
|
|
112
|
133
|
|
113
|
134
|
|
114
|
135
|
public void endSession(){
|
115
|
136
|
isWorking = false;
|
116
|
|
- if(timer!=null){
|
117
|
|
- timer.cancel();
|
118
|
|
- timer = null;
|
|
137
|
+ if(photoCaptureTimer !=null){
|
|
138
|
+ photoCaptureTimer.cancel();
|
|
139
|
+ photoCaptureTimer = null;
|
119
|
140
|
}
|
120
|
|
- //TODO
|
|
141
|
+ CameraJNIInterface.getInstance().mygpcameraexit();
|
121
|
142
|
listener.onSessionEnd(sessionBean.sessionId);
|
|
143
|
+ if(cameraInitHandler!=null){
|
|
144
|
+ cameraInitHandler.removeCallbacksAndMessages(null);
|
|
145
|
+ cameraInitHandler = null;
|
|
146
|
+ }
|
122
|
147
|
}
|
123
|
148
|
|
124
|
149
|
public void deletePhoto(PhotoBean photoBean){
|
125
|
|
- //TODO
|
126
|
150
|
LogHelper.d(TAG,"deletePhoto execute "+photoBean);
|
|
151
|
+ new File(photoBean.photoPath).delete();
|
127
|
152
|
}
|
128
|
153
|
|
129
|
154
|
}
|
|
|
@@ -10,6 +10,7 @@ import java.util.TimerTask;
|
10
|
10
|
|
11
|
11
|
import ai.pai.lensman.App;
|
12
|
12
|
import ai.pai.lensman.BuildConfig;
|
|
13
|
+import ai.pai.lensman.R;
|
13
|
14
|
import ai.pai.lensman.bean.PhotoBean;
|
14
|
15
|
import ai.pai.lensman.bean.SessionBean;
|
15
|
16
|
import ai.pai.lensman.db.DBService;
|
|
|
@@ -72,13 +73,13 @@ public class SessionPresenter implements SessionContract.Presenter, SessionInter
|
72
|
73
|
|
73
|
74
|
@Override
|
74
|
75
|
public void onSessionStartSuccess(String session) {
|
75
|
|
- sessionView.showToast("session启动成功");
|
|
76
|
+ sessionView.showToast(App.getAppContext().getString(R.string.session_start_success));
|
76
|
77
|
LogHelper.d(TAG,"onSessionStartSuccess session启动成功"+session);
|
77
|
78
|
}
|
78
|
79
|
|
79
|
80
|
@Override
|
80
|
81
|
public void onSessionStartError(String session) {
|
81
|
|
- sessionView.showToast("session启动失败");
|
|
82
|
+ sessionView.showToast(App.getAppContext().getString(R.string.session_start_success));
|
82
|
83
|
}
|
83
|
84
|
|
84
|
85
|
@Override
|
|
|
@@ -134,4 +134,8 @@
|
134
|
134
|
|
135
|
135
|
<string name="check_box_time">请检查手机时间设置是否正确</string>
|
136
|
136
|
|
|
137
|
+ <string name="session_start_success">拍摄启动成功</string>
|
|
138
|
+
|
|
139
|
+ <string name="session_start_error">拍摄启动失败,请检查相机及连接线</string>
|
|
140
|
+
|
137
|
141
|
</resources>
|