fix: 修改连续拍照txt与照片名称不匹配的问题
This commit is contained in:
parent
08a542f5ec
commit
02215187e7
@ -10,7 +10,7 @@ android {
|
|||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 26
|
versionCode 26
|
||||||
versionName "8.220815"
|
versionName "8.220816"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
lintOptions {
|
lintOptions {
|
||||||
|
@ -103,10 +103,21 @@ import java.util.Timer;
|
|||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE;
|
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE;
|
||||||
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER;
|
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import io.reactivex.ObservableEmitter;
|
||||||
|
import io.reactivex.ObservableOnSubscribe;
|
||||||
|
import io.reactivex.Observer;
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import io.reactivex.functions.Action;
|
||||||
|
import io.reactivex.functions.Consumer;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拍照
|
* 拍照
|
||||||
* (poi录像 和 道路)
|
* (poi录像 和 道路)
|
||||||
@ -133,7 +144,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
private GPSUtils gpsUtils;
|
private GPSUtils gpsUtils;
|
||||||
private Location gpsLocation;
|
private Location gpsLocation;
|
||||||
private boolean isMapSlide = false;
|
private boolean isMapSlide = false;
|
||||||
private boolean isOration = true;
|
private boolean isOration = true; // 当前是否为自动拍照模式
|
||||||
private boolean isTerminus = false;
|
private boolean isTerminus = false;
|
||||||
private boolean isBack = true;
|
private boolean isBack = true;
|
||||||
private int initCount;
|
private int initCount;
|
||||||
@ -359,13 +370,14 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
synchronized (finalVideoPath) {
|
synchronized (finalVideoPath) {
|
||||||
// 生成点位marker
|
// 生成点位marker
|
||||||
initMarker(booleanExtra);
|
initMarker(booleanExtra);
|
||||||
|
result.toFile(file, new FileCallback() {
|
||||||
|
@Override
|
||||||
|
public void onFileReady(@Nullable File file) {
|
||||||
int currentIndex = videoIndex = Integer.parseInt(file.getName().replace(".webp", ""));
|
int currentIndex = videoIndex = Integer.parseInt(file.getName().replace(".webp", ""));
|
||||||
// 下一张照片的路径
|
// 下一张照片的路径
|
||||||
finalVideoPath = Objects.requireNonNull(file.getParentFile()).getAbsolutePath() + "/" + (videoIndex + 1) + ".webp";
|
finalVideoPath = Objects.requireNonNull(file.getParentFile()).getAbsolutePath() + "/" + (videoIndex + 1) + ".webp";
|
||||||
tvTitle.setText("拍摄成功:" + (videoIndex + 1));
|
tvTitle.setText("拍摄成功:" + (videoIndex + 1));
|
||||||
result.toFile(file, new FileCallback() {
|
|
||||||
@Override
|
|
||||||
public void onFileReady(@Nullable File file) {
|
|
||||||
UserApplication.fixedThreadPool.execute(new Jpg2WebpRunnable(/*result, */file, 0, booleanExtra, currentIndex));
|
UserApplication.fixedThreadPool.execute(new Jpg2WebpRunnable(/*result, */file, 0, booleanExtra, currentIndex));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -603,16 +615,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
case R.id.btn_stop_picture:
|
case R.id.btn_stop_picture:
|
||||||
if (isOration) {
|
exit();
|
||||||
stopTimer();
|
|
||||||
}
|
|
||||||
picturesBuilder.append(TimestampUtil.time()).append(",").append("onClick 点击了结束采集 ,");
|
|
||||||
Intent intent = new Intent();
|
|
||||||
finalVideoPath = Objects.requireNonNull(paperFile.getParentFile()).getAbsolutePath() + "/" + videoIndex + ".webp";
|
|
||||||
intent.putExtra(Constant.INTENT_PICTURES_PATH, finalVideoPath);
|
|
||||||
intent.putExtra(Constant.INTENT_BOOLEAN,booleanExtra);
|
|
||||||
setResult(0x111, intent);
|
|
||||||
PicturesActivity.this.finish();
|
|
||||||
break;
|
break;
|
||||||
case R.id.image_view:
|
case R.id.image_view:
|
||||||
picturesBuilder.append(TimestampUtil.time()).append(",").append("onClick 点击了切换的窗口 ,");
|
picturesBuilder.append(TimestampUtil.time()).append(",").append("onClick 点击了切换的窗口 ,");
|
||||||
@ -869,7 +872,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
public void initMarkerPaper(int index) {
|
public void initMarkerPaper(int index) {
|
||||||
int endVideoIndex = index == -1 ? 0 : (index + 1);
|
int endVideoIndex = index == -1 ? 0 : index;
|
||||||
if (startVideoIndex == endVideoIndex) {
|
if (startVideoIndex == endVideoIndex) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -878,8 +881,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(formatter.format(new Date())); // 记录当前时
|
sb.append(formatter.format(new Date())); // 记录当前时
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
sb.append(index == -1 ? 0 : (index + 1));//個數
|
sb.append(index == -1 ? 0 : index);//個數
|
||||||
startVideoIndex = index == -1 ? 0 : (index + 1);
|
startVideoIndex = index == -1 ? 0 : index;
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
sb.append(Constant.currentLocation.getLatitude());
|
sb.append(Constant.currentLocation.getLatitude());
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
@ -1018,9 +1021,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (isOration) {
|
|
||||||
stopTimer();
|
|
||||||
}
|
|
||||||
String tvIndex = tvTitle.getText().toString();
|
String tvIndex = tvTitle.getText().toString();
|
||||||
String message = null;
|
String message = null;
|
||||||
if (tvIndex.equals("")) {
|
if (tvIndex.equals("")) {
|
||||||
@ -1032,13 +1032,51 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
MessageDialog.show(this, "提示", message, "是", "否").setOnOkButtonClickListener(new OnDialogButtonClickListener() {
|
MessageDialog.show(this, "提示", message, "是", "否").setOnOkButtonClickListener(new OnDialogButtonClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
|
baseDialog.doDismiss();
|
||||||
|
exit();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void exit() {
|
||||||
|
Observable.create(new ObservableOnSubscribe<String>() {
|
||||||
|
@Override
|
||||||
|
public void subscribe(ObservableEmitter<String> emitter) throws Exception {
|
||||||
|
stopTimer();
|
||||||
|
handler.removeMessages(0x101); // 如果handler中存在缓存的拍摄请求,也清空
|
||||||
picturesBuilder.append(TimestampUtil.time()).append(",").append("onClick 点击了结束采集 ,");
|
picturesBuilder.append(TimestampUtil.time()).append(",").append("onClick 点击了结束采集 ,");
|
||||||
|
emitter.onComplete();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.delay(2, TimeUnit.SECONDS)
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Observer<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
showLoadingDialog("正在保存照片...");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(String s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
dismissLoadingDialog();
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
finalVideoPath = Objects.requireNonNull(paperFile.getParentFile()).getAbsolutePath() + "/" + videoIndex + ".webp";
|
finalVideoPath = Objects.requireNonNull(paperFile.getParentFile()).getAbsolutePath() + "/" + videoIndex + ".webp";
|
||||||
intent.putExtra(Constant.INTENT_PICTURES_PATH, finalVideoPath);
|
intent.putExtra(Constant.INTENT_PICTURES_PATH, finalVideoPath);
|
||||||
setResult(0x111, intent);
|
setResult(0x111, intent);
|
||||||
PicturesActivity.this.finish();
|
PicturesActivity.this.finish();
|
||||||
return false;
|
handler = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1076,6 +1114,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
timerTask = new TimerTask() {
|
timerTask = new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (handler!=null) {
|
||||||
if (radioPicture == 1) {
|
if (radioPicture == 1) {
|
||||||
camera.takePictureSnapshot();
|
camera.takePictureSnapshot();
|
||||||
} else {
|
} else {
|
||||||
@ -1084,6 +1123,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
handler.sendMessage(message);
|
handler.sendMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (radioPicture == 1) {
|
if (radioPicture == 1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user