fix: 合并主线代码
This commit is contained in:
@@ -105,6 +105,7 @@ import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -437,36 +438,37 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
|
||||
pictureResultFlowable.subscribeOn(Schedulers.io()) // 指定上游为IO线程
|
||||
.observeOn(Schedulers.io())
|
||||
.doOnNext(new Consumer<Map<String, Object>>() {
|
||||
@Override
|
||||
public void accept(Map<String, Object> map) throws Exception {
|
||||
int fileIndex = (int) map.get("index");
|
||||
PictureResult pictureResult = (PictureResult) map.get("picture");
|
||||
// 图片和paper.txt处理
|
||||
File currentFile = new File(paperFile.getParentFile().getAbsolutePath() + "/" + fileIndex + ".webp");
|
||||
CameraUtils.writeToFile(pictureResult.getData(), currentFile); // 生成照片文件
|
||||
// 记录当前点位信息
|
||||
LocationRecorder recorder = new LocationRecorder();
|
||||
recorder.setTime(System.currentTimeMillis());
|
||||
// 记录主定位方式
|
||||
recorder.setTencentLocationX(LocationLifeCycle.getInstance().getMainLocation().getLongitude());
|
||||
recorder.setTencentLocationY(LocationLifeCycle.getInstance().getMainLocation().getLatitude());
|
||||
// 记录辅助定位方式
|
||||
MyLocation gpsLocation = LocationLifeCycle.getInstance().getReferenceLocation();
|
||||
if (gpsLocation!=null) {
|
||||
recorder.setGpsLocationX(gpsLocation.getLongitude());
|
||||
recorder.setGpsLocationY(gpsLocation.getLatitude());
|
||||
}
|
||||
recorder.setBearing(LocationLifeCycle.getInstance().getMainLocation().getBearing());
|
||||
recorder.setRssi(GPSUtils.getInstance(PicturesActivity.this).getSateliteCount());
|
||||
recorder.setSatelliteCount(GPSUtils.getInstance(PicturesActivity.this).getSateliteCount());
|
||||
FileUtils.writeFile(paperFile.getAbsolutePath(), recorder.toString(formatter, fileIndex), true);
|
||||
}
|
||||
})
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnNext(new Consumer<Map>() {
|
||||
.doOnNext(new io.reactivex.functions.Consumer<Map<String, Object>>() {
|
||||
@Override
|
||||
public void accept(Map map) throws Exception {
|
||||
public void accept(Map<String, Object> map) throws Exception {
|
||||
|
||||
int fileIndex = (int) map.get("index");
|
||||
PictureResult pictureResult = (PictureResult) map.get("picture");
|
||||
// 图片和paper.txt处理
|
||||
File currentFile = new File(paperFile.getParentFile().getAbsolutePath() + "/" + fileIndex + ".webp");
|
||||
CameraUtils.writeToFile(pictureResult.getData(), currentFile); // 生成照片文件
|
||||
// 记录当前点位信息
|
||||
LocationRecorder recorder = new LocationRecorder();
|
||||
recorder.setTime(System.currentTimeMillis());
|
||||
// 记录主定位方式
|
||||
recorder.setTencentLocationX(LocationLifeCycle.getInstance().getMainLocation().getLongitude());
|
||||
recorder.setTencentLocationY(LocationLifeCycle.getInstance().getMainLocation().getLatitude());
|
||||
// 记录辅助定位方式
|
||||
MyLocation gpsLocation = LocationLifeCycle.getInstance().getReferenceLocation();
|
||||
if (gpsLocation!=null) {
|
||||
recorder.setGpsLocationX(gpsLocation.getLongitude());
|
||||
recorder.setGpsLocationY(gpsLocation.getLatitude());
|
||||
}
|
||||
recorder.setBearing(LocationLifeCycle.getInstance().getMainLocation().getBearing());
|
||||
recorder.setRssi(GPSUtils.getInstance(PicturesActivity.this).getSateliteCount());
|
||||
recorder.setSatelliteCount(GPSUtils.getInstance(PicturesActivity.this).getSateliteCount());
|
||||
FileUtils.writeFile(paperFile.getAbsolutePath(), recorder.toString(formatter, fileIndex), true);
|
||||
}
|
||||
})
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnNext(new io.reactivex.functions.Consumer<Map<String, Object>>() {
|
||||
@Override
|
||||
public void accept(Map<String, Object> map) {
|
||||
// 绘制图标
|
||||
initMarker(booleanExtra);
|
||||
// 设置主界面拍照个数显示
|
||||
@@ -1481,7 +1483,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
} else {
|
||||
disposable = Observable.interval(1000L, TimeUnit.MILLISECONDS, Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<Long>() {
|
||||
.subscribe(new io.reactivex.functions.Consumer<Long>() {
|
||||
@Override
|
||||
public void accept(Long aLong) throws Exception {
|
||||
camera.takePictureSnapshot();
|
||||
|
||||
Reference in New Issue
Block a user