修改1级的部分bug,解决点位方向旋转问题

This commit is contained in:
wds 2021-07-30 19:07:48 +08:00
parent afa832e6fd
commit be6f17f4cd
29 changed files with 768 additions and 488 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

@ -25,6 +25,7 @@ import com.kongzue.dialog.v3.WaitDialog;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.util.BackHandlerHelper;
import com.navinfo.outdoor.util.FragmentBackHandler;
import com.navinfo.outdoor.util.NetWorkUtils;
public abstract class BaseFragment extends Fragment implements FragmentBackHandler {
@ -41,6 +42,7 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
return mView;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
@ -55,35 +57,41 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
return false;
}
public void initEvent(){}
public void initEvent() {
}
protected <T extends View> T findViewById(@IdRes int id){
protected <T extends View> T findViewById(@IdRes int id) {
return getView().findViewById(id);
}
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;
if (NetWorkUtils.iConnected(getContext())) { // 当前网络可用
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);
});
//loading样式
View view = LayoutInflater.from(getContext()).inflate(R.layout.loading, null);
alertDialog.setView(view);
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
} else {
Toast.makeText(getActivity(), "网络不可用", Toast.LENGTH_SHORT).show();
}
}
public void setLoadingDialogText(String s) {
//给loading 添加文字
TextView view = alertDialog.findViewById(R.id.progressBar_tx);
TextView view = alertDialog.findViewById(R.id.progressBar_tx);
view.setText(s);
}
@ -93,11 +101,21 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
}
}
protected void initMvp() { }
public void dismissDialog() {
if (!NetWorkUtils.iConnected(getContext())) { // 当前网络bu可用
Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_SHORT).show();
dismissLoadingDialog();
}
}
protected void initData() { }
protected void initMvp() {
}
protected void initView() { }
protected void initData() {
}
protected void initView() {
}
@Override
public void onDestroyView() {

View File

@ -125,6 +125,7 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
UMCrash.generateCustomLog("网络请求报错-位置CapacityEvaluationFragment"+e.getMessage(),"UmengException");
}
}).build();
dismissDialog();
}
@Override

View File

@ -105,6 +105,7 @@ public class CapacityEvaluationFragment2 extends BaseFragment implements View.On
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
@Override

View File

@ -135,6 +135,7 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
@Override
@ -227,5 +228,6 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
Log.d("TAG", "onError: " + response.message());
}
});
dismissDialog();
}
}

View File

@ -1146,7 +1146,10 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
if (requestCode == 101 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivPanorama.setTag(takePhotoPath1);
ivPanorama.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -1159,14 +1162,15 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
});
} else {
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivPanorama.setTag(takePhotoPath1);
ivPanorama.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 102 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivCoding.setTag(takePhotoPath2);
ivCoding.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -1179,14 +1183,15 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
});
} else {
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivCoding.setTag(takePhotoPath2);
ivCoding.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 103 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivEquipment.setImageBitmap(bitmap);//显示图像
ivEquipment.setTag(takePhotoPath3);
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -1199,14 +1204,15 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
});
} else {
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivEquipment.setImageBitmap(bitmap);//显示图像
ivEquipment.setTag(takePhotoPath3);
}
}*/
} else if (requestCode == 104 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivFacility.setTag(takePhotoPath4);
ivFacility.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -1219,14 +1225,15 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
});
} else {
takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivFacility.setTag(takePhotoPath4);
ivFacility.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 105 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivScutcheon.setTag(takePhotoPath5);
ivScutcheon.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -1239,14 +1246,15 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
});
} else {
takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivScutcheon.setTag(takePhotoPath5);
ivScutcheon.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 106 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
takePhotoPath6 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivDevice.setTag(takePhotoPath6);
ivDevice.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -1259,14 +1267,15 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
});
} else {
takePhotoPath6 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivDevice.setTag(takePhotoPath6);
ivDevice.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 107 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
takePhotoPath7 = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivUsable.setTag(takePhotoPath7);
ivUsable.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -1279,14 +1288,15 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
});
} else {
takePhotoPath7 = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivUsable.setTag(takePhotoPath7);
ivUsable.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 108 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
takePhotoPath8 = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivAvailable.setTag(takePhotoPath8);
ivAvailable.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -1299,14 +1309,15 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
});
} else {
takePhotoPath8 = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivAvailable.setTag(takePhotoPath8);
ivAvailable.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 109 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
takePhotoPath9 = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivParking.setImageBitmap(bitmap);//显示图像
ivParking.setTag(takePhotoPath9);
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -1319,14 +1330,15 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
});
} else {
takePhotoPath9 = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivParking.setImageBitmap(bitmap);//显示图像
ivParking.setTag(takePhotoPath9);
}
}*/
} else if (requestCode == 110 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
takePhotoPath10 = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivNumber.setImageBitmap(bitmap);//显示图像
ivNumber.setTag(takePhotoPath10);
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -1339,10 +1351,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
});
} else {
takePhotoPath10 = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivNumber.setImageBitmap(bitmap);//显示图像
ivNumber.setTag(takePhotoPath10);
}
}*/
}
}

View File

