fix: 增加轨迹图片恢复、缓存删除等功能
This commit is contained in:
parent
9d8185a958
commit
5a1b0edd82
@ -12,8 +12,8 @@ android {
|
||||
applicationId "com.navinfo.outdoor"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 30
|
||||
versionCode 53
|
||||
versionName "8.230419-正式版"
|
||||
versionCode 54
|
||||
versionName "8.230512-正式版"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
ndk {
|
||||
|
||||
@ -145,6 +145,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
private List<Removable> removables, trackRemovableList;
|
||||
private Polyline polyline;
|
||||
private String finalVideoPath, geoWkt, detail; // 摄像后最终保存的文件名
|
||||
private int matchTrack; // 是否通过轨迹匹配照片
|
||||
private ViewGroup layerChange; // 切换地图和相机的父控件
|
||||
private CheckBox capturePicture; //拍照
|
||||
private File paperFile, logFile;
|
||||
@ -231,6 +232,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
type = getIntent().getIntExtra(Constant.INTENT_TYPE, 0);
|
||||
geoWkt = getIntent().getStringExtra(Constant.INTENT_GEO_WKT);
|
||||
detail = getIntent().getStringExtra(Constant.INTENT_DETAIL);
|
||||
matchTrack = getIntent().getIntExtra(Constant.MATCH_TRACK, 0);
|
||||
booleanExtra = getIntent().getBooleanExtra(Constant.INTENT_BOOLEAN, true);
|
||||
if (finalVideoPath != null) {
|
||||
File file = new File(finalVideoPath);
|
||||
@ -501,53 +503,57 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
});
|
||||
imgLocationType = findViewById(R.id.img_location_type);
|
||||
imgLocationType.setOnClickListener(this::onClick);
|
||||
imgTrackSelectRange = findViewById(R.id.img_track_select_point);
|
||||
imgTrackSelectRange.setOnClickListener(this::onClick);
|
||||
imgTrackSelectConfirm = findViewById(R.id.img_track_select_confirm);
|
||||
imgTrackSelectConfirm.setOnClickListener(this::onClick);
|
||||
tencentMap.setOnMarkerClickListener(new TencentMap.OnMarkerClickListener() {
|
||||
@Override
|
||||
public boolean onMarkerClick(Marker marker) {
|
||||
if (marker.getTag() instanceof LocationRecorder) {
|
||||
LocationRecorder locationRecorder = (LocationRecorder) marker.getTag();
|
||||
// 设置为起点或终点
|
||||
MessageDialog.show(PicturesActivity.this, "选择起终点", "当前点位时间为:"+ formatter.format(new Date(locationRecorder.getTime()))+",设置为起点或终点",
|
||||
"起点", "取消", "终点")
|
||||
.setOnOkButtonClickListener(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// 设置该点位起点
|
||||
if (trackEndTime!=0&&trackStartTime>=locationRecorder.getTime()) {
|
||||
ToastUtils.Message(PicturesActivity.this, "开始时间不能在结束时间之后!");
|
||||
} else {
|
||||
trackStartTime = locationRecorder.getTime();
|
||||
marker.setIcon(pileDescriptor);
|
||||
}
|
||||
return false;
|
||||
if (matchTrack!=0) { // 只有需要轨迹匹配的时候才会显示
|
||||
imgTrackSelectRange = findViewById(R.id.img_track_select_point);
|
||||
imgTrackSelectRange.setOnClickListener(this::onClick);
|
||||
imgTrackSelectConfirm = findViewById(R.id.img_track_select_confirm);
|
||||
imgTrackSelectConfirm.setOnClickListener(this::onClick);
|
||||
imgTrackSelectRange.setVisibility(View.VISIBLE);
|
||||
imgTrackSelectConfirm.setVisibility(View.VISIBLE);
|
||||
tencentMap.setOnMarkerClickListener(new TencentMap.OnMarkerClickListener() {
|
||||
@Override
|
||||
public boolean onMarkerClick(Marker marker) {
|
||||
if (marker.getTag() instanceof LocationRecorder) {
|
||||
LocationRecorder locationRecorder = (LocationRecorder) marker.getTag();
|
||||
// 设置为起点或终点
|
||||
MessageDialog.show(PicturesActivity.this, "选择起终点", "当前点位时间为:"+ formatter.format(new Date(locationRecorder.getTime()))+",设置为起点或终点",
|
||||
"起点", "取消", "终点")
|
||||
.setOnOkButtonClickListener(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// 设置该点位起点
|
||||
if (trackEndTime!=0&&trackStartTime>=locationRecorder.getTime()) {
|
||||
ToastUtils.Message(PicturesActivity.this, "开始时间不能在结束时间之后!");
|
||||
} else {
|
||||
trackStartTime = locationRecorder.getTime();
|
||||
marker.setIcon(pileDescriptor);
|
||||
}
|
||||
})
|
||||
.setOnCancelButtonClickListener(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.setOnOtherButtonClickListener(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
if (trackStartTime!=0&&locationRecorder.getTime()<=trackStartTime) {
|
||||
ToastUtils.Message(PicturesActivity.this, "结束时间不能在开始时间之前!");
|
||||
} else {
|
||||
trackEndTime = locationRecorder.getTime();
|
||||
marker.setIcon(pileDescriptor);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.setOnCancelButtonClickListener(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.setOnOtherButtonClickListener(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
if (trackStartTime!=0&&locationRecorder.getTime()<=trackStartTime) {
|
||||
ToastUtils.Message(PicturesActivity.this, "结束时间不能在开始时间之前!");
|
||||
} else {
|
||||
trackEndTime = locationRecorder.getTime();
|
||||
marker.setIcon(pileDescriptor);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class Jpg2WebpRunnable implements Runnable {
|
||||
@ -870,6 +876,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
// trackRemovableList.add(marker);
|
||||
// }
|
||||
dismissLoadingDialog();
|
||||
ToastUtils.Message(PicturesActivity.this, "点选地图上的轨迹点选择起终点");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -887,6 +894,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
mCalendar.get(Calendar.DAY_OF_MONTH)
|
||||
);
|
||||
// 显示 DatePickerDialog
|
||||
datePickerDialog.setTitle("选择轨迹日期");
|
||||
datePickerDialog.show();
|
||||
} else { // 未选中
|
||||
setLocMarkerStyle(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE);
|
||||
@ -912,6 +920,27 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<Pair<Integer, LocationRecorder>> emitter) throws Exception {
|
||||
List<LocationRecorder> locationRecorderByTime = recorderDao.getLocationRecorderByTime(trackStartTime, trackEndTime);
|
||||
if (locationRecorderByTime.size()<5) {
|
||||
emitter.onError(new Throwable("轨迹点个数少于5个,请确认!"));
|
||||
return;
|
||||
}
|
||||
String geo = Geohash.getInstance().decode(geoWkt);
|
||||
Geometry lineString = GeometryTools.createGeometry(geo);
|
||||
int matchCount = 0, unMatchCount = 0;
|
||||
// 检查该轨迹与任务路线是否匹配
|
||||
for (int i = 0; i < locationRecorderByTime.size(); i++) {
|
||||
if (lineString.distance(GeometryTools.createGeometry(new LatLng(locationRecorderByTime.get(i).getTencentLocationY(), locationRecorderByTime.get(i).getTencentLocationX())))<120e-5) {
|
||||
matchCount++;
|
||||
} else {
|
||||
unMatchCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// if (matchCount==0||((float)unMatchCount)/matchCount>0.2) {
|
||||
// emitter.onError(new Throwable("选择的点位中包含过多非任务范围内轨迹点,请确认!"));
|
||||
// return;
|
||||
// }
|
||||
|
||||
final int[] index = {0};
|
||||
locationRecorderByTime.forEach(new Consumer<LocationRecorder>() {
|
||||
@Override
|
||||
@ -931,13 +960,16 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
// 转移图片文件
|
||||
File pictureFolder = new File(finalVideoPath).getParentFile();
|
||||
File originImg = new File(integerLocationRecorderPair.second.getImgFileName());
|
||||
File destFile = new File(pictureFolder.getParentFile().getAbsolutePath()+"/"+integerLocationRecorderPair.first+".jpg");
|
||||
File destFile = new File(paperFile.getParentFile().getAbsolutePath()+"/"+integerLocationRecorderPair.first+".webp");
|
||||
if (!destFile.exists()) {
|
||||
FileUtils.copyFile(originImg.getAbsolutePath(), destFile.getAbsolutePath());
|
||||
}
|
||||
FileUtils.writeFile(paperFile.getAbsolutePath(), integerLocationRecorderPair.second.toString(formatter ,integerLocationRecorderPair.first), true);
|
||||
videoIndex = integerLocationRecorderPair.first;
|
||||
}
|
||||
}).subscribe(new Observer<Pair<Integer, LocationRecorder>>() {
|
||||
})
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<Pair<Integer, LocationRecorder>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
showLoadingDialog();
|
||||
@ -956,11 +988,14 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
// ToastUtils.Message(PicturesActivity.this, e.getMessage());
|
||||
MessageDialog.show(PicturesActivity.this, "提示", e.getMessage()).show();
|
||||
dismissLoadingDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
MessageDialog.show(PicturesActivity.this, "提示", "处理完成,退回到详情界面可查看关联照片").show();
|
||||
dismissLoadingDialog();
|
||||
}
|
||||
});
|
||||
@ -1363,7 +1398,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
exit();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}).show();
|
||||
}
|
||||
|
||||
private void exit() {
|
||||
|
||||
@ -173,6 +173,7 @@ public class Constant {
|
||||
public static final String INTENT_TYPE = "type";//poiEntity 的type
|
||||
public static final String INTENT_GEO_WKT = "geowkt";//poiEntity 的geowkt
|
||||
public static final String INTENT_DETAIL = "Detail";//poiEntity 的detail
|
||||
public static final String MATCH_TRACK = "matchTrack";//poiEntity 的detail
|
||||
public static SlidingUpPanelLayout SLIDING_LAYOUT = null;//設置
|
||||
public static TencentMap.OnMarkerClickListener markerClickListener = null;
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@ public abstract class BaseDrawerFragment extends BaseFragment {
|
||||
protected PoiEntity showPoiEntity;
|
||||
public SlidingUpPanelLayout slidingPaneLayout;
|
||||
public TencentMap tencentMap;
|
||||
protected int matchTrack;
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
@ -586,7 +586,7 @@ public class AreaHubFragment extends BaseDrawerFragment implements View.OnClickL
|
||||
httpParams.put("taskId", poiEntity.getTaskId());
|
||||
httpParams.put("name", poiEntity.getName());
|
||||
httpParams.put("address", poiEntity.getAddress());
|
||||
httpParams.put("workType", 1);
|
||||
// httpParams.put("workType", 1);
|
||||
httpParams.put("memo", poiEntity.getMemo());
|
||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||
.time(30)
|
||||
|
||||
@ -687,7 +687,7 @@ public class BuildingInFragment extends BaseDrawerFragment implements View.OnCli
|
||||
httpParams.put("taskId", poiEntity.getTaskId());
|
||||
httpParams.put("name", poiEntity.getName());
|
||||
httpParams.put("address", poiEntity.getAddress());
|
||||
httpParams.put("workType", 1);
|
||||
// httpParams.put("workType", 1);
|
||||
httpParams.put("memo", poiEntity.getMemo());
|
||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||
.time(30)
|
||||
|
||||
@ -22,6 +22,7 @@ import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.AutoTakePictureActivity;
|
||||
import com.navinfo.outdoor.activity.NaviCarActivity;
|
||||
import com.navinfo.outdoor.activity.NaviRideActivity;
|
||||
import com.navinfo.outdoor.activity.NaviWalkActivity;
|
||||
@ -74,6 +75,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
private File logFile;
|
||||
private StringBuilder gatherGetBuilder;
|
||||
private TextView tvStartNav;
|
||||
private TextView tvMatchTrack; // 手动匹配轨迹照片
|
||||
|
||||
public static GatherGetFragment newInstance(Bundle bundle) {
|
||||
GatherGetFragment fragment = new GatherGetFragment();
|
||||
@ -154,6 +156,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
TextView tvDistance = findViewById(R.id.tv_distance);
|
||||
TextView tvDescribe = findViewById(R.id.tv_describe);
|
||||
tvStartNav = findViewById(R.id.tv_gather_start_navi);
|
||||
tvMatchTrack = findViewById(R.id.tv_gather_match_track);
|
||||
Button btnDelete = findViewById(R.id.btn_delete);
|
||||
btnDelete.setOnClickListener(this);
|
||||
btnCancelGet = findViewById(R.id.btn_cancel_get);//取消领取
|
||||
@ -214,9 +217,50 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 连续点击tvTitle显示匹配轨迹的按钮
|
||||
tvTitle.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (tvMatchTrack.isShown()) {
|
||||
return;
|
||||
}
|
||||
if (poiEntity.getType() != 3 && poiEntity.getType() != 4) {
|
||||
return;
|
||||
}
|
||||
settingHookClickCount++;
|
||||
if(lastClickTime > 0){
|
||||
long secondClickTime = System.currentTimeMillis();//距离上次开机时间
|
||||
long dtime = secondClickTime - lastClickTime;
|
||||
if(dtime <800){
|
||||
if (settingHookClickCount>8) {
|
||||
Toast.makeText(requireActivity(), "打开轨迹自动匹配功能", Toast.LENGTH_SHORT).show();
|
||||
tvMatchTrack.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (settingHookClickCount>5) {
|
||||
Toast.makeText(requireActivity(), "再点击"+(9-settingHookClickCount)+"下打开设置功能", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
} else{
|
||||
lastClickTime = 0;
|
||||
settingHookClickCount = 1;
|
||||
}
|
||||
}
|
||||
lastClickTime = System.currentTimeMillis();
|
||||
}
|
||||
});
|
||||
|
||||
tvMatchTrack.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// 与领取任务功能类似,不再检查当前位置与任务之间的距离
|
||||
initGather(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private long lastClickTime = 0;
|
||||
private int settingHookClickCount = 1;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -301,9 +345,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
} else if (type == 2) {//充电站的领取类型
|
||||
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity, false, 1);
|
||||
} else if (type == 3) {//poi录像的领取类型
|
||||
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK, poiEntity, false, 1);
|
||||
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK, poiEntity, false, 1, 0);
|
||||
} else if (type == 4) {//道路的领取类型
|
||||
taskByNet(HttpInterface.RECEIVED_ROAD_TASK, poiEntity, false, 1);
|
||||
taskByNet(HttpInterface.RECEIVED_ROAD_TASK, poiEntity, false, 1, 0);
|
||||
} else if (type == 5) {//其他的领取类型
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity, false, 1);
|
||||
}
|
||||
@ -327,13 +371,13 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "注意在任务附近50米范围内进行采集", "确定").setOnOkButtonClickListener(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
initGather();
|
||||
initGather(0);
|
||||
//Voice.sprat("注意在附近50米范围内进行采集",1);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
initGather();
|
||||
initGather(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -364,7 +408,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
}
|
||||
|
||||
private void initGather() {
|
||||
private void initGather(int matchTrack/*是否为根据轨迹手动匹配*/) {
|
||||
if (poiEntity != null) {
|
||||
int type = poiEntity.getType();
|
||||
if (type == 6) {
|
||||
@ -379,9 +423,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
} else if (type == 2) {//充电站的领取类型
|
||||
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity, true, 5);
|
||||
} else if (type == 3) {//poi录像的领取类型
|
||||
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK, poiEntity, true, 5);
|
||||
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK, poiEntity, true, 5, matchTrack);
|
||||
} else if (type == 4) {//道路的领取类型
|
||||
taskByNet(HttpInterface.RECEIVED_ROAD_TASK, poiEntity, true, 5);
|
||||
taskByNet(HttpInterface.RECEIVED_ROAD_TASK, poiEntity, true, 5, matchTrack);
|
||||
} else if (type == 5) {//其他的领取类型
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity, true, 5);
|
||||
}
|
||||
@ -938,7 +982,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
/**
|
||||
* @param url 不同任务类型对应的url
|
||||
*/
|
||||
private void taskByNet(String url, PoiEntity poiEntity, boolean isSaver, int statusId) {
|
||||
private void taskByNet(String url, PoiEntity poiEntity, boolean isSaver, int statusId, int matchTrack) {
|
||||
showLoadingDialog();
|
||||
OkGoBuilder okGoBuilder = OkGoBuilder
|
||||
.getInstance()
|
||||
@ -987,6 +1031,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.GATHER_GET_MAP;
|
||||
obtain.obj = poiListEntity;
|
||||
obtain.arg1 = matchTrack;
|
||||
EventBus.getDefault().post(obtain);
|
||||
} else {
|
||||
Message obtain = Message.obtain();
|
||||
@ -1007,6 +1052,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.GATHER_GET_MAP;
|
||||
obtain.obj = taskIdPoiEntity;
|
||||
obtain.arg1 = matchTrack;
|
||||
EventBus.getDefault().post(obtain);
|
||||
} else {
|
||||
Message obtain = Message.obtain();
|
||||
|
||||
@ -14,14 +14,20 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.github.lazylibrary.util.FileUtils;
|
||||
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||
import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||
import com.navinfo.outdoor.activity.LoginActivity;
|
||||
import com.navinfo.outdoor.activity.PicturesActivity;
|
||||
import com.navinfo.outdoor.activity.UserActivity;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
@ -29,6 +35,8 @@ import com.navinfo.outdoor.bean.GetPriceBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.DoubleUtil;
|
||||
import com.navinfo.outdoor.util.FlushTokenUtil;
|
||||
import com.navinfo.outdoor.util.TimestampUtil;
|
||||
@ -43,8 +51,19 @@ import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 我的Fragment
|
||||
*/
|
||||
@ -105,6 +124,8 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
|
||||
rlContact.setOnClickListener(this);
|
||||
RelativeLayout rlSet = findViewById(R.id.rl_set);
|
||||
rlSet.setOnClickListener(this);
|
||||
RelativeLayout rlClearCache = findViewById(R.id.rl_clear_cache);
|
||||
rlClearCache.setOnClickListener(this);
|
||||
RelativeLayout rlAbout = findViewById(R.id.rl_about);
|
||||
rlAbout.setOnClickListener(this);
|
||||
Button btnQuit = findViewById(R.id.btn_quit);
|
||||
@ -253,6 +274,85 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
|
||||
intentContact.putExtra("tag", 21);
|
||||
startActivity(intentContact);
|
||||
break;
|
||||
case R.id.rl_clear_cache: //清除缓存
|
||||
mainBuilder.append(TimestampUtil.time()).append(",").append("点击了item 清除缓存操作 ,");
|
||||
MessageDialog.show((AppCompatActivity) requireActivity(), "注意", "注意,清除缓存操作会删除自动采集保存的照片素材,请确认自动采集任务已完全上传再清除!",
|
||||
"确认", "取消")
|
||||
.setOnOkButtonClickListener(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
// 开始清除缓存
|
||||
Observable.create(new ObservableOnSubscribe<PoiEntity>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<PoiEntity> emitter) throws Exception {
|
||||
// 查询所有已上传数据,删除对应的文件夹
|
||||
List<PoiEntity> poiEntityList = PoiDatabase.getInstance(requireActivity()).getPoiDao().getAllPoi();
|
||||
for (PoiEntity poiEntity:poiEntityList) {
|
||||
if (poiEntity.getTaskStatus() == 100) { // 只删除已上传完成的数据
|
||||
emitter.onNext(poiEntity);
|
||||
}
|
||||
}
|
||||
emitter.onComplete();
|
||||
}
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.io())
|
||||
.doOnNext(new Consumer<PoiEntity>() {
|
||||
@Override
|
||||
public void accept(PoiEntity poiEntity) throws Exception {
|
||||
// 删除指定文件夹
|
||||
File folder = new File(Constant.PICTURE_FOLDER, poiEntity.getId());
|
||||
if (folder.exists()) {
|
||||
FileUtils.deleteFile(folder.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}).doOnComplete(new Action() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
File tmpFolder = new File(Constant.PICTURE_FOLDER, "tmp");
|
||||
if (tmpFolder.exists()) {
|
||||
FileUtils.deleteFile(tmpFolder.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}).observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnComplete(new Action() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
setLoadingDialogText("正在清理自动采集的照片");
|
||||
}
|
||||
})
|
||||
.subscribe(new Observer<PoiEntity>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
showLoadingDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(PoiEntity poiEntity) {
|
||||
setLoadingDialogText("正在清理:"+poiEntity.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dismissLoadingDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
dismissLoadingDialog();
|
||||
ToastUtils.Message(requireActivity(), "缓存清理完成");
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.setOnCancelButtonClickListener(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.show();
|
||||
break;
|
||||
case R.id.rl_about: //关于
|
||||
mainBuilder.append(TimestampUtil.time()).append(",").append("点击了item 跳转到关于页面 ,");
|
||||
Intent intentAbout = new Intent(getActivity(), FragmentManagement.class);
|
||||
|
||||
@ -288,6 +288,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
// 添加信息:
|
||||
assert getArguments() != null;
|
||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||
matchTrack = getArguments().getInt("matchTrack", 0);
|
||||
if (showPoiEntity != null) {
|
||||
String name = showPoiEntity.getName();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
@ -461,6 +462,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
intents.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType());
|
||||
intents.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt());
|
||||
intents.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail());
|
||||
intents.putExtra(Constant.MATCH_TRACK, matchTrack);
|
||||
int gpsRssi = LocationLifeCycle.getInstance().getTencentLocation().getGPSRssi();
|
||||
if (gpsRssi == 0) {
|
||||
intents.putExtra(Constant.INTENT_BOOLEAN, false);
|
||||
@ -569,7 +571,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
httpParams.put("taskId", poiEntity.getTaskId());
|
||||
httpParams.put("name", poiEntity.getName());
|
||||
httpParams.put("address", poiEntity.getAddress());
|
||||
httpParams.put("workType", 1);
|
||||
// httpParams.put("workType", 1);
|
||||
httpParams.put("memo", poiEntity.getMemo());
|
||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||
.time(30)
|
||||
|
||||
@ -319,6 +319,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
// 添加信息:
|
||||
assert getArguments() != null;
|
||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||
matchTrack = getArguments().getInt("matchTrack", 0);
|
||||
if (showPoiEntity != null) {
|
||||
String name = showPoiEntity.getName();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
@ -582,6 +583,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType());
|
||||
intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt());
|
||||
intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail());
|
||||
intent.putExtra(Constant.MATCH_TRACK, matchTrack);
|
||||
int gpsRssi = LocationLifeCycle.getInstance().getTencentLocation().getGPSRssi();
|
||||
if (gpsRssi == 0) {
|
||||
intent.putExtra(Constant.INTENT_BOOLEAN, false);
|
||||
|
||||
@ -586,7 +586,7 @@ public class TrafficHubFragment extends BaseDrawerFragment implements View.OnCli
|
||||
httpParams.put("taskId", poiEntity.getTaskId());
|
||||
httpParams.put("name", poiEntity.getName());
|
||||
httpParams.put("address", poiEntity.getAddress());
|
||||
httpParams.put("workType", 1);
|
||||
// httpParams.put("workType", 1);
|
||||
httpParams.put("memo", poiEntity.getMemo());
|
||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||
.time(30)
|
||||
|
||||
@ -974,6 +974,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
bundle.putBoolean("isSliding", true); // 通知抽屉不收回
|
||||
bundle.putInt("matchTrack", data.arg1);
|
||||
switch (poiEntity.getType()) {
|
||||
case 1:
|
||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
||||
|
||||
@ -2,9 +2,9 @@ package com.navinfo.outdoor.http;
|
||||
|
||||
public class HttpInterface {
|
||||
// public static final String IP = "http://172.23.138.133:9999/m4";//测试接口-IP
|
||||
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发接口-外网
|
||||
public static final String IP0 = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发接口-外网
|
||||
public static final String IP1 = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试接口-外网
|
||||
public static final String IP0 = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
|
||||
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
|
||||
public static final String USER_PATH = "/user/";//我的
|
||||
public static final String MSG_LIST_PATH = "/msgList/";//发现
|
||||
public static final String USER_LOGIN_PATH = "/userlogin/";//登录
|
||||
|
||||
@ -176,15 +176,19 @@ public class DataSaveUtils {
|
||||
poiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
// 同时删除关联的照片文件和压缩包文件
|
||||
if (zipFile.exists()) {
|
||||
zipFile.delete();
|
||||
}
|
||||
if (poiPicList!=null&&!poiPicList.isEmpty()) {
|
||||
for (File picFile: poiPicList
|
||||
) {
|
||||
picFile.delete();
|
||||
}
|
||||
if (zipFile.getParentFile().exists()) {
|
||||
// 删除对应的文件夹
|
||||
FileUtils.deleteFile(zipFile.getParentFile().getAbsolutePath());
|
||||
}
|
||||
// if (zipFile.exists()) {
|
||||
// zipFile.delete();
|
||||
// }
|
||||
// if (poiPicList!=null&&!poiPicList.isEmpty()) {
|
||||
// for (File picFile: poiPicList
|
||||
// ) {
|
||||
// picFile.delete();
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
throw new Exception("数据:" + poiEntity.getName() + " 上传失败");
|
||||
}
|
||||
|
||||
@ -45,7 +45,9 @@ public class PoiEntityDeleteUtil {
|
||||
if (poiEntity.getPhotoInfo() != null) {
|
||||
for (int i = 0; i < poiEntity.getPhotoInfo().size(); i++) {
|
||||
File file = new File(poiEntity.getPhotoInfo().get(i).getPhoto());
|
||||
file.delete();
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (poiEntity.getId() != null) {
|
||||
@ -59,7 +61,9 @@ public class PoiEntityDeleteUtil {
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < chargingPileFileList.size(); i++) {
|
||||
chargingPileFileList.get(i).delete();
|
||||
if (chargingPileFileList.get(i).exists()) {
|
||||
chargingPileFileList.get(i).delete();
|
||||
}
|
||||
}
|
||||
PoiDatabase.getInstance(context).getChargingPileDao().deleteChargingPileEntity(chargingPileEntity);
|
||||
}
|
||||
@ -71,10 +75,14 @@ public class PoiEntityDeleteUtil {
|
||||
private void initPicture(PoiEntity poiEntity) {
|
||||
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
fileListByUUID.get(i).delete();
|
||||
if (fileListByUUID.get(i).exists()) {
|
||||
fileListByUUID.get(i).delete();
|
||||
}
|
||||
}
|
||||
File filePath = AWMp4ParserHelper.getInstance().getFilePath(poiEntity.getId());
|
||||
filePath.delete();
|
||||
if (filePath.exists()) {
|
||||
filePath.delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -83,7 +91,9 @@ public class PoiEntityDeleteUtil {
|
||||
if (poiEntity.getPhotoInfo() != null) {
|
||||
for (int i = 0; i < poiEntity.getPhotoInfo().size(); i++) {
|
||||
File file = new File(poiEntity.getPhotoInfo().get(i).getPhoto());
|
||||
file.delete();
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.github.lazylibrary.util.FileUtils;
|
||||
import com.github.lazylibrary.util.ToastUtils;
|
||||
import com.github.lazylibrary.util.ZipUtil;
|
||||
import com.google.gson.Gson;
|
||||
@ -571,9 +572,14 @@ public class PoiSaveUtils {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).delete();
|
||||
// 同时删除关联的照片文件和压缩包文件
|
||||
if (!list.isEmpty()&&list.get(0).getParentFile().exists()) {
|
||||
// 删除对应的文件夹
|
||||
FileUtils.deleteFile(list.get(0).getParentFile().getAbsolutePath());
|
||||
}
|
||||
// for (int i = 0; i < list.size(); i++) {
|
||||
// list.get(i).delete();
|
||||
// }
|
||||
PoiEntityDeleteUtil.getInstance().deleteUtil(mContext, poiEntity);
|
||||
Log.d("TAGSS", "uploadPoiNet: 成功" + anInt);
|
||||
anInt++;
|
||||
|
||||
7
app/src/main/res/drawable/ic_baseline_more_time_24.xml
Normal file
7
app/src/main/res/drawable/ic_baseline_more_time_24.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M10,8l0,6l4.7,2.9l0.8,-1.2l-4,-2.4l0,-5.3z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M17.92,12c0.05,0.33 0.08,0.66 0.08,1c0,3.9 -3.1,7 -7,7s-7,-3.1 -7,-7c0,-3.9 3.1,-7 7,-7c0.7,0 1.37,0.1 2,0.29V4.23C12.36,4.08 11.69,4 11,4c-5,0 -9,4 -9,9s4,9 9,9s9,-4 9,-9c0,-0.34 -0.02,-0.67 -0.06,-1H17.92z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M20,5l0,-3l-2,0l0,3l-3,0l0,2l3,0l0,3l2,0l0,-3l3,0l0,-2z"/>
|
||||
</vector>
|
||||
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M2,19.99l7.5,-7.51l4,4l7.09,-7.97L22,9.92l-8.5,9.56l-4,-4l-6,6.01L2,19.99zM3.5,15.49l6,-6.01l4,4L22,3.92l-1.41,-1.41l-7.09,7.97l-4,-4L2,13.99L3.5,15.49z"/>
|
||||
</vector>
|
||||
@ -180,16 +180,18 @@
|
||||
android:layout_height="@dimen/default_round_widget"
|
||||
android:background="@drawable/selector_round_bg"
|
||||
android:text="从轨迹选择"
|
||||
android:src="@drawable/selector_location_type"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/ic_baseline_stacked_line_chart_24"
|
||||
android:padding="@dimen/default_widget_padding"
|
||||
android:layout_marginTop="@dimen/default_widget_padding"></ImageView>
|
||||
<ImageView
|
||||
android:id="@+id/img_track_select_confirm"
|
||||
android:layout_width="@dimen/default_round_widget"
|
||||
android:layout_height="@dimen/default_round_widget"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/selector_round_bg"
|
||||
android:text="确认轨迹选择时间"
|
||||
android:src="@drawable/selector_location_type"
|
||||
android:src="@drawable/ic_baseline_more_time_24"
|
||||
android:padding="@dimen/default_widget_padding"
|
||||
android:layout_marginTop="@dimen/default_widget_padding"></ImageView>
|
||||
</LinearLayout>
|
||||
|
||||
@ -29,6 +29,20 @@
|
||||
android:layout_marginEnd="18dp"
|
||||
android:text="导航到此处"></androidx.appcompat.widget.AppCompatTextView>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_gather_match_track"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/pickerview_topbar_title_textsize"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:padding="@dimen/default_widget_padding"
|
||||
android:background="@drawable/selector_red_bg"
|
||||
app:layout_constraintRight_toLeftOf="@id/tv_gather_start_navi"
|
||||
app:layout_constraintBaseline_toBaselineOf="@id/btn_delete"
|
||||
android:layout_marginEnd="18dp"
|
||||
android:visibility="gone"
|
||||
android:text="匹配轨迹照片"></androidx.appcompat.widget.AppCompatTextView>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_layout"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@ -335,6 +335,33 @@
|
||||
android:textSize="18sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#F1F0F0" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_clear_cache"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="清除缓存"
|
||||
android:layout_centerVertical="true"
|
||||
style="@style/main_text_style" />
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@drawable/ic_baseline_navigate"
|
||||
android:textSize="18sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user