diff --git a/app/build.gradle b/app/build.gradle
index 472c971..28a889c 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -11,9 +11,9 @@ android {
defaultConfig {
applicationId "com.navinfo.outdoor"
minSdkVersion 24
- targetSdkVersion 32
- versionCode 40
- versionName "8.221219"
+ targetSdkVersion 30
+ versionCode 41
+ versionName "8.230109"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 7068e75..1e87300 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -150,13 +150,13 @@
android:screenOrientation="portrait" />
+ android:screenOrientation="landscape" />
+ android:screenOrientation="landscape" />
+ android:screenOrientation="landscape" />
finishEntityMap) {
- hasFinishTask = true;
- Observable.fromIterable(finishEntityMap.values())
- .subscribeOn(Schedulers.io()).observeOn(Schedulers.computation())
- .filter(roadMatchEntity -> roadMatchEntity!=null)
- .map(roadMatchEntity -> {
- // 判断是否已领取,未领取则调用领取数据接口
- PoiEntity poiEntity = poiDao.getTaskIdPoiEntity(roadMatchEntity.getId());
- if (poiEntity == null) {
- // 数据库中不存在,尝试再次领取
- InsertAndUpdateUtils.getInstance().insertOrUpdate(AutoTakePictureActivity.this, translateRoadMatchEntity(roadMatchEntity));
- // 调用网络领取任务
- receiverRoadTask(roadMatchEntity).subscribe(receiveObserver);
- }
+ if (finishEntityMap!=null&&!finishEntityMap.isEmpty()) {
+ finishTaskCount++;
- List recorderList = recorderDao.getLocationRecorderByTime(roadMatchEntity.getStartMatchTime(), roadMatchEntity.getEndMathchTime());
- File recorderFolder = new File(Constant.PICTURE_FOLDER+"/"+poiEntity.getId());
- if (!recorderFolder.exists()) {
- recorderFolder.mkdirs();
- }
- // 编辑paper.txt
- // 复制图片文件
- File paperFile = new File(recorderFolder.getAbsolutePath(), "paper.txt");
- for (int i = 0; i < recorderList.size(); i++) {
- File originImg = new File(recorderList.get(i).getImgFileName());
- File destFile = new File(recorderFolder.getAbsolutePath()+"/"+i+".jpg");
- if (!destFile.exists()) {
- FileUtils.copyFile(originImg.getAbsolutePath(), destFile.getAbsolutePath());
+ Observable.fromIterable(finishEntityMap.values())
+ .subscribeOn(Schedulers.io()).observeOn(Schedulers.computation())
+ .filter(roadMatchEntity -> roadMatchEntity!=null)
+ .map(roadMatchEntity -> {
+ // 判断是否已领取,未领取则调用领取数据接口
+ PoiEntity poiEntity = poiDao.getTaskIdPoiEntity(roadMatchEntity.getId());
+ if (poiEntity == null) {
+ // 数据库中不存在,尝试再次领取
+ InsertAndUpdateUtils.getInstance().insertOrUpdate(AutoTakePictureActivity.this, translateRoadMatchEntity(roadMatchEntity));
+ // 调用网络领取任务
+ receiverRoadTask(roadMatchEntity).subscribe(receiveObserver);
}
- FileUtils.writeFile(paperFile.getAbsolutePath(), recorderList.get(i).toString(picFormatter ,i), true);
- }
- return poiEntity;
- })
- .doOnNext(poiEntity -> {
- // 网络提交数据
- if (poiEntity!=null) {
- // 提交数据,更新状态
- roadSaveWork(poiEntity);
+ List recorderList = recorderDao.getLocationRecorderByTime(roadMatchEntity.getStartMatchTime(), roadMatchEntity.getEndMathchTime());
+ File recorderFolder = new File(Constant.PICTURE_FOLDER+"/"+poiEntity.getId());
+ if (!recorderFolder.exists()) {
+ recorderFolder.mkdirs();
+ }
+ // 编辑paper.txt
+ // 复制图片文件
+ File paperFile = new File(recorderFolder.getAbsolutePath(), "paper.txt");
+ for (int i = 0; i < recorderList.size(); i++) {
+ File originImg = new File(recorderList.get(i).getImgFileName());
+ File destFile = new File(recorderFolder.getAbsolutePath()+"/"+i+".jpg");
+ if (!destFile.exists()) {
+ FileUtils.copyFile(originImg.getAbsolutePath(), destFile.getAbsolutePath());
+ }
+ FileUtils.writeFile(paperFile.getAbsolutePath(), recorderList.get(i).toString(picFormatter ,i), true);
+ }
+
+ return poiEntity;
+ })
+ .doOnNext(poiEntity -> {
+ // 网络提交数据
+ if (poiEntity!=null) {
+ // 提交数据,更新状态
+ roadSaveWork(poiEntity);
/*poiEntity.setTaskStatus(3);
InsertAndUpdateUtils.getInstance().insertOrUpdate(AutoTakePictureActivity.this, poiEntity);*/
- }
- })
- .observeOn(AndroidSchedulers.mainThread())
- .onErrorResumeNext(new Function>() {
- @Override
- public ObservableSource extends PoiEntity> apply(Throwable throwable) throws Exception {
- return null;
- }
- })
- .subscribe(new Consumer() {
- @Override
- public void accept(PoiEntity poiEntity) {
+ finishEntityMap.remove(poiEntity.getTaskId());
+ }
+ })
+ .observeOn(AndroidSchedulers.mainThread())
+ .onErrorResumeNext(Observable.empty())
+ .subscribe(new Consumer() {
+ @Override
+ public void accept(PoiEntity poiEntity) {
// // 已经处理过该任务,将其从finish列表中移除
// if (poiEntity!=null) {
// finishEntityMap.remove(poiEntity.getTaskId());
// }
- }
- }, new Consumer() {
+
+ }
+ }, new Consumer() {
+ @Override
+ public void accept(Throwable throwable) {
+ // 此处异常可能是服务返回的数据无法解析,但http正常返回了,因此可能为程序问题,不再重复尝试上报
+ systemTTS.playText("注意,领取任务失败!");
+ XLog.e("完成失败:"+throwable.getMessage());
+ ToastUtils.Message(AutoTakePictureActivity.this, throwable.getMessage());
+ finishTaskCount--;
+ if (finishTaskCount == 0) {
+ showExitDialog(true);
+ }
+ }
+ }, new Action() {
+ @Override
+ public void run() throws Exception {
+ // 重新绘制网络任务和本地任务
+ initRoadLine2Map();
+ finishTaskCount--;
+ if (finishTaskCount == 0) {
+ showExitDialog(false);
+ }
+ }
+ });
+ }
+ }
+
+ private void showExitDialog(boolean hasError) {
+ StringBuilder dialogMessage = new StringBuilder("任务数据处理完成,是否退出当前界面");
+ if (hasError) {
+ dialogMessage.append("(注意,其中有部分任务处理失败)");
+ }
+ MessageDialog.show(AutoTakePictureActivity.this, "退出当前界面", dialogMessage)
+ .setOkButton("确定", new OnDialogButtonClickListener() {
@Override
- public void accept(Throwable throwable) {
- // 此处异常可能是服务返回的数据无法解析,但http正常返回了,因此可能为程序问题,不再重复尝试上报
- systemTTS.playText("注意,领取任务失败!");
- XLog.e("完成失败:"+throwable.getMessage());
- ToastUtils.Message(AutoTakePictureActivity.this, throwable.getMessage());
- hasFinishTask = false;
+ public boolean onClick(BaseDialog baseDialog, View v) {
+ AutoTakePictureActivity.this.finish();
+ return false;
}
- }, new Action() {
+ })
+ .setCancelButton("取消", new OnDialogButtonClickListener() {
@Override
- public void run() throws Exception {
- // 重新绘制网络任务和本地任务
- initRoadLine2Map();
-// finishEntityMap.clear();
- hasFinishTask = false;
+ public boolean onClick(BaseDialog baseDialog, View v) {
+ baseDialog.doDismiss();
+ wantBack = false;
+ return false;
}
- });
+ })
+ .show();
}
private void roadSaveWork(PoiEntity poiEntity) throws IOException {
@@ -1681,8 +1713,9 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
@Override
public void onBackPressed() {
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
- if (hasFinishTask) {
+ if (finishTaskCount>0) {
MessageDialog.show(this, "提示", "后台正在处理已拍摄完成的任务,请稍后再退出当前界面");
+ wantBack = true;
return;
}
MessageDialog.show(this, "提示", "退出自动采集模式?", "是", "否").setOnOkButtonClickListener(new OnDialogButtonClickListener() {