@ -619,6 +619,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
}
}).build();
dismissDialog();
}
public void initRemovePileSharePre() {
@ -688,27 +689,52 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
obtain.what = Constant.TREASURE_FRAGMENT;
obtain.obj = false;
EventBus.getDefault().post(obtain);
String name = editNameContent.getText().toString().trim();//名称
if (name == null || name.equals("")) {
Toast.makeText(getActivity(), "请输入充电站 名称", Toast.LENGTH_SHORT).show();
return;
}
if (latLng == null) {
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
return;
}
chargingStationList = new ArrayList<>();
String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama != null) {
if (tagPanorama == null) {
Toast.makeText(getContext(), "请拍照", Toast.LENGTH_SHORT).show();
return;
} else {
chargingStationList.add(new File(tagPanorama));
}
String tagName = (String) ivName.getTag();
if (tagName != null) {
if (tagName == null) {
Toast.makeText(getContext(), "请拍照", Toast.LENGTH_SHORT).show();
return;
} else {
chargingStationList.add(new File(tagName));
}
String tagInternal = (String) ivInternal.getTag();
if (tagInternal != null) {
chargingStationList.add(new File(tagInternal));
}
String tagElse = (String) ivElse.getTag();
if (tagElse != null) {
chargingStationList.add(new File(tagElse));
}
String tagScutcheon = (String) ivScutcheon.getTag();
if (tagScutcheon != null) {
chargingStationList.add(new File(tagScutcheon));
if (existence == 0) {
String tagInternal = (String) ivInternal.getTag();
if (tagInternal == null) {
Toast.makeText(getContext(), "请拍照", Toast.LENGTH_SHORT).show();
return;
} else {
chargingStationList.add(new File(tagInternal));
}
String tagElse = (String) ivElse.getTag();
if (tagElse == null) {
Toast.makeText(getContext(), "请拍照", Toast.LENGTH_SHORT).show();
return;
} else {
chargingStationList.add(new File(tagElse));
}
String tagScutcheon = (String) ivScutcheon.getTag();
if (tagScutcheon == null) {
Toast.makeText(getContext(), "请拍照", Toast.LENGTH_SHORT).show();
return;
} else {
chargingStationList.add(new File(tagScutcheon));
}
}
new Thread(new Runnable() {
@Override
@ -1035,6 +1061,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
});
}
}).start();
dismissDialog();
}
/**
@ -1093,6 +1120,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
private String initShowStation() {
@ -1242,7 +1270,10 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
if (requestCode == 101 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivPanorama.setTag(takePhotoPath);
ivPanorama.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -1255,14 +1286,15 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
});
} else {
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivPanorama.setTag(takePhotoPath);
ivPanorama.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 102 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivName.setTag(takePhotoPath);
ivName.setImageBitmap(bitmap);//显示图像
/*int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -1275,14 +1307,15 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
});
} else {
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivName.setTag(takePhotoPath);
ivName.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 103 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivInternal.setTag(takePhotoPath);
ivInternal.setImageBitmap(bitmap);//显示图像
/*int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -1295,14 +1328,15 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
});
} else {
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivInternal.setTag(takePhotoPath);
ivInternal.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 104 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivElse.setTag(takePhotoPath);
ivElse.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -1315,14 +1349,15 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
});
} else {
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivElse.setTag(takePhotoPath);
ivElse.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 105 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivScutcheon.setTag(takePhotoPath);
ivScutcheon.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -1335,10 +1370,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
});
} else {
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivScutcheon.setTag(takePhotoPath);
ivScutcheon.setImageBitmap(bitmap);//显示图像
}
}*/
}
}
@ -1413,9 +1446,10 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity != null && poiDaoPoiEntity.getMemo() == null) {
poiDao.deletePoiEntity(poiDaoPoiEntity);
chargingPileDao.deleteChargingFidPileEntity(showPoiEntity.getId());
if (poiDaoPoiEntity != null) {
if (poiDaoPoiEntity.getTaskStatus()==5){
poiDao.deletePoiEntity(poiDaoPoiEntity);
}
}
}
}).start();

View File

@ -87,6 +87,7 @@ public class EventPrefectureFragment extends BaseFragment implements View.OnClic
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
// private void initEventPrefecture(TaskPrefectureBean taskPrefectureBean, boolean start) {

View File

