修改删选界面上的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 {
compileSdkVersion 29
buildToolsVersion '29.0.2'
ndkVersion '23.0.7123448'
// ndkVersion '23.0.7123448'
defaultConfig {
applicationId "com.navinfo.outdoor"

View File

@ -72,6 +72,24 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
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
public boolean onBackPressed() {
return false;
@ -95,20 +113,7 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
protected abstract int getLayout();
public void showLoadingDialog() {
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);
initLoadingDialog();
alertDialog.show();
//initTimer();
}
@ -121,8 +126,8 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
}
public void dismissLoadingDialog() {
if (null != alertDialog && alertDialog.isShowing()) {
alertDialog.dismiss();
if (null != alertDialog) {
alertDialog.hide();
}
}
@ -153,6 +158,9 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
@Override
public void onDestroyView() {
if (alertDialog!=null) {
alertDialog.dismiss();
}
super.onDestroyView();
}
}

View File

@ -182,11 +182,12 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
poiEntity.setDist(list.get(i).getDist()+"");
poiEntity.setType(Integer.valueOf(list.get(i).getType()));
String geo = list.get(i).getGeo();
poiEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {//
LatLng latLng = GeometryTools.createLatLng(geo);
poiEntity.setX(latLng.longitude + "");
poiEntity.setY(latLng.altitude + "");
poiEntity.setY(latLng.latitude + "");
} else if (geometry.getGeometryType().equals("LineString")) {//线
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
poiEntity.setX(latLineString.get(0).longitude + "");
@ -304,22 +305,10 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
filterAdapter.setItemCLick(new FilterAdapter.ItemCLick() {
@Override
public void item(PoiEntity poiEntity) {
if (poiEntity.getTaskStatus()!=1) {
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET;
obtain.obj = poiEntity;
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);
}
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)
.params(new HttpParams("geo", encode))
.cls(GetPhoneBean.class)
.token(Constant.ACCESS_TOKEN)
.getRequest(new Callback<GetPhoneBean>() {
@Override

View File

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

View File

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