修改bug

This commit is contained in:
wds
2021-08-11 19:03:47 +08:00
parent 2bb442eb55
commit 6aee99ac85
3 changed files with 217 additions and 218 deletions

File diff suppressed because one or more lines are too long

View File

@@ -167,8 +167,8 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
poiEntity.setName(list.get(i).getName()); poiEntity.setName(list.get(i).getName());
poiEntity.setAddress(list.get(i).getAddress()); poiEntity.setAddress(list.get(i).getAddress());
poiEntity.setTelPhone(list.get(i).getTelephone() + ""); poiEntity.setTelPhone(list.get(i).getTelephone() + "");
poiEntity.setPrecision(list.get(i).getPrice()); poiEntity.setPrecision(list.get(i).getPrice()+"");
poiEntity.setDist(list.get(i).getDist()); poiEntity.setDist(list.get(i).getDist()+"");
poiEntity.setType(Integer.valueOf(list.get(i).getType())); poiEntity.setType(Integer.valueOf(list.get(i).getType()));
String geo = list.get(i).getGeo(); String geo = list.get(i).getGeo();
Geometry geometry = GeometryTools.createGeometry(geo); Geometry geometry = GeometryTools.createGeometry(geo);

View File

@@ -191,7 +191,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
// ivMessage.setVisibility(View.GONE); // ivMessage.setVisibility(View.GONE);
// } // }
cbMapType = (CheckBox) findViewById(R.id.cb_map_type); cbMapType = (CheckBox) findViewById(R.id.cb_map_type);
//sliding_layout.setScrollableViewHelper(new NestedScrollableViewHelper()); //sliding_layout.setScrollableViewHelper(new NestedScrollableViewHelper());
//地图转换 //地图转换
cbMapType.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { cbMapType.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
@@ -315,8 +315,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
poiListEntity.setName(listBean.getName()); poiListEntity.setName(listBean.getName());
poiListEntity.setAddress(listBean.getAddress()); poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setTelPhone(listBean.getTelephone() + ""); poiListEntity.setTelPhone(listBean.getTelephone() + "");
poiListEntity.setPrecision(listBean.getPrice()); poiListEntity.setPrecision(listBean.getPrice() + "");
poiListEntity.setDist(listBean.getDist()); poiListEntity.setDist(listBean.getDist() + "");
poiListEntity.setDescribe(listBean.getMemo()); poiListEntity.setDescribe(listBean.getMemo());
poiListEntity.setCreateTime(listBean.getEndDate()); poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setType(Integer.valueOf(listBean.getType())); poiListEntity.setType(Integer.valueOf(listBean.getType()));
@@ -356,7 +356,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
private class NestedScrollableViewHelper extends ScrollableViewHelper { private class NestedScrollableViewHelper extends ScrollableViewHelper {
public int getScrollableViewScrollPosition(View mScrollableView, boolean isSlidingUp) { public int getScrollableViewScrollPosition(View mScrollableView, boolean isSlidingUp) {
if (mScrollableView instanceof NestedScrollView) { if (mScrollableView instanceof NestedScrollView) {
if(isSlidingUp){ if (isSlidingUp) {
return mScrollableView.getScrollY(); return mScrollableView.getScrollY();
} else { } else {
NestedScrollView nsv = ((NestedScrollView) mScrollableView); NestedScrollView nsv = ((NestedScrollView) mScrollableView);
@@ -395,6 +395,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Log.d("TAG", "onSuccess: " + response.getCode() + response.getMessage() + "" + response.getBody()); Log.d("TAG", "onSuccess: " + response.getCode() + response.getMessage() + "" + response.getBody());
} }
} }
@Override @Override
public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
@@ -423,14 +424,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
centerEncode = Geohash.getInstance().encode(mapCenterPoint.latitude, mapCenterPoint.longitude); centerEncode = Geohash.getInstance().encode(mapCenterPoint.latitude, mapCenterPoint.longitude);
} }
userEncode = Geohash.getInstance().encode(tencentLocation.getLatitude(), tencentLocation.getLongitude()); userEncode = Geohash.getInstance().encode(tencentLocation.getLatitude(), tencentLocation.getLongitude());
long date = System.currentTimeMillis();
OkGo.getInstance().cancelTag(this); OkGo.getInstance().cancelTag(this);
showLoadingDialog(); showLoadingDialog();
// 请求方式和请求url // 请求方式和请求url
HttpParams httpParams = new HttpParams(); HttpParams httpParams = new HttpParams();
httpParams.put("userGeo", userEncode); httpParams.put("userGeo", userEncode);
httpParams.put("centerGeo", centerEncode); httpParams.put("centerGeo", centerEncode);
httpParams.put("date", date);
httpParams.put("pageSize", Constant.NUMBER); httpParams.put("pageSize", Constant.NUMBER);
httpParams.put("pageNum", "1"); httpParams.put("pageNum", "1");
httpParams.put("type", task_type); httpParams.put("type", task_type);
@@ -446,8 +445,14 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
public void onSuccess(JobSearchBean response, int id) { public void onSuccess(JobSearchBean response, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
JobSearchBean.BodyBean body = response.getBody(); JobSearchBean.BodyBean body = response.getBody();
upload =response.getUpload(); upload = response.getBody().getUpload();
if (body != null) { if (body != null) {
if (upload != null) {
ivSubmit.setEnabled(true);
} else {
ivSubmit.setEnabled(false);
}
Log.d("TAG", "onSuccess: " + response.getBody().toString() + "sssssssssssss"); Log.d("TAG", "onSuccess: " + response.getBody().toString() + "sssssssssssss");
for (int i = 0; i < removables.size(); i++) { for (int i = 0; i < removables.size(); i++) {
removables.get(i).remove(); removables.get(i).remove();
@@ -466,11 +471,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if (geometry.getGeometryType().equals("Point")) {//点 if (geometry.getGeometryType().equals("Point")) {//点
latLng = GeometryTools.createLatLng(geo); latLng = GeometryTools.createLatLng(geo);
} else if (geometry.getGeometryType().equals("LineString")) {//线 } else if (geometry.getGeometryType().equals("LineString")) {//线
BitmapDescriptor bitmapLine=null; BitmapDescriptor bitmapLine = null;
if (Integer.valueOf(listBean.getType())==3){//poi录像 if (Integer.valueOf(listBean.getType()) == 3) {//poi录像
bitmapLine= BitmapDescriptorFactory.fromResource(R.drawable.arrow_down); bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.arrow_down);
}else if (Integer.valueOf(listBean.getType())==4){//道路录像 } else if (Integer.valueOf(listBean.getType()) == 4) {//道路录像
bitmapLine=BitmapDescriptorFactory.fromResource(R.drawable.arrow_down); bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.arrow_down);
} }
List<LatLng> latLineString = GeometryTools.getLatLngs(geo); List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
// 构造 PolylineOpitons // 构造 PolylineOpitons
@@ -485,10 +490,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.arrow(true) .arrow(true)
.arrowSpacing(30) .arrowSpacing(30)
.arrowTexture(bitmapLine); .arrowTexture(bitmapLine);
// 还可以添加描边颜色 // 还可以添加描边颜色
//.borderColor(0xffff0000) //.borderColor(0xffff0000)
// 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth` // 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth`
//.borderWidth(1); //.borderWidth(1);
// 绘制折线 // 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions); Polyline polyline = tencentMap.addPolyline(polylineOptions);
polyline.setZIndex(3); polyline.setZIndex(3);
@@ -591,6 +596,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
obtain.obj = response; obtain.obj = response;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
} }
@Override @Override
public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
@@ -599,6 +605,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}); });
dismissDialog(); dismissDialog();
} }
public void initMarker(PoiEntity poiEntity) { public void initMarker(PoiEntity poiEntity) {
sliding_layout.setPanelHeight(0); sliding_layout.setPanelHeight(0);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
@@ -614,11 +621,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
latLng = GeometryTools.createLatLng(geo); latLng = GeometryTools.createLatLng(geo);
} else if (geometry.getGeometryType().equals("LineString")) {//线 } else if (geometry.getGeometryType().equals("LineString")) {//线
BitmapDescriptor bitmapLine=null; BitmapDescriptor bitmapLine = null;
if (poiEntity.getType()==3){//poi录像 if (poiEntity.getType() == 3) {//poi录像
bitmapLine= BitmapDescriptorFactory.fromResource(R.drawable.arrow_down); bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.arrow_down);
}else if (poiEntity.getType()==4){//道路录像 } else if (poiEntity.getType() == 4) {//道路录像
bitmapLine=BitmapDescriptorFactory.fromResource(R.drawable.arrow_down); bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.arrow_down);
} }
List<LatLng> latLineString = GeometryTools.getLatLngs(geo); List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
// 构造 PolylineOpitons // 构造 PolylineOpitons
@@ -732,11 +739,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if (geometry.getGeometryType().equals("Point")) {//点 if (geometry.getGeometryType().equals("Point")) {//点
latLng = GeometryTools.createLatLng(geo); latLng = GeometryTools.createLatLng(geo);
} else if (geometry.getGeometryType().equals("LineString")) {//线 } else if (geometry.getGeometryType().equals("LineString")) {//线
BitmapDescriptor bitmapLine =null; BitmapDescriptor bitmapLine = null;
if (type==3){//poi录像 if (type == 3) {//poi录像
bitmapLine= BitmapDescriptorFactory.fromResource(R.drawable.arrow_down); bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.arrow_down);
}else if (type==4){//道路录像 } else if (type == 4) {//道路录像
bitmapLine=BitmapDescriptorFactory.fromResource(R.drawable.arrow_down); bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.arrow_down);
} }
List<LatLng> latLineString = GeometryTools.getLatLngs(geo); List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
// 构造 PolylineOpitons // 构造 PolylineOpitons
@@ -1231,14 +1238,14 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if (gatherGetFragment != null) { if (gatherGetFragment != null) {
fragmentTransaction.remove(gatherGetFragment); fragmentTransaction.remove(gatherGetFragment);
} }
}else if (data.what==Constant.POI_DRAWER){//设置每个点的中心位置 } else if (data.what == Constant.POI_DRAWER) {//设置每个点的中心位置
LatLng latLng = (LatLng) data.obj; LatLng latLng = (LatLng) data.obj;
if (latLng!=null){ if (latLng != null) {
MapManager.getInstance().animateMapLocation2TopCenter(latLng, 0.5f, 0.25f); MapManager.getInstance().animateMapLocation2TopCenter(latLng, 0.5f, 0.25f);
} }
}else if (data.what== Constant.UN_POLY_GEN_TASK){//面妆任务立即采集 领取 } else if (data.what == Constant.UN_POLY_GEN_TASK) {//面妆任务立即采集 领取
if ((boolean)data.obj){ if ((boolean) data.obj) {
frameLayout.setVisibility(View.GONE); frameLayout.setVisibility(View.GONE);
sliding_layout.setPanelHeight(0); sliding_layout.setPanelHeight(0);
@@ -1306,10 +1313,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
screenPosition = tencentMap.getProjection().toScreenLocation(latLng); screenPosition = tencentMap.getProjection().toScreenLocation(latLng);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
//创建Marker对象之前设置属性 //创建Marker对象之前设置属性
if (markerPile!=null){ if (markerPile != null) {
markerPile.setFixingPoint(screenPosition.x, screenPosition.y); markerPile.setFixingPoint(screenPosition.x, screenPosition.y);
} }
} }
@Override @Override
public void onCancel() { public void onCancel() {
} }
@@ -1467,6 +1475,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} }
break; break;
case R.id.iv_submit://弹窗 case R.id.iv_submit://弹窗
//分享 //分享
CharSequence title = "请选择上报类型"; CharSequence title = "请选择上报类型";
// 如果当前fragment是筛选则移除该fragment // 如果当前fragment是筛选则移除该fragment
@@ -1476,12 +1485,31 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} }
DialogSettings.style = DialogSettings.STYLE.STYLE_MIUI; DialogSettings.style = DialogSettings.STYLE.STYLE_MIUI;
List<ShareDialog.Item> itemList = new ArrayList<>(); List<ShareDialog.Item> itemList = new ArrayList<>();
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_poi, "POI")); if (upload.contains(1)) {
itemList.add(new ShareDialog.Item(getContext(), R.drawable.poi_video, "POI录像")); itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_poi, "POI"));
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_road, "道路")); } else {
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_chongdianzhuang, "充电站"));
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_qingbao, "其他"));
}
if (upload.contains(2)) {
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_chongdianzhuang, "充电站"));
}else {
}
if (upload.contains(3)) {
itemList.add(new ShareDialog.Item(getContext(), R.drawable.poi_video, "POI录像"));
}else {
}
if (upload.contains(4)) {
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_road, "道路"));
}else {
}
if (upload.contains(5)) {
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_qingbao, "其他"));
}else {
}
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
PoiEntity poiEntity = new PoiEntity(); PoiEntity poiEntity = new PoiEntity();
// 上报时以当前用户位置为准 // 上报时以当前用户位置为准
@@ -1497,34 +1525,28 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
ShareDialog.show((AppCompatActivity) getActivity(), itemList, new ShareDialog.OnItemClickListener() { ShareDialog.show((AppCompatActivity) getActivity(), itemList, new ShareDialog.OnItemClickListener() {
@Override @Override
public boolean onClick(ShareDialog shareDialog, int index, ShareDialog.Item item) { public boolean onClick(ShareDialog shareDialog, int index, ShareDialog.Item item) {
switch (index) { if (item.getText().equals("POI")) {
case 0: // POI showPoiMarkerByType(1, newPoiLatLng);
showPoiMarkerByType(1, newPoiLatLng); PoiFragment poiFragment = PoiFragment.newInstance(bundle);
PoiFragment poiFragment = PoiFragment.newInstance(bundle); showSlidingFragment(poiFragment);
showSlidingFragment(poiFragment); } else if (item.getText().equals("充电站")) {
break; showPoiMarkerByType(4, newPoiLatLng);
case 1: // POI录像 ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
showPoiMarkerByType(2, newPoiLatLng); showSlidingFragment(chargingStationFragment);
poiEntity.setWork_type(1); } else if (item.getText().equals("POI录像")) {
bundle.putSerializable("poiEntity", poiEntity); showPoiMarkerByType(2, newPoiLatLng);
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle); poiEntity.setWork_type(1);
showSlidingFragment(poiVideoFragment); bundle.putSerializable("poiEntity", poiEntity);
break; PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
case 2://道路录像 showSlidingFragment(poiVideoFragment);
showPoiMarkerByType(3, newPoiLatLng); } else if (item.getText().equals("道路")) {
RoadFragment roadFragment = RoadFragment.newInstance(bundle); showPoiMarkerByType(3, newPoiLatLng);
showSlidingFragment(roadFragment); RoadFragment roadFragment = RoadFragment.newInstance(bundle);
break; showSlidingFragment(roadFragment);
case 3://充电站 } else if (item.getText().equals("其他")) {
showPoiMarkerByType(4, newPoiLatLng); showPoiMarkerByType(5, newPoiLatLng);
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle); OtherFragment otherFragment = OtherFragment.newInstance(bundle);
showSlidingFragment(chargingStationFragment); showSlidingFragment(otherFragment);
break;
case 4://其他
showPoiMarkerByType(5, newPoiLatLng);
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
showSlidingFragment(otherFragment);
break;
} }
return false; return false;
} }
@@ -1544,7 +1566,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} }
} }
private void showPoiMarkerByType(int type, LatLng latLng) { private void showPoiMarkerByType(int type, LatLng latLng) {
if (type == 1) { if (type == 1) {
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor1).zIndex(2)); markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor1).zIndex(2));
} else if (type == 2) { } else if (type == 2) {
@@ -1580,26 +1602,26 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} }
} }
if (!(fragment instanceof PoiFragment)) { if (!(fragment instanceof PoiFragment)) {
PoiFragment poiFragment = (PoiFragment) supportFragmentManager.findFragmentByTag(PoiFragment.class.getName()); PoiFragment poiFragment = (PoiFragment) supportFragmentManager.findFragmentByTag(PoiFragment.class.getName());
if (poiFragment != null) { if (poiFragment != null) {
fragmentTransaction.hide(poiFragment); fragmentTransaction.hide(poiFragment);
}
} }
if (!(fragment instanceof RoadFragment)) { }
RoadFragment roadFragment = (RoadFragment) supportFragmentManager.findFragmentByTag(RoadFragment.class.getName()); if (!(fragment instanceof RoadFragment)) {
if (roadFragment != null) { RoadFragment roadFragment = (RoadFragment) supportFragmentManager.findFragmentByTag(RoadFragment.class.getName());
fragmentTransaction.hide(roadFragment); if (roadFragment != null) {
} fragmentTransaction.hide(roadFragment);
} }
}
if (!(fragment instanceof PoiVideoFragment)) { if (!(fragment instanceof PoiVideoFragment)) {
PoiVideoFragment poiVideoFragment = (PoiVideoFragment) supportFragmentManager.findFragmentByTag(PoiVideoFragment.class.getName()); PoiVideoFragment poiVideoFragment = (PoiVideoFragment) supportFragmentManager.findFragmentByTag(PoiVideoFragment.class.getName());
if (poiVideoFragment != null) { if (poiVideoFragment != null) {
fragmentTransaction.hide(poiVideoFragment); fragmentTransaction.hide(poiVideoFragment);
}
} }
fragmentTransaction.show(fragment); }
fragmentTransaction.addToBackStack(null); fragmentTransaction.show(fragment);
fragmentTransaction.commit(); fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
} }
/** /**