@ -118,11 +118,11 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
} else {
tvMoney.setText("" + poiEntity.getPrecision());
}
if (poiEntity !=null){
if (poiEntity.getDescribe()!=null&&!"".equals(poiEntity.getDescribe())) {
if (poiEntity != null) {
if (poiEntity.getDescribe() != null && !"".equals(poiEntity.getDescribe())) {
tvDescribe.setText("任务描述:" + poiEntity.getDescribe());
}
if (poiEntity.getCreateTime()!=null&&!"".equals(poiEntity.getCreateTime())) {
if (poiEntity.getCreateTime() != null && !"".equals(poiEntity.getCreateTime())) {
tvTime.setText("到期时间:" + poiEntity.getCreateTime());
}
}
@ -132,13 +132,13 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
tvDistance.setText("距离:" + format5(Double.valueOf(poiEntity.getDist()) / 1000) + "km");
}
if (poiEntity.getTaskStatus()<2){
if (poiEntity.getTaskStatus() < 2) {
double latitude = Constant.currentLocation.getLatitude();
double longitude = Constant.currentLocation.getLongitude();
LatLng startLatLng = new LatLng(latitude, longitude); //用户当前位置
LatLng endLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
double v = GeometryTools.distanceToDouble(startLatLng, endLatLng);
if (v>5000){
if (v > 5000) {
Message obtain = Message.obtain();
obtain.what = Constant.EVENT_WORK_UNPOLYGON;
obtain.obj = true;
@ -147,8 +147,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}
}
int taskStatus = poiEntity.getTaskStatus();
initViewByTaskStatus(taskStatus);
@ -194,7 +192,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (poiEntity != null) {
int type = poiEntity.getType();
if (type == 6) {
initUnPolygonTask(HttpInterface.UNRECEIVED_POLYGON_TASK, poiEntity.getTaskId(),poiEntity);
initUnPolygonTask(HttpInterface.UNRECEIVED_POLYGON_TASK, poiEntity.getTaskId(), poiEntity);
} else {
new Thread(new Runnable() {
@Override
@ -218,17 +216,17 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (poiEntity != null) {
int type = poiEntity.getType();
if (type == 6) {//面状任务的领取类型
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), false,poiEntity);
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), false, poiEntity);
} else if (type == 1) {//poi的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), false,poiEntity);
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), false, poiEntity, 1);
} else if (type == 2) {//充电站的领取类型
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), false,poiEntity);
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), false, 1);
} else if (type == 3) {//poi录像的领取类型
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK,poiEntity.getTaskId(),false,poiEntity);
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK, poiEntity.getTaskId(), false, poiEntity, 1);
} else if (type == 4) {//道路的领取类型
taskByNet(HttpInterface.RECEIVED_ROAD_TASK,poiEntity.getTaskId(),false,poiEntity);
taskByNet(HttpInterface.RECEIVED_ROAD_TASK, poiEntity.getTaskId(), false, poiEntity, 1);
} else if (type == 5) {//其他的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), false, poiEntity);
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), false, poiEntity, 1);
}
}
break;
@ -248,23 +246,23 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
initCompleteTask(HttpInterface.COMPLETE, poiEntity.getTaskId(),true, taskIdPoiEntity);
initCompleteTask(HttpInterface.COMPLETE, poiEntity.getTaskId(), true, taskIdPoiEntity);
}
});
}
}).start();
}
} else if (type== 1) {//poi的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), true, poiEntity);
} else if (type== 2) {//充电站的领取类型
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), true, poiEntity);
} else if (type== 3) {//poi录像的领取类型
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK,poiEntity.getTaskId(),true, poiEntity);
} else if (type == 1) {//poi的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), true, poiEntity, 5);
} else if (type == 2) {//充电站的领取类型
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), true, 5);
} else if (type == 3) {//poi录像的领取类型
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK, poiEntity.getTaskId(), true, poiEntity, 5);
} else if (type == 4) {//道路的领取类型
taskByNet(HttpInterface.RECEIVED_ROAD_TASK,poiEntity.getTaskId(),true, poiEntity);
taskByNet(HttpInterface.RECEIVED_ROAD_TASK, poiEntity.getTaskId(), true, poiEntity, 5);
} else if (type == 5) {//其他的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), true, poiEntity);
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), true, poiEntity, 5);
}
}
break;
@ -294,10 +292,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}
/**
* @param url 筛选充电站领取任务
* @param poiEntity
* @param url 筛选充电站领取任务
* @param
*/
private void chargingTaskByWork(String url, int taskId, boolean isSaver, PoiEntity poiEntity) {
private void chargingTaskByWork(String url, int taskId, boolean isSaver,int statusId) {
showLoadingDialog();
OkGoBuilder.getInstance()
.Builder(getActivity())
@ -308,85 +306,90 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
@Override
public void onSuccess(ReceivedBean response, int id) {
dismissLoadingDialog();
if (response.getCode() == 200){
if (response.getCode() == 200) {
ReceivedBean.BodyBean stationBean = response.getBody();
PoiEntity chargingStationEntity = new PoiEntity();
if (stationBean!=null){
chargingStationEntity.setTaskId(taskId);
chargingStationEntity.setStation_type(stationBean.getSptype());
chargingStationEntity.setName(stationBean.getName());
chargingStationEntity.setDescribe(stationBean.getMemo());
chargingStationEntity.setCreateTime(stationBean.getEndDate());
chargingStationEntity.setPrecision(stationBean.getPrice() + "");
chargingStationEntity.setAddress(stationBean.getAddress());
chargingStationEntity.setTelPhone(stationBean.getTelephone() + "");
chargingStationEntity.setType(Integer.valueOf(stationBean.getType()));
chargingStationEntity.setTaskStatus(1);
chargingStationEntity.setIsLocalData(1);
String geo = stationBean.getGeo();
chargingStationEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {//
LatLng latLng = GeometryTools.createLatLng(geo);
chargingStationEntity.setX(latLng.longitude + "");
chargingStationEntity.setY(latLng.latitude + "");
} else if (geometry.getGeometryType().equals("LineString")) {//线
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
chargingStationEntity.setX(latLineString.get(0).longitude + "");
chargingStationEntity.setY(latLineString.get(0).latitude + "");
} else if (geometry.getGeometryType().equals("Polygon")) {//
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
chargingStationEntity.setX(latPolygon.get(0).longitude + "");
chargingStationEntity.setY(latPolygon.get(0).latitude + "");
}
}
//充电桩
List<ReceivedBean.BodyBean.CsTaskListBean> csTaskList = response.getBody().getCsTaskList();
if (csTaskList!=null&&!csTaskList.isEmpty()){
ChargingPileEntity[] chargingPileEntityList= new ChargingPileEntity[csTaskList.size()];
for (int i = 0; i < csTaskList.size(); i++) {
ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
chargingPileEntity.setFid(chargingStationEntity.getId());
chargingPileEntity.setName(csTaskList.get(i).getName());
chargingPileEntity.setMemo(csTaskList.get(i).getAddress());
chargingPileEntity.setP(csTaskList.get(i).getGeo());
chargingPileEntityList[i]=chargingPileEntity;
}
if (stationBean != null) {
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getActivity(), chargingPileEntityList);
PoiEntity taskIdPoiEntity = poiDao.getTaskIdPoiEntity(taskId);
if (taskIdPoiEntity == null) {
PoiEntity chargingStationEntity = new PoiEntity();
chargingStationEntity.setTaskId(taskId);
chargingStationEntity.setStation_type(stationBean.getSptype());
chargingStationEntity.setName(stationBean.getName());
chargingStationEntity.setDescribe(stationBean.getMemo());
chargingStationEntity.setCreateTime(stationBean.getEndDate());
chargingStationEntity.setPrecision(stationBean.getPrice() + "");
chargingStationEntity.setAddress(stationBean.getAddress());
chargingStationEntity.setTelPhone(stationBean.getTelephone() + "");
chargingStationEntity.setType(Integer.valueOf(stationBean.getType()));
chargingStationEntity.setTaskStatus(statusId);
chargingStationEntity.setIsLocalData(1);
String geo = stationBean.getGeo();
chargingStationEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {//
LatLng latLng = GeometryTools.createLatLng(geo);
chargingStationEntity.setX(latLng.longitude + "");
chargingStationEntity.setY(latLng.latitude + "");
} else if (geometry.getGeometryType().equals("LineString")) {//线
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
chargingStationEntity.setX(latLineString.get(0).longitude + "");
chargingStationEntity.setY(latLineString.get(0).latitude + "");
} else if (geometry.getGeometryType().equals("Polygon")) {//
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
chargingStationEntity.setX(latPolygon.get(0).longitude + "");
chargingStationEntity.setY(latPolygon.get(0).latitude + "");
}
//充电桩
List<ReceivedBean.BodyBean.CsTaskListBean> csTaskList = response.getBody().getCsTaskList();
if (csTaskList != null && !csTaskList.isEmpty()) {
ChargingPileEntity[] chargingPileEntityList = new ChargingPileEntity[csTaskList.size()];
for (int i = 0; i < csTaskList.size(); i++) {
ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
chargingPileEntity.setFid(chargingStationEntity.getId());
chargingPileEntity.setName(csTaskList.get(i).getName());
chargingPileEntity.setMemo(csTaskList.get(i).getAddress());
chargingPileEntity.setP(csTaskList.get(i).getGeo());
chargingPileEntityList[i] = chargingPileEntity;
}
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getActivity(), chargingPileEntityList);
}
//获取当前位置的marker
senMessageMarker(chargingStationEntity.getType(), chargingStationEntity.getY(), chargingStationEntity.getX());
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(),chargingStationEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
initViewByTaskStatus(1);
if (isSaver) {
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET_MAP;
obtain.obj = chargingStationEntity;
EventBus.getDefault().post(obtain);
}
}
});
}else{
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
initViewByTaskStatus(1);
if (isSaver) {
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET_MAP;
obtain.obj = taskIdPoiEntity;
EventBus.getDefault().post(obtain);
}
}
});
}
}
}).start();
}
//获取当前位置的marker
senMessageMarker(chargingStationEntity.getType(),chargingStationEntity.getY(),chargingStationEntity.getX());
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), chargingStationEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
poiEntity.setTaskStatus(1);
initViewByTaskStatus(1);
if (isSaver) {
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET_MAP;
obtain.obj = chargingStationEntity;
EventBus.getDefault().post(obtain);
}
}
});
}
}).start();
}else {
Toast.makeText(getActivity(), "本任务已锁定", Toast.LENGTH_SHORT).show();
}
}
@Override
@ -395,11 +398,12 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
/**
* @param url 面妆任务领取任务
* @param url 面妆任务领取任务
* @param poiEntity
*/
private void initPolygonTask(String url, int taskId, boolean aBoolean, PoiEntity poiEntity) {
@ -420,7 +424,7 @@ 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();
if (listBean!=null){
if (listBean != null) {
polygonEntity.setTaskId(listBean.getId());
polygonEntity.setName(listBean.getName());
polygonEntity.setType(Integer.valueOf(listBean.getType()));
@ -472,10 +476,11 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
/**
* @param url 面妆任务结束领取
* @param url 面妆任务结束领取
* @param poiEntity
*/
private void initUnPolygonTask(String url, int taskId, PoiEntity poiEntity) {
@ -521,12 +526,12 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
/**
* @param url 面妆任务立即采集
* @param b
*
*/
private void initCompleteTask(String url, int taskId, boolean b, PoiEntity poiEntity) {
if (taskId == 0) {
@ -552,7 +557,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
initViewByTaskStatus(1);
initViewByTaskStatus(1);
Message obtain = Message.obtain();
obtain.what = Constant.EVENT_WORK_UNPOLYGON;
obtain.obj = true;
@ -571,6 +576,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
/**
@ -620,14 +626,15 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
/**
* @param url poi类型对应的url
* @param url poi类型对应的url
* @param poiEntity
*/
private void receivedTaskByNet(String url, int taskId, boolean isSaver, PoiEntity poiEntity) {
private void receivedTaskByNet(String url, int taskId, boolean isSaver, PoiEntity poiEntity, int statusId) {
showLoadingDialog();
OkGoBuilder.getInstance()
.Builder(getActivity())
@ -638,62 +645,73 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
@Override
public void onSuccess(ReceivedPoiBean response, int id) {
dismissLoadingDialog();
if (response.getCode()==200){
ReceivedPoiBean.BodyBean listBean = response.getBody();
PoiEntity poiListEntity = new PoiEntity();
poiListEntity.setTaskId(listBean.getId());
poiListEntity.setName(listBean.getName());
poiListEntity.setDescribe(listBean.getMemo());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setType(Integer.valueOf(listBean.getType()));
poiListEntity.setIsExclusive(listBean.getIsExclusive());
poiListEntity.setTaskStatus(1);
poiListEntity.setIsLocalData(1);
String geo = listBean.getGeo();
poiListEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {//
LatLng latLng = GeometryTools.createLatLng(geo);
poiListEntity.setX(latLng.longitude + "");
poiListEntity.setY(latLng.latitude + "");
} else if (geometry.getGeometryType().equals("LineString")) {//线
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
poiListEntity.setX(latLineString.get(0).longitude + "");
poiListEntity.setY(latLineString.get(0).latitude + "");
} else if (geometry.getGeometryType().equals("Polygon")) {//
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
poiListEntity.setX(latPolygon.get(0).longitude + "");
poiListEntity.setY(latPolygon.get(0).latitude + "");
}
// 通知地图界面显示当前编辑数据的marker
senMessageMarker(poiEntity.getType(),poiEntity.getY(),poiEntity.getX());
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
poiEntity.setTaskStatus(1);
initViewByTaskStatus(1);
// btnGetTask.setVisibility(View.GONE);
// btnCancelGet.setVisibility(View.VISIBLE);
// btnFinishGather.setVisibility(View.GONE);
// btnGather.setVisibility(View.VISIBLE);
if (isSaver) {
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET_MAP;
obtain.obj = poiListEntity;
EventBus.getDefault().post(obtain);
if (response.getCode() == 200) {
ReceivedPoiBean.BodyBean body = response.getBody();
if (body != null) {
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity taskIdPoiEntity = poiDao.getTaskIdPoiEntity(taskId);
if (taskIdPoiEntity == null) {//数据库没有这条数据
ReceivedPoiBean.BodyBean listBean = response.getBody();
PoiEntity poiListEntity = new PoiEntity();
poiListEntity.setTaskId(taskId);
poiListEntity.setName(listBean.getName());
poiListEntity.setDescribe(listBean.getMemo());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setType(Integer.valueOf(listBean.getType()));
poiListEntity.setIsExclusive(listBean.getIsExclusive());
poiListEntity.setTaskStatus(statusId);
poiListEntity.setIsLocalData(1);
String geo = listBean.getGeo();
poiListEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {//
LatLng latLng = GeometryTools.createLatLng(geo);
poiListEntity.setX(latLng.longitude + "");
poiListEntity.setY(latLng.latitude + "");
} else if (geometry.getGeometryType().equals("LineString")) {//线
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
poiListEntity.setX(latLineString.get(0).longitude + "");
poiListEntity.setY(latLineString.get(0).latitude + "");
} else if (geometry.getGeometryType().equals("Polygon")) {//
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
poiListEntity.setX(latPolygon.get(0).longitude + "");
poiListEntity.setY(latPolygon.get(0).latitude + "");
}
// 通知地图界面显示当前编辑数据的marker
senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
initViewByTaskStatus(1);
if (isSaver) {
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET_MAP;
obtain.obj = poiListEntity;
EventBus.getDefault().post(obtain);
}
}
});
} else {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
initViewByTaskStatus(1);
if (isSaver) {
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET_MAP;
obtain.obj = taskIdPoiEntity;
EventBus.getDefault().post(obtain);
}
}
});
}
});
}
}).start();
}
}).start();
}
}
}
@ -704,6 +722,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
Toast.makeText(getContext(), e.getMessage() + "", Toast.LENGTH_SHORT).show();
}
}).build();
dismissDialog();
}
@Override
@ -721,10 +740,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}
/**
* @param url 不同任务类型对应的url
* @param url 不同任务类型对应的url
* @param poiEntity
*/
private void taskByNet(String url, int taskId, boolean isSaver, PoiEntity poiEntity) {
private void taskByNet(String url, int taskId, boolean isSaver, PoiEntity poiEntity, int statusId) {
showLoadingDialog();
OkGoBuilder.getInstance()
.Builder(getActivity())
@ -735,60 +754,77 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
@Override
public void onSuccess(TaskByNetBean response, int id) {
dismissLoadingDialog();
if (response.getCode()==200){
if (response.getCode() == 200) {
TaskByNetBean.BodyBean listBean = response.getBody();
PoiEntity poiListEntity = new PoiEntity();
if (listBean!=null){
poiListEntity.setTaskId(taskId);
poiListEntity.setName(listBean.getName());
poiListEntity.setDescribe(listBean.getMemo());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setType(Integer.valueOf(listBean.getType()));
poiListEntity.setPrecision(String.valueOf(listBean.getPrice()));
poiListEntity.setIsExclusive(listBean.getIsExclusive());
poiListEntity.setTaskStatus(1);
poiListEntity.setIsLocalData(1);
String geo = listBean.getGeo();
poiListEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {//
LatLng latLng = GeometryTools.createLatLng(geo);
poiListEntity.setX(latLng.longitude + "");
poiListEntity.setY(latLng.latitude + "");
} else if (geometry.getGeometryType().equals("LineString")) {//线
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
poiListEntity.setX(latLineString.get(0).longitude + "");
poiListEntity.setY(latLineString.get(0).latitude + "");
} else if (geometry.getGeometryType().equals("Polygon")) {//
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
poiListEntity.setX(latPolygon.get(0).longitude + "");
poiListEntity.setY(latPolygon.get(0).latitude + "");
}
if (listBean != null) {
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity taskIdPoiEntity = poiDao.getTaskIdPoiEntity(taskId);
if (taskIdPoiEntity == null) {//数据库没有这条数据
PoiEntity poiListEntity = new PoiEntity();
poiListEntity.setTaskId(taskId);
poiListEntity.setName(listBean.getName());
poiListEntity.setDescribe(listBean.getMemo());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setType(Integer.valueOf(listBean.getType()));
poiListEntity.setPrecision(String.valueOf(listBean.getPrice()));
poiListEntity.setIsExclusive(listBean.getIsExclusive());
poiListEntity.setTaskStatus(statusId);
poiListEntity.setIsLocalData(1);
String geo = listBean.getGeo();
poiListEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {//
LatLng latLng = GeometryTools.createLatLng(geo);
poiListEntity.setX(latLng.longitude + "");
poiListEntity.setY(latLng.latitude + "");
} else if (geometry.getGeometryType().equals("LineString")) {//线
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
poiListEntity.setX(latLineString.get(0).longitude + "");
poiListEntity.setY(latLineString.get(0).latitude + "");
} else if (geometry.getGeometryType().equals("Polygon")) {//
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
poiListEntity.setX(latPolygon.get(0).longitude + "");
poiListEntity.setY(latPolygon.get(0).latitude + "");
}
// 通知地图界面显示当前编辑数据的marker
senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
initViewByTaskStatus(1);
if (isSaver) {
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET_MAP;
obtain.obj = poiListEntity;
EventBus.getDefault().post(obtain);
}
}
});
} else {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
initViewByTaskStatus(1);
if (isSaver) {
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET_MAP;
obtain.obj = taskIdPoiEntity;
EventBus.getDefault().post(obtain);
}
}
});
}
}
}).start();
}
//获取当前位置的marker
senMessageMarker(poiListEntity.getType(),poiListEntity.getY(),poiListEntity.getX());
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
poiEntity.setTaskStatus(1);
initViewByTaskStatus(1);
if (isSaver) {
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET_MAP;
obtain.obj = poiListEntity;
EventBus.getDefault().post(obtain);
}
}
});
}
}).start();
}
}
@Override
@ -798,7 +834,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
Toast.makeText(getContext(), e.getMessage() + "", Toast.LENGTH_SHORT).show();
}
}).build();
dismissDialog();
}
public static String format5(double value) {
return String.format("%.2f", value).toString();
}

