修改‘其他页面’的保存本地和上传

This commit is contained in:
md 2021-07-12 14:04:49 +08:00
parent e3201d6e1f
commit c37471f55c
3 changed files with 57 additions and 18 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

@ -269,6 +269,8 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
editOtherDescribe.setText(describe); editOtherDescribe.setText(describe);
} }
linearExist.setVisibility(View.VISIBLE); linearExist.setVisibility(View.VISIBLE);
body = showPoiEntity.getBodyId();
int station_type = showPoiEntity.getStation_type(); int station_type = showPoiEntity.getStation_type();
spinnerOther.setSelection(station_type, true); spinnerOther.setSelection(station_type, true);
if (showPoiEntity.getPhotoInfo() != null) { if (showPoiEntity.getPhotoInfo() != null) {
@ -362,11 +364,20 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (poiEntity.getTaskId() == 0) {
poiDao.insertPoiEntity(poiEntity); poiDao.insertPoiEntity(poiEntity);
} else {
poiDao.updatePoiEntity(poiEntity);
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
otherSaveByNetWork(poiEntity);
}
});
} }
}).start(); }).start();
otherSaveByNetWork(poiEntity);
// onBackPressed(); // onBackPressed();
} else { } else {
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
@ -394,12 +405,23 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
if (tagPictures != null) { if (tagPictures != null) {
otherUploadList.add(new File(tagPictures)); otherUploadList.add(new File(tagPictures));
} }
if (body!=0){ new Thread(new Runnable() {
otherUploadByNet(body,otherUploadList); @Override
}else { public void run() {
PoiEntity poiEntity = poiDao.getPoiEntity(showPoiEntity.getTaskId());
int taskStatus = poiEntity.getTaskStatus();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (taskStatus == 2) {//保存本地未提交
Toast.makeText(getActivity(), "请保存本地", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "请保存本地", Toast.LENGTH_SHORT).show();
} else if (taskStatus == 3) {//保存本地已提交
otherUploadByNet(body, otherUploadList);
} }
}
});
}
}).start();
break; break;
} }
} }
@ -458,7 +480,15 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
dismissLoadingDialog(); dismissLoadingDialog();
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
body = poiSaveBean.getBody(); body = poiSaveBean.getBody();
Log.d("TAG", " 其他其他其他其他"+poiSaveBean.getBody()); poiEntity.setTaskStatus(3);
poiEntity.setBodyId(body);
new Thread(new Runnable() {
@Override
public void run() {
poiDao.updatePoiEntity(poiEntity);
}
}).start();
// Log.d("TAG", " 其他其他其他其他" + poiSaveBean.getBody());
} }
@Override @Override

View File

@ -31,6 +31,15 @@ public class PoiEntity implements Serializable {
private String extend;//添加字段 private String extend;//添加字段
private boolean checked; private boolean checked;
private String geoWkt; // 数据的wkt private String geoWkt; // 数据的wkt
private int bodyId;//保存本地的bodyId
public int getBodyId() {
return bodyId;
}
public void setBodyId(int bodyId) {
this.bodyId = bodyId;
}
public String getGeoWkt() { public String getGeoWkt() {
return geoWkt; return geoWkt;