修改删选界面上的bug

This commit is contained in:
wds 2021-08-15 19:57:18 +08:00
parent 4c114b8357
commit f9cc2cdfbe
6 changed files with 60 additions and 86 deletions

View File

@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 29 compileSdkVersion 29
buildToolsVersion '29.0.2' buildToolsVersion '29.0.2'
ndkVersion '23.0.7123448' // ndkVersion '23.0.7123448'
defaultConfig { defaultConfig {
applicationId "com.navinfo.outdoor" applicationId "com.navinfo.outdoor"

View File

@ -72,6 +72,24 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
initEvent(); initEvent();
} }
private void initLoadingDialog() {
if (alertDialog == null) {
alertDialog = new AlertDialog.Builder(getActivity()).create();
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable());
alertDialog.setCancelable(false);
alertDialog.setOnKeyListener((dialog, keyCode, event) -> {
if (keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_BACK)
return true;
return false;
});
//loading样式
View view = LayoutInflater.from(getContext()).inflate(R.layout.loading, null);
alertDialog.setView(view);
alertDialog.setCanceledOnTouchOutside(false);
}
}
@Override @Override
public boolean onBackPressed() { public boolean onBackPressed() {
return false; return false;
@ -95,20 +113,7 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
protected abstract int getLayout(); protected abstract int getLayout();
public void showLoadingDialog() { public void showLoadingDialog() {
initLoadingDialog();
alertDialog = new AlertDialog.Builder(getActivity()).create();
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable());
alertDialog.setCancelable(false);
alertDialog.setOnKeyListener((dialog, keyCode, event) -> {
if (keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_BACK)
return true;
return false;
});
//loading样式
View view = LayoutInflater.from(getContext()).inflate(R.layout.loading, null);
alertDialog.setView(view);
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show(); alertDialog.show();
//initTimer(); //initTimer();
} }
@ -121,8 +126,8 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
} }
public void dismissLoadingDialog() { public void dismissLoadingDialog() {
if (null != alertDialog && alertDialog.isShowing()) { if (null != alertDialog) {
alertDialog.dismiss(); alertDialog.hide();
} }
} }
@ -153,6 +158,9 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
@Override @Override
public void onDestroyView() { public void onDestroyView() {
if (alertDialog!=null) {
alertDialog.dismiss();
}
super.onDestroyView(); super.onDestroyView();
} }
} }

View File

@ -182,11 +182,12 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
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();
poiEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo); Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {// if (geometry.getGeometryType().equals("Point")) {//
LatLng latLng = GeometryTools.createLatLng(geo); LatLng latLng = GeometryTools.createLatLng(geo);
poiEntity.setX(latLng.longitude + ""); poiEntity.setX(latLng.longitude + "");
poiEntity.setY(latLng.altitude + ""); poiEntity.setY(latLng.latitude + "");
} else if (geometry.getGeometryType().equals("LineString")) {//线 } else if (geometry.getGeometryType().equals("LineString")) {//线
List<LatLng> latLineString = GeometryTools.getLatLngs(geo); List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
poiEntity.setX(latLineString.get(0).longitude + ""); poiEntity.setX(latLineString.get(0).longitude + "");
@ -304,22 +305,10 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
filterAdapter.setItemCLick(new FilterAdapter.ItemCLick() { filterAdapter.setItemCLick(new FilterAdapter.ItemCLick() {
@Override @Override
public void item(PoiEntity poiEntity) { public void item(PoiEntity poiEntity) {
if (poiEntity.getTaskStatus()!=1) { Message obtains = Message.obtain();
Message obtain = Message.obtain(); obtains.what = Constant.FILTER_LIST_ITEM;
obtain.what = Constant.GATHER_GET; obtains.obj = poiEntity;
obtain.obj = poiEntity; EventBus.getDefault().post(obtains);
EventBus.getDefault().post(obtain);
} else {//1:表示領取的本地認爲
Message obtain = Message.obtain();
obtain.what = Constant.TREASURE_FRAGMENT;
obtain.obj = true;
EventBus.getDefault().post(obtain);
Message obtains = Message.obtain();
obtains.what = Constant.FILTER_LIST_ITEM;
obtains.obj = poiEntity;
EventBus.getDefault().post(obtains);
}
} }
}); });
} }