View File

@ -208,6 +208,7 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
Log.d("TAG", "onError: " + response.message());
}
});
dismissDialog();
}
@Override

View File

@ -82,6 +82,7 @@ public class IssueFragment extends BaseFragment implements View.OnClickListener
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
@Override

View File

@ -107,6 +107,7 @@ public class MessageFragment extends BaseFragment implements View.OnClickListene
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
@Override
protected void initData() {

View File

@ -124,6 +124,7 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
@Override

View File

@ -86,10 +86,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
private PoiEntity showPoiEntity;
private LatLng latLng;
private int station_type = 5;
private String takePhotoPath;
private String takePhotoPath2;
private ArrayList<File> otherUploadList;
private CheckBox checkPot;
@ -291,9 +287,13 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
editOtherDescribe.setText(describe);
}
int station_type = showPoiEntity.getStation_type();
spinnerOther.setSelection(station_type, true);
if (station_type==5){
spinnerOther.setSelection(0, true);
}else if (station_type==6){
spinnerOther.setSelection(1, true);
}else if (station_type==7){
spinnerOther.setSelection(2, true);
}
if (showPoiEntity.getPhotoInfo() != null) {
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
@ -333,12 +333,27 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
break;
case R.id.btn_other_uploading:
otherUploadList = new ArrayList<>();
String name = editTaskName.getText().toString().trim();//名称
if (name == null || name.equals("")) {
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
return;
}
if (latLng == null) {
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
return;
}
String tagPicture = (String) ivPicture.getTag();
if (tagPicture != null) {
if (tagPicture == null) {
Toast.makeText(getActivity(), "请拍照", Toast.LENGTH_SHORT).show();
return;
} else {
otherUploadList.add(new File(tagPicture));
}
String tagPictures = (String) ivPictures.getTag();
if (tagPictures != null) {
if (tagPictures == null) {
Toast.makeText(getActivity(), "请拍照", Toast.LENGTH_SHORT).show();
return;
} else {
otherUploadList.add(new File(tagPictures));
}
new Thread(new Runnable() {
@ -489,6 +504,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
Log.d("TAG", "onError: " + poiUploadBeanResponse.code() + "");
}
});
dismissDialog();
}
private void otherSaveByNetWork(PoiEntity poiEntity,boolean isLocal) {
@ -539,6 +555,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
/**
@ -600,7 +617,11 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
if (requestCode == 101 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
//照片路径
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivPicture.setTag(takePhotoPath);
ivPicture.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -613,16 +634,17 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
}
});
} else {
//照片路径
takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivPicture.setTag(takePhotoPath);
ivPicture.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 102 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
//照片路径
String takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivPictures.setTag(takePhotoPath2);
ivPictures.setImageBitmap(bitmap);//显示图像
/*int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -635,11 +657,8 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
}
});
} else {
//照片路径
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivPictures.setTag(takePhotoPath2);
ivPictures.setImageBitmap(bitmap);//显示图像
}
}*/
}
}
@ -652,8 +671,10 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity!=null&&poiDaoPoiEntity.getMemo() == null) {
poiDao.deletePoiEntity(poiDaoPoiEntity);
if (poiDaoPoiEntity!=null) {
if (poiDaoPoiEntity.getTaskStatus()==5){
poiDao.deletePoiEntity(poiDaoPoiEntity);
}
}
}
}).start();

