feat: 完成12月份4个需求开发

This commit is contained in:
xiaoyan 2023-11-29 13:47:47 +08:00
parent aaaef022ea
commit cbcaf38b65
29 changed files with 1602 additions and 114 deletions

View File

@ -173,9 +173,9 @@
<activity
android:name=".activity.AutoTakePicture4PoiActivity"
android:screenOrientation="landscape" />
<activity
android:name=".activity.AutoTakePicture4PoiVideoActivity"
android:screenOrientation="landscape" />
<!-- <activity-->
<!-- android:name=".activity.AutoTakePicture4PoiVideoActivity"-->
<!-- android:screenOrientation="landscape" />-->
<activity
android:name=".activity.UserActivity"
android:configChanges="keyboardHidden|orientation"

View File

@ -604,7 +604,7 @@ public class AutoTakePicture4PoiActivity extends BaseActivity implements View.On
PoiEntity poiEntity = poiDao.getTaskIdPoiEntity(roadMatchEntity.getId());
if (poiEntity == null) {
// 数据库中不存在尝试再次领取
InsertAndUpdateUtils.getInstance().insertOrUpdate(AutoTakePicture4PoiActivity.this, translateRoadMatchEntity(roadMatchEntity));
InsertAndUpdateUtils.getInstance().insertOrUpdate(AutoTakePicture4PoiActivity.this, roadMatchEntity.getDataDetail());
// 调用网络领取任务
receiverRoadTask(roadMatchEntity).subscribe(receiveObserver);
}
@ -671,19 +671,62 @@ public class AutoTakePicture4PoiActivity extends BaseActivity implements View.On
* 根据网络数据和本地数据库数据更新地图上渲染的道路任务
* */
private void initRoadLine2Map() {
roadLinkEntityList.clear();
if (Constant.USHERED != null) {
// 刷新筛选的本地数据
tencentMarkerUtils.initLocalMarker(AutoTakePicture4PoiActivity.this, tencentMap, removablesLocality, removableHashMap, new TencentMarkerUtils.MarkerInitCallback<PoiEntity>() {
@Override
public void onMarkerInit(Map<String, List<Marker>> removableHashMap, List<Integer> uploadByNet, List<PoiEntity> listData) {
// 将已领取的任务数据添加到可匹配列表中
if (listData!=null&&listData.size()>0) {
for (PoiEntity poiEntity: listData) {
// 过滤POI录像类型数据且状态为已领取
if (poiEntity.getType() == 3 && poiEntity.getTaskStatus() == 1) {
String geometryStr = Geohash.getInstance().decode(poiEntity.getGeoWkt());
Geometry geometry = GeometryTools.createGeometry(geometryStr);
// 实时设置当前任务的起始角度
if (geometry instanceof LineString) {
RoadMatchEntity roadMatchEntity = new RoadMatchEntity();
roadMatchEntity.setId(poiEntity.getTaskId());
roadMatchEntity.setDataDetail(poiEntity);
roadMatchEntity.setGeometry((LineString) geometry);
// roadMatchEntity.setBuffer(geometry.buffer(MATCH_BUFFER_DISTANCE).toString());
LineString lineString = (LineString) geometry;
// 计算前两个点的坐标角度
// 获取当前数据的前两个点的方向
Coordinate[] coordinates = lineString.getCoordinates();
// 循环取出当前数据的坐标点为防止出现重复点需要循环做判断
Coordinate[] lineCoordinates = new Coordinate[2];
lineCoordinates[0] = coordinates[0];
lineCoordinates[1] = coordinates[0];
for (Coordinate c: coordinates) {
if (c.x!=lineCoordinates[0].x&&c.y!=lineCoordinates[0].y) {
lineCoordinates[1] = c;
break;
}
}
if (lineCoordinates[0]!=lineCoordinates[1]) {
double dataBearing = getBearing(lineCoordinates[0].x, lineCoordinates[1].x, lineCoordinates[0].y, lineCoordinates[1].y);
roadMatchEntity.setAngle(dataBearing);
}
roadMatchEntity.setsPoint(lineString.getStartPoint().toString());
roadMatchEntity.setePoint(lineString.getEndPoint().toString());
roadLinkEntityList.add(roadMatchEntity);
} else {
com.github.lazylibrary.util.ToastUtils.showToast(AutoTakePicture4PoiActivity.this, "当前界面存在多线任务,已自动过滤!");
systemTTS.playText("存在多线任务!");
XLog.e("存在多线任务:"+poiEntity.getTaskId()+"-"+poiEntity.getName());
}
}
}
}
}
});
}
if (LocationLifeCycle.getInstance().getMainLocation() != null) { //筛选从服务器获取到的数据
// 注意此处只获取道路数据
tencentMarkerUtils.initNetMarkerList(AutoTakePicture4PoiActivity.this, LocationLifeCycle.getInstance().getTencentLocation(), tencentMap, removables,
"3"/*只获取道路数据*/,"0"/*只获取未领取的数据*/, removableHashMap, 30, new TencentMarkerUtils.MarkerInitCallback<JobSearchBean.BodyBean.ListBean>() {
"3"/*只获取POI数据*/,"0"/*只获取未领取的数据*/, removableHashMap, 30, new TencentMarkerUtils.MarkerInitCallback<JobSearchBean.BodyBean.ListBean>() {
@Override
public void onMarkerInit(Map<String, List<Marker>> removableHashMap, List<Integer> uploadByNet,
@ -693,13 +736,17 @@ public class AutoTakePicture4PoiActivity extends BaseActivity implements View.On
if (listData!=null) {
listData.stream().forEach(
it -> {
// 如果是半透明显示的未发布任务直接跳过此次循环
if (it.getPublish() == 0) {
return;
}
String geometryStr = Geohash.getInstance().decode(it.getGeo());
Geometry geometry = GeometryTools.createGeometry(geometryStr);
// 实时设置当前任务的起始角度
if (geometry instanceof LineString) {
RoadMatchEntity roadMatchEntity = new RoadMatchEntity();
roadMatchEntity.setId(it.getId());
roadMatchEntity.setDataDetail(it);
roadMatchEntity.setDataDetail(translateRoadMatchEntity(it));
roadMatchEntity.setGeometry((LineString) geometry);
// roadMatchEntity.setBuffer(geometry.buffer(MATCH_BUFFER_DISTANCE).toString());
LineString lineString = (LineString) geometry;
@ -803,7 +850,7 @@ public class AutoTakePicture4PoiActivity extends BaseActivity implements View.On
return true;
} else {
// 根据方向判定无法匹配
logger.d(null, "方向不匹配:", "currentBearing:"+currentBearing+",数据角度:"+dataBearing+",数据id:"+it.getDataDetail().getId());
logger.d(null, "方向不匹配:", "currentBearing:"+currentBearing+",数据角度:"+dataBearing+",数据id:"+it.getDataDetail().getTaskId());
return false;
}
} else {
@ -1014,11 +1061,9 @@ public class AutoTakePicture4PoiActivity extends BaseActivity implements View.On
})
.min((t1, t2) -> {
// 判断距离用户当前位置的距离
JobSearchBean.BodyBean.ListBean bean1 = t1.getDataDetail();
JobSearchBean.BodyBean.ListBean bean2 = t2.getDataDetail();
// 转换geo
Geometry geometry1 = GeometryTools.createGeometry(Geohash.getInstance().decode(bean1.getGeo()));
Geometry geometry2 = GeometryTools.createGeometry(Geohash.getInstance().decode(bean2.getGeo()));
Geometry geometry1 = GeometryTools.createGeometry(Geohash.getInstance().decode(t1.getDataDetail().getGeoWkt()));
Geometry geometry2 = GeometryTools.createGeometry(Geohash.getInstance().decode(t1.getDataDetail().getGeoWkt()));
if (currentGeometry.distance(geometry1)>currentGeometry.distance(geometry2)) {
return 1;
} else if (currentGeometry.distance(geometry1)<currentGeometry.distance(geometry2)) {
@ -1036,9 +1081,8 @@ public class AutoTakePicture4PoiActivity extends BaseActivity implements View.On
.subscribe(new Consumer<RoadMatchEntity>() {
@Override
public void accept(RoadMatchEntity minRoadLink) throws Exception {
JobSearchBean.BodyBean.ListBean bean = minRoadLink.getDataDetail();
Coordinate endPoint = GeometryTools.createGeometry(Geohash.getInstance().decode(bean.getGeo())).getCoordinates()[0];
ToastUtils.Message(AutoTakePicture4PoiActivity.this, "已为您规划距离最近的任务路径:"+bean.getName());
Coordinate endPoint = GeometryTools.createGeometry(Geohash.getInstance().decode(minRoadLink.getDataDetail().getGeoWkt())).getCoordinates()[0];
ToastUtils.Message(AutoTakePicture4PoiActivity.this, "已为您规划距离最近的任务路径:"+minRoadLink.getDataDetail().getName());
// 跳转到对应的导航界面
try {
if (Constant.currentNaviType == null) {
@ -1217,13 +1261,13 @@ public class AutoTakePicture4PoiActivity extends BaseActivity implements View.On
@Override
public PoiEntity apply(RoadMatchEntity roadMatchEntity) throws Exception {
PoiEntity poiEntity = translateRoadMatchEntity(roadMatchEntity);
PoiEntity poiEntity = roadMatchEntity.getDataDetail();
// 首先发送领取任务的请求
OkGoBuilder okGoBuilder = OkGoBuilder
.getInstance()
.time(30)
.Builder(AutoTakePicture4PoiActivity.this)
.url(HttpInterface.RECEIVED_POI_VIDEO_TASK + "/" + entity.getDataDetail().getId())
.url(HttpInterface.RECEIVED_POI_VIDEO_TASK + "/" + entity.getDataDetail().getTaskId())
.cls(TaskByNetBean.class)
.params(new HttpParams())
.token(Constant.ACCESS_TOKEN);
@ -1345,9 +1389,8 @@ public class AutoTakePicture4PoiActivity extends BaseActivity implements View.On
});
}
private PoiEntity translateRoadMatchEntity(RoadMatchEntity roadMatchEntity) {
private PoiEntity translateRoadMatchEntity(JobSearchBean.BodyBean.ListBean listBean) {
PoiEntity poiListEntity = new PoiEntity();
JobSearchBean.BodyBean.ListBean listBean = roadMatchEntity.getDataDetail();
poiListEntity.setTaskId(listBean.getId());
poiListEntity.setGeoWkt(listBean.getGeo());
poiListEntity.setName(listBean.getName());

View File

@ -147,7 +147,7 @@ import okhttp3.Response;
/**
* 拍照
* poi录像 道路
* poi录像 道路,暂时弃用
*/
@RequiresApi(api = Build.VERSION_CODES.N)
public class AutoTakePicture4PoiVideoActivity extends BaseActivity implements View.OnClickListener {
@ -609,11 +609,15 @@ public class AutoTakePicture4PoiVideoActivity extends BaseActivity implements Vi
if (listData!=null) {
listData.stream().forEach(
it -> {
// 如果是半透明显示的未发布任务直接跳过此次循环
if (it.getPublish() == 0) {
return;
}
String geometryStr = Geohash.getInstance().decode(it.getGeo());
Geometry geometry = GeometryTools.createGeometry(geometryStr);
RoadMatchEntity roadMatchEntity = new RoadMatchEntity();
roadMatchEntity.setId(it.getId());
roadMatchEntity.setDataDetail(it);
roadMatchEntity.setDataDetail(translateRoadMatchEntity(it));
roadMatchEntity.setGeometry((LineString) geometry);
// roadMatchEntity.setBuffer(geometry.buffer(MATCH_BUFFER_DISTANCE).toString());
// 实时设置当前任务的起始角度
@ -715,7 +719,7 @@ public class AutoTakePicture4PoiVideoActivity extends BaseActivity implements Vi
return true;
} else {
// 根据方向判定无法匹配
write2Log("方向不匹配:", "currentBearing:"+currentBearing+",数据角度:"+dataBearing+",数据id:"+it.getDataDetail().getId());
write2Log("方向不匹配:", "currentBearing:"+currentBearing+",数据角度:"+dataBearing+",数据id:"+it.getDataDetail().getTaskId());
return false;
}
} else {
@ -916,11 +920,9 @@ public class AutoTakePicture4PoiVideoActivity extends BaseActivity implements Vi
})
.min((t1, t2) -> {
// 判断距离用户当前位置的距离
JobSearchBean.BodyBean.ListBean bean1 = t1.getDataDetail();
JobSearchBean.BodyBean.ListBean bean2 = t2.getDataDetail();
// 转换geo
Geometry geometry1 = GeometryTools.createGeometry(Geohash.getInstance().decode(bean1.getGeo()));
Geometry geometry2 = GeometryTools.createGeometry(Geohash.getInstance().decode(bean2.getGeo()));
Geometry geometry1 = GeometryTools.createGeometry(Geohash.getInstance().decode(t1.getDataDetail().getGeoWkt()));
Geometry geometry2 = GeometryTools.createGeometry(Geohash.getInstance().decode(t2.getDataDetail().getGeoWkt()));
if (currentGeometry.distance(geometry1)>currentGeometry.distance(geometry2)) {
return 1;
} else if (currentGeometry.distance(geometry1)<currentGeometry.distance(geometry2)) {
@ -938,9 +940,8 @@ public class AutoTakePicture4PoiVideoActivity extends BaseActivity implements Vi
.subscribe(new Consumer<RoadMatchEntity>() {
@Override
public void accept(RoadMatchEntity minRoadLink) throws Exception {
JobSearchBean.BodyBean.ListBean bean = minRoadLink.getDataDetail();
Coordinate endPoint = GeometryTools.createGeometry(Geohash.getInstance().decode(bean.getGeo())).getCoordinates()[0];
ToastUtils.Message(AutoTakePicture4PoiVideoActivity.this, "已为您规划距离最近的任务路径:"+bean.getName());
Coordinate endPoint = GeometryTools.createGeometry(Geohash.getInstance().decode(minRoadLink.getDataDetail().getGeoWkt())).getCoordinates()[0];
ToastUtils.Message(AutoTakePicture4PoiVideoActivity.this, "已为您规划距离最近的任务路径:"+minRoadLink.getDataDetail().getName());
// 跳转到对应的导航界面
try {
if (Constant.currentNaviType == null) {
@ -1119,13 +1120,13 @@ public class AutoTakePicture4PoiVideoActivity extends BaseActivity implements Vi
@Override
public PoiEntity apply(RoadMatchEntity roadMatchEntity) throws Exception {
PoiEntity poiEntity = translateRoadMatchEntity(roadMatchEntity);
PoiEntity poiEntity = roadMatchEntity.getDataDetail();
// 首先发送领取任务的请求
OkGoBuilder okGoBuilder = OkGoBuilder
.getInstance()
.time(30)
.Builder(AutoTakePicture4PoiVideoActivity.this)
.url(HttpInterface.RECEIVED_POI_VIDEO_TASK + "/" + entity.getDataDetail().getId())
.url(HttpInterface.RECEIVED_POI_VIDEO_TASK + "/" + entity.getDataDetail().getTaskId())
.cls(TaskByNetBean.class)
.params(new HttpParams())
.token(Constant.ACCESS_TOKEN);
@ -1247,9 +1248,8 @@ public class AutoTakePicture4PoiVideoActivity extends BaseActivity implements Vi
});
}
private PoiEntity translateRoadMatchEntity(RoadMatchEntity roadMatchEntity) {
private PoiEntity translateRoadMatchEntity(JobSearchBean.BodyBean.ListBean listBean) {
PoiEntity poiListEntity = new PoiEntity();
JobSearchBean.BodyBean.ListBean listBean = roadMatchEntity.getDataDetail();
poiListEntity.setTaskId(listBean.getId());
poiListEntity.setGeoWkt(listBean.getGeo());
poiListEntity.setName(listBean.getName());
@ -1286,7 +1286,7 @@ public class AutoTakePicture4PoiVideoActivity extends BaseActivity implements Vi
PoiEntity poiEntity = poiDao.getTaskIdPoiEntity(roadMatchEntity.getId());
if (poiEntity == null) {
// 数据库中不存在尝试再次领取
InsertAndUpdateUtils.getInstance().insertOrUpdate(AutoTakePicture4PoiVideoActivity.this, translateRoadMatchEntity(roadMatchEntity));
InsertAndUpdateUtils.getInstance().insertOrUpdate(AutoTakePicture4PoiVideoActivity.this, roadMatchEntity.getDataDetail());
// 调用网络领取任务
receiverRoadTask(roadMatchEntity).subscribe(receiveObserver);
}

View File

@ -656,7 +656,7 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
PoiEntity poiEntity = poiDao.getTaskIdPoiEntity(roadMatchEntity.getId());
if (poiEntity == null) {
// 数据库中不存在尝试再次领取
InsertAndUpdateUtils.getInstance().insertOrUpdate(AutoTakePictureActivity.this, translateRoadMatchEntity(roadMatchEntity));
InsertAndUpdateUtils.getInstance().insertOrUpdate(AutoTakePictureActivity.this, roadMatchEntity.getDataDetail());
// 调用网络领取任务
receiverRoadTask(roadMatchEntity).subscribe(receiveObserver);
}
@ -723,12 +723,55 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
* 根据网络数据和本地数据库数据更新地图上渲染的道路任务
* */
private void initRoadLine2Map() {
roadLinkEntityList.clear();
if (Constant.USHERED != null) {
// 刷新筛选的本地数据
tencentMarkerUtils.initLocalMarker(AutoTakePictureActivity.this, tencentMap, removablesLocality, removableHashMap, new TencentMarkerUtils.MarkerInitCallback<PoiEntity>() {
@Override
public void onMarkerInit(Map<String, List<Marker>> removableHashMap, List<Integer> uploadByNet, List<PoiEntity> listData) {
// 将已领取的任务数据添加到可匹配列表中
if (listData!=null&&listData.size()>0) {
for (PoiEntity poiEntity: listData) {
// 过滤道路类型数据且状态为已领取
if (poiEntity.getType() == 4 && poiEntity.getTaskStatus() == 1) {
String geometryStr = Geohash.getInstance().decode(poiEntity.getGeoWkt());
Geometry geometry = GeometryTools.createGeometry(geometryStr);
// 实时设置当前任务的起始角度
if (geometry instanceof LineString) {
RoadMatchEntity roadMatchEntity = new RoadMatchEntity();
roadMatchEntity.setId(poiEntity.getTaskId());
roadMatchEntity.setDataDetail(poiEntity);
roadMatchEntity.setGeometry((LineString) geometry);
// roadMatchEntity.setBuffer(geometry.buffer(MATCH_BUFFER_DISTANCE).toString());
LineString lineString = (LineString) geometry;
// 计算前两个点的坐标角度
// 获取当前数据的前两个点的方向
Coordinate[] coordinates = lineString.getCoordinates();
// 循环取出当前数据的坐标点为防止出现重复点需要循环做判断
Coordinate[] lineCoordinates = new Coordinate[2];
lineCoordinates[0] = coordinates[0];
lineCoordinates[1] = coordinates[0];
for (Coordinate c: coordinates) {
if (c.x!=lineCoordinates[0].x&&c.y!=lineCoordinates[0].y) {
lineCoordinates[1] = c;
break;
}
}
if (lineCoordinates[0]!=lineCoordinates[1]) {
double dataBearing = getBearing(lineCoordinates[0].x, lineCoordinates[1].x, lineCoordinates[0].y, lineCoordinates[1].y);
roadMatchEntity.setAngle(dataBearing);
}
roadMatchEntity.setsPoint(lineString.getStartPoint().toString());
roadMatchEntity.setePoint(lineString.getEndPoint().toString());
roadLinkEntityList.add(roadMatchEntity);
} else {
com.github.lazylibrary.util.ToastUtils.showToast(AutoTakePictureActivity.this, "当前界面存在多线任务,已自动过滤!");
systemTTS.playText("存在多线任务!");
XLog.e("存在多线任务:"+poiEntity.getTaskId()+"-"+poiEntity.getName());
}
}
}
}
}
});
}
@ -741,17 +784,20 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
public void onMarkerInit(Map<String, List<Marker>> removableHashMap, List<Integer> uploadByNet,
List<JobSearchBean.BodyBean.ListBean> listData) {
// 根据获取到的网络数据整理数据的起终点数据方便接下来自动捕捉数据
roadLinkEntityList.clear();
if (listData!=null) {
listData.stream().forEach(
it -> {
// 如果是半透明显示的未发布任务直接跳过此次循环
if (it.getPublish() == 0) {
return;
}
String geometryStr = Geohash.getInstance().decode(it.getGeo());
Geometry geometry = GeometryTools.createGeometry(geometryStr);
// 实时设置当前任务的起始角度
if (geometry instanceof LineString) {
RoadMatchEntity roadMatchEntity = new RoadMatchEntity();
roadMatchEntity.setId(it.getId());
roadMatchEntity.setDataDetail(it);
roadMatchEntity.setDataDetail(translateRoadMatchEntity(it));
roadMatchEntity.setGeometry((LineString) geometry);
// roadMatchEntity.setBuffer(geometry.buffer(MATCH_BUFFER_DISTANCE).toString());
LineString lineString = (LineString) geometry;
@ -855,7 +901,7 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
return true;
} else {
// 根据方向判定无法匹配
logger.d(null, "方向不匹配:", "currentBearing:"+currentBearing+",数据角度:"+dataBearing+",数据id:"+it.getDataDetail().getId());
logger.d(null, "方向不匹配:", "currentBearing:"+currentBearing+",数据角度:"+dataBearing+",数据id:"+it.getDataDetail().getTaskId());
return false;
}
} else {
@ -1066,11 +1112,9 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
})
.min((t1, t2) -> {
// 判断距离用户当前位置的距离
JobSearchBean.BodyBean.ListBean bean1 = t1.getDataDetail();
JobSearchBean.BodyBean.ListBean bean2 = t2.getDataDetail();
// 转换geo
Geometry geometry1 = GeometryTools.createGeometry(Geohash.getInstance().decode(bean1.getGeo()));
Geometry geometry2 = GeometryTools.createGeometry(Geohash.getInstance().decode(bean2.getGeo()));
Geometry geometry1 = GeometryTools.createGeometry(Geohash.getInstance().decode(t1.getDataDetail().getGeoWkt()));
Geometry geometry2 = GeometryTools.createGeometry(Geohash.getInstance().decode(t2.getDataDetail().getGeoWkt()));
if (currentGeometry.distance(geometry1)>currentGeometry.distance(geometry2)) {
return 1;
} else if (currentGeometry.distance(geometry1)<currentGeometry.distance(geometry2)) {
@ -1088,9 +1132,8 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
.subscribe(new Consumer<RoadMatchEntity>() {
@Override
public void accept(RoadMatchEntity minRoadLink) throws Exception {
JobSearchBean.BodyBean.ListBean bean = minRoadLink.getDataDetail();
Coordinate endPoint = GeometryTools.createGeometry(Geohash.getInstance().decode(bean.getGeo())).getCoordinates()[0];
ToastUtils.Message(AutoTakePictureActivity.this, "已为您规划距离最近的任务路径:"+bean.getName());
Coordinate endPoint = GeometryTools.createGeometry(Geohash.getInstance().decode(minRoadLink.getDataDetail().getGeoWkt())).getCoordinates()[0];
ToastUtils.Message(AutoTakePictureActivity.this, "已为您规划距离最近的任务路径:"+minRoadLink.getDataDetail().getName());
// 跳转到对应的导航界面
try {
if (Constant.currentNaviType == null) {
@ -1269,13 +1312,13 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
@Override
public PoiEntity apply(RoadMatchEntity roadMatchEntity) throws Exception {
PoiEntity poiEntity = translateRoadMatchEntity(roadMatchEntity);
PoiEntity poiEntity = roadMatchEntity.getDataDetail();
// 首先发送领取任务的请求
OkGoBuilder okGoBuilder = OkGoBuilder
.getInstance()
.time(30)
.Builder(AutoTakePictureActivity.this)
.url(HttpInterface.RECEIVED_ROAD_TASK + "/" + entity.getDataDetail().getId())
.url(HttpInterface.RECEIVED_ROAD_TASK + "/" + entity.getDataDetail().getTaskId())
.cls(TaskByNetBean.class)
.params(new HttpParams())
.token(Constant.ACCESS_TOKEN);
@ -1397,9 +1440,8 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
});
}
private PoiEntity translateRoadMatchEntity(RoadMatchEntity roadMatchEntity) {
private PoiEntity translateRoadMatchEntity(JobSearchBean.BodyBean.ListBean listBean) {
PoiEntity poiListEntity = new PoiEntity();
JobSearchBean.BodyBean.ListBean listBean = roadMatchEntity.getDataDetail();
poiListEntity.setTaskId(listBean.getId());
poiListEntity.setGeoWkt(listBean.getGeo());
poiListEntity.setName(listBean.getName());

View File

@ -0,0 +1,241 @@
package com.navinfo.outdoor.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.PoiEntityDeleteUtil;
import org.greenrobot.eventbus.EventBus;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
public class HasReceiveAdapter extends RecyclerView.Adapter<HasReceiveAdapter.ViewHolder> {
private final Vector<PoiEntity> allRoad = new Vector<>();
private Context context;
public HasReceiveAdapter(Context context) {
this.context = context;
}
public List<PoiEntity> getAllRoad() {
return allRoad;
}
public List<PoiEntity> getCheckedPoiEntity() {
List<PoiEntity> poiEntityList = new ArrayList<>();
if (allRoad!=null&&!allRoad.isEmpty()) {
for (PoiEntity poiEntity: allRoad) {
if (poiEntity.isChecked()) {
poiEntityList.add(poiEntity);
}
}
}
return poiEntityList;
}
public void setAllRoad(List<PoiEntity> allRoad) {
this.allRoad.clear();
this.allRoad.addAll(allRoad);
notifyDataSetChanged();
}
public void setUpdateWork() {
new Thread(new Runnable() {
@Override
public void run() {
synchronized (allRoad) {
for (PoiEntity poiEntity : allRoad) {
if (poiEntity.isChecked()) {
poiEntity.setWork_type(1);
poiEntity.setChecked(true);
} else {
poiEntity.setWork_type(0);
poiEntity.setChecked(false);
}
PoiDatabase.getInstance(context).getPoiDao().updatePoiEntity(poiEntity);
}
handler.sendEmptyMessage(0x105);
}
}
}).start();
}
/**
* 设置所有的勾选数据的当前状态
* */
public void setAllWorkType(int workType) {
new Thread(new Runnable() {
@Override
public void run() {
synchronized (allRoad) {
for (PoiEntity poiEntity : allRoad) {
if (poiEntity.isChecked()) {
poiEntity.setWork_type(workType);
}
PoiDatabase.getInstance(context).getPoiDao().updatePoiEntity(poiEntity);
}
handler.sendEmptyMessage(0x105);
}
}
}).start();
}
//全选
public void setAllDataChecked(boolean isChecked) {
for (PoiEntity entity : this.allRoad) {
entity.setChecked(isChecked);
}
}
//条目删除
public void setAllCheckedDelete() {
new Thread(new Runnable() {
@Override
public void run() {
synchronized (allRoad) {
Iterator<PoiEntity> iterator = allRoad.iterator();
while (iterator.hasNext()) {
PoiEntity poiEntity = (PoiEntity) iterator.next();
if (poiEntity.isChecked()) {
PoiEntityDeleteUtil.getInstance().deleteUtil(context, poiEntity);
PoiDatabase.getInstance(context).getPoiDao().deletePoiEntity(poiEntity);
iterator.remove();
}
}
handler.sendEmptyMessage(0x105);
}
Message obtain = Message.obtain();
obtain.what = Constant.STAY_SUBMIT_ITEM;
obtain.obj = true;
EventBus.getDefault().post(obtain);
}
}).start();
}
@NotNull
@Override
public ViewHolder onCreateViewHolder(@NotNull ViewGroup parent, int viewType) {
View inflate = LayoutInflater.from(context).inflate(R.layout.has_receive_item, parent, false);
return new ViewHolder(inflate);
}
@Override
public void onBindViewHolder(@NotNull ViewHolder holder, @SuppressLint("RecyclerView") int position) {
PoiEntity poiEntity = allRoad.get(position);
holder.tvName.setText(poiEntity.getName());
holder.tvDay.setText(poiEntity.getCreateTime());
//获取checkBox点击的记录
holder.cbUnSubmit.setChecked(allRoad.get(position).isChecked());
holder.cbUnSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
holder.cbUnSubmit.setChecked(!poiEntity.isChecked());
poiEntity.setChecked(!poiEntity.isChecked());
}
});
if (poiEntity.getWork_type() == 0) {
holder.tvText.setText("待提交");
} else if (poiEntity.getWork_type() == 1) {
holder.tvText.setText("提交中");
// poiEntity.setChecked(true);
} else if (poiEntity.getWork_type() == 2) {
holder.tvText.setText("完成");
} else if (poiEntity.getWork_type() == -1) {
holder.tvText.setText("出错");
}
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onClickItem != null) {
onClickItem.item(position, poiEntity);
}
}
});
// 显示进度
if (poiEntity.getWork_type()!=0&&poiEntity.getUploadMax()>0&&poiEntity.getUploadProgress()!=poiEntity.getUploadMax()) {
holder.layerProgress.setVisibility(View.VISIBLE);
holder.pbUpload.setMax(poiEntity.getUploadMax());
holder.pbUpload.setProgress(poiEntity.getUploadProgress());
holder.tvUploadProgress.setText(poiEntity.getUploadProgress()+"/"+poiEntity.getUploadMax());
} else {
holder.layerProgress.setVisibility(View.INVISIBLE);
}
// 显示上传状态
if (poiEntity.getUploadResult()!=null&&!poiEntity.getUploadResult().trim().equals("")) {
holder.tvUploadResult.setVisibility(View.VISIBLE);
holder.tvUploadResult.setText(poiEntity.getUploadResult());
holder.layerProgress.setVisibility(View.GONE); // 上传结果存在不需要显示进度条
} else {
holder.tvUploadResult.setVisibility(View.INVISIBLE);
}
}
@Override
public int getItemCount() {
return allRoad.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
private TextView tvName, tvText, tvDay;
private CheckBox cbUnSubmit;
private ProgressBar pbUpload;
private TextView tvUploadProgress, tvUploadResult;
private View layerProgress;
public ViewHolder(@NonNull View itemView) {
super(itemView);
tvName = itemView.findViewById(R.id.tv_road_name);
tvText = itemView.findViewById(R.id.tv_text);
tvDay = itemView.findViewById(R.id.tv_road_day);
cbUnSubmit = itemView.findViewById(R.id.cb_unSubmit);
pbUpload = itemView.findViewById(R.id.pb_stay_upload);
tvUploadProgress = itemView.findViewById(R.id.tv_pb_stay_upload);
layerProgress = itemView.findViewById(R.id.layer_pb);
tvUploadResult = itemView.findViewById(R.id.tv_upload_result);
}
}
Handler handler = new Handler() {
@SuppressLint("HandlerLeak")
@Override
public void handleMessage(@NonNull @NotNull Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 0x105:
notifyDataSetChanged();
break;
}
}
};
public onClickItem onClickItem;
public void setOnClickItem(onClickItem onClickItem) {
this.onClickItem = onClickItem;
}
public interface onClickItem {
void item(int position, PoiEntity allRoad);
}
}

View File

@ -158,6 +158,9 @@ public class Constant {
public static final int EVENT_WHAT_FINISH_DRAW_LINE=64;// 完成绘制参考线
public static final int SWITCH_RECORFER_ITEM=65;//记录界面请求数据提醒
public static final int EVENT_WHAT_NOTIFYCATION_RECOMMAND_TASK=66;//记录界面请求数据提醒
public static final int HAS_RECEIVE_ITEM = 67;//记录tab下的已领取子tab
public static final int EVENT_WHAT_HAS_RECEIVE_ITEM = 68;//用户点击了已领取的item数据打开半页弹出界面
public static final String INTENT_POI_VIDEO_TYPE = "poi_video_type";
public static int NUMBER = 200; //任务个数
public static int LIMIT_TYPE = -1; //权限类型普通任务-0专属任务-1

View File

@ -115,6 +115,8 @@ public class JobSearchBean implements Serializable {
private String memo;
private String telephone;
private int publish; // 是否已发布如果是未发布的数据则用半透明形式展示
public int getCanReceived() {
return canReceived;
}
@ -210,6 +212,14 @@ public class JobSearchBean implements Serializable {
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public int getPublish() {
return publish;
}
public void setPublish(int publish) {
this.publish = publish;
}
}
}
}

View File

@ -0,0 +1,24 @@
package com.navinfo.outdoor.bean;
import java.util.Map;
public class LatestPushMessageResponse extends CommonResponseBase{
public LatestPushMessageResponse(int code, String message, Map<String, String> body) {
this.code = code;
this.message = message;
this.body = body;
}
public LatestPushMessageResponse() {
}
protected Map<String, String> body;
public Map<String, String> getBody() {
return body;
}
public void setBody(Map<String, String> body) {
this.body = body;
}
}

View File

@ -52,6 +52,8 @@ public class PolygonTaskBean {
private String name;
private int isExclusive;
private String unReceivedTime; // 任务领取后自动释放的时间
public int getId() {
return id;
}
@ -91,5 +93,17 @@ public class PolygonTaskBean {
public void setIsExclusive(int isExclusive) {
this.isExclusive = isExclusive;
}
public String getUnReceivedTime() {
return unReceivedTime;
}
public void setUnReceivedTime(String unReceivedTime) {
this.unReceivedTime = unReceivedTime;
}
public BodyBean(String unReceivedTime) {
this.unReceivedTime = unReceivedTime;
}
}
}

View File

@ -43,7 +43,17 @@ public class ReceivedBean {
private String name;
private Integer isExclusive;
private String memo;
public String getUnReceivedTime() {
return unReceivedTime;
}
public void setUnReceivedTime(String unReceivedTime) {
this.unReceivedTime = unReceivedTime;
}
private String endDate;
private String unReceivedTime;
public String getMemo() {
return memo;

View File

@ -58,6 +58,8 @@ public class ReceivedPoiBean {
private String endDate;
private String telephone;
private String unReceivedTime;
public String getTelephone() {
return telephone;
}
@ -129,5 +131,13 @@ public class ReceivedPoiBean {
public void setIsExclusive(int isExclusive) {
this.isExclusive = isExclusive;
}
public String getUnReceivedTime() {
return unReceivedTime;
}
public void setUnReceivedTime(String unReceivedTime) {
this.unReceivedTime = unReceivedTime;
}
}
}

View File

@ -3,6 +3,7 @@ package com.navinfo.outdoor.bean;
import androidx.room.ColumnInfo;
import com.navinfo.outdoor.activity.MyCoordinate;
import com.navinfo.outdoor.room.PoiEntity;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import org.locationtech.jts.geom.Coordinate;
@ -21,7 +22,7 @@ import java.util.List;
* */
public class RoadMatchEntity implements Serializable {
private int id; // 唯一id
private JobSearchBean.BodyBean.ListBean dataDetail; // 具体的内容信息
private PoiEntity dataDetail; // 具体的内容信息
private double angle=0; // 起点匹配方向
private double length=0; //geometry的长度
private String geometry; // 数据的geometry此处应该为lineString
@ -46,12 +47,12 @@ public class RoadMatchEntity implements Serializable {
this.id = id;
}
public JobSearchBean.BodyBean.ListBean getDataDetail() {
public PoiEntity getDataDetail() {
return dataDetail;
}
public void setDataDetail(JobSearchBean.BodyBean.ListBean dataDetail) {
this.dataDetail = dataDetail;
public void setDataDetail(PoiEntity poiEntity) {
this.dataDetail = poiEntity;
}
public double getAngle() {

View File

@ -56,6 +56,15 @@ public class TaskByNetBean {
private int isExclusive;
private String memo;
private String endDate;
private String unReceivedTime;
public String getUnReceivedTime() {
return unReceivedTime;
}
public void setUnReceivedTime(String unReceivedTime) {
this.unReceivedTime = unReceivedTime;
}
public String getMemo() {
return memo;

View File

@ -328,7 +328,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
EventBus.getDefault().post(obtains);
break;
case R.id.btn_cancel_get://结束领取
gatherGetBuilder.append(TimestampUtil.time()).append(",").append("点击了结束领取的按钮 ,");
gatherGetBuilder.append(TimestampUtil.time()).append(",").append("点击了取消领取的按钮 ,");
if (poiEntity != null) {
initEndReceiveTask(HttpInterface.UNRECEIVED_POLYGON_TASK, poiEntity);
}
@ -457,10 +457,13 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (taskIdPoiEntity == null) {
PoiEntity chargingStationEntity = new PoiEntity();
chargingStationEntity.setTaskId(poiEntity.getTaskId());
chargingStationEntity.setRecord_way(poiEntity.getRecord_way());
chargingStationEntity.setWork_type(poiEntity.getWork_type());
chargingStationEntity.setStation_type(stationBean.getSptype());
chargingStationEntity.setName(stationBean.getName());
chargingStationEntity.setDescribe(stationBean.getMemo());
chargingStationEntity.setCreateTime(stationBean.getEndDate());
chargingStationEntity.setUnReceivedTime(stationBean.getUnReceivedTime());
chargingStationEntity.setPrecision(stationBean.getPrice() + "");
chargingStationEntity.setAddress(stationBean.getAddress());
if (stationBean.getTelephone() == null || stationBean.getTelephone().equals("") || stationBean.getTelephone().equals("null")) {
@ -497,6 +500,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
@Override
public void run() {
initViewByTaskStatus(1);
ToastUtils.showToast(requireContext(), "领取成功");
if (isSaver) {
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET_MAP;
@ -599,11 +603,14 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (response.getCode() == 200) {// 0.未领取 1.已领取2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功)4已上传结束采集,
PolygonTaskBean.BodyBean listBean = response.getBody();
PoiEntity polygonEntity = new PoiEntity();
polygonEntity.setRecord_way(poiEntity.getRecord_way());
polygonEntity.setWork_type(poiEntity.getWork_type());
if (listBean != null) {
polygonEntity.setTaskId(listBean.getId());
polygonEntity.setName(listBean.getName());
polygonEntity.setType(listBean.getType());
polygonEntity.setGeoWkt(listBean.getGeo());
polygonEntity.setUnReceivedTime(listBean.getUnReceivedTime());
String encodeStr = listBean.getGeo();
String geo = Geohash.getInstance().decode(encodeStr);
// 生成对应的x和y poiEntity.setX
@ -696,6 +703,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
@Override
public void run() {
Log.d("TAG", "run: " + response.getMessage());
ToastUtils.showToast(requireContext(), "已取消领取:" + poiEntity.getName());
initViewByTaskStatus(0);
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
@ -907,9 +915,12 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setName(listBean.getName());
poiListEntity.setDescribe(listBean.getMemo());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setUnReceivedTime(listBean.getUnReceivedTime());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setType(listBean.getType());
poiListEntity.setIsExclusive(listBean.getIsExclusive());
poiListEntity.setRecord_way(poiEntity.getRecord_way());
poiListEntity.setWork_type(poiEntity.getWork_type());
if (listBean.getType() == 1) {
if (listBean.getTelephone() == null || listBean.getTelephone().equals("") || listBean.getTelephone().equals("null")) {
poiListEntity.setTelPhone(null);
@ -931,6 +942,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
@Override
public void run() {
initViewByTaskStatus(1);//已领取
ToastUtils.showToast(requireContext(), "领取成功");
if (isSaver) {
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET_MAP;
@ -1026,9 +1038,12 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (taskIdPoiEntity == null) {//数据库没有这条数据
PoiEntity poiListEntity = new PoiEntity();
poiListEntity.setTaskId(poiEntity.getTaskId());
poiListEntity.setRecord_way(poiEntity.getRecord_way());
poiListEntity.setWork_type(poiEntity.getWork_type());
poiListEntity.setName(listBean.getName());
poiListEntity.setMemo(listBean.getMemo());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setUnReceivedTime(listBean.getUnReceivedTime());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setType(listBean.getType());
poiListEntity.setPrecision(String.valueOf(listBean.getPrice()));
@ -1047,6 +1062,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
@Override
public void run() {
initViewByTaskStatus(1);
ToastUtils.showToast(requireContext(), "领取成功");
if (isSaver) {
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET_MAP;

View File

@ -0,0 +1,553 @@
package com.navinfo.outdoor.fragment;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Message;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.elvishew.xlog.Logger;
import com.elvishew.xlog.XLog;
import com.github.lazylibrary.util.FileUtils;
import com.github.lazylibrary.util.MD5;
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.interfaces.OnMenuItemClickListener;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.BottomMenu;
import com.kongzue.dialog.v3.MessageDialog;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.adapter.HasReceiveAdapter;
import com.navinfo.outdoor.adapter.StaySubmitAdapter;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseFragment;
import com.navinfo.outdoor.bean.CommonRequestSend;
import com.navinfo.outdoor.bean.CommonResponse;
import com.navinfo.outdoor.bean.UnPolygonTaskBean;
import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.FlushTokenUtil;
import com.navinfo.outdoor.util.LocationLifeCycle;
import com.navinfo.outdoor.util.PoiEntityDeleteUtil;
import com.navinfo.outdoor.util.PoiSaveUtils;
import com.navinfo.outdoor.util.TimestampUtil;
import com.navinfo.outdoor.util.ToastUtils;
import com.navinfo.outdoor.util.XLogUtils;
import com.umeng.umcrash.UMCrash;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
/**
* 记录-已领取的fragment
*/
public class HasReceiveFragment extends BaseFragment implements View.OnClickListener {
private HasReceiveAdapter hasReceiveAdapter;
private TextView tvStayType,tvNumber;
private List<PoiEntity> roadEntities;
private ArrayList<PoiEntity> poiEntities;
private CheckBox cbSelect;
private File logFile;
// private StringBuilder staySubmitBuilder;
private Logger logger;
public static HasReceiveFragment newInstance(Bundle bundle) {
HasReceiveFragment fragment = new HasReceiveFragment();
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onStart() {
super.onStart();
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this);
}
logger=XLogUtils.Companion.getInstance().getUploadLogWriter();
}
@Override
protected int getLayout() {
return R.layout.fragment_has_receive;
}
@SuppressLint("SetTextI18n")
@Override
protected void initView() {
super.initView();
ConstraintLayout clStayType = findViewById(R.id.cl_has_receive_type);
clStayType.setOnClickListener(this);
cbSelect = findViewById(R.id.cb_select);
cbSelect.setOnClickListener(this);
TextView tvDelete = findViewById(R.id.tv_delete);
tvDelete.setOnClickListener(this);
tvStayType = findViewById(R.id.tv_stay_type);
Button btnStaySubmit = findViewById(R.id.btn_stay_submit);
tvNumber = findViewById(R.id.tv_number);
btnStaySubmit.setOnClickListener(this);
Button btnStayCancel = findViewById(R.id.btn_stay_cancel);
btnStayCancel.setOnClickListener(this);
RecyclerView stayXrv = findViewById(R.id.stay_xrv);
stayXrv.setLayoutManager(new LinearLayoutManager(getActivity()));
stayXrv.addItemDecoration(new DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL));
hasReceiveAdapter = new HasReceiveAdapter(getContext());
stayXrv.setAdapter(hasReceiveAdapter);
//点击条目跳转
hasReceiveAdapter.setOnClickItem(new HasReceiveAdapter.onClickItem() {
@Override
public void item(int position, PoiEntity poiEntity) {
Message subObtain = Message.obtain();
subObtain.what = Constant.EVENT_WORK_HOME;
subObtain.obj = true;
EventBus.getDefault().post(subObtain);
Message obtain = Message.obtain();
obtain.what = Constant.EVENT_WHAT_HAS_RECEIVE_ITEM;
obtain.obj = poiEntity;
EventBus.getDefault().post(obtain);
}
});
//全选
cbSelect.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (Constant.isPresent) {
hasReceiveAdapter.setAllDataChecked(isChecked);
hasReceiveAdapter.notifyDataSetChanged();
} else {
cbSelect.setChecked(false);
ToastUtils.Message(getActivity(), "有正在提交的数据,等提交成功后,方可操作");
}
}
});
}
@Override
public void onResume() {
super.onResume();
if (LocationLifeCycle.getInstance().getMainLocation() != null) {
if (Constant.USHERED != null) {
cbSelect.setChecked(false);
refreshData();
}
}
}
@Override
protected void initData() {
super.initData();
SharedPreferences sharedPreferences = requireActivity().getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
SharedPreferences.Editor sharedEdit = sharedPreferences.edit();
@SuppressLint("SimpleDateFormat")
DateFormat formatter = new SimpleDateFormat("yyyyMMdd");
String newFormat = formatter.format(new Date(System.currentTimeMillis()));
String pictures_time = sharedPreferences.getString("pictures_time", null);
if (pictures_time == null) {
sharedEdit.putString("pictures_time", newFormat);
sharedEdit.apply();
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
} else {
if (pictures_time.equals(newFormat)) {
logFile = new File(Constant.LOG_FOLDER + "/" + pictures_time + ".txt");
} else {
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
}
}
}
@Subscribe(threadMode = ThreadMode.MAIN_ORDERED)
public void onEvent(Message data) {
if (data.what == Constant.HAS_RECEIVE_ITEM) {
if ((boolean) data.obj) {
if (Constant.USHERED != null) {
refreshData();
}
}
}
// else if (data.what == Constant.EVENT_WHAT_UPLOAD_PROGRESS) {
// if (data.obj!=null&&hasReceiveAdapter!=null&&hasReceiveAdapter.getAllRoad()!=null) {
// for (int i = 0; i < hasReceiveAdapter.getAllRoad().size(); i++) {
// if (data.obj == hasReceiveAdapter.getAllRoad().get(i)) {
// hasReceiveAdapter.notifyItemChanged(i);
// }
// }
// }
// }
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
}
@Override
public void onStop() {
super.onStop();
dismissLoadingDialog();
}
public void initRoadWord(int type) {
if (roadEntities == null) {
roadEntities = new ArrayList<>();
} else {
roadEntities.clear();
}
PoiDatabase roadDatabase = PoiDatabase.getInstance(getContext());
if (roadDatabase != null) {
PoiDao roadDao = roadDatabase.getPoiDao();
if (roadDao != null) {
new Thread(new Runnable() {
@Override
public void run() {
try {
List<PoiEntity> roadAll = null;
if (type == 0) {
roadAll = roadDao.getHasReceivePoiByRecoded();
} else {
roadAll = roadDao.getHasReceivePoiType(type);
}
if (getActivity() != null) {
List<PoiEntity> finalRoadAll = roadAll;
getActivity().runOnUiThread(new Runnable() {
@SuppressLint("SetTextI18n")
@Override
public void run() {
roadEntities.clear();
roadEntities.addAll(finalRoadAll);
hasReceiveAdapter.setAllRoad(roadEntities);
hasReceiveAdapter.notifyDataSetChanged();
if (tvNumber != null) {
tvNumber.setText(hasReceiveAdapter.getAllRoad().size() + "");
}
}
});
}
} catch (Exception e) {
UMCrash.generateCustomLog(e, "自定义");
}
}
}).start();
} else {
ToastUtils.Message(getActivity(), "无法读取数据库,请尝试重启程序!");
UMCrash.generateCustomLog("无法读取数据库", "自定义");
}
} else {
ToastUtils.Message(getActivity(), "数据库创建失败,请关闭程序重新进入");
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.cl_stay_type://1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务"
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
BottomMenu.show((AppCompatActivity) requireActivity(), new String[]{"全部", "poi", "充电站", "poi录像", "道路录像", "其他"}, new OnMenuItemClickListener() {
@SuppressLint("SetTextI18n")
@Override
public void onClick(String text, int index) {
switch (index) {
case 0:
initRoadWord(0);
break;
case 1:
initRoadWord(1);
break;
case 2:
initRoadWord(2);
break;
case 3:
initRoadWord(3);
break;
case 4:
initRoadWord(4);
break;
case 5:
initRoadWord(5);
break;
}
tvStayType.setText(text);
}
});
break;
case R.id.tv_delete:
List<PoiEntity> checkedPoiEntityList = hasReceiveAdapter.getCheckedPoiEntity();
if (checkedPoiEntityList == null || checkedPoiEntityList.isEmpty()) {
ToastUtils.Message(getActivity(), "没有勾选任何数据!");
return;
}
logger.d("用户点击批量删除按钮+++++++++++++++++++++++");
if (Constant.isPresent) {
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
MessageDialog.show((AppCompatActivity) requireActivity(), "提示", "是否删除", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@SuppressLint("SetTextI18n")
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
logger.d("用户点击确认批量删除按钮+++++++++++++++++++++++");
initRequest(hasReceiveAdapter.getCheckedPoiEntity());
return false;
}
});
} else {
ToastUtils.Message(getActivity(), "有正在提交的数据,等提交成功后,方可操作");
}
break;
case R.id.btn_stay_submit://提交
logger.d("用户点击批量上传提交按钮+++++++++++++++++++++++");
if (Constant.isPresent) {
if (poiEntities == null) {
poiEntities = new ArrayList<>();
} else {
poiEntities.clear();
}
List<PoiEntity> allRoad = hasReceiveAdapter.getAllRoad();
for (int i = 0; i < allRoad.size(); i++) {
if (allRoad.get(i).isChecked()) {
poiEntities.add(allRoad.get(i));
}
}
if (poiEntities.size() > 0) {
Constant.isPresent = false;
hasReceiveAdapter.setUpdateWork();
PoiSaveUtils.getInstance(getActivity()).uploadPoiEntityBatch(poiEntities);
} else {
ToastUtils.Message(getActivity(), "请选择要提交的数据");
}
} else {
ToastUtils.Message(getActivity(), "有正在提交的数据,等提交成功后,方可操作");
}
break;
case R.id.btn_stay_cancel:
// 用户点击取消上传
PoiSaveUtils.getInstance(requireActivity()).cancelUploadPoiEntityBatch();
// 数据上传取消后重置上传状态
hasReceiveAdapter.setAllWorkType(0);
// 设置当前没有正在上传的数据
Constant.isPresent = true;
break;
}
}
private void initRequest(List<PoiEntity> poiEntities) {
showLoadingDialog();
new Thread(new Runnable() {
@Override
public void run() {
if (getActivity() != null) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
StringBuilder taskIds = new StringBuilder();
StringBuilder auditIds = new StringBuilder();
for (int i = 0; i < poiEntities.size(); i++) {
if (poiEntities.get(i).getTaskStatus() == 2) {
taskIds.append(poiEntities.get(i).getTaskId()).append(",");
} else if (poiEntities.get(i).getTaskStatus() == 3) {
auditIds.append(poiEntities.get(i).getBodyId()).append(",");
}
}
if (!taskIds.toString().equals("")) {
taskIds = new StringBuilder(taskIds.substring(0, taskIds.length() - 1));
}
if (!auditIds.toString().equals("")) {
auditIds = new StringBuilder(auditIds.substring(0, auditIds.length() - 1));
}
HttpParams httpParams = new HttpParams();
httpParams.put("taskIds", taskIds.toString());
httpParams.put("auditIds", auditIds.toString());
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
.time(30)
.Builder(getActivity())
.url(HttpInterface.UNRECEIVED_POLYGON_TASK)
.params(httpParams)
.token(Constant.ACCESS_TOKEN)
.cls(UnPolygonTaskBean.class);
okGoBuilder.getRequest(new Callback<UnPolygonTaskBean>() {
@Override
public void onSuccess(UnPolygonTaskBean response, int id) {
dismissLoadingDialog();
if (response.getCode() == 200) {
// 启动线程删除对应的图片文件
Observable.fromIterable(poiEntities)
.subscribeOn(Schedulers.io())
.doOnNext(new Consumer<PoiEntity>() {
@Override
public void accept(PoiEntity poiEntity) throws Exception {
PoiEntityDeleteUtil.getInstance().deleteUtil(getContext(), poiEntity);
}
})
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<PoiEntity>() {
@Override
public void accept(PoiEntity poiEntity) throws Exception {
logger.d("数据被删除:"+poiEntity.getId()+"-"+poiEntity.getName()+"-"+poiEntity.getTaskId()+"-"+poiEntity.getBodyId());
}
},
new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
}
},
new Action() { // 最终结束的处理
@Override
public void run() throws Exception {
hasReceiveAdapter.setAllCheckedDelete();
}
});
} else if (response.getCode() == 230) {
FlushTokenUtil.flushToken(getActivity());
} else {
ToastUtils.Message(getActivity(), response.getMessage() );
}
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
String message = e.getMessage();
assert message != null;
if (message.equals("timeout") || message.equals("Read time out")) {
ToastUtils.Message(getActivity(), "请求超时");
} else {
ToastUtils.Message(getActivity(), message);
}
}
});
}
});
}
}
}).start();
}
public void refreshData() {
if (roadEntities == null) {
roadEntities = new ArrayList<>();
} else {
roadEntities.clear();
}
PoiDatabase roadDatabase = PoiDatabase.getInstance(getContext());
if (roadDatabase != null) {
PoiDao roadDao = roadDatabase.getPoiDao();
if (roadDao != null) {
new Thread(new Runnable() {
@Override
public void run() {
try {
List<PoiEntity> roadAll = roadDao.getHasReceivePoiByRecoded();
// 首先过滤数据中记录的领取失效时间超限的数据
Iterator iterator = roadAll.iterator();
while (iterator.hasNext()) {
PoiEntity poiEntity = (PoiEntity) iterator.next();
if (poiEntity.getUnReceivedTimeStamp()<=new Date().getTime()) {
// 删除该条数据并且将此数据移除出当前列表
roadDao.deletePoiEntity(poiEntity);
iterator.remove();
}
}
// 再次请求在线已领取数据做差分处理
HttpParams httpParams = new HttpParams();
httpParams.put("datetime", System.currentTimeMillis());
CommonRequestSend commonRequestSend = new CommonRequestSend<CommonResponse<List<Double>>>();
CommonResponse<List<Double>> response = commonRequestSend.getMethodCommonSync(requireActivity(), HttpInterface.GET_RECEIVED_LIST, httpParams, Constant.DEFAULT_TIME_OUT, new CommonResponse<List<Double>>().getClass());
if (response!=null) {
if (response.getCode() == 200) {
List<Double> ids = response.getBody();
// 使用id过滤已有的数据如果数据不在ids中需要删除该数据过滤掉
Iterator iteratorAgain = roadAll.iterator();
a:while (iteratorAgain.hasNext()) {
PoiEntity poiEntity = (PoiEntity) iteratorAgain.next();
for (double id: ids) {
if (((int)id) == poiEntity.getTaskId()) {
continue a;
}
}
// 数据库中移除该数据
roadDao.deletePoiEntity(poiEntity);
iteratorAgain.remove();
}
} else {
ToastUtils.Message(requireActivity(), response.getMessage());
}
}
if (getActivity() != null) {
getActivity().runOnUiThread(new Runnable() {
@SuppressLint("SetTextI18n")
@Override
public void run() {
roadEntities.clear();
roadEntities.addAll(roadAll);
hasReceiveAdapter.setAllRoad(roadEntities);
hasReceiveAdapter.notifyDataSetChanged();
if (tvNumber != null) {
tvNumber.setText(hasReceiveAdapter.getAllRoad().size() + "");
}
}
});
}
} catch (Exception e) {
ToastUtils.Message(requireActivity(), "初始化数据失败!");
XLog.e("获取数据失败:" + e.getMessage());
UMCrash.generateCustomLog(e, "自定义");
}
}
}).start();
} else {
ToastUtils.Message(getActivity(), "无法读取数据库,请尝试重启程序!");
UMCrash.generateCustomLog("无法读取数据库", "自定义");
}
} else {
ToastUtils.Message(getActivity(), "数据库创建失败,请关闭程序重新进入");
}
}
@Override
public void onPause() {
super.onPause();
}
@Override
public void onDestroy() {
if (EventBus.getDefault().isRegistered(this))//加上判断
EventBus.getDefault().unregister(this);
super.onDestroy();
dismissLoadingDialog();
}
}

View File

@ -30,7 +30,7 @@ import java.util.Objects;
*/
public class RecordFragment extends BaseFragment {
private final String[] names = {"待提交", "已提交"};
private final String[] names = {"已领取", "待提交", "已提交"};
private TabLayout tabRecord;
public static RecordFragment newInstance(Bundle bundle) {
@ -50,6 +50,8 @@ public class RecordFragment extends BaseFragment {
tabRecord = findViewById(R.id.tab_record);
NoSlideViewPager vpRecord = findViewById(R.id.vp_record);
ArrayList<Fragment> fragments = new ArrayList<>();
// 待作业
fragments.add(new HasReceiveFragment());
// 待提交
fragments.add(new StaySubmitFragment());
// 已提交
@ -70,15 +72,21 @@ public class RecordFragment extends BaseFragment {
tabRecord.setupWithViewPager(vpRecord);
Objects.requireNonNull(tabRecord.getTabAt(0)).setText(names[0]);
Objects.requireNonNull(tabRecord.getTabAt(1)).setText(names[1]);
Objects.requireNonNull(tabRecord.getTabAt(2)).setText(names[2]);
tabRecord.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
if (tab.getPosition()==0){
Message obtain = Message.obtain();
obtain.what = Constant.STAY_SUBMIT_ITEM;
obtain.what = Constant.HAS_RECEIVE_ITEM;
obtain.obj=true;
EventBus.getDefault().post(obtain);
}else if (tab.getPosition()==1){
Message obtain = Message.obtain();
obtain.what = Constant.STAY_SUBMIT_ITEM;
obtain.obj = true;
EventBus.getDefault().post(obtain);
}else if (tab.getPosition()==2){
Message obtain = Message.obtain();
obtain.what = Constant.HAS_SUBMIT_ITEM;
obtain.obj = true;
@ -126,8 +134,13 @@ public class RecordFragment extends BaseFragment {
@Subscribe
public void onEvent(Message data) {
if (data.what == Constant.SWITCH_RECORFER_ITEM) {
if (data.what == Constant.SWITCH_RECORFER_ITEM) { // 底部Tab切换为"记录"tab
if (tabRecord.getSelectedTabPosition() == 0) {
Message obtain = Message.obtain();
obtain.what = Constant.HAS_RECEIVE_ITEM;
obtain.obj = true;
EventBus.getDefault().post(obtain);
} else if (tabRecord.getSelectedTabPosition() == 1) {
Message obtain = Message.obtain();
obtain.what = Constant.STAY_SUBMIT_ITEM;
obtain.obj = true;

View File

@ -1,5 +1,7 @@
package com.navinfo.outdoor.fragment;
import static anet.channel.util.Utils.context;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
@ -17,6 +19,7 @@ import android.os.Message;
import android.provider.Settings;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
@ -40,20 +43,21 @@ import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.elvishew.xlog.XLog;
import com.github.lazylibrary.util.DensityUtil;
import com.github.lazylibrary.util.FileUtils;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.Permission;
import com.hjq.permissions.XXPermissions;
import com.jcodecraeer.xrecyclerview.XRecyclerView;
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.MessageDialog;
import com.kongzue.dialog.v3.ShareDialog;
import com.kongzue.dialogx.dialogs.CustomDialog;
import com.kongzue.dialogx.dialogs.PopMenu;
import com.kongzue.dialogx.interfaces.OnBindView;
import com.kongzue.dialogx.interfaces.OnIconChangeCallBack;
import com.kongzue.dialogx.interfaces.OnMenuItemClickListener;
import com.lzy.okgo.model.HttpParams;
@ -67,8 +71,10 @@ import com.navinfo.outdoor.adapter.MarkerAdapter;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment;
import com.navinfo.outdoor.base.BaseFragment;
import com.navinfo.outdoor.bean.CommonResponse;
import com.navinfo.outdoor.bean.GetPhoneBean;
import com.navinfo.outdoor.bean.JobSearchBean;
import com.navinfo.outdoor.bean.LatestPushMessageResponse;
import com.navinfo.outdoor.bean.MessageNoticeBean;
import com.navinfo.outdoor.bean.NotificationBean;
import com.navinfo.outdoor.bean.UserBean;
@ -78,7 +84,6 @@ import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.http.UploadCallBack;
import com.navinfo.outdoor.room.ChargingPileEntity;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.Base64;
import com.navinfo.outdoor.util.FlushTokenUtil;
import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools;
@ -115,6 +120,8 @@ import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
import com.tencent.tencentmap.mapsdk.maps.model.TencentMapGestureListener;
import org.json.JSONException;
import org.json.JSONObject;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.MultiPoint;
@ -133,6 +140,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.Consumer;
import java.util.function.Predicate;
@ -172,6 +182,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
private Marker gatherMarker;
private long lastClickTime = 0;
private int settingHookClickCount = 1;
private TextView tvLatestPush; // 最新的推荐任务按钮
private Handler handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(@NonNull Message msg) {
@ -244,6 +255,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
}
});
// 最新推荐任务按钮
tvLatestPush = findViewById(R.id.tv_latest_push);
//地图放大
ivZoomAdd = (ImageView) findViewById(R.id.iv_zoom_add);
ivZoomAdd.setOnClickListener(this);
@ -318,7 +331,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
imgAutoMatchRoad = findViewById(R.id.iv_auto_match_road);
// 如果当前用户的level为1或23自动采集功能才会开放
if (Constant.LEVEL == 1||Constant.LEVEL==2||Constant.LEVEL==3) {
if (Constant.LEVEL == 1 || Constant.LEVEL == 2 || Constant.LEVEL == 3) {
imgAutoMatchRoad.setVisibility(View.VISIBLE);
}
imgAutoMatchRoad.setOnClickListener(new View.OnClickListener() {
@ -334,7 +347,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.setOnIconChangeCallBack(new OnIconChangeCallBack<PopMenu>() {
@Override
public int getIcon(PopMenu dialog, int index, String menuText) {
switch (index){
switch (index) {
case 0:
return R.drawable.marker_road_show;
case 1:
@ -348,17 +361,35 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.setOnMenuItemClickListener(new OnMenuItemClickListener<PopMenu>() {
@Override
public boolean onClick(PopMenu dialog, CharSequence text, int index) {
if (index == 0) { // 自动捕捉道路任务
Intent autoMatchIntent = new Intent(getContext(), AutoTakePictureActivity.class);
startActivity(autoMatchIntent);
} else if (index == 1) {
Intent autoMatchIntent = new Intent(getContext(), AutoTakePicture4PoiActivity.class);
startActivity(autoMatchIntent);
// 检查当前的筛选条件如果不是默认筛选条件则提示用户
if (Constant.TASK_STARTUP!=-1 || Constant.TASK_TYPE!=-1) {
com.kongzue.dialogx.dialogs.MessageDialog messageDialog = com.kongzue.dialogx.dialogs.MessageDialog
.show("提示", "注意,当前筛选条件可能导致部分已领取任务无法自动捕捉,是否重置筛选条件?", "确定", "取消")
.setOkButtonClickListener(new com.kongzue.dialogx.interfaces.OnDialogButtonClickListener<com.kongzue.dialogx.dialogs.MessageDialog>() {
@Override
public boolean onClick(com.kongzue.dialogx.dialogs.MessageDialog dialog, View v) {
Constant.TASK_STARTUP = -1;
Constant.TASK_TYPE = -1;
intentToAutoTakePictureActivity(index);
dialog.dismiss();
return false;
}
})
.setCancelButtonClickListener(new com.kongzue.dialogx.interfaces.OnDialogButtonClickListener<com.kongzue.dialogx.dialogs.MessageDialog>() {
@Override
public boolean onClick(com.kongzue.dialogx.dialogs.MessageDialog dialog, View v) {
dialog.dismiss();
return false;
}
})
.show();
} else {
intentToAutoTakePictureActivity(index);
}
return false;
}
})
.show();
.show();
}
});
ivNaviDistance = findViewById(R.id.img_navi_distance);
@ -398,8 +429,21 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
/**
* 导航到最近的POIEntity
* 跳转到自动捕捉界面
* */
private void intentToAutoTakePictureActivity(int index) {
if (index == 0) { // 自动捕捉道路任务
Intent autoMatchIntent = new Intent(getContext(), AutoTakePictureActivity.class);
startActivity(autoMatchIntent);
} else if (index == 1) {
Intent autoMatchIntent = new Intent(getContext(), AutoTakePicture4PoiActivity.class);
startActivity(autoMatchIntent);
}
}
/**
* 导航到最近的POIEntity
*/
@RequiresApi(api = Build.VERSION_CODES.N)
private void navi2NearestPoiEntity() {
if (removables == null || removables.isEmpty()) {
@ -425,16 +469,16 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
// 转换geo
Geometry geometry1 = GeometryTools.createGeometry(Geohash.getInstance().decode(bean1.getGeo()));
Geometry geometry2 = GeometryTools.createGeometry(Geohash.getInstance().decode(bean2.getGeo()));
if (currentGeometry.distance(geometry1)>currentGeometry.distance(geometry2)) {
if (currentGeometry.distance(geometry1) > currentGeometry.distance(geometry2)) {
return 1;
} else if (currentGeometry.distance(geometry1)<currentGeometry.distance(geometry2)) {
} else if (currentGeometry.distance(geometry1) < currentGeometry.distance(geometry2)) {
return -1;
}
return 0;
}).get();
JobSearchBean.BodyBean.ListBean bean = (JobSearchBean.BodyBean.ListBean)((Marker)minRemoveable).getTag();
JobSearchBean.BodyBean.ListBean bean = (JobSearchBean.BodyBean.ListBean) ((Marker) minRemoveable).getTag();
Coordinate endPoint = GeometryTools.createGeometry(Geohash.getInstance().decode(bean.getGeo())).getCoordinates()[0];
ToastUtils.Message(getActivity(), "自动导航到"+bean.getName());
ToastUtils.Message(getActivity(), "自动导航到" + bean.getName());
// 跳转到对应的导航界面
if (Constant.currentNaviType == null) {
NaviUtils.getInstance().selectNaviType((AppCompatActivity) getActivity(), new NaviUtils.SelectNaviTypeListener() {
@ -512,7 +556,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
});
}
if (LocationLifeCycle.getInstance().getTencentLocation() != null) { //筛选从服务器获取到的数据
tencentMarkerUtils.initNetMarkerList(getActivity(), LocationLifeCycle.getInstance().getTencentLocation(), tencentMap, removables,null, null, removableHashMap, 200, new TencentMarkerUtils.MarkerInitCallback<JobSearchBean.BodyBean.ListBean>() {
tencentMarkerUtils.initNetMarkerList(getActivity(), LocationLifeCycle.getInstance().getTencentLocation(), tencentMap, removables, null, null, removableHashMap, 200, new TencentMarkerUtils.MarkerInitCallback<JobSearchBean.BodyBean.ListBean>() {
@Override
public void onMarkerInit(Map<String, List<Marker>> removableHashMap, List<Integer> uploadByNet, List<JobSearchBean.BodyBean.ListBean> listData) {
@ -706,6 +750,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if (Constant.DEVICE_TOKEN != null) {
httpParams.put("deviceTokens", Constant.DEVICE_TOKEN);
}
if (Constant.PUSH_TOKEN != null) {
httpParams.put("pushId", Constant.PUSH_TOKEN);
}
OkGoBuilder okGoBuilder = OkGoBuilder
.getInstance()
.Builder(getActivity())
@ -911,7 +958,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
gatherMarker.setVisible(false);
}
PoiEntity poiEntity = (PoiEntity) data.obj;
if (poiEntity!=null) {
if (poiEntity != null) {
Bundle bundle = new Bundle();
bundle.putSerializable("poiEntity", poiEntity);
bundle.putBoolean("isSliding", true); // 通知抽屉不收回
@ -1075,7 +1122,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
}
} else if (data.what == Constant.EVENT_WHAT_CHANGE_SLIDING_STATE) { // 改变滑动窗口的状态
if (sliding_layout!=null) {
if (sliding_layout != null) {
if (data.arg1 == View.GONE || data.arg1 == View.INVISIBLE) {
sliding_layout.setPanelHeight(0);
} else {
@ -1094,7 +1141,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
@Override
public void onClick(View view) {
// 检查当前线型的点位数据如果小于2个点无法完成
if (drawLinePolyline.getPoints()==null||drawLinePolyline.getPoints().size()<2) {
if (drawLinePolyline.getPoints() == null || drawLinePolyline.getPoints().size() < 2) {
// 绘制的线不存在
ToastUtils.Message(getActivity(), "绘制的线不存在!");
return;
@ -1102,13 +1149,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Message drawLineFinishMsg = Message.obtain();
drawLineFinishMsg.what = Constant.EVENT_WHAT_FINISH_DRAW_LINE;
drawLineFinishMsg.obj = drawLinePolyline.getPoints();
drawLineFinishMsg.arg1=1; // arg1为1代表存在绘制的辅助线为0代表用户点击取消不需要辅助线
drawLineFinishMsg.arg1 = 1; // arg1为1代表存在绘制的辅助线为0代表用户点击取消不需要辅助线
EventBus.getDefault().post(drawLineFinishMsg);
drawFinish.setVisibility(View.GONE);
drawCancel.setVisibility(View.GONE);
tencentMap.setOnMapClickListener(null);
if (drawLineMarkerList!=null&&!drawLineMarkerList.isEmpty()) {
if (drawLineMarkerList != null && !drawLineMarkerList.isEmpty()) {
drawLineMarkerList.stream().forEach(new Consumer<Marker>() {
@Override
public void accept(Marker marker) {
@ -1118,7 +1165,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
drawLineMarkerList.clear();
}
if (drawLinePolyline!=null) {
if (drawLinePolyline != null) {
drawLinePolyline.remove();
}
}
@ -1128,13 +1175,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
public void onClick(View view) {
Message drawLineFinishMsg = Message.obtain();
drawLineFinishMsg.what = Constant.EVENT_WHAT_FINISH_DRAW_LINE;
drawLineFinishMsg.arg1=0;// arg1为1代表存在绘制的辅助线为0代表用户点击取消不需要辅助线
drawLineFinishMsg.arg1 = 0;// arg1为1代表存在绘制的辅助线为0代表用户点击取消不需要辅助线
EventBus.getDefault().post(drawLineFinishMsg);
drawFinish.setVisibility(View.GONE);
drawCancel.setVisibility(View.GONE);
tencentMap.setOnMapClickListener(null);
if (drawLineMarkerList!=null&&!drawLineMarkerList.isEmpty()) {
if (drawLineMarkerList != null && !drawLineMarkerList.isEmpty()) {
drawLineMarkerList.stream().forEach(new Consumer<Marker>() {
@Override
public void accept(Marker marker) {
@ -1144,12 +1191,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
drawLineMarkerList.clear();
}
if (drawLinePolyline!=null) {
if (drawLinePolyline != null) {
drawLinePolyline.remove();
}
}
});
if (drawLineMarkerList!=null&&!drawLineMarkerList.isEmpty()) {
if (drawLineMarkerList != null && !drawLineMarkerList.isEmpty()) {
drawLineMarkerList.stream().forEach(new Consumer<Marker>() {
@Override
public void accept(Marker marker) {
@ -1159,7 +1206,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
drawLineMarkerList.clear();
}
if (drawLinePolyline!=null) {
if (drawLinePolyline != null) {
drawLinePolyline.remove();
}
PolylineOptions drawLineOptions = new PolylineOptions() // 用户绘制参考线的线数据
@ -1173,7 +1220,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
// 描边颜色的宽度线宽还是 25 像素不过填充的部分宽度为 `width` - 2 * `borderWidth`
.borderWidth(5);
drawLinePolyline = tencentMap.addPolyline(drawLineOptions);
if (tencentMap!=null) {
if (tencentMap != null) {
tencentMap.setOnMapClickListener(new TencentMap.OnMapClickListener() {
@Override
public void onMapClick(LatLng latLng) {
@ -1210,6 +1257,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
});
} else if(data.what == Constant.EVENT_WHAT_HAS_RECEIVE_ITEM) {
PoiEntity poiEntity = (PoiEntity) data.obj;
initMarker(poiEntity, true);
}
}
@ -1439,10 +1489,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
treasureBuilder.append(TimestampUtil.time()).append(",").append("点击了定位的按钮,");
if (LocationLifeCycle.getInstance().getTencentLocation() != null) {
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
new LatLng(LocationLifeCycle.getInstance().getTencentLocation().getLatitude(), LocationLifeCycle.getInstance().getTencentLocation().getLongitude()),//中心点坐标地图目标经纬度
17,//目标缩放级别
0,//目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
0));//目标旋转角 0~360° (正北方为0)
new LatLng(LocationLifeCycle.getInstance().getTencentLocation().getLatitude(), LocationLifeCycle.getInstance().getTencentLocation().getLongitude()),//中心点坐标地图目标经纬度
17,//目标缩放级别
0,//目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
0));//目标旋转角 0~360° (正北方为0)
tencentMap.animateCamera(cameraSigma);
} else {
ToastUtils.Message(getActivity(), "无定位");
@ -2064,13 +2114,86 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
/**
* 获取最新的推荐任务数据
* */
*/
private void initRecommandTaskInfo() {
if (Constant.PUSH_TOKEN!=null) {
if (Constant.PUSH_TOKEN != null) {
HttpParams httpParams = new HttpParams();
httpParams.put("pushId", Constant.PUSH_TOKEN);
long time = System.currentTimeMillis();
httpParams.put("datetime", time);
OkGoBuilder okGoBuilder = OkGoBuilder
.getInstance()
.time(30)
.Builder(requireActivity())
.url(HttpInterface.MESSAGE_LATEST_PUSH)
.cls(LatestPushMessageResponse.class)
.params(httpParams);
okGoBuilder.getRequest(new Callback<LatestPushMessageResponse>() {
@Override
public void onSuccess(LatestPushMessageResponse response, int id) {
tvLatestPush.setVisibility(View.GONE); // 默认先隐藏推荐任务按钮
if (response != null) {
Map<String, String> responseBody = response.getBody();
// 解析response
// 获取当前json的id如果id大于等于0则根据Content内容尝试展示提示信息
int messageId = Integer.parseInt(responseBody.get("id"));
if (messageId >= 0) {
// 读取该推送的截止时间如果当前时间比截止时间晚则不需要展示
if (responseBody.get("endTime") != null) {
long endTime = Long.parseLong(responseBody.get("endTime"));
if (endTime >= 0 && System.currentTimeMillis() / 1000 > endTime) {
return;
}
}
String imgUrl = responseBody.get("img");
String wkt = responseBody.get("geom");
int zoom = (int) Double.parseDouble(responseBody.get("zoom"));
// 存在最新的推荐任务显示推荐任务按钮
tvLatestPush.setVisibility(View.VISIBLE);
tvLatestPush.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// 显示对话框
CustomDialog.show(new OnBindView<com.kongzue.dialogx.dialogs.CustomDialog>(R.layout.dialog_push_tesk) {
@Override
public void onBind(com.kongzue.dialogx.dialogs.CustomDialog dialog, View v) {
ImageView photo = v.findViewById(R.id.img_photo);
TextView tvConfirm = v.findViewById(R.id.tv_confirm);
// 显示照片
Glide.with(requireContext()).load(imgUrl).into(photo);
View.OnClickListener clickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
// 地图定位到指定位置发送Event
Map<String, Object> map = new HashMap<>();
map.put("geom", wkt);
map.put("zoom", zoom);
Message msg = Message.obtain();
msg.obj = map;
msg.what = Constant.EVENT_WHAT_NOTIFYCATION_RECOMMAND_TASK;
EventBus.getDefault().post(msg);
dialog.dismiss();
}
};
// 点击对话框的图片
photo.setOnClickListener(clickListener);
tvConfirm.setOnClickListener(clickListener);
}
}).setCancelable(true).setAlign(CustomDialog.ALIGN.CENTER);
}
}
);
}
}
}
@Override
public void onError(Throwable e, int id) {
tvLatestPush.setVisibility(View.GONE);
}
});
}
}
}

View File

@ -2,12 +2,12 @@ package com.navinfo.outdoor.http;
public class HttpInterface {
// 开发
// public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发地址
// public static final String IP_UPLOAD = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发接口-数据上传
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发地址
public static final String IP_UPLOAD = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发接口-数据上传
// 测试
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试环境接口
public static final String IP_UPLOAD = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试环境接口-数据上传
// public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试环境接口
// public static final String IP_UPLOAD = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试环境接口-数据上传
// 生产
// public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/m4";//生产地址
@ -144,10 +144,12 @@ public class HttpInterface {
public static String SUBMIT_POLYGON_TASK = null;//面状任务开始采集
//dtxbmaps.navinfo.com/dtxb_test/m4/msgList/InfoPush/28/push?type=0
public static String MESSAGE_INFO_PUSH = null;//消息通知
public static String MESSAGE_LATEST_PUSH = null;//最新的推荐任务推送信息获取
public static String UPDATE_PHONE_NUM_URL = null;//消息通知
public static String CREATE_UPLOAD_TASK = null;//创建断点续传任务
public static String UPLOAD_SPLITE_TASK = null;//执行断点续传
public static String UPLOAD_TASK_FINISH = null;//断点续传完成
public static String GET_RECEIVED_LIST = null;//获取当前用户所有已领取的任务ID
public static String CONTACT_US = "";//联系我们
public static String ABOUT_MAP = "";//关于 -关于地图寻宝
@ -186,6 +188,7 @@ public class HttpInterface {
//172.23.139.4:8002/findAndMessage/1/submitExam
EXAM_SUBMIT = IP + MSG_LIST_PATH + "findAndMessage/" + userId + "/submitExam";//发现 -能力测评提交试卷 post
MESSAGE_INFO_PUSH = IP + MSG_LIST_PATH + "InfoPush/" + userId + "/push";//寻宝-消息通知
MESSAGE_LATEST_PUSH = IP + MSG_LIST_PATH + "UserMessage/" + userId + "/getLatestMessage";//寻宝首页-获取最新推送推荐任务
/* 提现 金额
* Path=/m4/price/
@ -240,6 +243,7 @@ public class HttpInterface {
UPDATE_PHONE_NUM_URL = IP + UPDATE_PHONE_NUM_PATH.replace("{userId}", userId);// 修改手机号
CREATE_UPLOAD_TASK = IP + TASK_PATH + "task/"+ userId+"/createUploadTask";// 创建断点续传任务
UPLOAD_TASK_FINISH = IP + TASK_PATH + "task/"+ userId+"/uploadTaskFinish";// 断点续传完成
GET_RECEIVED_LIST = IP + TASK_PATH + "task/"+ userId+"/getReceivedList";// 断点续传完成
//172.23.139.4:8003/othertask/1/uploadpic
OTHER_TASK_UPLOAD_PIC = IP_UPLOAD + TASK_PATH + "othertask/" + userId + "/uploadpic";//其他-上传

View File

@ -76,6 +76,11 @@ public class MessageReceiver extends XGPushBaseReceiver {
// 获取当前json的id如果id大于等于0则根据Content内容尝试展示提示信息
int id = msgJson.optInt("id", -1);
if (id >= 0) {
// 读取该推送的截止时间如果当前时间比截止时间晚则不需要展示
long endTime = msgJson.optLong("endTime", 0);
if (endTime > 0 && System.currentTimeMillis()/1000 > endTime) {
return;
}
int type = msgJson.optInt("type", -1);
if (type == 0) { // 显示推荐任务
String imgUrl = msgJson.optString("img", "");
@ -101,8 +106,7 @@ public class MessageReceiver extends XGPushBaseReceiver {
} catch (TimeoutException e) {
throw new RuntimeException(e);
}
} else if (type == 1) {
// 显示普通通知
} else if (type == 1) { // 显示普通通知
String title = msgJson.optString("title", "通知");
String content = msgJson.optString("content", "");
// 展示普通notification
@ -138,7 +142,8 @@ public class MessageReceiver extends XGPushBaseReceiver {
.setSilent(false)
.setAutoCancel(true)
.setContentIntent(pendingIntent)
.addAction(R.mipmap.ic_launcher, "去看看", pendingIntent);
.addAction(R.mipmap.ic_launcher, "去看看", pendingIntent)
.setAutoCancel(true);
mManager.notify(2, mBuilder.build());
}

View File

@ -22,9 +22,13 @@ public interface PoiDao {
@Query("SELECT * FROM poi where taskStatus > 1 and taskStatus!=100 and type!=6 ")
List<PoiEntity> getAllPoiByRecoded();
@Query("SELECT * FROM poi where taskStatus = 1 and type!=6 ")
List<PoiEntity> getHasReceivePoiByRecoded();
@Query("SELECT * FROM poi where type=:type and taskStatus > 1 and taskStatus!=100")
List<PoiEntity> getAllPoiType(int type);
@Query("SELECT * FROM poi where type=:type and taskStatus = 1 and taskStatus!=100")
List<PoiEntity> getHasReceivePoiType(int type);
@Query("SELECT * FROM poi where taskStatus =5")
List<PoiEntity> getAllPoiStatus();

View File

@ -30,7 +30,7 @@ import java.io.File;
* 如果需要在主线程调用则使用allowMainThreadQueries进行说明
*/
@Database(entities = {PoiEntity.class,ChargingPileEntity.class, LocationRecorder.class}, version = 6, exportSchema = false)
@Database(entities = {PoiEntity.class,ChargingPileEntity.class, LocationRecorder.class}, version = 7, exportSchema = false)
public abstract class PoiDatabase extends RoomDatabase {
private static final String DB_NAME = "navinfo.db";
private static volatile PoiDatabase instance;
@ -57,6 +57,7 @@ public abstract class PoiDatabase extends RoomDatabase {
.addMigrations(migration_3_4)
.addMigrations(migration_4_5)
.addMigrations(migration_5_6)
.addMigrations(migration_6_7)
//.fallbackToDestructiveMigration()//数据库更新时删除数据重新创建 改动特别大的时候在用
.build();
}
@ -125,6 +126,16 @@ public abstract class PoiDatabase extends RoomDatabase {
}
}
};
private static Migration migration_6_7 = new Migration(6, 7) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
try {
database.execSQL("ALTER TABLE poi ADD COLUMN unReceivedTime TEXT DEFAULT NULL"); // 添加接受任务后的失效时间
} catch (Exception e) {
XLog.e(e.toString());
}
}
};
public abstract PoiDao getPoiDao();//其他信息
public abstract ChargingPileDao getChargingPileDao();//充电桩

View File

@ -1,6 +1,7 @@
package com.navinfo.outdoor.room;
import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;
@ -11,6 +12,9 @@ import com.navinfo.outdoor.util.PhotoInfoConverter;
import java.io.File;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.UUID;
@ -56,6 +60,7 @@ public class PoiEntity implements Serializable {
private int score; // 置信度
private String drawLine; // 用户绘制的线型
private String uploadResult; //上传结果
private String unReceivedTime; // 任务领取后自动释放的时间
public int getRecord_way() {
return record_way;
@ -326,6 +331,31 @@ public class PoiEntity implements Serializable {
this.uploadResult = uploadResult;
}
/**
* 获取经过处理后的接受任务失效时间的时间戳
* */
public long getUnReceivedTimeStamp() {
if (getUnReceivedTime() == null || "".equals(getUnReceivedTime())) {
return 0;
}
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long time = 0;
try {
time = df.parse(getUnReceivedTime()).getTime();
} catch (ParseException e) {
throw new RuntimeException(e);
}
return time;
}
public String getUnReceivedTime() {
return unReceivedTime;
}
public void setUnReceivedTime(String unReceivedTime) {
this.unReceivedTime = unReceivedTime;
}
@Override
public String toString() {
return "PoiEntity{" +
@ -346,6 +376,7 @@ public class PoiEntity implements Serializable {
", x='" + x + '\'' +
", y='" + y + '\'' +
", detail='" + detail + '\'' +
", unReceivedTime='" + unReceivedTime + '\'' +
'}';
}
}

View File

@ -186,7 +186,10 @@ public class TencentMarkerUtils {
}
break;
}
switch (list.get(i).getType()) {
// publish字段标识了当前数据是否已发布如果未发布则半透明显示且不可点击否则正常显示
float alpha = listBean.getPublish() == 0? 0.3f: 1.0f;
boolean clickable = listBean.getPublish() == 0? false: true;
switch (listBean.getType()) {
case 1://poi
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi);
//poiDescriptor.getForager().setScale(50);
@ -194,6 +197,7 @@ public class TencentMarkerUtils {
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
.anchor(0.5f, 1.0f)
.flat(true)
.alpha(alpha)
.clockwise(false));
if (poiMarker != null) {
if (listBean != null) {
@ -203,7 +207,7 @@ public class TencentMarkerUtils {
removables.add(poiMarker);
String poiGeo = initGeo(latLng);
geoMarker(poiGeo, poiMarker, removableHashMap);
poiMarker.setClickable(true);
poiMarker.setClickable(clickable);
}
break;
case 2://充电站
@ -212,6 +216,7 @@ public class TencentMarkerUtils {
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
.anchor(0.5f, 1.0f)
.flat(true)
.alpha(alpha)
.clockwise(false));
if (stationMarker != null) {
if (listBean != null) {
@ -221,7 +226,7 @@ public class TencentMarkerUtils {
removables.add(stationMarker);
String stationGeo = initGeo(latLng);
geoMarker(stationGeo, stationMarker, removableHashMap);
stationMarker.setClickable(true);
stationMarker.setClickable(clickable);
}
break;
case 3://poi录像
@ -230,6 +235,7 @@ public class TencentMarkerUtils {
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
.anchor(0.5f, 1.0f)
.flat(true)
.alpha(alpha)
.clockwise(false));
if (poiVideoMarker != null) {
if (listBean != null) {
@ -239,7 +245,7 @@ public class TencentMarkerUtils {
removables.add(poiVideoMarker);
String poiVideoGeo = initGeo(latLng);
geoMarker(poiVideoGeo, poiVideoMarker, removableHashMap);
poiVideoMarker.setClickable(true);
poiVideoMarker.setClickable(clickable);
}
break;
case 4://道路录像
@ -248,6 +254,7 @@ public class TencentMarkerUtils {
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
.anchor(0.5f, 1.0f)
.flat(true)
.alpha(alpha)
.clockwise(false));
if (roadMarker != null) {
if (listBean != null) {
@ -257,7 +264,7 @@ public class TencentMarkerUtils {
removables.add(roadMarker);
String roadGeo = initGeo(latLng);
geoMarker(roadGeo, roadMarker, removableHashMap);
roadMarker.setClickable(true);
roadMarker.setClickable(clickable);
}
break;
case 5://其他
@ -266,6 +273,7 @@ public class TencentMarkerUtils {
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
.anchor(0.5f, 1.0f)
.flat(true)
.alpha(alpha)
.clockwise(false));
if (otherMarker != null) {
if (listBean != null) {
@ -275,7 +283,7 @@ public class TencentMarkerUtils {
removables.add(otherMarker);
String otherGeo = initGeo(latLng);
geoMarker(otherGeo, otherMarker, removableHashMap);
otherMarker.setClickable(true);
otherMarker.setClickable(clickable);
}
break;
case 6://面状任务
@ -284,6 +292,7 @@ public class TencentMarkerUtils {
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
.anchor(0.5f, 1.0f)
.flat(true)
.alpha(alpha)
.clockwise(false));
if (planarMarker != null) {
if (listBean != null) {
@ -293,7 +302,7 @@ public class TencentMarkerUtils {
removables.add(planarMarker);
String planarGeo = initGeo(latLng);
geoMarker(planarGeo, planarMarker, removableHashMap);
planarMarker.setClickable(true);
planarMarker.setClickable(clickable);
}
break;
}

View File

@ -9,6 +9,6 @@
android:right="@dimen/default_widget_padding"
android:top="@dimen/default_widget_padding" />
<stroke
android:width="0.5dp"
android:width="1dp"
android:color="@color/colorPrimaryBlue" />
</shape>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/img_photo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:scaleType="fitCenter" />
<TextView
android:id="@+id/tv_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/btn_round_corner"
android:gravity="center"
android:background="@drawable/selector_default_btn_round_corner_bg"
android:text="去看看"></TextView>
</LinearLayout>

View File

@ -0,0 +1,172 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/layer_operate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent">
<Button
android:id="@+id/btn_stay_submit"
style="@style/user_data_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="20dp"
android:text="提交"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_del" />
<Button
android:id="@+id/btn_stay_cancel"
style="@style/user_data_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="20dp"
android:text="取消"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_del" />
</LinearLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/layer_operate"
app:layout_constraintTop_toTopOf="parent"
tools:context=".fragment.StaySubmitFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_has_receive_type"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@drawable/road_shape"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
style="@style/text_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:layout_marginBottom="5dp"
android:text="类型"
android:textColor="#333"
app:layout_constraintBottom_toTopOf="@+id/tv_stay_type"
app:layout_constraintStart_toStartOf="@+id/tv_stay_type"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_stay_type"
style="@style/main_about_text_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginBottom="20dp"
android:text="全部"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:background="@drawable/ic_baseline_arrow_forward"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:id="@+id/ll_results"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@drawable/road_shape"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cl_has_receive_type">
<TextView
android:id="@+id/tv_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="10dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:text="筛选结果"
android:textColor="#333"
android:textSize="20sp" />
<TextView
android:id="@+id/tv_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:text="全选"
android:visibility="gone"
android:textColor="#333"
android:textSize="17sp" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/stay_xrv"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_results" />
<LinearLayout
android:id="@+id/ll_del"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/stay_xrv">
<CheckBox
android:id="@+id/cb_select"
style="@style/CheckBoxTheme"
android:padding="@dimen/default_widget_padding"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="全选"
android:visibility="gone"
android:textSize="17sp" />
<TextView
android:id="@+id/tv_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="@dimen/default_widget_padding"
android:visibility="gone"
android:text="删除"
android:textColor="@color/colorPrimaryBlue"
android:textSize="18sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/stay_main_info"
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_margin="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_road_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:ellipsize="end"
android:singleLine="true"
android:text="测试1"
android:textColor="#333"
android:textSize="15sp" />
<TextView
android:id="@+id/tv_road_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="2021-05-08 13:24:36"
android:textColor="#333"
app:layout_constraintTop_toBottomOf="@id/tv_road_name" />
</LinearLayout>
<TextView
android:id="@+id/tv_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:visibility="gone"
android:textColor="#333"
app:layout_constraintBottom_toBottomOf="@+id/cb_unSubmit"
app:layout_constraintEnd_toStartOf="@+id/cb_unSubmit"
app:layout_constraintTop_toTopOf="@+id/cb_unSubmit" />
<CheckBox
android:id="@+id/cb_unSubmit"
android:layout_width="30dp"
android:layout_height="30dp"
android:scaleX="1.1"
android:scaleY="1.1"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:id="@+id/layer_pb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/default_widget_padding"
app:layout_constraintTop_toBottomOf="@id/stay_main_info"
app:layout_constraintLeft_toLeftOf="parent">
<ProgressBar
android:id="@+id/pb_stay_upload"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_gravity="center"
android:progressDrawable="@drawable/default_progress"
style="@android:style/Widget.ProgressBar.Horizontal"
></ProgressBar>
<TextView
android:id="@+id/tv_pb_stay_upload"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:textSize="8sp"
android:background="@color/white80"
android:layout_height="wrap_content"></TextView>
</FrameLayout>
<TextView
android:id="@+id/tv_upload_result"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:textSize="12sp"
android:maxLength="20"
android:ellipsize="middle"
android:lines="1"
android:gravity="center"
android:textColor="@color/colorRed"
android:paddingHorizontal="@dimen/default_widget_padding"
app:layout_constraintTop_toBottomOf="@id/layer_pb"
app:layout_constraintRight_toRightOf="parent"></TextView>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -40,7 +40,17 @@
android:background="@drawable/iv_message"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_latest_push"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="推荐任务"
app:layout_constraintLeft_toRightOf="@id/iv_message"
app:layout_constraintTop_toTopOf="@id/iv_message"
android:layout_marginHorizontal="@dimen/default_widget_padding"
android:visibility="gone"
style="@style/btn_round_corner"></androidx.appcompat.widget.AppCompatTextView>
<ImageView
android:id="@+id/iv_mas_notification"

View File

@ -174,7 +174,7 @@
</style>
<style name="btn_round_corner">
<item name="background">@drawable/selector_default_btn_round_corner_bg</item>
<item name="android:background">@drawable/selector_default_btn_round_corner_bg</item>
<item name="android:textColor">@color/selector_default_btn_text_color</item>
<item name="android:padding">@dimen/default_widget_padding</item>
</style>