View File

@ -500,7 +500,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
.url(HttpInterface.GET_PHONES) .url(HttpInterface.GET_PHONES)
.params(new HttpParams("geo", encode)) .params(new HttpParams("geo", encode))
.cls(GetPhoneBean.class) .cls(GetPhoneBean.class)
.token(Constant.ACCESS_TOKEN) .token(Constant.ACCESS_TOKEN)
.getRequest(new Callback<GetPhoneBean>() { .getRequest(new Callback<GetPhoneBean>() {
@Override @Override

View File

@ -115,7 +115,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
private ImageView ivSubmit; private ImageView ivSubmit;
private ImageView ivRefish; private ImageView ivRefish;
private SlidingUpPanelLayout sliding_layout; private SlidingUpPanelLayout sliding_layout;
private FragmentTransaction fragmentTransaction; // private FragmentTransaction fragmentTransaction;
private Marker markerPoi; private Marker markerPoi;
private ImageView ivFilter; private ImageView ivFilter;
@ -698,7 +698,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
frameLayout.setVisibility(View.VISIBLE); frameLayout.setVisibility(View.VISIBLE);
setMainButtonVisiable(View.GONE); setMainButtonVisiable(View.GONE);
fragmentTransaction = supportFragmentManager.beginTransaction(); FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putSerializable("poiEntity", poiEntity); bundle.putSerializable("poiEntity", poiEntity);
gatherGetFragment = GatherGetFragment.newInstance(bundle); gatherGetFragment = GatherGetFragment.newInstance(bundle);
@ -1020,45 +1020,16 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
@Subscribe @Subscribe
public void onEvent(Message data) { public void onEvent(Message data) {
if (data.what == Constant.FILTER_LIST_ITEM) { // 点击筛选的item if (data.what == Constant.FILTER_LIST_ITEM) { // 点击筛选的item
PoiEntity poiEntity = (PoiEntity) data.obj;
initMarker(poiEntity,true);
// 如果当前fragment是筛选则移除该fragment // 如果当前fragment是筛选则移除该fragment
FilterFragment filterFragment = (FilterFragment) supportFragmentManager.findFragmentByTag(FilterFragment.class.getName()); FilterFragment filterFragment = (FilterFragment) supportFragmentManager.findFragmentByTag(FilterFragment.class.getName());
if (filterFragment != null) { if (filterFragment != null) {
FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
fragmentTransaction.remove(filterFragment); fragmentTransaction.remove(filterFragment);
fragmentTransaction.commit();
} }
} else if (data.what == Constant.GATHER_GET) { //筛选item 点击开始采集
PoiEntity poiEntity = (PoiEntity) data.obj; PoiEntity poiEntity = (PoiEntity) data.obj;
Bundle bundle = new Bundle(); initMarker(poiEntity,true);
bundle.putBoolean("isSliding", false); // 通知抽屉不收回 } else if (data.what == Constant.GATHER_GET_MAP) { //地图界面点击采集 点击开始采集
bundle.putSerializable("poiEntity", poiEntity);
switch (poiEntity.getType()) {
case 1:
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
showSlidingFragment(poiFragment);
break;
case 2:
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
showSlidingFragment(chargingStationFragment);
break;
case 3:
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
showSlidingFragment(poiVideoFragment);
break;
case 4:
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
showSlidingFragment(roadFragment);
break;
case 5:
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
showSlidingFragment(otherFragment);
break;
}
frameLayout.setVisibility(View.GONE);
if (gatherGetFragment != null) {
fragmentTransaction.remove(gatherGetFragment);
}
} else if (data.what == Constant.GATHER_GET_MAP) { //地图界面点击采集 点击开始采集
PoiEntity poiEntity = (PoiEntity) data.obj; PoiEntity poiEntity = (PoiEntity) data.obj;
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putSerializable("poiEntity", poiEntity); bundle.putSerializable("poiEntity", poiEntity);
@ -1087,7 +1058,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} }
frameLayout.setVisibility(View.GONE); frameLayout.setVisibility(View.GONE);
if (gatherGetFragment != null) { if (gatherGetFragment != null) {
FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
fragmentTransaction.remove(gatherGetFragment); fragmentTransaction.remove(gatherGetFragment);
fragmentTransaction.commit();
} }
}/* else if (data.what == Constant.TREASURE_WORD) { // POI采集-移动位置 }/* else if (data.what == Constant.TREASURE_WORD) { // POI采集-移动位置
initPoiMarker((LatLng) data.obj); initPoiMarker((LatLng) data.obj);
@ -1138,7 +1111,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} else { } else {
frameLayout.setVisibility(View.GONE); frameLayout.setVisibility(View.GONE);
setMainButtonVisiable(View.VISIBLE); setMainButtonVisiable(View.VISIBLE);
FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
fragmentTransaction.remove(gatherGetFragment); fragmentTransaction.remove(gatherGetFragment);
fragmentTransaction.commit();
} }
if (bigMarker != null) { if (bigMarker != null) {
bigMarker.setVisible(false); bigMarker.setVisible(false);
@ -1230,7 +1205,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} }
frameLayout.setVisibility(View.GONE); frameLayout.setVisibility(View.GONE);
if (gatherGetFragment != null) { if (gatherGetFragment != null) {
FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
fragmentTransaction.remove(gatherGetFragment); fragmentTransaction.remove(gatherGetFragment);
fragmentTransaction.commit();
} }
} else if (data.what == Constant.POI_DRAWER) {//设置每个点的中心位置 } else if (data.what == Constant.POI_DRAWER) {//设置每个点的中心位置
LatLng latLng = (LatLng) data.obj; LatLng latLng = (LatLng) data.obj;
@ -1442,7 +1419,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
// 如果当前fragment是筛选则移除该fragment // 如果当前fragment是筛选则移除该fragment
FilterFragment filterFragments = (FilterFragment) supportFragmentManager.findFragmentByTag(FilterFragment.class.getName()); FilterFragment filterFragments = (FilterFragment) supportFragmentManager.findFragmentByTag(FilterFragment.class.getName());
if (filterFragments != null) { if (filterFragments != null) {
FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
fragmentTransaction.remove(filterFragments); fragmentTransaction.remove(filterFragments);
fragmentTransaction.commit();
} }
DialogSettings.style = DialogSettings.STYLE.STYLE_MIUI; DialogSettings.style = DialogSettings.STYLE.STYLE_MIUI;
List<ShareDialog.Item> itemList = new ArrayList<>(); List<ShareDialog.Item> itemList = new ArrayList<>();
@ -1545,7 +1524,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
* 将fragment显示到抽屉内 * 将fragment显示到抽屉内
*/ */
private void showSlidingFragment(BaseDrawerFragment fragment) { private void showSlidingFragment(BaseDrawerFragment fragment) {
fragmentTransaction = supportFragmentManager.beginTransaction(); FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
int[] deviceInfo = DensityUtil.getDeviceInfo(getActivity()); int[] deviceInfo = DensityUtil.getDeviceInfo(getActivity());
sliding_layout.setPanelHeight(deviceInfo[1] / 2); sliding_layout.setPanelHeight(deviceInfo[1] / 2);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
@ -1638,6 +1617,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
TencentMap.OnMarkerClickListener markerClickListener=new TencentMap.OnMarkerClickListener() { TencentMap.OnMarkerClickListener markerClickListener=new TencentMap.OnMarkerClickListener() {
@Override @Override
public boolean onMarkerClick(Marker marker) { public boolean onMarkerClick(Marker marker) {
FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
if (marker.getTitle() != null && !marker.getTitle().equals("")) {//是本地数据直接跳转到采集页面 if (marker.getTitle() != null && !marker.getTitle().equals("")) {//是本地数据直接跳转到采集页面
PoiEntity poiEntity = (PoiEntity) marker.getTag(); PoiEntity poiEntity = (PoiEntity) marker.getTag();
frameLayout.setVisibility(View.GONE); frameLayout.setVisibility(View.GONE);

View File

@ -38,8 +38,8 @@ public class PoiSaveUtils {
private Activity mContext; private Activity mContext;
private Gson gson; private Gson gson;
private static PoiSaveUtils instance; private static PoiSaveUtils instance;
private int anInt=0; private int anInt = 0;
private int bInt=0; private int bInt = 0;
public static PoiSaveUtils getInstance(Activity mContext) { public static PoiSaveUtils getInstance(Activity mContext) {
if (instance == null) { if (instance == null) {
@ -60,7 +60,8 @@ public class PoiSaveUtils {
if (poiEntityList == null || poiEntityList.isEmpty()) { if (poiEntityList == null || poiEntityList.isEmpty()) {
return; return;
} }
anInt = 0;
bInt = 0;
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -74,10 +75,7 @@ public class PoiSaveUtils {
} }
} }
} }
} else if (poiEntity.getType() == 6) {//面状任务 }else {//其他类型
} else {//其他类型
if (savePoiNet(poiEntity) == 200) { // 网络保存成功 if (savePoiNet(poiEntity) == 200) { // 网络保存成功
//走上传流程 //走上传流程
uploadPoiNet(poiEntity); uploadPoiNet(poiEntity);
@ -89,7 +87,7 @@ public class PoiSaveUtils {
public void run() { public void run() {
Message obtain = Message.obtain(); Message obtain = Message.obtain();
obtain.what = Constant.EVENT_STAY_REFRESH; obtain.what = Constant.EVENT_STAY_REFRESH;
obtain.obj = "提交成功"+anInt+",提交失败"+bInt; obtain.obj = "提交成功" + anInt + ",提交失败" + bInt;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
} }
}); });
@ -178,7 +176,7 @@ public class PoiSaveUtils {
Response execute = OkGoBuilder.getInstance().url(url) Response execute = OkGoBuilder.getInstance().url(url)
.Builder(mContext) .Builder(mContext)
.token(Constant.ACCESS_TOKEN).params(httpParams).getSynchronization(); .token(Constant.ACCESS_TOKEN).params(httpParams).getSynchronization();
if (execute==null){ if (execute == null) {
return -1; return -1;
} }
if (execute.code() != 200) { if (execute.code() != 200) {
@ -250,6 +248,7 @@ public class PoiSaveUtils {
return; return;
} }
ArrayList<File> photoFile = new ArrayList<>(); ArrayList<File> photoFile = new ArrayList<>();
photoFile.clear();
if (poiEntity.getPhotoInfo() != null) { if (poiEntity.getPhotoInfo() != null) {
if (poiEntity.getPhotoInfo().size() > 0) { if (poiEntity.getPhotoInfo().size() > 0) {
for (int i = 0; i < poiEntity.getPhotoInfo().size(); i++) { for (int i = 0; i < poiEntity.getPhotoInfo().size(); i++) {
@ -260,9 +259,9 @@ public class PoiSaveUtils {
} }
List<File> videoFileList = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(poiEntity.getId()); List<File> videoFileList = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(poiEntity.getId());
if (videoFileList!=null&&!videoFileList.isEmpty()) { if (videoFileList != null && !videoFileList.isEmpty()) {
List<File> txtFileList = new ArrayList<>(); List<File> txtFileList = new ArrayList<>();
for (File videoFile: videoFileList) { for (File videoFile : videoFileList) {
File file = new File(videoFile.getAbsolutePath() + ".txt"); File file = new File(videoFile.getAbsolutePath() + ".txt");
txtFileList.add(file); txtFileList.add(file);
} }
@ -287,16 +286,15 @@ public class PoiSaveUtils {
url = HttpInterface.OTHER_TASK_UPLOAD_PIC; url = HttpInterface.OTHER_TASK_UPLOAD_PIC;
} }
try { try {
HttpParams httpParams=new HttpParams(); HttpParams httpParams = new HttpParams();
httpParams.put("auditId",bodyId); httpParams.put("auditId", bodyId);
Response execute = OkGoBuilder.getInstance() Response execute = OkGoBuilder.getInstance()
.Builder(mContext) .Builder(mContext)
.url(url) .url(url)
.params(httpParams) .params(httpParams)
.token(Constant.ACCESS_TOKEN) .token(Constant.ACCESS_TOKEN)
.fileList(photoFile).postFileSynchronization(); .fileList(photoFile).postFileSynchronization();
if(execute==null){ if (execute == null) {
return; return;
} }
if (execute.code() != 200) { if (execute.code() != 200) {