View File

@ -57,6 +57,7 @@ import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.ui.view.ContactView;
import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.NetWorkUtils;
import com.navinfo.outdoor.util.PhotoPathUtil;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
@ -246,6 +247,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}
//拍照长按删除
private void onLongDel() {
rlPanorama.setOnLongClickListener(new View.OnLongClickListener() {
@ -342,7 +344,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
String memo = showPoiEntity.getMemo();//任务描述
if (memo != null && !memo.equals("")) {
editDescribe.setText(memo+"");
editDescribe.setText(memo + "");
}
String telPhone = showPoiEntity.getTelPhone();
if (telPhone != null && !telPhone.equals("")) {
@ -460,6 +462,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
}
}).build();
dismissDialog();
}
@ -509,11 +512,26 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
case R.id.btn_uploading:
poiPicList = new ArrayList<>();
String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama != null) {
String name = editNameContent.getText().toString().trim();//名称
if (name == null || name.equals("")) {
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
return;
}
if (latLng == null) {
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
return;
}
if (tagPanorama == null) {
Toast.makeText(getActivity(), "请拍照", Toast.LENGTH_SHORT).show();
return;
} else {
poiPicList.add(new File(tagPanorama));
}
String tagName = (String) ivName.getTag();
if (tagName != null) {
if (tagName == null) {
Toast.makeText(getActivity(), "请拍照", Toast.LENGTH_SHORT).show();
return;
} else {
poiPicList.add(new File(tagName));
}
@ -577,7 +595,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
showLoadingDialog();
HttpParams httpParams = new HttpParams();
httpParams.put("geo", poiEntity.getGeoWkt());
httpParams.put("name",editNameContent.getText().toString());
httpParams.put("name", editNameContent.getText().toString());
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.TASK_NAME)
@ -589,7 +607,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
public void onSuccess(TaskNameBean taskNameBean, int id) {
dismissLoadingDialog();
Toast.makeText(getContext(), "存在类似名称"+taskNameBean.getBody(), Toast.LENGTH_SHORT).show();
Toast.makeText(getContext(), "存在类似名称" + taskNameBean.getBody(), Toast.LENGTH_SHORT).show();
}
@Override
@ -599,6 +617,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
public void initPoiSaveLocal(boolean isLocal) {
@ -705,6 +724,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}
}
});
}
private void poiUploadByNetWork(int body, ArrayList<File> poiPicList) {
@ -749,6 +769,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
Log.d("TAG", "onError: " + response.message() + "");
}
});
dismissDialog();
}
private void poiSaveByNet(PoiEntity poiEntity, boolean isLocal) {
@ -800,6 +822,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
/**
@ -887,7 +910,10 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
if (requestCode == 101 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
String takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivPanorama.setTag(takePhotoPath1);
ivPanorama.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -900,14 +926,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}
});
} else {
String takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivPanorama.setTag(takePhotoPath1);
ivPanorama.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 102 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
String takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivName.setTag(takePhotoPath2);
ivName.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -920,14 +947,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}
});
} else {
String takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivName.setTag(takePhotoPath2);
ivName.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 103 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
String takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivInternal.setTag(takePhotoPath3);
ivInternal.setImageBitmap(bitmap);//显示图像
/*int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -940,14 +968,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}
});
} else {
String takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivInternal.setTag(takePhotoPath3);
ivInternal.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 104 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
String takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivCard.setTag(takePhotoPath4);
ivCard.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -960,14 +989,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}
});
} else {
String takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivCard.setTag(takePhotoPath4);
ivCard.setImageBitmap(bitmap);//显示图像
}
}*/
} else if (requestCode == 105 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
String takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivElse.setTag(takePhotoPath5);
ivElse.setImageBitmap(bitmap);//显示图像
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
@ -979,11 +1009,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
return false;
}
});
} else {
String takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivElse.setTag(takePhotoPath5);
ivElse.setImageBitmap(bitmap);//显示图像
}
} else {}*/
}
}
@ -1003,8 +1030,11 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity!=null&&poiDaoPoiEntity.getMemo() == null) {
poiDao.deletePoiEntity(poiDaoPoiEntity);
if (poiDaoPoiEntity != null ) {
if (poiDaoPoiEntity.getTaskStatus()==5){
poiDao.deletePoiEntity(poiDaoPoiEntity);
}
}
}
}).start();

View File

@ -286,26 +286,29 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
videoFileList.add(videoFile);
File file = new File(videoFile.getPath()+".txt");
videoFileList.add(file);
}
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
ZipUtil.zipFiles(videoFileList, fileZip, null);
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
initPoiSaveLocal(true);
} else {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
}
});
}
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
ZipUtil.zipFiles(videoFileList, fileZip, null);
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
initPoiSaveLocal(true);
} else {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
}
});
}
}
}).start();
}
}).start();
}else {
Toast.makeText(getContext(), "请录像", Toast.LENGTH_SHORT).show();
return;
}
break;
}
}
@ -362,11 +365,12 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
poiEntity.setTaskId(showPoiEntity.getTaskId());
}
}
if (ivPoiVideoPicture.getTag() == null) {
File videoFile = (File) ivPoiVideoPicture.getTag();
if (videoFile == null ) {
Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
return;
} else {
File videoFile = (File) ivPoiVideoPicture.getTag();
String path = videoFile.getPath() + ".txt";
poiEntity.setPhoto(videoFile.getAbsolutePath());
List<String> strings = FileUtils.readFileToList(path, "utf-8");
@ -473,6 +477,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
Log.d("TAG", "onError: " + response.code() + "");
}
});
dismissDialog();
}
private void poiVideoSave(PoiEntity poiEntity, boolean isLocal) {
@ -527,6 +532,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
@Override
@ -634,8 +640,10 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity!=null&&poiDaoPoiEntity.getMemo() == null) {
poiDao.deletePoiEntity(poiDaoPoiEntity);
if (poiDaoPoiEntity!=null) {
if (poiDaoPoiEntity.getTaskStatus()==5){
poiDao.deletePoiEntity(poiDaoPoiEntity);
}
}
}
}).start();

View File

@ -267,26 +267,30 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
videoFileList.add(videoFile);
File file = new File(videoFile.getPath() + ".txt");
videoFileList.add(file);
}
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
ZipUtil.zipFiles(videoFileList, fileZip, null);
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
initPoiSaveLocal(true);
} else {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
}
});
}
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
ZipUtil.zipFiles(videoFileList, fileZip, null);
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
initPoiSaveLocal(true);
} else {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
}
});
}
}
}).start();
}else {
Toast.makeText(getContext(), "请录像", Toast.LENGTH_SHORT).show();
return;
}
}
}).start();
break;
}
@ -454,6 +458,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
Log.d("TAG", "onError: " + response.code() + "");
}
});
dismissDialog();
}
private void roadSaveBetWork(PoiEntity poiEntity, boolean isLocal) {
@ -509,6 +514,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
@Override
@ -617,14 +623,16 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
if (EventBus.getDefault().isRegistered(this))//加上判断
EventBus.getDefault().unregister(this);
super.onDestroy();
// new Thread(new Runnable() {
// @Override
// public void run() {
// PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
// if (poiDaoPoiEntity!=null&&poiDaoPoiEntity.getName() == null) {
// poiDao.deletePoiEntity(poiDaoPoiEntity);
// }
// }
// }).start();
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity!=null) {
if (poiDaoPoiEntity.getTaskStatus()==5){
poiDao.deletePoiEntity(poiDaoPoiEntity);
}
}
}
}).start();
}
}

View File

@ -133,6 +133,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
dismissLoadingDialog();
refreshData();
}
}

View File

@ -121,6 +121,7 @@ public class TaskExplainFragment extends BaseFragment implements View.OnClickLis
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}

View File

@ -114,6 +114,7 @@ public class TaskExplainFragment2 extends BaseFragment implements View.OnClickLi
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
@Override

View File

@ -122,6 +122,7 @@ public class TaskPrefectureFragment extends BaseFragment implements View.OnClick
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
// private void initTaskSpecification(TaskPrefectureBean taskPrefectureBean, boolean start) {

View File

@ -45,6 +45,7 @@ import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment;
import com.navinfo.outdoor.base.BaseFragment;
import com.navinfo.outdoor.bean.JobSearchBean;
import com.navinfo.outdoor.bean.RoadExtend;
import com.navinfo.outdoor.http.DialogCallback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.room.ChargingPileEntity;
@ -244,8 +245,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
case 1:
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
showSlidingFragment(poiFragment);
break;
case 2:
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
@ -482,20 +481,21 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Log.d("TAG", "onError: " + response.message() + "");
}
});
dismissDialog();
}
public void initMarker(PoiEntity poiEntity) {
sliding_layout.setPanelHeight(0);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
LatLng latLng = new LatLng();
latLng.setLongitude(Double.parseDouble( poiEntity.getX()));
latLng.setLongitude(Double.parseDouble(poiEntity.getX()));
latLng.setLatitude(Double.parseDouble(poiEntity.getY()));
if (bigMarker==null){
if (bigMarker == null) {
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bag);
bigMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
}else {
} else {
bigMarker.setPosition(latLng);
}
bigMarker.setVisible(true);
@ -782,7 +782,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
gatherGetFragment = GatherGetFragment.newInstance(bundle);
fragmentTransaction.replace(R.id.frame_layout, gatherGetFragment);
fragmentTransaction.commit();
// 如果当前fragment是筛选则移除该fragment
FilterFragment filterFragment = (FilterFragment) supportFragmentManager.findFragmentByTag(FilterFragment.class.getName());
if (filterFragment != null) {
@ -817,7 +816,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
}
frameLayout.setVisibility(View.GONE);
if (gatherGetFragment!=null){
if (gatherGetFragment != null) {
fragmentTransaction.remove(gatherGetFragment);
}
} else if (data.what == Constant.GATHER_GET_MAP) { //地图界面点击采集 点击开始采集
@ -848,7 +847,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
}
frameLayout.setVisibility(View.GONE);
if (gatherGetFragment!=null){
if (gatherGetFragment != null) {
fragmentTransaction.remove(gatherGetFragment);
}
} else if (data.what == Constant.FILTER_LIST) { // 筛选列表所有数据地图显示
@ -883,15 +882,15 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
frameLayout.setVisibility(View.GONE);
sliding_layout.setPanelHeight(0);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
if (markerPoi != null) {
markerPoi.remove();
}
if (markerPile!=null){
markerPile.remove();
}
if (bigMarker!=null){
bigMarker.setVisible(false);
}
}
if (markerPoi != null) {
markerPoi.remove();
}
if (markerPile != null) {
markerPile.remove();
}
if (bigMarker != null) {
bigMarker.setVisible(false);
}
} else if (data.what == Constant.MAIN_BUTTON_VISIABLE) {//控制主界面各个按钮显隐状态的what值
setMainButtonVisiable((Integer) data.obj);
@ -908,12 +907,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
sliding_layout.setPanelHeight(1000);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
} else {
setMainButtonVisiable(View.VISIBLE);
frameLayout.setVisibility(View.GONE);
fragmentTransaction.remove(gatherGetFragment);
if (bigMarker!=null){
bigMarker.setVisible(false);
}
}
if (bigMarker != null) {
bigMarker.setVisible(false);
}
} else if (data.what == Constant.CHARGING_STATION) {//充电站的充电桩-新增
Bundle bundle = new Bundle();
@ -956,13 +954,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
LatLng latLng = (LatLng) data.obj;
int type = data.arg1;
showPoiMarkerByType(type, latLng);
} else if (data.what == Constant.EVENT_WHAT_COMPLETE_TASK){
// 如果当前fragment是筛选则移除该fragment
FilterFragment filterFragment = (FilterFragment) supportFragmentManager.findFragmentByTag(FilterFragment.class.getName());
if (filterFragment != null) {
fragmentTransaction.remove(filterFragment);
//fragmentTransaction.commit();
}
} else if (data.what == Constant.EVENT_WHAT_COMPLETE_TASK) {
initRemoveFragment();
PoiEntity poiEntity = (PoiEntity) data.obj;
Bundle bundle = new Bundle();
bundle.putBoolean("isSliding", true); // 通知抽屉不收回
@ -990,22 +983,48 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
}
frameLayout.setVisibility(View.GONE);
}else if (data.what==Constant.EVENT_WORK_UNPOLYGON){//面妆任务点击立即采集或者结束采集需要回到寻宝界面
if ((boolean)data.obj){
if (gatherGetFragment != null) {
fragmentTransaction.remove(gatherGetFragment);
}
} else if (data.what == Constant.EVENT_WORK_UNPOLYGON) {//面妆任务点击立即采集或者结束采集需要回到寻宝界面
if ((boolean) data.obj) {
setMainButtonVisiable(View.VISIBLE);
frameLayout.setVisibility(View.GONE);
fragmentTransaction.remove(gatherGetFragment);
if (bigMarker!=null){
if (bigMarker != null) {
bigMarker.setVisible(false);
}
Toast.makeText(getActivity(), "不在作业范围", Toast.LENGTH_SHORT).show();
}else {
} else {
frameLayout.setVisibility(View.VISIBLE);
}
}
}
private void initRemoveFragment() {
PoiFragment poiFragments = (PoiFragment) supportFragmentManager.findFragmentByTag(PoiFragment.class.getName());
if (poiFragments != null) {
fragmentTransaction.remove(poiFragments);
}
ChargingStationFragment chargingStationFragment = (ChargingStationFragment) supportFragmentManager.findFragmentByTag(ChargingStationFragment.class.getName());
if (chargingStationFragment != null) {
fragmentTransaction.remove(chargingStationFragment);
}
PoiVideoFragment poiVideoFragment = (PoiVideoFragment) supportFragmentManager.findFragmentByTag(PoiVideoFragment.class.getName());
if (poiVideoFragment != null) {
fragmentTransaction.remove(poiVideoFragment);
} RoadFragment roadFragment = (RoadFragment) supportFragmentManager.findFragmentByTag(RoadFragment.class.getName());
if (roadFragment != null) {
fragmentTransaction.remove(roadFragment);
}
OtherFragment otherFragment = (OtherFragment) supportFragmentManager.findFragmentByTag(OtherFragment.class.getName());
if (otherFragment != null) {
fragmentTransaction.remove(otherFragment);
}
}
/**
* 控制主界面各个按钮的显示状态
@ -1057,6 +1076,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
});
}
private void initPileMarker(LatLng latLng) {
LatLng mapCenterPoint = getMapCenterPoint();
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
@ -1083,6 +1103,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
});
}
private void initCheckedPileMarker(int poiWord) {
if (screenPosition != null) {
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
@ -1116,7 +1137,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
*/
private void setLocMarkerStyle() {
locationStyle = new MyLocationStyle();
locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_FOLLOW_NO_CENTER);
locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
//创建图标
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap(R.drawable.location));
locationStyle.icon(bitmapDescriptor);
@ -1244,7 +1265,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Bundle bundle = new Bundle();
PoiEntity poiEntity = new PoiEntity();
// 上报时以当前用户位置为准
if (Constant.currentLocation==null) {
if (Constant.currentLocation == null) {
ToastUtil.showShort(getContext(), "无法获取当前位置请检查GPS是否打开");
return;
}
@ -1417,6 +1438,18 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
fragmentTransaction.hide(poiFragment);
}
}
if (!(fragment instanceof RoadFragment)) {
RoadFragment roadFragment = (RoadFragment) supportFragmentManager.findFragmentByTag(RoadFragment.class.getName());
if (roadFragment != null) {
fragmentTransaction.hide(roadFragment);
}
}
if (!(fragment instanceof PoiVideoFragment)) {
PoiVideoFragment poiVideoFragment = (PoiVideoFragment) supportFragmentManager.findFragmentByTag(PoiVideoFragment.class.getName());
if (poiVideoFragment != null) {
fragmentTransaction.hide(poiVideoFragment);
}
}
fragmentTransaction.show(fragment);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
@ -1426,7 +1459,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
* 检查网络状态
*/
private void checkNetWork() {
if (NetWorkUtils.isNetworkAvailable(getContext())) { // 当前网络可用
if (NetWorkUtils.iConnected(getContext())) { // 当前网络可用
checkMyLocation();
} else { // 当前网络不可用
ToastUtil.showShort(getContext(), Constant.NETWORK_UNAVAILABLE);
@ -1503,9 +1536,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
int measuredWidth = treasureMap.getWidth();
int measuredHeight = treasureMap.getHeight();
if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
treasureMap.onSizeChanged(measuredHeight,measuredWidth,measuredWidth,measuredHeight);
treasureMap.onSizeChanged(measuredHeight, measuredWidth, measuredWidth, measuredHeight);
} else if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
treasureMap.onSizeChanged(measuredHeight,measuredWidth,measuredWidth,measuredHeight);
treasureMap.onSizeChanged(measuredHeight, measuredWidth, measuredWidth, measuredHeight);
}
}
}

View File

@ -213,6 +213,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
Log.d("TAG", "onError: " + response.message());
}
});
dismissDialog();
}
@Override

View File

@ -118,6 +118,7 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
@Override
@ -174,5 +175,6 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
dismissDialog();
}
}

View File

@ -42,7 +42,7 @@ public class PoiEntity implements Serializable {
private String y;//纬度
private String detail;//深度信息
private String dist;//距离用户位置
private int taskStatus;//任务状态 0.未领取 1.已领取2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功)4已上传结束采集
private int taskStatus;//任务状态 0.未领取 1.已领取5 立即采集2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功)4已上传结束采集
private int type;//1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务"
private int station_type;//1."充电站"2 "充换电站"3 "充电桩组"4 "换电站"5 "门牌", "公交:6 情报:7
private int isLocalData;//是否是本地数据 0,服务 1,本地

View File

@ -66,7 +66,7 @@ public class ContactView {
// rootView.removeViewAt(i);
}
});
holder.editPhoneNumber.setText(poiBean.getPhone());
holder.editPhoneNumber.setText(poiBean.getPhone()+"");
holder.editPhoneNumber.addTextChangedListener(new TextWatcher() {
@Override

View File

@ -2,32 +2,86 @@ package com.navinfo.outdoor.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresPermission;
import static android.Manifest.permission.ACCESS_NETWORK_STATE;
/**
* 项目名称网络工具类
*/
* @author GreenHairTurtle
* 网络工具类
**/
public class NetWorkUtils {
/**
* 当前网络是否可用
*
* @param context
* @return
*/
public static boolean isNetworkAvailable(Context context) {
ConnectivityManager connectivityManager =
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivityManager != null) {
NetworkInfo info = connectivityManager.getActiveNetworkInfo();
if (info != null && info.isConnected()) {
// 当前网络是连接的
if (info.getState() == NetworkInfo.State.CONNECTED) {
// 当前所链接的网络可用
return true;
/**
* 网络是否已连接
*
* @return true:已连接 false:未连接
*/
@SuppressWarnings("deprecation")
@RequiresPermission(ACCESS_NETWORK_STATE)
public static boolean iConnected(@NonNull Context context) {
ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (manager != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
NetworkCapabilities networkCapabilities = manager.getNetworkCapabilities(manager.getActiveNetwork());
if (networkCapabilities != null) {
return networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)
|| networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)
|| networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET);
}
} else {
NetworkInfo networkInfo = manager.getActiveNetworkInfo();
return networkInfo != null && networkInfo.isConnected();
}
}
return false;
}
/**
* Wifi是否已连接
*
* @return true:已连接 false:未连接
*/
@SuppressWarnings("deprecation")
public static boolean isWifiConnected(@NonNull Context context) {
ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (manager != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
NetworkCapabilities networkCapabilities = manager.getNetworkCapabilities(manager.getActiveNetwork());
if (networkCapabilities != null) {
return networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI);
}
} else {
NetworkInfo networkInfo = manager.getActiveNetworkInfo();
return networkInfo != null && networkInfo.isConnected() && networkInfo.getType() == ConnectivityManager.TYPE_WIFI;
}
}
return false;
}
/**
* 是否为流量
*/
@SuppressWarnings("deprecation")
public static boolean isMobileData(@NonNull Context context) {
ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (manager != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
NetworkCapabilities networkCapabilities = manager.getNetworkCapabilities(manager.getActiveNetwork());
if (networkCapabilities != null) {
return networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR);
}
} else {
NetworkInfo networkInfo = manager.getActiveNetworkInfo();
return networkInfo != null && networkInfo.isConnected() && networkInfo.getType() == ConnectivityManager.TYPE_MOBILE;
}
}
return false;
}
}

View File

@ -46,6 +46,9 @@ public class TecentLocationUtils implements TencentLocationListener{
//创建定位请求
locationRequest = TencentLocationRequest.create();
locationRequest.setInterval(1000); // 每1秒返回一次地址数据
locationRequest.setAllowDirection(true);
locationRequest.setAllowGPS(true);
locationRequest.setIndoorLocationMode(true);
}
public void startLocation(Context mContext) { // 启动定位服务
@ -92,10 +95,15 @@ public class TecentLocationUtils implements TencentLocationListener{
public void onLocationChanged(TencentLocation tencentLocation, int i, String s) {
if (i == TencentLocation.ERROR_OK) {
Location location = new Location(tencentLocation.getProvider());
//设置经纬度以及精度
// //设置经纬度以及精度
location.setLatitude(tencentLocation.getLatitude());
location.setLongitude(tencentLocation.getLongitude());
location.setAccuracy(tencentLocation.getAccuracy());
if (tencentLocation.getBearing()!=0) {
location.setBearing(tencentLocation.getBearing());
} else {
location.setBearing((float) tencentLocation.getDirection());
}
if (locationChangedListenerList!=null) {
for (LocationSource.OnLocationChangedListener locationChangedListener:locationChangedListenerList) {
locationChangedListener.onLocationChanged(location);

View File

@ -21,6 +21,8 @@
android:layout_height="60dp"
android:layout_marginTop="6dp"
app:tabMode="fixed"
app:tabGravity="fill"
app:tabMaxWidth="0dp"
app:tabRippleColor="@android:color/transparent"
app:tabIndicatorHeight="0dp"
app:tabTextColor="#F08A8888"