diff --git a/app/build.gradle b/app/build.gradle
index d3987bb..8394c74 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -62,6 +62,7 @@ dependencies {
implementation 'androidx.navigation:navigation-ui:2.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation files('libs\\jts-1.13.jar')
+ implementation files('libs\\jacob.jar')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
diff --git a/app/libs/jacob.jar b/app/libs/jacob.jar
new file mode 100644
index 0000000..35ce4fa
Binary files /dev/null and b/app/libs/jacob.jar differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 1a6001d..e6df76b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -96,6 +96,7 @@
fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
if (fileListByUUID != null) {
- List lineStringByFileList = AWMp4ParserHelper.getInstance().getLineStringByFileList(fileListByUUID);
+ List lineStringByFileList = AWMp4ParserHelper.getInstance().getLinePhotoByList(fileListByUUID);
for (int i = 0; i < lineStringByFileList.size(); i++) {
LatLng latLng = lineStringByFileList.get(i);
if (latLng != null) {
diff --git a/app/src/main/java/com/navinfo/outdoor/activity/PicturesActivity.java b/app/src/main/java/com/navinfo/outdoor/activity/PicturesActivity.java
index 2e95590..a6caded 100644
--- a/app/src/main/java/com/navinfo/outdoor/activity/PicturesActivity.java
+++ b/app/src/main/java/com/navinfo/outdoor/activity/PicturesActivity.java
@@ -116,6 +116,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
private TimerTask timerTask;
private int videoIndex = -1;
private int oration;
+ private ImageView ivPicImage;
+ private boolean isPicture=true;
@Override
protected int getLayout() {
@@ -141,6 +143,13 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
ivMap = findViewById(R.id.iv_map);
+ ivMap.setOnClickListener(this);
+ ivPicImage = findViewById(R.id.iv_pic);
+ if (poi_video_type==1||poi_video_type==2){
+ ivPicImage.setImageResource(R.mipmap.take_poi_video_arrow);
+ }else if (poi_video_type==3){
+ ivPicImage.setImageResource(R.mipmap.take_pic_arrow);
+ }
btnSwitch = findViewById(R.id.btn_switch);
btnSwitch.setOnClickListener(this);
//相机记录器
@@ -190,7 +199,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
if (poiEntity.getId() != null) {
List fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
if (fileListByUUID != null) {
- List lineStringByFileList = AWMp4ParserHelper.getInstance().getLineStringByFileList(fileListByUUID);
+ List lineStringByFileList = AWMp4ParserHelper.getInstance().getLinePhotoByList(fileListByUUID);
for (int i = 0; i < lineStringByFileList.size(); i++) {
LatLng latLng = lineStringByFileList.get(i);
if (latLng != null) {
@@ -212,8 +221,10 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
if (Objects.requireNonNull(camera.getPictureSize()).getWidth() < camera.getPictureSize().getHeight()) {
Toast.makeText(PicturesActivity.this, "不允许竖向拍摄...", Toast.LENGTH_SHORT).show();
stopTimer();
+ capturePicture.setChecked(false);
if (poi_video_type != 2) {
capturePicture.setText("开始采集");
+ capturePicture.setChecked(false);
}
return;
}
@@ -300,6 +311,18 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
setResult(0x111, intent);
finish();
break;
+ case R.id.camera:
+ benSwitch();
+
+ if (!isPicture){
+ // benSwitch();
+ }
+ break;
+ case R.id.iv_map:
+ if (isPicture){
+ benSwitch();
+ }
+ break;
case R.id.btn_switch:
v.setEnabled(false);
handler.sendEmptyMessageDelayed(0x102, 2000);// 利用handler延迟发送更改状态信息
@@ -382,6 +405,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
layerChange.addView(camera);
layerChange.addView(ivMap);
initMapBig();
+ ivPicImage.setVisibility(View.VISIBLE);
+ isPicture = true;
} else {
layoutParamsMap.height = dm.heightPixels;
layoutParamsMap.width = dm.widthPixels;
@@ -392,6 +417,9 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
layerChange.addView(ivMap);
layerChange.addView(camera);
initMapShort();
+ ivPicImage.setVisibility(View.GONE);
+ isPicture = false;
+
}
}
diff --git a/app/src/main/java/com/navinfo/outdoor/api/BankCard.java b/app/src/main/java/com/navinfo/outdoor/api/BankCard.java
index 35644b6..be71f46 100644
--- a/app/src/main/java/com/navinfo/outdoor/api/BankCard.java
+++ b/app/src/main/java/com/navinfo/outdoor/api/BankCard.java
@@ -2,7 +2,7 @@ package com.navinfo.outdoor.api;
-import com.navinfo.outdoor.base.Base64Util;
+import com.navinfo.outdoor.util.Base64Util;
import com.navinfo.outdoor.http.HttpUtil;
import com.navinfo.outdoor.util.FileUtil;
diff --git a/app/src/main/java/com/navinfo/outdoor/api/Constant.java b/app/src/main/java/com/navinfo/outdoor/api/Constant.java
index 64072e4..ad64d3e 100644
--- a/app/src/main/java/com/navinfo/outdoor/api/Constant.java
+++ b/app/src/main/java/com/navinfo/outdoor/api/Constant.java
@@ -101,6 +101,7 @@ public class Constant {
public static String MOBILE = null;//手机号
public static String FILE_PATH = null;//银行卡图片途径
public static int LEVEL = 0;//用户等级
+ public static boolean isPresent =true;//判断是否在提交中
public static String YOU_MENG_APP_KEY="6139d82c5f798a55cafc51d6";//友盟appkey
@@ -152,6 +153,7 @@ public class Constant {
public static final int REGISTER_WORD = 46; //注册的返回
public static final int VIDEO_FINISH_ROAD = 47;//录像视频列表的返回
public static final int PHOTO_FINISH_VIDEO = 49;//拍照列表的返回
+ public static final int NEST_WORD_SUBMIT =50;//所有的提交/上传
public static final String INTENT_POI_VIDEO_TYPE ="poi_video_type";
@@ -188,7 +190,7 @@ public class Constant {
public static TencentMap.OnMarkerClickListener markerClickListener=null;
- public static final String NAVIN_FO="9.07";//版本
+ public static final String NAVIN_FO="9.14";//版本
/**
* 联系我们的QQ群名称和QQ群号
diff --git a/app/src/main/java/com/navinfo/outdoor/api/IdCard.java b/app/src/main/java/com/navinfo/outdoor/api/IdCard.java
index 600d60d..8f8088e 100644
--- a/app/src/main/java/com/navinfo/outdoor/api/IdCard.java
+++ b/app/src/main/java/com/navinfo/outdoor/api/IdCard.java
@@ -1,6 +1,6 @@
package com.navinfo.outdoor.api;
-import com.navinfo.outdoor.base.Base64Util;
+import com.navinfo.outdoor.util.Base64Util;
import com.navinfo.outdoor.http.HttpUtil;
import com.navinfo.outdoor.util.FileUtil;
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/ChargingStationFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/ChargingStationFragment.java
index 35b0764..642701f 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/ChargingStationFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/ChargingStationFragment.java
@@ -4,10 +4,8 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.Point;
-import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
-import android.provider.MediaStore;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
@@ -39,6 +37,7 @@ import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.MessageDialog;
+import com.kongzue.dialog.v3.WaitDialog;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement;
@@ -46,6 +45,7 @@ import com.navinfo.outdoor.activity.PhotographActivity;
import com.navinfo.outdoor.adapter.ChargingPileAdapter;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment;
+import com.navinfo.outdoor.util.UploadUtils;
import com.navinfo.outdoor.bean.ChargingPileSaveBean;
import com.navinfo.outdoor.bean.ChargingStationBean;
import com.navinfo.outdoor.bean.GetPhoneBean;
@@ -67,7 +67,6 @@ import com.navinfo.outdoor.ui.view.ContactView;
import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.PhotoUtils;
-import com.navinfo.outdoor.util.ToastUtil;
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.interfaces.Removable;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
@@ -75,6 +74,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
+import com.vividsolutions.jts.geom.Geometry;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@@ -91,8 +91,6 @@ import java.util.Objects;
import okhttp3.Response;
-import static android.app.Activity.RESULT_OK;
-
/**
* 充电站的Fragment
* 2021-5-25
@@ -115,7 +113,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
private int existence = 0;
private LinearLayout linearChargingPile;
private ChargingPileAdapter chargingPileAdapter;
- private int station_type = 0;
+ private int station_type = 1;
private ChargingPileDao chargingPileDao;
private LatLng latLng;
private RelativeLayout linearExist;
@@ -126,7 +124,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
private ArrayList chargingStationList;
String str = "";
-// private ArrayList fileList;
+ // private ArrayList fileList;
private NestedScrollView nestedScrollView;
private Marker markerStation;
private Point screenStationPositions;
@@ -143,12 +141,12 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
return R.layout.charging_station_fragment;
}
- @Override
+ @Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (!hidden) {
setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT);
- if (slidingPaneLayout!=null) {
+ if (slidingPaneLayout != null) {
slidingPaneLayout.setScrollableView(nestedScrollView);
}
initHeader();
@@ -179,7 +177,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), FragmentManagement.class);
- intent.putExtra("tag",8);
+ intent.putExtra("tag", 8);
startActivity(intent);
}
});
@@ -198,9 +196,10 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
public void onResume() {
super.onResume();
initHeader();
- moveLatlng(latLng,null);
+ moveLatlng(latLng, null);
}
+
@Override
protected void initView() {
super.initView();
@@ -210,9 +209,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
checkBoxLife = findViewById(R.id.check_pot_life);
CheckBox checkBoxRight = findViewById(R.id.check_pot_right);
nestedScrollView = findViewById(R.id.nested_scroll_view);
- removablesLocality=new ArrayList<>();
+ removablesLocality = new ArrayList<>();
setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT);
- if (slidingPaneLayout!=null) {
+ if (slidingPaneLayout != null) {
slidingPaneLayout.setScrollableView(nestedScrollView);
}
//添加桩
@@ -263,8 +262,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
public void item(ChargingPileEntity chargingPileEntity) {
String showStation = initShowStation();
HashMap stringObjectHashMap = new HashMap<>();
- stringObjectHashMap.put("chargingPileEntity",chargingPileEntity);
- stringObjectHashMap.put("showStation",showStation);
+ stringObjectHashMap.put("chargingPileEntity", chargingPileEntity);
+ stringObjectHashMap.put("showStation", showStation);
Message obtain = Message.obtain();
obtain.what = Constant.CHARGING_STATION;
obtain.obj = stringObjectHashMap;
@@ -274,7 +273,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
checkBoxLife.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- if(checkBoxLife.isChecked()){
+ if (checkBoxLife.isChecked()) {
moveLatlng(latLng, new TencentMap.CancelableCallback() {
@Override
public void onFinish() {
@@ -289,6 +288,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
checkBoxLife.setTextColor(Color.WHITE);
checkBoxLife.setChecked(true);
}
+
@Override
public void onCancel() {
BitmapDescriptor stationDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bags);
@@ -298,7 +298,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
checkBoxLife.setChecked(false);
}
});
- }else {
+ } else {
BitmapDescriptor stationDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bags);
markerStation.setIcon(stationDescriptor);
checkBoxLife.setText("编辑");
@@ -333,6 +333,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
break;
}
}
+
@Override
public void onNothingSelected(AdapterView> parent) {
}
@@ -369,6 +370,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
break;
}
}
+
@Override
public void onNothingSelected(AdapterView> parent) {
}
@@ -465,16 +467,16 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
if (name != null && !name.equals("")) {
editNameContent.setText(name);
}
- if (editNameContent.getText().toString()!=null||editNameContent!=null){
+ if (editNameContent.getText().toString() != null || editNameContent != null) {
editNameContent.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
- if (!hasFocus){
+ if (!hasFocus) {
findingDuplicateByWork();
}
}
});
- }else {
+ } else {
Toast.makeText(getActivity(), "请输入名称", Toast.LENGTH_SHORT).show();
}
@@ -483,34 +485,55 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
editSiteContent.setText(address);
}
bodyId = showPoiEntity.getBodyId(); // 获取当前数据的bodyId
- String x = showPoiEntity.getX();
- String y = showPoiEntity.getY();
- if (x != null && y != null) {
- latLng = new LatLng();
- latLng.setLatitude(Double.parseDouble(y));
- latLng.setLongitude(Double.parseDouble(x));
+ String geoWkt = showPoiEntity.getGeoWkt();
+ if (geoWkt != null) {
+ String geo = Geohash.getInstance().decode(geoWkt);
+ Geometry geometry = GeometryTools.createGeometry(geo);
+ switch (geometry.getGeometryType()) {
+ case "Point": //点
+ latLng = GeometryTools.createLatLng(geo);
+ break;
+ case "LineString": //线
+ case "Polygon": //面
+ List latLineString = GeometryTools.getLatLags(geo);
+ assert latLineString != null;
+ latLng = latLineString.get(0);
+ break;
+ }
BitmapDescriptor stationDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bags);
- markerStation = tencentMap.addMarker(new MarkerOptions(latLng).icon(stationDescriptor).anchor(0.5f,1.0f));
+ markerStation = tencentMap.addMarker(new MarkerOptions(latLng).icon(stationDescriptor).anchor(0.5f, 1.0f));
markerStation.setZIndex(4);
- moveLatlng(latLng,null);
+ moveLatlng(latLng, null);
+ } else {
+ String x = showPoiEntity.getX();
+ String y = showPoiEntity.getY();
+ if (x != null && y != null) {
+ latLng = new LatLng();
+ latLng.setLatitude(Double.parseDouble(y));
+ latLng.setLongitude(Double.parseDouble(x));
+ BitmapDescriptor stationDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bags);
+ markerStation = tencentMap.addMarker(new MarkerOptions(latLng).icon(stationDescriptor).anchor(0.5f, 1.0f));
+ markerStation.setZIndex(4);
+ moveLatlng(latLng, null);
+ }
}
- initPhone();
String describe = showPoiEntity.getMemo();//任务描述
if (describe != null && !describe.equals("")) {
editDescribe.setText(describe);
}
+ initPhone();
int station_type = showPoiEntity.getStation_type();
- if (station_type==1){
+ if (station_type == 1) {
spinnerType.setSelection(0, true);
- }else if (station_type==2){
+ } else if (station_type == 2) {
spinnerType.setSelection(1, true);
- }else if (station_type==3){
+ } else if (station_type == 3) {
spinnerType.setSelection(2, true);
- }else if (station_type==4){
+ } else if (station_type == 4) {
spinnerType.setSelection(3, true);
}
String telPhone = showPoiEntity.getTelPhone();
- if (telPhone != null && !telPhone.equals("")&&!telPhone.equals("null")) {
+ if (telPhone != null && !telPhone.equals("") && !telPhone.equals("null")) {
String[] phones = telPhone.split("\\|");
for (int i = 0; i < phones.length; i++) {
if (i == 0) {
@@ -611,8 +634,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
ChargingPileEntity chargingPileEntity = new Gson().fromJson(pileFileString, ChargingPileEntity.class);
String showStation = initShowStation();
HashMap stringObjectHashMap = new HashMap<>();
- stringObjectHashMap.put("chargingPileEntity",chargingPileEntity);
- stringObjectHashMap.put("showStation",showStation);
+ stringObjectHashMap.put("chargingPileEntity", chargingPileEntity);
+ stringObjectHashMap.put("showStation", showStation);
initRemovePileSharePre();
Message obtain = Message.obtain();
obtain.what = Constant.CHARGING_STATION;
@@ -644,13 +667,13 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
if (getPhoneBean.getCode() == 200) {
String code = getPhoneBean.getBody().getCode();
Integer telLength = getPhoneBean.getBody().getTelLength();
- if (!code.equals(Constant.CODE)){
+ if (!code.equals(Constant.CODE)) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
- MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "此地区区号为"+code+",请手动修改", "确定","取消").setOkButton(new OnDialogButtonClickListener() {
+ MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "此地区区号为" + code + ",请手动修改", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Constant.CODE = code;
- Constant.TelLength=telLength;
+ Constant.TelLength = telLength;
/* for (int i = 0; i < poiBeans.size(); i++) {
poiBeans.get(i).setArea(Constant.CODE);
}
@@ -660,8 +683,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
});
}
- }else {
- Toast.makeText(getActivity(), getPhoneBean.getMessage()+"", Toast.LENGTH_SHORT).show();
+ } else {
+ Toast.makeText(getActivity(), getPhoneBean.getMessage() + "", Toast.LENGTH_SHORT).show();
}
}
@@ -720,11 +743,12 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
} else if (data.what == Constant.CHARGING_PILE_STATION) { // 新增充电桩
ChargingPileEntity chargingPileEntity = (ChargingPileEntity) data.obj;
List currentChargingPileList = chargingPileAdapter.getChargingPileEntities();
- m: if (currentChargingPileList!=null&&!currentChargingPileList.isEmpty()) {
+ m:
+ if (currentChargingPileList != null && !currentChargingPileList.isEmpty()) {
for (int i = 0; i < currentChargingPileList.size(); i++) {
if (currentChargingPileList.get(i).getPileId() == chargingPileEntity.getPileId()) {
currentChargingPileList.add(i, chargingPileEntity);
- currentChargingPileList.remove(i+1);
+ currentChargingPileList.remove(i + 1);
break m;
}
}
@@ -734,11 +758,12 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
currentChargingPileList.add(chargingPileEntity);
}
chargingPileAdapter.notifyDataSetChanged();
- }else if (data.what==Constant.PILE_MARKER_SHOW){
- initPileMarkerShow();
+ } else if (data.what == Constant.PILE_MARKER_SHOW) {
+ initPileMarkerShow();
}
}
- public void initPileMarkerShow(){
+
+ public void initPileMarkerShow() {
for (int i = 0; i < removablesLocality.size(); i++) {
removablesLocality.get(i).remove();
}
@@ -751,7 +776,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
// 解密geo
String decodeGeometry = Geohash.getInstance().decode(p);
LatLng latLngPile = GeometryTools.createLatLng(decodeGeometry);
- Marker markerPile = tencentMap.addMarker(new MarkerOptions(latLngPile).icon(pileDescriptor).anchor(0.5f,1.0f));
+ Marker markerPile = tencentMap.addMarker(new MarkerOptions(latLngPile).icon(pileDescriptor).anchor(0.5f, 1.0f));
markerPile.setZIndex(3);
removablesLocality.add(markerPile);
}
@@ -833,7 +858,15 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
- stationUploadByNetWork(poiDaoPoiEntity, chargingStationList);
+ if (Constant.isPresent) {
+ stationUploadByNetWork(poiDaoPoiEntity, chargingStationList);
+ Constant.isPresent = false;
+ } else {
+ Toast.makeText(getContext(), "有正在提交的数据,等提交成功后,方可操作", Toast.LENGTH_SHORT).show();
+
+ }
+
+
}
});
}
@@ -885,8 +918,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
chargingPileEntity.setP(encode);
- stringObjectHashMap.put("chargingPileEntity",chargingPileEntity);
- stringObjectHashMap.put("showStation",showStation);
+ stringObjectHashMap.put("chargingPileEntity", chargingPileEntity);
+ stringObjectHashMap.put("showStation", showStation);
initRemovePileSharePre();
Message obtain = Message.obtain();
obtain.what = Constant.CHARGING_STATION;
@@ -904,7 +937,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
if (chargingPileEntityList != null && !chargingPileEntityList.isEmpty()) {
for (ChargingPileEntity pileEntity : chargingPileEntityList) {
if (pileEntity.getBodyId() == 0) {
- saveChargingPileByWork(pileEntity,poiEntity.getBodyId());
+ saveChargingPileByWork(pileEntity, poiEntity.getBodyId());
}
}
}
@@ -928,13 +961,13 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
try {
- HttpParams httpParams=new HttpParams();
- httpParams.put("auditId",chargingPileEntity.getBodyId());
+ HttpParams httpParams = new HttpParams();
+ httpParams.put("auditId", chargingPileEntity.getBodyId());
Response execute = OkGoBuilder.getInstance().url(HttpInterface.CS_TASK_UP_LOAD_PIC)
.params(httpParams)
.token(Constant.ACCESS_TOKEN)
.fileList(chargingPileFileList).postFileSynchronization();
- if(execute!=null){
+ if (execute != null) {
assert execute.body() != null;
String pileUpLoadResultStr = execute.body().string();
PoiUploadBean uploadBeanResult = new Gson().fromJson(pileUpLoadResultStr, PoiUploadBean.class);
@@ -995,7 +1028,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
PoiCheckResult poiCheckResult = checkPoiEntity(poiEntity);
if (poiCheckResult.getCode() == 1) {
- Toast.makeText(getActivity(), poiCheckResult.getMsg()+"", Toast.LENGTH_SHORT).show();
+ Toast.makeText(getActivity(), poiCheckResult.getMsg() + "", Toast.LENGTH_SHORT).show();
return;
}
new Thread(new Runnable() {
@@ -1028,8 +1061,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
private void stationUploadByNetWork(PoiEntity poiEntity, ArrayList chargingStationList) {
- showLoadingDialog();
- setLoadingDialogText("上传中...");
if (poiEntity == null || poiEntity.getBodyId() == 0) {
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
assert poiEntity != null;
@@ -1049,12 +1080,11 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
}
}
-
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
- HttpParams httpParams=new HttpParams();
- httpParams.put("auditId",poiEntity.getBodyId());
+ HttpParams httpParams = new HttpParams();
+ httpParams.put("auditId", poiEntity.getBodyId());
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.C_TASK_UP_LOAD_PIC)
@@ -1062,89 +1092,11 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
.token(Constant.ACCESS_TOKEN)
.params(httpParams)
.cls(PoiUploadBean.class)
- .postFileAsynchronous( new Callback() {
- @Override
- public void onSuccess(PoiUploadBean response, int id) {
- dismissLoadingDialog();
- if (response.getCode() == 200) {
+ .postFileAsynchronous(UploadUtils.getInstance().getChargingUploadCallback(getActivity(), showPoiEntity));
+ Objects.requireNonNull(getActivity()).onBackPressed();//回退
+ WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台上传中,请稍候...");
+ WaitDialog.dismiss(3000);
- new Thread(new Runnable() {
- @Override
- public void run() {
- poiDao.deletePoiEntity(poiEntity);
- getActivity().runOnUiThread(new Runnable() {
- @Override
- public void run() {
- Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
- Message obtain = Message.obtain();
- obtain.what = Constant.JOB_WORD_MONITOR;
- obtain.obj = true;
- EventBus.getDefault().post(obtain);
- getActivity().onBackPressed();//回退
- }
- });
- }
- }).start();
- } else {
- Toast.makeText(getActivity(), "上传失败", Toast.LENGTH_SHORT).show();
- }
- }
-
- @Override
- public void onError(Throwable e, int id) {
- dismissLoadingDialog();
- Toast.makeText(getActivity(), e.getMessage()+"", Toast.LENGTH_SHORT).show();
- Log.d("TAG", "onError: " +e.getMessage() + "");
- }
- });
-
-
- /* OkGo
- // 请求方式和请求url
- .post(HttpInterface.C_TASK_UP_LOAD_PIC)
- // 请求的 tag, 主要用于取消对应的请求
- .params("auditId", poiEntity.getBodyId())
- .addFileParams("file", chargingStationList)
- .tag(this)
- .execute(new DialogCallback(PoiUploadBean.class) {
- @Override
- public void onSuccess(Response poiUploadBeanResponse) {
- dismissLoadingDialog();
- if (poiUploadBeanResponse == null || poiUploadBeanResponse.code() != 200 || poiUploadBeanResponse.body().getCode() != 200) {
- Toast.makeText(getActivity(), "上传失败", Toast.LENGTH_SHORT).show();
- return;
- }
-
- if (poiUploadBeanResponse != null && poiUploadBeanResponse.code() == 200) {
- PoiUploadBean body = poiUploadBeanResponse.body();
- if (body.getCode() == 200) {
- Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
- Log.d("TAG", "onSuccess: " + poiUploadBeanResponse.toString() + "sssssssssssss");
- new Thread(new Runnable() {
- @Override
- public void run() {
- poiDao.deletePoiEntity(showPoiEntity);
- getActivity().runOnUiThread(new Runnable() {
- @Override
- public void run() {
- getActivity().onBackPressed();//回退
- }
- });
- }
- }).start();
- return;
- }
- }
- }
-
- @Override
- public void onError(Response poiUploadBeanResponse) {
- super.onError(poiUploadBeanResponse);
- dismissLoadingDialog();
- Toast.makeText(getActivity(), poiUploadBeanResponse.code() + "", Toast.LENGTH_SHORT).show();
- Log.d("TAG", "onError: " + poiUploadBeanResponse.code() + "");
- }
- });*/
}
});
}
@@ -1190,6 +1142,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
public void run() {
if (isLocal) {
stationUploadByNetWork(poiEntity, chargingStationList);
+ Constant.isPresent = false;
// chargingPileUploadNetWork(chargingPileBody, fileList);
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
@@ -1220,6 +1173,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
});
}
+
private void findingDuplicateByWork() {
HttpParams httpParams = new HttpParams();
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
@@ -1234,40 +1188,40 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
.getRequest(new Callback() {
@Override
public void onSuccess(TaskNameBean taskNameBean, int id) {
- if (getActivity()==null){
+ if (getActivity() == null) {
return;
}
dismissLoadingDialog();
- if (taskNameBean.getCode()==200){
+ if (taskNameBean.getCode() == 200) {
editNameContent.setTextColor(Color.BLACK);
btnSaveLocal.setEnabled(true);
btnUploading.setEnabled(true);
List body = taskNameBean.getBody();
- if (body!=null){
+ if (body != null) {
for (int i = 0; i < body.size(); i++) {
- str +=body.get(i) + ",";
+ str += body.get(i) + ",";
}
- if (str!=null){
- Toast.makeText(getActivity(), "存在类似名称---"+str, Toast.LENGTH_SHORT).show();
+ if (str != null) {
+ Toast.makeText(getActivity(), "存在类似名称---" + str, Toast.LENGTH_SHORT).show();
str = "";
- }else {
+ } else {
Toast.makeText(getActivity(), "没有类似名称可以作业", Toast.LENGTH_SHORT).show();
}
- }else {
+ } else {
Toast.makeText(getActivity(), "没有类似名称可以作业", Toast.LENGTH_SHORT).show();
}
- }else {
+ } else {
editNameContent.setTextColor(Color.RED);
btnSaveLocal.setEnabled(false);
btnUploading.setEnabled(false);
- Toast.makeText(getActivity(), taskNameBean.getMessage()+"", Toast.LENGTH_SHORT).show();
+ Toast.makeText(getActivity(), taskNameBean.getMessage() + "", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(Throwable e, int id) {
- if (getActivity()==null){
+ if (getActivity() == null) {
return;
}
dismissLoadingDialog();
@@ -1276,6 +1230,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
});
}
+
private String initShowStation() {
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
String newPoiEntity = new Gson().toJson(poiEntity);
@@ -1313,8 +1268,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
- if (resultCode==0x104){
- if (requestCode==101){
+ if (resultCode == 0x104) {
+ if (requestCode == 101) {
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
@@ -1323,7 +1278,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivPanorama);
tvPanorama.setTag(andGetPath);
}
- }else if (requestCode==102){
+ } else if (requestCode == 102) {
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
@@ -1332,7 +1287,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivName);
tvNamePic.setTag(andGetPath);
}
- }else if (requestCode==103){
+ } else if (requestCode == 103) {
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
@@ -1341,7 +1296,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivInternal);
tvInternal.setTag(andGetPath);
}
- }else if (requestCode==104){
+ } else if (requestCode == 104) {
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
@@ -1350,7 +1305,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivElse);
tvElse.setTag(andGetPath);
}
- }else if (requestCode==105){
+ } else if (requestCode == 105) {
assert data != null;
String file = data.getStringExtra("file");
assert file != null;
@@ -1384,7 +1339,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
Response execute = OkGoBuilder.getInstance().url(HttpInterface.SUBMIT_CSTASK)
.token(Constant.ACCESS_TOKEN)
.params(httpParams).getSynchronization();
- if(execute!=null){
+ if (execute != null) {
assert execute.body() != null;
String responseBodyStr = execute.body().string();
Gson gson = new Gson();
@@ -1400,13 +1355,14 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
e.printStackTrace();
}
}
+
@Override
public void onDestroyView() {
super.onDestroyView();
if (showPoiEntity != null) {
if (showPoiEntity.getTaskStatus() == 5) {
initEndReceiveTask(HttpInterface.UNRECEIVED_POLYGON_TASK, showPoiEntity);
- }else {
+ } else {
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
@@ -1414,12 +1370,13 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
}
}
+
@Override
public void onDestroy() {
if (EventBus.getDefault().isRegistered(this))//加上判断
EventBus.getDefault().unregister(this);
super.onDestroy();
- if (markerStation!=null){
+ if (markerStation != null) {
markerStation.remove();
}
for (int i = 0; i < removablesLocality.size(); i++) {
@@ -1428,7 +1385,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
removablesLocality.clear();
}
- private void initEndReceiveTask(String url,PoiEntity poiEntity) {
+ private void initEndReceiveTask(String url, PoiEntity poiEntity) {
if (poiEntity.getTaskId() == 0) {
Toast.makeText(getActivity(), "无此任务", Toast.LENGTH_SHORT).show();
return;
@@ -1471,6 +1428,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
});
}
+
@Override
protected PoiEntity initPoiEntityByUI(PoiEntity poiEntity) {
List infoPhoto = new ArrayList<>();
@@ -1533,49 +1491,49 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
PoiCheckResult poiCheckResult = new PoiCheckResult();
- if (entity.getName()==null){
+ if (entity.getName() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请输入 名称");
return poiCheckResult;
}
- if (tvPanorama.getTag()==null){
+ if (tvPanorama.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 全景图");
return poiCheckResult;
}
- if (tvNamePic.getTag()==null){
+ if (tvNamePic.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 名称照片");
return poiCheckResult;
}
- if (entity.getExistence()==0){
- if (tvInternal.getTag()==null){
+ if (entity.getExistence() == 0) {
+ if (tvInternal.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 服务说明");
return poiCheckResult;
}
- if (tvElse.getTag()==null){
+ if (tvElse.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 充电站指引牌");
return poiCheckResult;
}
- if (tvScutcheon.getTag()==null){
+ if (tvScutcheon.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 收费标牌");
return poiCheckResult;
}
}
- if (entity.getX()==null&&entity.getY()==null){
+ if (entity.getX() == null && entity.getY() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请确定 点位");
return poiCheckResult;
}
- if (contactView.getPhoneList()!=-1){
+ if (contactView.getPhoneList() != -1) {
poiCheckResult.setCode(1);
- poiCheckResult.setMsg("您第"+contactView.getPhoneList()+"手机号输入有误");
+ poiCheckResult.setMsg("您第" + contactView.getPhoneList() + "手机号输入有误");
return poiCheckResult;
}
- if (entity.getTelPhone()==null){
+ if (entity.getTelPhone() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请输入 手机号");
return poiCheckResult;
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/ContactFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/ContactFragment.java
index a069bc1..c8b28e1 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/ContactFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/ContactFragment.java
@@ -38,7 +38,6 @@ public class ContactFragment extends BaseFragment implements View.OnClickListene
super.initView();
ImageView ivContact = findViewById(R.id.iv_contact);
ivContact.setOnClickListener(this);
-
TextView tvJigName = (TextView) findViewById(R.id.tv_jingName);
tvJigName.setText(Constant.REGION_JIG_NAME);
TextView tvJigPhone = (TextView) findViewById(R.id.tv_jingPhone);
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/FilterFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/FilterFragment.java
index 0b6bae7..7820b09 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/FilterFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/FilterFragment.java
@@ -62,7 +62,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
private FilterAdapter filterAdapter;
private ArrayList poiEntities;
private ArrayList btnChock;
- private PoiDao poiDao;
private CheckBox checkOk;
public static FilterFragment newInstance(Bundle bundle) {
@@ -144,13 +143,14 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
PoiEntity poiEntity = new PoiEntity();
poiEntity.setTaskId(list.get(i).getId());
poiEntity.setName(list.get(i).getName());
+ poiEntity.setGeoWkt(list.get(i).getGeo());
poiEntity.setAddress(list.get(i).getAddress());
poiEntity.setTelPhone(list.get(i).getTelephone() + "");
poiEntity.setPrecision(list.get(i).getPrice() + "");
poiEntity.setDist(list.get(i).getDist() + "");
poiEntity.setType(list.get(i).getType());
- String geo = list.get(i).getGeo();
- poiEntity.setGeoWkt(geo);
+ String gawk = list.get(i).getGeo();
+ String geo = Geohash.getInstance().decode(gawk);
Geometry geometry = GeometryTools.createGeometry(geo);
switch (geometry.getGeometryType()) {
case "Point": //点
@@ -180,7 +180,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
protected void initData() {
super.initData();
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
- poiDao = poiDatabase.getPoiDao();
+ PoiDao poiDao = poiDatabase.getPoiDao();
poiEntities = new ArrayList<>();
btnChock = new ArrayList<>();//存储选择中的的数据
ConstraintLayout clNumber = findViewById(R.id.cl_number);
@@ -310,7 +310,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_draw:
- if (btnChock==null){
+ if (btnChock == null) {
return;
}
StringBuilder a = new StringBuilder();
@@ -457,6 +457,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
/**
* 批量领取
+ *
* @param taskId
*/
private void initBatch(String taskId) {
@@ -487,6 +488,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
EventBus.getDefault().post(obtain);
Toast.makeText(getContext(), "领取成功", Toast.LENGTH_SHORT).show();
}
+
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
@@ -498,7 +500,8 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
/**
* 通过不同类型的type 进行批量领取
- * @param successBean
+ *
+ * @param
*/
private void initType(FilterBatchBean.BodyBean.SuccessBean successBean) {
switch (successBean.getType()) {
@@ -514,16 +517,16 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
chargingStationEntity.setCreateTime(String.valueOf(successBean.getEndDate()));
chargingStationEntity.setPrecision(String.valueOf(successBean.getPrice()));
chargingStationEntity.setAddress(successBean.getAddress());
- if(successBean.getTelephone()==null||successBean.getTelephone().equals("")||successBean.getTelephone().equals("null")){
+ if (successBean.getTelephone() == null || successBean.getTelephone().equals("") || successBean.getTelephone().equals("null")) {
chargingStationEntity.setTelPhone(null);
- }else {
+ } else {
chargingStationEntity.setTelPhone(successBean.getTelephone());
}
chargingStationEntity.setType(successBean.getType());
chargingStationEntity.setTaskStatus(1);
+ chargingStationEntity.setGeoWkt(successBean.getGeo());
String encodeStr = successBean.getGeo();
String geo = Geohash.getInstance().decode(encodeStr);
- chargingStationEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
switch (geometry.getGeometryType()) {
case "Point": //点
@@ -565,20 +568,20 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
new Thread(new Runnable() {
@Override
public void run() {
- PoiEntity poiListEntity = new PoiEntity();
- poiListEntity.setTaskId(successBean.getId());
- poiListEntity.setName(successBean.getName());
- poiListEntity.setDescribe(successBean.getMemo());
- poiListEntity.setCreateTime(successBean.getEndDate()+"");
- poiListEntity.setAddress(successBean.getAddress());
- poiListEntity.setType(successBean.getType());
- poiListEntity.setPrecision(String.valueOf(successBean.getPrice()));
- poiListEntity.setIsExclusive(successBean.getIsExclusive());
- poiListEntity.setTaskStatus(1);
- String encodeStr = successBean.getGeo();
- String geo = Geohash.getInstance().decode(encodeStr);
- poiListEntity.setGeoWkt(geo);
- Geometry geometry = GeometryTools.createGeometry(geo);
+ PoiEntity poiListEntity = new PoiEntity();
+ poiListEntity.setTaskId(successBean.getId());
+ poiListEntity.setName(successBean.getName());
+ poiListEntity.setDescribe(successBean.getMemo());
+ poiListEntity.setCreateTime(successBean.getEndDate() + "");
+ poiListEntity.setAddress(successBean.getAddress());
+ poiListEntity.setType(successBean.getType());
+ poiListEntity.setPrecision(String.valueOf(successBean.getPrice()));
+ poiListEntity.setIsExclusive(successBean.getIsExclusive());
+ poiListEntity.setTaskStatus(1);
+ poiListEntity.setGeoWkt(successBean.getGeo());
+ String encodeStr = successBean.getGeo();
+ String geo = Geohash.getInstance().decode(encodeStr);
+ Geometry geometry = GeometryTools.createGeometry(geo);
switch (geometry.getGeometryType()) {
case "Point": //点
LatLng latLng = GeometryTools.createLatLng(geo);
@@ -594,7 +597,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
break;
}
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
- }
+ }
}).start();
break;
case 6://面
@@ -606,9 +609,9 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
polygonEntity.setName(successBean.getName());
polygonEntity.setType(successBean.getType());
polygonEntity.setTaskStatus(1);
+ polygonEntity.setGeoWkt(successBean.getGeo());
String encodeStr = successBean.getGeo();
String geo = Geohash.getInstance().decode(encodeStr);
- polygonEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
switch (geometry.getGeometryType()) {
case "Point": //点
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/GatherGetFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/GatherGetFragment.java
index a3ec6b5..6363f22 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/GatherGetFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/GatherGetFragment.java
@@ -35,6 +35,7 @@ import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools;
+import com.navinfo.outdoor.util.Voice;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.vividsolutions.jts.geom.Geometry;
@@ -243,19 +244,21 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
return;
}else {
if (geometry>50){
+// Voice.sprat("注意在附近50米范围内进行采集",0);
+
+
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
- MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "当前位置偏离任务线", "确定").setOnOkButtonClickListener(new OnDialogButtonClickListener() {
+ MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "注意在任务附近50米范围内进行采集", "确定").setOnOkButtonClickListener(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
initGather();
+// Voice.sprat("注意在附近50米范围内进行采集",1);
return false;
}
});
}else {
initGather();
}
-
-
}
}
break;
@@ -361,10 +364,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}
chargingStationEntity.setType(Integer.valueOf(stationBean.getType()));
chargingStationEntity.setTaskStatus(statusId);
-
+ chargingStationEntity.setGeoWkt(stationBean.getGeo());
String encodeStr = stationBean.getGeo();
String geo = Geohash.getInstance().decode(encodeStr);
- chargingStationEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
switch (geometry.getGeometryType()) {
case "Point": //点
@@ -375,6 +377,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
case "LineString": //线
case "Polygon": //面
List latLineString = GeometryTools.getLatLags(geo);
+ assert latLineString != null;
chargingStationEntity.setX(latLineString.get(0).longitude + "");
chargingStationEntity.setY(latLineString.get(0).latitude + "");
break;
@@ -479,22 +482,23 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
polygonEntity.setTaskId(listBean.getId());
polygonEntity.setName(listBean.getName());
polygonEntity.setType(listBean.getType());
+ polygonEntity.setGeoWkt(listBean.getGeo());
String encodeStr = listBean.getGeo();
String geo = Geohash.getInstance().decode(encodeStr);
- polygonEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
- if (geometry.getGeometryType().equals("Point")) {//点
- LatLng latLng = GeometryTools.createLatLng(geo);
- polygonEntity.setX(latLng.longitude + "");
- polygonEntity.setY(latLng.latitude + "");
- } else if (geometry.getGeometryType().equals("LineString")) {//线
- List latLineString = GeometryTools.getLatLags(geo);
- polygonEntity.setX(latLineString.get(0).longitude + "");
- polygonEntity.setY(latLineString.get(0).latitude + "");
- } else if (geometry.getGeometryType().equals("Polygon")) {//面
- List latPolygon = GeometryTools.getLatLags(geo);
- polygonEntity.setX(latPolygon.get(0).longitude + "");
- polygonEntity.setY(latPolygon.get(0).latitude + "");
+ switch (geometry.getGeometryType()) {
+ case "Point": //点
+ LatLng latLng = GeometryTools.createLatLng(geo);
+ polygonEntity.setX(latLng.longitude + "");
+ polygonEntity.setY(latLng.latitude + "");
+ break;
+ case "LineString": //线
+ case "Polygon": //面
+ List latLineString = GeometryTools.getLatLags(geo);
+ assert latLineString != null;
+ polygonEntity.setX(latLineString.get(0).longitude + "");
+ polygonEntity.setY(latLineString.get(0).latitude + "");
+ break;
}
polygonEntity.setTaskStatus(1);
}
@@ -725,25 +729,26 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setDescribe(listBean.getMemo());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setAddress(listBean.getAddress());
- poiListEntity.setType(Integer.valueOf(listBean.getType()));
+ poiListEntity.setType(listBean.getType());
poiListEntity.setIsExclusive(listBean.getIsExclusive());
poiListEntity.setTaskStatus(statusId);
+ poiListEntity.setGeoWkt(listBean.getGeo());
String encodeStr = listBean.getGeo();
String geo = Geohash.getInstance().decode(encodeStr);
- 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 latLineString = GeometryTools.getLatLags(geo);
- poiListEntity.setX(latLineString.get(0).longitude + "");
- poiListEntity.setY(latLineString.get(0).latitude + "");
- } else if (geometry.getGeometryType().equals("Polygon")) {//面
- List latPolygon = GeometryTools.getLatLags(geo);
- poiListEntity.setX(latPolygon.get(0).longitude + "");
- poiListEntity.setY(latPolygon.get(0).latitude + "");
+ switch (geometry.getGeometryType()) {
+ case "Point": //点
+ LatLng latLng = GeometryTools.createLatLng(geo);
+ poiListEntity.setX(latLng.longitude + "");
+ poiListEntity.setY(latLng.latitude + "");
+ break;
+ case "LineString": //线
+ case "Polygon": //面
+ List latLineString = GeometryTools.getLatLags(geo);
+ assert latLineString != null;
+ poiListEntity.setX(latLineString.get(0).longitude + "");
+ poiListEntity.setY(latLineString.get(0).latitude + "");
+ break;
}
//senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
if (statusId==1||statusId==5){
@@ -851,22 +856,23 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setPrecision(String.valueOf(listBean.getPrice()));
poiListEntity.setIsExclusive(listBean.getIsExclusive());
poiListEntity.setTaskStatus(statusId);
+ poiListEntity.setGeoWkt(listBean.getGeo());
String encodeStr = listBean.getGeo();
String geo = Geohash.getInstance().decode(encodeStr);
- 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 latLineString = GeometryTools.getLatLags(geo);
- poiListEntity.setX(latLineString.get(0).longitude + "");
- poiListEntity.setY(latLineString.get(0).latitude + "");
- } else if (geometry.getGeometryType().equals("Polygon")) {//面
- List latPolygon = GeometryTools.getLatLags(geo);
- poiListEntity.setX(latPolygon.get(0).longitude + "");
- poiListEntity.setY(latPolygon.get(0).latitude + "");
+ switch (geometry.getGeometryType()) {
+ case "Point": //点
+ LatLng latLng = GeometryTools.createLatLng(geo);
+ poiListEntity.setX(latLng.longitude + "");
+ poiListEntity.setY(latLng.latitude + "");
+ break;
+ case "LineString": //线
+ case "Polygon": //面
+ List latLineString = GeometryTools.getLatLags(geo);
+ assert latLineString != null;
+ poiListEntity.setX(latLineString.get(0).longitude + "");
+ poiListEntity.setY(latLineString.get(0).latitude + "");
+ break;
}
//senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
if (statusId==1||statusId==5){
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/GatheringFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/GatheringFragment.java
index fbaf0aa..2d473b9 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/GatheringFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/GatheringFragment.java
@@ -22,6 +22,7 @@ import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
+import com.github.lazylibrary.util.StringUtils;
import com.google.gson.Gson;
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.util.BaseDialog;
@@ -240,7 +241,12 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
}else {
if (bankCardBean.getResult()!=null&&bankCardBean.getResult().getBank_card_number()!=null){
String bank_card_number = bankCardBean.getResult().getBank_card_number();
+ if (StringUtils.isEmpty(bank_card_number)) {
+ Toast.makeText(getActivity(), "无法识别银行卡号", Toast.LENGTH_SHORT).show();
+ return;
+ }
etBankNum.setText(bank_card_number);
+ String bankName = bankCardBean.getResult().getBank_name();
}else {
Toast.makeText(getActivity(), "请拍银行卡照片", Toast.LENGTH_SHORT).show();
}
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/MineFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/MineFragment.java
index 5918ab0..518727d 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/MineFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/MineFragment.java
@@ -98,7 +98,7 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
mainGrade = (TextView) findViewById(R.id.main_grade);
tvMainGrade = findViewById(R.id.tv_main_grade);
if (Constant.LEVEL != 0) {
- tvMainGrade.setText(Constant.LEVEL+"");
+ tvMainGrade.setText(Constant.LEVEL + "");
}
initNetWork();
@@ -164,21 +164,23 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
case R.id.rl_set://设置
case R.id.rl_issue://常见问题
case R.id.rl_map://地图下载
- case R.id.rl_privilege://我的特权
- case R.id.rl_grade://我的等级
Toast.makeText(getActivity(), "该功能以后上新,敬请期待", Toast.LENGTH_SHORT).show();
break;
+ case R.id.rl_privilege://我的特权
+ Intent intentPrivilege = new Intent(getActivity(), FragmentManagement.class);
+ intentPrivilege.putExtra("tag", 18);
+ startActivity(intentPrivilege);
+ break;
+ case R.id.rl_grade://我的等级
+ Intent intentGrade = new Intent(getActivity(), FragmentManagement.class);
+ intentGrade.putExtra("tag", 17);
+ startActivity(intentGrade);
+ break;
case R.id.btn_withdraw://提现页面
Intent intentWithdraw = new Intent(getActivity(), FragmentManagement.class);
intentWithdraw.putExtra("tag", 15);
startActivity(intentWithdraw);
break;
-// Intent intentGrade = new Intent(getActivity(), FragmentManagement.class);
-// intentGrade.putExtra("tag", 17);
-// startActivity(intentGrade);
-// Intent intentPrivilege = new Intent(getActivity(), FragmentManagement.class);
-// intentPrivilege.putExtra("tag", 18);
-// startActivity(intentPrivilege);
// Intent intentMap = new Intent(getActivity(), FragmentManagement.class);
// intentMap.putExtra("tag", 19);
// startActivity(intentMap);
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/OtherFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/OtherFragment.java
index e7aebf4..c8fde98 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/OtherFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/OtherFragment.java
@@ -2,21 +2,16 @@ package com.navinfo.outdoor.fragment;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Point;
-import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
-import android.provider.MediaStore;
import android.util.Log;
-import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
-import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
@@ -38,21 +33,19 @@ import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.MessageDialog;
-import com.lzy.okgo.OkGo;
+import com.kongzue.dialog.v3.WaitDialog;
import com.lzy.okgo.model.HttpParams;
-import com.lzy.okgo.model.Response;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement;
import com.navinfo.outdoor.activity.PhotographActivity;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment;
+import com.navinfo.outdoor.util.UploadUtils;
import com.navinfo.outdoor.bean.Info;
-import com.navinfo.outdoor.bean.OtherUploadPicBean;
import com.navinfo.outdoor.bean.PoiSaveBean;
import com.navinfo.outdoor.bean.PoiUploadBean;
import com.navinfo.outdoor.bean.UnPolygonTaskBean;
import com.navinfo.outdoor.http.Callback;
-import com.navinfo.outdoor.http.DialogCallback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.room.ChargingPileEntity;
@@ -60,8 +53,8 @@ import com.navinfo.outdoor.room.InsertAndUpdateUtils;
import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
-import com.navinfo.outdoor.util.AWMp4ParserHelper;
import com.navinfo.outdoor.util.Geohash;
+import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.PhotoUtils;
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
@@ -69,6 +62,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
+import com.vividsolutions.jts.geom.Geometry;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@@ -81,8 +75,6 @@ import java.util.Calendar;
import java.util.List;
import java.util.Objects;
-import static android.app.Activity.RESULT_OK;
-
/**
* 寻宝-上报-其他的fragment
*/
@@ -90,7 +82,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
private Spinner spinnerOther;
- String[] others = new String[]{"门牌", "公交", "情报"};// //门牌:5 公交:6 情报:7 现在其他任务类型里就这三种
+ String[] others = new String[]{"门牌", "公交", "情报"};// //门牌:7 公交:8 情报:9 现在其他任务类型里就这三种
private EditText editTaskName, editOtherDescribe;
private RelativeLayout rlPicture;
private ImageView ivPicture;
@@ -101,7 +93,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
private Button btnOtherLocal;
private PoiDao poiDao;
private LatLng latLng;
- private int station_type = 5;
+ private int station_type = 7;
private ArrayList otherUploadList;
private CheckBox checkPot;
private Marker markerOther;
@@ -173,13 +165,13 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
public void onItemSelected(AdapterView> parent, View view, int position, long id) {
switch (position) {
case 0:
- station_type = 5;
+ station_type = 7;
break;
case 1:
- station_type = 6;
+ station_type = 8;
break;
case 2:
- station_type = 7;
+ station_type = 9;
break;
}
}
@@ -320,27 +312,51 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
if (name != null && !name.equals("")) {
editTaskName.setText(name);
}
- String x = showPoiEntity.getX();
- String y = showPoiEntity.getY();
- if (x != null && y != null) {
- latLng = new LatLng();
- latLng.setLongitude(Double.parseDouble(x));
- latLng.setLatitude(Double.parseDouble(y));
+
+ String geoWkt = showPoiEntity.getGeoWkt();
+ if (geoWkt!=null){
+ String geo = Geohash.getInstance().decode(geoWkt);
+ Geometry geometry = GeometryTools.createGeometry(geo);
+ switch (geometry.getGeometryType()) {
+ case "Point": //点
+ latLng = GeometryTools.createLatLng(geo);
+ break;
+ case "LineString": //线
+ case "Polygon": //面
+ List latLineString = GeometryTools.getLatLags(geo);
+ assert latLineString != null;
+ latLng = latLineString.get(0);
+ break;
+ }
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bag);
markerOther = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).anchor(0.5f, 1.0f));
markerOther.setZIndex(4);
moveLatlng(latLng, null);
+ }else {
+ String x = showPoiEntity.getX();
+ String y = showPoiEntity.getY();
+ if (x != null && y != null) {
+ latLng = new LatLng();
+ latLng.setLongitude(Double.parseDouble(x));
+ latLng.setLatitude(Double.parseDouble(y));
+ BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bag);
+ markerOther = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).anchor(0.5f, 1.0f));
+ markerOther.setZIndex(4);
+ moveLatlng(latLng, null);
+ }
}
+
+
String describe = showPoiEntity.getMemo();//任务描述
if (describe != null && !describe.equals("")) {
editOtherDescribe.setText(describe);
}
int station_type = showPoiEntity.getStation_type();
- if (station_type == 5) {
+ if (station_type == 7) {
spinnerOther.setSelection(0, true);
- } else if (station_type == 6) {
+ } else if (station_type == 8) {
spinnerOther.setSelection(1, true);
- } else if (station_type == 7) {
+ } else if (station_type == 9) {
spinnerOther.setSelection(2, true);
}
if (showPoiEntity.getPhotoInfo() != null) {
@@ -423,7 +439,12 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
- otherUploadByNet(poiDaoPoiEntity.getBodyId(), otherUploadList);
+ if (Constant.isPresent){
+ otherUploadByNet(poiDaoPoiEntity.getBodyId(), otherUploadList);
+ Constant.isPresent=false;
+ }else {
+ Toast.makeText(getContext(), "有正在提交的数据,等提交成功后,方可操作", Toast.LENGTH_SHORT).show();
+ }
}
});
}
@@ -488,8 +509,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
HttpParams httpParams = new HttpParams();
httpParams.put("auditId", body);
- showLoadingDialog();
- setLoadingDialogText("上传中...");
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.OTHER_TASK_UPLOAD_PIC)
@@ -497,42 +516,11 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
.token(Constant.ACCESS_TOKEN)
.params(httpParams)
.cls(PoiUploadBean.class)
- .postFileAsynchronous(new Callback() {
- @Override
- public void onSuccess(PoiUploadBean response, int id) {
- dismissLoadingDialog();
- if (response.getCode() == 200) {
- new Thread(new Runnable() {
- @Override
- public void run() {
- PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
- poiDao.deletePoiEntity(poiDaoPoiEntity);
- Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
- @Override
- public void run() {
- Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
- Message obtain = Message.obtain();
- obtain.what = Constant.JOB_WORD_MONITOR;
- obtain.obj = true;
- EventBus.getDefault().post(obtain);
- getActivity().onBackPressed();//回退
- }
- });
- }
- }).start();
- } else {
- Toast.makeText(getActivity(), response.getMessage(), Toast.LENGTH_SHORT).show();
- }
+ .postFileAsynchronous(UploadUtils.getInstance().getOtherUploadCallback(getActivity(),showPoiEntity));
+ Objects.requireNonNull(getActivity()).onBackPressed();//回退
+ WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台上传中,请稍候...");
+ WaitDialog.dismiss(3000);
- }
-
- @Override
- public void onError(Throwable e, int id) {
- dismissLoadingDialog();
- Toast.makeText(getActivity(), e.getMessage() + "", Toast.LENGTH_SHORT).show();
- Log.d("TAG", "onError: " + e.getMessage() + "");
- }
- });
}
private void otherSaveByNetWork(PoiEntity poiEntity, boolean isLocal) {
@@ -569,6 +557,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
public void run() {
if (isLocal) {
otherUploadByNet(body, otherUploadList);
+ Constant.isPresent=false;
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
Message obtain = Message.obtain();
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/PoiFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/PoiFragment.java
index 068e03d..802a479 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/PoiFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/PoiFragment.java
@@ -4,17 +4,14 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.Point;
-import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
-import android.provider.MediaStore;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
-import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -38,12 +35,14 @@ import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.MessageDialog;
+import com.kongzue.dialog.v3.WaitDialog;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement;
import com.navinfo.outdoor.activity.PhotographActivity;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment;
+import com.navinfo.outdoor.util.UploadUtils;
import com.navinfo.outdoor.bean.GetPhoneBean;
import com.navinfo.outdoor.bean.Info;
import com.navinfo.outdoor.bean.OtherUploadPicBean;
@@ -61,6 +60,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.GeometryTools;
import com.navinfo.outdoor.util.PhotoUtils;
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
@@ -68,6 +68,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
+import com.vividsolutions.jts.geom.Geometry;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@@ -80,8 +81,6 @@ import java.util.Calendar;
import java.util.List;
import java.util.Objects;
-import static android.app.Activity.RESULT_OK;
-
/**
* poi记录的Fragment
* 2021-5-25
@@ -382,17 +381,40 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
if (address != null && !address.equals("")) {
editSiteContent.setText(address);
}
- String x = showPoiEntity.getX();
- String y = showPoiEntity.getY();
- if (x != null && y != null) {
- latLng = new LatLng();
- latLng.setLatitude(Double.parseDouble(y));
- latLng.setLongitude(Double.parseDouble(x));
+
+ String geoWkt = showPoiEntity.getGeoWkt();
+ if (geoWkt!=null){
+ String geo = Geohash.getInstance().decode(geoWkt);
+ Geometry geometry = GeometryTools.createGeometry(geo);
+ switch (geometry.getGeometryType()) {
+ case "Point": //点
+ latLng = GeometryTools.createLatLng(geo);
+ break;
+ case "LineString": //线
+ case "Polygon": //面
+ List latLineString = GeometryTools.getLatLags(geo);
+ assert latLineString != null;
+ latLng = latLineString.get(0);
+ break;
+ }
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bags);
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).anchor(0.5f, 1.0f));
markerPoi.setZIndex(4);
moveLatlng(latLng, null);
+ }else {
+ String x = showPoiEntity.getX();
+ String y = showPoiEntity.getY();
+ if (x != null && y != null) {
+ latLng = new LatLng();
+ latLng.setLatitude(Double.parseDouble(y));
+ latLng.setLongitude(Double.parseDouble(x));
+ BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bags);
+ markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).anchor(0.5f, 1.0f));
+ markerPoi.setZIndex(4);
+ moveLatlng(latLng, null);
+ }
}
+
//得到区号
initPhone();
String memo = showPoiEntity.getMemo();//任务描述
@@ -637,7 +659,12 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
- poiUploadByNetWork(poiDaoPoiEntity.getBodyId(), poiPicList);
+ if (Constant.isPresent){
+ poiUploadByNetWork(poiDaoPoiEntity.getBodyId(), poiPicList);
+ Constant.isPresent=false;
+ }else {
+ Toast.makeText(getContext(), "有正在提交的数据,等提交成功后,方可操作", Toast.LENGTH_SHORT).show();
+ }
}
});
}
@@ -755,7 +782,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
- getActivity().runOnUiThread(new Runnable() {
+ Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
poiSaveByNet(poiEntity, isLocal);
@@ -786,8 +813,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
Log.e("TAG", "poiUploadByNetWork: " + body + poiPicList);
return;
}
- showLoadingDialog();
- setLoadingDialogText("上传中...");
HttpParams httpParams = new HttpParams();
httpParams.put("auditId", body);
OkGoBuilder.getInstance()
@@ -796,41 +821,10 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
.token(Constant.ACCESS_TOKEN)
.fileList(poiPicList)
.params(httpParams)
- .postFileAsynchronous(new Callback() {
- @Override
- public void onSuccess(OtherUploadPicBean response, int id) {
- dismissLoadingDialog();
- if (response.getCode() == 200) {
- new Thread(new Runnable() {
- @Override
- public void run() {
- PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
- poiDao.deletePoiEntity(poiDaoPoiEntity);
- Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
- @Override
- public void run() {
- Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
- Message obtain = Message.obtain();
- obtain.what = Constant.JOB_WORD_MONITOR;
- obtain.obj = true;
- EventBus.getDefault().post(obtain);
- getActivity().onBackPressed();//回退
- }
- });
- }
- }).start();
- } else {
- Toast.makeText(getActivity(), response.getMessage(), Toast.LENGTH_SHORT).show();
- }
-
- }
-
- @Override
- public void onError(Throwable e, int id) {
- dismissLoadingDialog();
- Toast.makeText(getActivity(), e.getMessage() + "", Toast.LENGTH_SHORT).show();
- }
- });
+ .postFileAsynchronous(UploadUtils.getInstance().getPoiUploadCallback(getActivity(),showPoiEntity));
+ Objects.requireNonNull(getActivity()).onBackPressed();//回退
+ WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台上传中,请稍候...");
+ WaitDialog.dismiss(3000);
}
@@ -869,6 +863,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
public void run() {
if (isLocal) {
poiUploadByNetWork(body, poiPicList);//上传
+ Constant.isPresent=false;
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
Message obtain = Message.obtain();
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/PoiVideoFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/PoiVideoFragment.java
index 0d7ffde..2997b32 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/PoiVideoFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/PoiVideoFragment.java
@@ -11,8 +11,6 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
-import android.widget.RadioButton;
-import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
@@ -32,13 +30,14 @@ import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.MessageDialog;
+import com.kongzue.dialog.v3.WaitDialog;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement;
-import com.navinfo.outdoor.activity.PictureActivity;
import com.navinfo.outdoor.activity.PicturesActivity;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment;
+import com.navinfo.outdoor.util.UploadUtils;
import com.navinfo.outdoor.bean.OtherUploadPicBean;
import com.navinfo.outdoor.bean.PoiVideoBean;
import com.navinfo.outdoor.bean.UnPolygonTaskBean;
@@ -51,12 +50,14 @@ import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
+import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
+import com.vividsolutions.jts.geom.Geometry;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@@ -197,17 +198,40 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
if (name != null && !name.equals("")) {
etRoadName.setText(name);
}
- String x = showPoiEntity.getX();
- String y = showPoiEntity.getY();
- if (x != null && y != null) {
- latLng = new LatLng();
- latLng.setLongitude(Double.parseDouble(x));
- latLng.setLatitude(Double.parseDouble(y));
+
+ String geoWkt = showPoiEntity.getGeoWkt();
+ if (geoWkt!=null){
+ String geo = Geohash.getInstance().decode(geoWkt);
+ Geometry geometry = GeometryTools.createGeometry(geo);
+ switch (geometry.getGeometryType()) {
+ case "Point": //点
+ latLng = GeometryTools.createLatLng(geo);
+ break;
+ case "LineString": //线
+ case "Polygon": //面
+ List latLineString = GeometryTools.getLatLags(geo);
+ assert latLineString != null;
+ latLng = latLineString.get(0);
+ break;
+ }
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bag);
markerPoiVideo = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).anchor(0.5f, 1.0f));
markerPoiVideo.setZIndex(4);
moveLatlng(latLng, null);
+ }else {
+ String x = showPoiEntity.getX();
+ String y = showPoiEntity.getY();
+ if (x != null && y != null) {
+ latLng = new LatLng();
+ latLng.setLongitude(Double.parseDouble(x));
+ latLng.setLatitude(Double.parseDouble(y));
+ BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bag);
+ markerPoiVideo = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).anchor(0.5f, 1.0f));
+ markerPoiVideo.setZIndex(4);
+ moveLatlng(latLng, null);
+ }
}
+
String describe = showPoiEntity.getMemo();//任务描述
if (describe != null && !describe.equals("")) {
etDesc.setText(describe);
@@ -311,40 +335,42 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
startActivityForResult(intent, 0x101);
break;
case R.id.btn_poi_video_upload:
- showLoadingDialog();
- setLoadingDialogText("压缩中...");
- if (fmPoiVideoPic.getTag() != null) {
- List videoFileList = (List) fmPoiVideoPic.getTag();
- fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
- new Thread(new Runnable() {
- @Override
- public void run() {
- ZipUtil.zipFiles(videoFileList, fileZip, null);
- PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
- if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0 || poiDaoPoiEntity.getTaskStatus() == 5) {
- Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
- @Override
- public void run() {
- dismissLoadingDialog();
- initPoiSaveLocal(true);
- }
- });
- } else {
- Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
- @Override
- public void run() {
- dismissLoadingDialog();
- poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
- }
- });
+ if (Constant.isPresent){
+ if (fmPoiVideoPic.getTag() != null) {
+ List videoFileList = (List) fmPoiVideoPic.getTag();
+ fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ ZipUtil.zipFiles(videoFileList, fileZip, null);
+ PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
+ if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0 || poiDaoPoiEntity.getTaskStatus() == 5) {
+ Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ initPoiSaveLocal(true);
+ }
+ });
+ } else {
+ Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
+ Constant.isPresent=false;
+ }
+ });
+ }
}
- }
- }).start();
- } else {
- dismissLoadingDialog();
- Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
- return;
+ }).start();
+ } else {
+ dismissLoadingDialog();
+ Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
+ return;
+ }
+ }else {
+ Toast.makeText(getContext(), "有正在提交的数据,等提交成功后,方可操作", Toast.LENGTH_SHORT).show();
}
+
break;
}
}
@@ -406,49 +432,17 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
long time = System.currentTimeMillis();
httpParams.put("datetime", time);
httpParams.put("file", fileZip);
- showLoadingDialog();
- setLoadingDialogText("上传中...");
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.POI_VIDEO_UPLOAD_PIC)
.cls(OtherUploadPicBean.class)
.params(httpParams)
.token(Constant.ACCESS_TOKEN)
- .postRequest(new Callback() {
- @Override
- public void onSuccess(OtherUploadPicBean response, int id) {
- dismissLoadingDialog();
- if (response.getCode() == 200) {
- new Thread(new Runnable() {
- @Override
- public void run() {
- PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
- poiDao.deletePoiEntity(poiDaoPoiEntity);
- Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
- @Override
- public void run() {
- Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
- Message obtain = Message.obtain();
- obtain.what = Constant.JOB_WORD_MONITOR;
- obtain.obj = true;
- EventBus.getDefault().post(obtain);
- getActivity().onBackPressed();//回退
- }
- });
- }
- }).start();
- } else {
- Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
- }
- }
+ .postRequest(UploadUtils.getInstance().getPoiVideoUploadCallback(getActivity(),showPoiEntity));
+ Objects.requireNonNull(getActivity()).onBackPressed();//回退
+ WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台上传中,请稍候...");
+ WaitDialog.dismiss(3000);
- @Override
- public void onError(Throwable e, int id) {
- dismissLoadingDialog();
- Toast.makeText(getActivity(), "上传失败", Toast.LENGTH_SHORT).show();
- Log.d("TAG", "onError: " + e.getMessage() + "");
- }
- });
}
private void poiVideoSave(PoiEntity poiEntity, boolean isLocal) {
@@ -680,9 +674,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
}
if (fmPoiVideoPic.getTag() != null && !((List) fmPoiVideoPic.getTag()).isEmpty()) {
- List lineStringByFileList = AWMp4ParserHelper.getInstance().getLineStringByFileList((List) fmPoiVideoPic.getTag());
- String lineString = GeometryTools.getLineString(lineStringByFileList);
- Log.d("TAG", "onGranted: " + lineString);
+ List lineStringByFileList = AWMp4ParserHelper.getInstance().getLinePhotoByList((List) fmPoiVideoPic.getTag());
+ String lineString = Geohash.getInstance().encodeList(lineStringByFileList);
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List) fmPoiVideoPic.getTag());
poiEntity.setPhoto(photoStr);
if (lineString != null) {
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/RoadFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/RoadFragment.java
index e75a6f8..e9a2d99 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/RoadFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/RoadFragment.java
@@ -2,7 +2,6 @@ package com.navinfo.outdoor.fragment;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
@@ -12,8 +11,6 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
-import android.widget.RadioButton;
-import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
@@ -22,6 +19,7 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.widget.NestedScrollView;
+import com.bumptech.glide.Glide;
import com.github.lazylibrary.util.StringUtils;
import com.github.lazylibrary.util.ZipUtil;
import com.google.gson.Gson;
@@ -32,13 +30,14 @@ import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.MessageDialog;
+import com.kongzue.dialog.v3.WaitDialog;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement;
-import com.navinfo.outdoor.activity.PictureActivity;
import com.navinfo.outdoor.activity.PicturesActivity;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment;
+import com.navinfo.outdoor.util.UploadUtils;
import com.navinfo.outdoor.bean.OtherUploadPicBean;
import com.navinfo.outdoor.bean.RoadSaveBean;
import com.navinfo.outdoor.bean.UnPolygonTaskBean;
@@ -51,12 +50,14 @@ import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
+import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
+import com.vividsolutions.jts.geom.Geometry;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@@ -64,7 +65,6 @@ import org.greenrobot.eventbus.Subscribe;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Objects;
@@ -142,7 +142,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
super.initView();
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
poiDao = poiDatabase.getPoiDao();
- tvPictures = findViewById(R.id.tv_pictures);
+ tvPictures = findViewById(R.id.tv_pictures);
tvPictures.setOnClickListener(this);
setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT);
NestedScrollView nestedScrollView = findViewById(R.id.nested_scroll_view);
@@ -194,16 +194,37 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
if (name != null && !name.equals("")) {
etRoadName.setText(name);
}
- String x = showPoiEntity.getX();
- String y = showPoiEntity.getY();
- if (x != null && y != null) {
- latLng = new LatLng();
- latLng.setLongitude(Double.parseDouble(x));
- latLng.setLatitude(Double.parseDouble(y));
+ String geoWkt = showPoiEntity.getGeoWkt();
+ if (geoWkt!=null){
+ String geo = Geohash.getInstance().decode(geoWkt);
+ Geometry geometry = GeometryTools.createGeometry(geo);
+ switch (geometry.getGeometryType()) {
+ case "Point": //点
+ latLng = GeometryTools.createLatLng(geo);
+ break;
+ case "LineString": //线
+ case "Polygon": //面
+ List latLineString = GeometryTools.getLatLags(geo);
+ assert latLineString != null;
+ latLng = latLineString.get(0);
+ break;
+ }
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bag);
markerRoad = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).anchor(0.5f, 1.0f));
markerRoad.setZIndex(4);
moveLatlng(latLng, null);
+ }else {
+ String x = showPoiEntity.getX();
+ String y = showPoiEntity.getY();
+ if (x != null && y != null) {
+ latLng = new LatLng();
+ latLng.setLongitude(Double.parseDouble(x));
+ latLng.setLatitude(Double.parseDouble(y));
+ BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bag);
+ markerRoad = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).anchor(0.5f, 1.0f));
+ markerRoad.setZIndex(4);
+ moveLatlng(latLng, null);
+ }
}
String describe = showPoiEntity.getDescribe();//任务描述
if (describe != null && !describe.equals("")) {
@@ -211,7 +232,22 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
}
String photoList = showPoiEntity.getPhoto();//存儲在數據庫中的數據
if (!StringUtils.isEmpty(photoList)) {
- String[] photos = photoList.split(",");
+ if (!StringUtils.isEmpty(photoList)) {
+ boolean isImageLoad = false;
+ List fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
+ for (int i = 0; i < fileListByUUID.size(); i++) {
+ if (fileListByUUID.get(i).getPath().contains(".jpg") && !fileListByUUID.get(i).getPath().contains("paper.txt")) {
+ if (fileListByUUID.get(i).exists() && !isImageLoad) {
+ // 使用glide加载视频的第一帧
+ Glide.with(Objects.requireNonNull(getActivity())).load(fileListByUUID.get(i)).into(ivRoadPicture);
+ isImageLoad = true;
+ }
+ }
+ }
+ fmRoadPic.setTag(fileListByUUID);
+ }
+
+ /* String[] photos = photoList.split(",");
List videoFileList = new ArrayList<>();
boolean isImageLoad = false;
if (photos.length > 0) {
@@ -229,7 +265,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
}
}
fmRoadPic.setTag(videoFileList);
- }
+ }*/
}
}
assert showPoiEntity != null;
@@ -301,42 +337,44 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
startActivityForResult(intent, 0x101);
break;
case R.id.road_upload:
- showLoadingDialog();
- setLoadingDialogText("压缩中...");
- if (fmRoadPic.getTag() != null) {
- List videoFileList = (List) fmRoadPic.getTag();
- fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
- new Thread(new Runnable() {
- @Override
- public void run() {
- ZipUtil.zipFiles(videoFileList, fileZip, null);//压缩
- PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
- if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0 || poiDaoPoiEntity.getTaskStatus() == 5) {
- Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
- @Override
- public void run() {
- dismissLoadingDialog();
- initPoiSaveLocal(true);
- }
- });
+ if (Constant.isPresent) {
+ if (fmRoadPic.getTag() != null) {
+ List videoFileList = (List) fmRoadPic.getTag();
+ fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ ZipUtil.zipFiles(videoFileList, fileZip, null);//压缩
+ PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
+ if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0 || poiDaoPoiEntity.getTaskStatus() == 5) {
+ Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ initPoiSaveLocal(true);
+ }
+ });
+
+ } else {
+ Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
+ Constant.isPresent = false;
+ }
+ });
+ }
- } else {
- Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
- @Override
- public void run() {
- dismissLoadingDialog();
- poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
- }
- });
}
-
- }
- }).start();
+ }).start();
+ } else {
+ dismissLoadingDialog();
+ Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
+ return;
+ }
} else {
- dismissLoadingDialog();
- Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
- return;
+ Toast.makeText(getContext(), "有正在提交的数据,等提交成功后,方可操作", Toast.LENGTH_SHORT).show();
}
+
break;
}
@@ -400,49 +438,18 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
long time = System.currentTimeMillis();
httpParams.put("datetime", time);
httpParams.put("file", fileZip);
- showLoadingDialog();
- setLoadingDialogText("上传中...");
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.ROAD_TASK_UPLOAD_PIC)
.params(httpParams)
.token(Constant.ACCESS_TOKEN)
.cls(OtherUploadPicBean.class)
- .postRequest(new Callback() {
- @Override
- public void onSuccess(OtherUploadPicBean response, int id) {
- dismissLoadingDialog();
- if (response.getCode() == 200) {
- new Thread(new Runnable() {
- @Override
- public void run() {
- PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
- poiDao.deletePoiEntity(poiDaoPoiEntity);
- Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
- @Override
- public void run() {
- Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
- Message obtain = Message.obtain();
- obtain.what = Constant.JOB_WORD_MONITOR;
- obtain.obj = true;
- EventBus.getDefault().post(obtain);
- getActivity().onBackPressed();//回退
- }
- });
- }
- }).start();
- } else {
- Toast.makeText(getActivity(), response.getMessage(), Toast.LENGTH_SHORT).show();
- }
- }
+ .postRequest(UploadUtils.getInstance().getRoadUploadCallback(getActivity(), showPoiEntity));
+ Objects.requireNonNull(getActivity()).onBackPressed();//回退
+ WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台上传中,请稍候...");
+ WaitDialog.dismiss(3000);
+
- @Override
- public void onError(Throwable e, int id) {
- dismissLoadingDialog();
- Toast.makeText(getActivity(), "上传失败", Toast.LENGTH_SHORT).show();
- Log.d("TAG", "onError: " + e.getMessage() + "");
- }
- });
}
private void roadSaveBetWork(PoiEntity poiEntity, boolean isLocal) {
@@ -477,6 +484,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
public void run() {
if (isLocal) {
poiVideoUpload(roadBody, fileZip);
+ Constant.isPresent = false;
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
Message obtain = Message.obtain();
@@ -673,13 +681,13 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
}
}
if (fmRoadPic.getTag() != null && !((List) fmRoadPic.getTag()).isEmpty()) {
- List lineStringByFileList = AWMp4ParserHelper.getInstance().getLineStringByFileList((List) fmRoadPic.getTag());
- String lineString = GeometryTools.getLineString(lineStringByFileList);
- Log.d("TAG", "onGranted: " + lineString);
+ List lineStringByFileList = AWMp4ParserHelper.getInstance().getLinePhotoByList((List) fmRoadPic.getTag());
+ String encodeList = Geohash.getInstance().encodeList(lineStringByFileList);
+ Log.d("TAG", "onGranted: " + encodeList);
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List) fmRoadPic.getTag());
poiEntity.setPhoto(photoStr);
- if (lineString != null) {
- poiEntity.setGeoWkt(lineString);
+ if (encodeList != null) {
+ poiEntity.setGeoWkt(encodeList);
}
}
return poiEntity;
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/StaySubmitFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/StaySubmitFragment.java
index 4ca8495..963dbc3 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/StaySubmitFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/StaySubmitFragment.java
@@ -22,6 +22,7 @@ import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.BottomMenu;
import com.kongzue.dialog.v3.MessageDialog;
+import com.kongzue.dialog.v3.WaitDialog;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.adapter.StaySubmitAdapter;
@@ -83,13 +84,13 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
roadDao = roadDatabase.getPoiDao();
ConstraintLayout clStayType = findViewById(R.id.cl_stay_type);
clStayType.setOnClickListener(this);
- RecyclerView stayXrv =findViewById(R.id.stay_xrv);
+ RecyclerView stayXrv = findViewById(R.id.stay_xrv);
cbSelect = findViewById(R.id.cb_select);
cbSelect.setOnClickListener(this);
- TextView tvDelete =findViewById(R.id.tv_delete);
+ TextView tvDelete = findViewById(R.id.tv_delete);
tvDelete.setOnClickListener(this);
tvStayType = findViewById(R.id.tv_stay_type);
- Button btnStaySubmit =findViewById(R.id.btn_stay_submit);
+ Button btnStaySubmit = findViewById(R.id.btn_stay_submit);
btnStaySubmit.setOnClickListener(this);
stayXrv.setLayoutManager(new LinearLayoutManager(getActivity()));
stayXrv.addItemDecoration(new DividerItemDecoration(Objects.requireNonNull(getContext()), DividerItemDecoration.VERTICAL));
@@ -126,8 +127,6 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
public void onEvent(Message data) {
if (data.what == Constant.EVENT_STAY_REFRESH) {
cbSelect.setChecked(false);
- Toast.makeText(getActivity(), (String) data.obj, Toast.LENGTH_SHORT).show();
- dismissLoadingDialog();
refreshData();
}
}
@@ -192,14 +191,18 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
break;
case R.id.tv_delete:
- DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
- MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "是否删除", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
- @Override
- public boolean onClick(BaseDialog baseDialog, View v) {
- initRequest(staySubmitAdapter.getAllRoad());
- return false;
- }
- });
+ if (Constant.isPresent) {
+ DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
+ MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "是否删除", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
+ @Override
+ public boolean onClick(BaseDialog baseDialog, View v) {
+ initRequest(staySubmitAdapter.getAllRoad());
+ return false;
+ }
+ });
+ } else {
+ Toast.makeText(getContext(), "有正在提交的数据,等提交成功后,方可操作", Toast.LENGTH_SHORT).show();
+ }
break;
case R.id.btn_stay_submit://提交
if (poiEntities == null) {
@@ -212,12 +215,17 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
poiEntities.add(allRoad.get(i));
}
}
- if (poiEntities.size() > 0) {
- showLoadingDialog();
- setLoadingDialogText("提交中...");
- PoiSaveUtils.getInstance(getActivity()).uploadPoiEntityBatch(poiEntities);
+ if (Constant.isPresent) {
+ if (poiEntities.size() > 0) {
+ PoiSaveUtils.getInstance(getActivity()).uploadPoiEntityBatch(poiEntities);
+ Constant.isPresent = false;
+ WaitDialog.show((AppCompatActivity) getActivity(), "任务正在提交中,无需重复提交");
+ WaitDialog.dismiss(2000);
+ } else {
+ Toast.makeText(getActivity(), "请选择要提交的数据", Toast.LENGTH_SHORT).show();
+ }
} else {
- Toast.makeText(getActivity(), "请选择要提交的数据", Toast.LENGTH_SHORT).show();
+ Toast.makeText(getContext(), "有正在提交的数据,等提交成功后,方可操作", Toast.LENGTH_SHORT).show();
}
break;
}
@@ -248,10 +256,10 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
auditIds.append(poiEntities.get(i).getBodyId()).append(",");
}
}
- if (!taskIds.toString().equals("")){
+ if (!taskIds.toString().equals("")) {
taskIds = new StringBuilder(taskIds.substring(0, taskIds.length() - 1));
}
- if (!auditIds.toString().equals("")){
+ if (!auditIds.toString().equals("")) {
auditIds = new StringBuilder(auditIds.substring(0, auditIds.length() - 1));
}
HttpParams httpParams = new HttpParams();
@@ -267,9 +275,9 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
@Override
public void onSuccess(UnPolygonTaskBean response, int id) {
dismissLoadingDialog();
- if (response.getCode()==200){
+ if (response.getCode() == 200) {
staySubmitAdapter.setAllCheckedDelete();
- }else {
+ } else {
Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
}
}
@@ -315,7 +323,6 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
// roadEntities.add(roadAll.get(i));
// }
// }
-
Log.d("TAG", "run: " + roadEntities.toString());
staySubmitAdapter.setAllRoad(roadEntities);
staySubmitAdapter.notifyDataSetChanged();
diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/TreasureFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/TreasureFragment.java
index 7bbafa0..c710385 100644
--- a/app/src/main/java/com/navinfo/outdoor/fragment/TreasureFragment.java
+++ b/app/src/main/java/com/navinfo/outdoor/fragment/TreasureFragment.java
@@ -560,7 +560,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
String encodeStr = list.get(i).getGeo();
// 解密geo
String geo = Geohash.getInstance().decode(encodeStr);
- listBean.setGeo(geo);
Log.d("TAG", "onSuccess: " + geo);
Geometry geometry = GeometryTools.createGeometry(geo);
LatLng latLng = null;
@@ -569,9 +568,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
case "MultiLineString"://多线
BitmapDescriptor bitmapLine = null;
if (listBean.getType() == 3) {//poi录像
- bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
- } else if (listBean.getType() == 4) {//道路录像
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
+ } else if (listBean.getType() == 4) {//道路录像
+ bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
}
List latLineString = GeometryTools.getLatLags(geo);
// 构造 PolylineOptions
@@ -582,13 +581,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
// 折线的颜色为绿色
.color(Color.parseColor("#0096FF"))
// 折线宽度为5像素
- .width(10)
+ .width(28)
// 还可以添加描边颜色
//.borderColor(0xffff0000)
// 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth`
//.borderWidth(1);
.arrow(true)
- .arrowSpacing(100)
+ .arrowSpacing(80)
.arrowTexture(bitmapLine);
// 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions);
@@ -756,8 +755,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
public void initMarker(PoiEntity poiEntity, boolean aBoolean) {
- String geo = poiEntity.getGeoWkt();
- Log.d("TAG", "onSuccess: " + geo);
+ String geoWkt = poiEntity.getGeoWkt();
+ Log.d("TAG", "onSuccess: " + geoWkt);
+ String geo = Geohash.getInstance().decode(geoWkt);//解密
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry == null) {
return;
@@ -775,9 +775,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
case "MultiLineString"://多线
BitmapDescriptor bitmapLine = null;
if (poiEntity.getType() == 3) {//poi录像
- bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
- } else if (poiEntity.getType() == 4) {//道路录像
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
+ } else if (poiEntity.getType() == 4) {//道路录像
+ bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
+
}
List latLineString = GeometryTools.getLatLags(geo);
// 构造 PolylineOnions
@@ -786,11 +787,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
// 折线设置圆形线头
.lineCap(true)
// 折线的颜色为绿色
- .color(Color.parseColor("#D8D8D8"))
+ .color(Color.parseColor("#00ffff"))
// 折线宽度为5像素
- .width(20)
+ .width(28)
.arrow(true)
- .arrowSpacing(150)
+ .arrowSpacing(80)
.arrowTexture(bitmapLine);
// 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions);
@@ -887,9 +888,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
removablesLocality.clear();
for (int i = 0; i < allTaskStatus.size(); i++) {
PoiEntity poiEntity = allTaskStatus.get(i);
- String geo = allTaskStatus.get(i).getGeoWkt();
+ String geoWkt = allTaskStatus.get(i).getGeoWkt();
+
LatLng latLng = null;
- Log.d("TAG", "onSuccess: " + geo);
+ Log.d("TAG", "onSuccess: " + geoWkt);
+ String geo = Geohash.getInstance().decode(geoWkt);//解密geo
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry != null) {
switch (geometry.getGeometryType()) {
@@ -899,23 +902,22 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
case "LineString": //线
case "MultiLineString"://多线
BitmapDescriptor bitmapLine = null;
- if (type == 3) {//poi录像
- bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
- } else if (type == 4) {//道路录像
+ if (poiEntity.getType() == 3) {//poi录像
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
+ } else if (poiEntity.getType() == 4) {//道路录像
+ bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
}
List latLineString = GeometryTools.getLatLags(geo);
// 构造 PolylineOnions
PolylineOptions polylineOptions = new PolylineOptions()
- .alpha(0.5f)
.addAll(latLineString)
// 折线设置圆形线头
.lineCap(true)
.color(Color.parseColor("#FFE70C"))
// 折线宽度为5像素
- .width(10)
+ .width(28)
.arrow(true)
- .arrowSpacing(100)
+ .arrowSpacing(80)
.arrowTexture(bitmapLine);
// 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions);
@@ -1756,7 +1758,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
marker.remove();
break;
case 3:
-
initMarker(poiEntity, false);
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
showSlidingFragment(poiVideoFragment);
@@ -1797,8 +1798,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
poiListEntity.setDescribe(listBean.getMemo());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setType(listBean.getType());
- String geo = listBean.getGeo();
- poiListEntity.setGeoWkt(geo);
+ String beanGeo = listBean.getGeo();
+ String geo = Geohash.getInstance().decode(beanGeo);
Geometry geometry = GeometryTools.createGeometry(geo);
switch (geometry.getGeometryType()) {
case "Point": //点
diff --git a/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java b/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java
index 6b5952e..f6b0512 100644
--- a/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java
+++ b/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java
@@ -3,13 +3,12 @@ package com.navinfo.outdoor.http;
import com.navinfo.outdoor.api.Constant;
public class HttpInterface {
- public static final String IP_ = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
+ public static final String IP_TEST = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
public static final String DATA_IP = "http://172.23.139.4:9999/m4";//接口
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口
public static final String TEST_GUIDANCE_IP = "http://172.21.98.90:9999/m4";//引导页完成接口
public static final String APKIP = "http://172.23.139.4:8001/";
-
public static final String USER_PATH = "/user/";//我的
public static final String MSG_LIST_PATH = "/msgList/";//发现
public static final String USER_LOGIN_PATH = "/userlogin/";//登录
@@ -24,7 +23,6 @@ public class HttpInterface {
public static void initAppPath(String userId) {
APP_CHECK_VERSION = IP + USER_PATH + "appVersion/" + userId + "/checkVersion"; //版本升级
-
}
/**
diff --git a/app/src/main/java/com/navinfo/outdoor/util/AWMp4ParserHelper.java b/app/src/main/java/com/navinfo/outdoor/util/AWMp4ParserHelper.java
index 3f5624d..ed53f2b 100644
--- a/app/src/main/java/com/navinfo/outdoor/util/AWMp4ParserHelper.java
+++ b/app/src/main/java/com/navinfo/outdoor/util/AWMp4ParserHelper.java
@@ -357,4 +357,37 @@ public class AWMp4ParserHelper {
}
return latLngs;
}
+
+
+ /**
+ * 根据图片文件列表,获取到对应的轨迹数据
+ * */
+ public List getLinePhotoByList(List videoFileList) {
+ List latLags = new ArrayList<>();
+ if (videoFileList == null || videoFileList.isEmpty()) {
+ return latLags;
+ }
+
+ for (int m = 0; m < videoFileList.size(); m++) {
+ if (videoFileList.get(m).getPath().contains("paper.txt")){
+ File path = videoFileList.get(m);
+ List strings = FileUtils.readFileToList(path.getPath(), "utf-8");
+ if (strings!=null) {
+ for (int i = 0; i < strings.size(); i++) {
+ String[] split = strings.get(i).split(",");
+ LatLng latLng = new LatLng();
+ latLng.setLatitude(Double.valueOf(split[2]));
+ latLng.setLongitude(Double.valueOf(split[3]));
+ latLags.add(latLng);
+ }
+ if (strings.size() == 1) {
+ LatLng latLng = latLags.get(0);
+ latLags.add(latLng);
+ }
+ }
+ }
+ }
+ return latLags;
+ }
+
}
diff --git a/app/src/main/java/com/navinfo/outdoor/base/Base64Util.java b/app/src/main/java/com/navinfo/outdoor/util/Base64Util.java
similarity index 98%
rename from app/src/main/java/com/navinfo/outdoor/base/Base64Util.java
rename to app/src/main/java/com/navinfo/outdoor/util/Base64Util.java
index c2eba8c..c3d98da 100644
--- a/app/src/main/java/com/navinfo/outdoor/base/Base64Util.java
+++ b/app/src/main/java/com/navinfo/outdoor/util/Base64Util.java
@@ -1,4 +1,4 @@
-package com.navinfo.outdoor.base;
+package com.navinfo.outdoor.util;
/**
* Base64 工具类
diff --git a/app/src/main/java/com/navinfo/outdoor/util/Geohash.java b/app/src/main/java/com/navinfo/outdoor/util/Geohash.java
index b382158..9e5ae02 100644
--- a/app/src/main/java/com/navinfo/outdoor/util/Geohash.java
+++ b/app/src/main/java/com/navinfo/outdoor/util/Geohash.java
@@ -9,6 +9,7 @@ import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.BitSet;
import java.util.HashMap;
+import java.util.List;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
@@ -151,6 +152,15 @@ public class Geohash {
}
return null;
}
+ public String encodeList(List latLngs){
+ String lineString = GeometryTools.getLineString(latLngs);
+ try {
+ return Base64.desEncrypt(lineString);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
private BitSet getBits(double lat, double floor, double ceiling) {
BitSet buffer = new BitSet(nubbins);
diff --git a/app/src/main/java/com/navinfo/outdoor/util/PoiSaveUtils.java b/app/src/main/java/com/navinfo/outdoor/util/PoiSaveUtils.java
index b46a65c..efbf5bc 100644
--- a/app/src/main/java/com/navinfo/outdoor/util/PoiSaveUtils.java
+++ b/app/src/main/java/com/navinfo/outdoor/util/PoiSaveUtils.java
@@ -87,8 +87,12 @@ public class PoiSaveUtils {
public void run() {
Message obtain = Message.obtain();
obtain.what = Constant.EVENT_STAY_REFRESH;
- obtain.obj = "提交成功" + anInt + ",提交失败" + bInt;
EventBus.getDefault().post(obtain);
+
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "批量提交 成功:" + anInt + ", 失败:" + bInt;
+ EventBus.getDefault().post(obtain1);
}
});
@@ -259,12 +263,6 @@ public class PoiSaveUtils {
}
List videoFileList = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
if (videoFileList != null && !videoFileList.isEmpty()) {
- /*List txtFileList = new ArrayList<>();
- for (File videoFile : videoFileList) {
- File file = new File(videoFile.getAbsolutePath() + ".txt");
- txtFileList.add(file);
- }*/
- //videoFileList.addAll(videoFileList);
File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
ZipUtil.zipFiles(videoFileList, fileZip, null);
photoFile.add(fileZip);
diff --git a/app/src/main/java/com/navinfo/outdoor/util/UploadUtils.java b/app/src/main/java/com/navinfo/outdoor/util/UploadUtils.java
new file mode 100644
index 0000000..299ba00
--- /dev/null
+++ b/app/src/main/java/com/navinfo/outdoor/util/UploadUtils.java
@@ -0,0 +1,283 @@
+package com.navinfo.outdoor.util;
+
+import android.app.Activity;
+import android.os.Message;
+import android.util.Log;
+
+import com.navinfo.outdoor.api.Constant;
+import com.navinfo.outdoor.bean.OtherUploadPicBean;
+import com.navinfo.outdoor.bean.PoiUploadBean;
+import com.navinfo.outdoor.http.Callback;
+import com.navinfo.outdoor.room.PoiDao;
+import com.navinfo.outdoor.room.PoiDatabase;
+import com.navinfo.outdoor.room.PoiEntity;
+
+import org.greenrobot.eventbus.EventBus;
+
+import java.util.Objects;
+
+public class UploadUtils {
+ private static UploadUtils instance;
+
+ public static UploadUtils getInstance() {
+ if (instance == null) {
+ instance = new UploadUtils();
+ }
+ return instance;
+ }
+
+ /**
+ * 道路
+ * @param mContext
+ * @param showPoiEntity
+ * @return
+ */
+ public Callback getRoadUploadCallback(Activity mContext, PoiEntity showPoiEntity) {
+ PoiDao poiDao = PoiDatabase.getInstance(mContext).getPoiDao();
+ return new Callback() {
+ @Override
+ public void onSuccess(OtherUploadPicBean response, int id) {
+ if (response.getCode() == 200) {
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "道路:" + showPoiEntity.getName() + " 上传成功";
+ EventBus.getDefault().post(obtain1);
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
+ poiDao.deletePoiEntity(poiDaoPoiEntity);
+ Objects.requireNonNull(mContext).runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ Message obtain = Message.obtain();
+ obtain.what = Constant.JOB_WORD_MONITOR;
+ obtain.obj = true;
+ EventBus.getDefault().post(obtain);
+ }
+ });
+ }
+ }).start();
+ } else {
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "道路:" + showPoiEntity.getName() + " 上传失败";
+ EventBus.getDefault().post(obtain1);
+ }
+ }
+
+ @Override
+ public void onError(Throwable e, int id) {
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "道路:" + showPoiEntity.getName() + " 上传失败";
+ EventBus.getDefault().post(obtain1);
+ Log.d("TAG", "onError: " + e.getMessage() + "");
+ }
+ };
+ }
+ /**
+ * poi
+ * @param mContext
+ * @param showPoiEntity
+ * @return
+ */
+ public Callback getPoiUploadCallback(Activity mContext, PoiEntity showPoiEntity) {
+ PoiDao poiDao = PoiDatabase.getInstance(mContext).getPoiDao();
+ return new Callback() {
+ @Override
+ public void onSuccess(OtherUploadPicBean response, int id) {
+ if (response.getCode() == 200) {
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "Poi:"+showPoiEntity.getName()+" 上传成功";
+ EventBus.getDefault().post(obtain1);
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
+ poiDao.deletePoiEntity(poiDaoPoiEntity);
+ Objects.requireNonNull(mContext).runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ Message obtain = Message.obtain();
+ obtain.what = Constant.JOB_WORD_MONITOR;
+ obtain.obj = true;
+ EventBus.getDefault().post(obtain);
+ }
+ });
+ }
+ }).start();
+ } else {
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "Poi:"+showPoiEntity.getName()+" 上传失败";
+ EventBus.getDefault().post(obtain1);
+ }
+
+ }
+
+ @Override
+ public void onError(Throwable e, int id) {
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "Poi:"+showPoiEntity.getName()+" 上传失败";
+ EventBus.getDefault().post(obtain1);
+ }
+ };
+ }
+
+ /**
+ * poiVideo
+ * @param mContext
+ * @param showPoiEntity
+ * @return
+ */
+ public Callback getPoiVideoUploadCallback(Activity mContext, PoiEntity showPoiEntity) {
+ PoiDao poiDao = PoiDatabase.getInstance(mContext).getPoiDao();
+ return new Callback() {
+ @Override
+ public void onSuccess(OtherUploadPicBean response, int id) {
+ if (response.getCode() == 200) {
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "poi录像:"+showPoiEntity.getName()+" 上传成功";
+ EventBus.getDefault().post(obtain1);
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
+ poiDao.deletePoiEntity(poiDaoPoiEntity);
+ Objects.requireNonNull(mContext).runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ Message obtain = Message.obtain();
+ obtain.what = Constant.JOB_WORD_MONITOR;
+ obtain.obj = true;
+ EventBus.getDefault().post(obtain);
+ }
+ });
+ }
+ }).start();
+ } else {
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "poi录像:"+showPoiEntity.getName()+" 上传失败";
+ EventBus.getDefault().post(obtain1);
+ }
+ }
+
+ @Override
+ public void onError(Throwable e, int id) {
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "poi录像:"+showPoiEntity.getName()+" 上传失败";
+ EventBus.getDefault().post(obtain1);
+ Log.d("TAG", "onError: " + e.getMessage() + "");
+ }
+ };
+ }
+
+ /**
+ * other
+ * @param mContext
+ * @param showPoiEntity
+ * @return
+ */
+ public Callback getOtherUploadCallback(Activity mContext, PoiEntity showPoiEntity) {
+ PoiDao poiDao = PoiDatabase.getInstance(mContext).getPoiDao();
+ return new Callback() {
+ @Override
+ public void onSuccess(PoiUploadBean response, int id) {
+ if (response.getCode() == 200) {
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "其他:"+showPoiEntity.getName()+" 上传成功";
+ EventBus.getDefault().post(obtain1);
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
+ poiDao.deletePoiEntity(poiDaoPoiEntity);
+ Objects.requireNonNull(mContext).runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ Message obtain = Message.obtain();
+ obtain.what = Constant.JOB_WORD_MONITOR;
+ obtain.obj = true;
+ EventBus.getDefault().post(obtain);
+ }
+ });
+ }
+ }).start();
+ } else {
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "其他:"+showPoiEntity.getName()+" 上传失败";
+ EventBus.getDefault().post(obtain1);
+ }
+
+ }
+
+ @Override
+ public void onError(Throwable e, int id) {
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "其他:"+showPoiEntity.getName()+" 上传失败";
+ EventBus.getDefault().post(obtain1);
+ Log.d("TAG", "onError: " + e.getMessage() + "");
+ }
+ };
+ }
+
+ /**
+ * charging
+ * @param mContext
+ * @param showPoiEntity
+ * @return
+ */
+ public Callback getChargingUploadCallback(Activity mContext, PoiEntity showPoiEntity) {
+ PoiDao poiDao = PoiDatabase.getInstance(mContext).getPoiDao();
+ return new Callback() {
+ @Override
+ public void onSuccess(PoiUploadBean response, int id) {
+ if (response.getCode() == 200) {
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "充电站:"+showPoiEntity.getName()+" 上传成功";
+ EventBus.getDefault().post(obtain1);
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ poiDao.deletePoiEntity(showPoiEntity);
+ mContext.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ Message obtain = Message.obtain();
+ obtain.what = Constant.JOB_WORD_MONITOR;
+ obtain.obj = true;
+ EventBus.getDefault().post(obtain);
+ }
+ });
+ }
+ }).start();
+ } else {
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "充电站:"+showPoiEntity.getName()+" 上传失败";
+ EventBus.getDefault().post(obtain1);
+ }
+ }
+
+ @Override
+ public void onError(Throwable e, int id) {
+ Message obtain1 = Message.obtain();
+ obtain1.what = Constant.NEST_WORD_SUBMIT;
+ obtain1.obj = "充电站:"+showPoiEntity.getName()+" 上传失败";
+ EventBus.getDefault().post(obtain1);
+ Log.d("TAG", "onError: " +e.getMessage() + "");
+ }
+ };
+ }
+
+}
diff --git a/app/src/main/java/com/navinfo/outdoor/util/Voice.java b/app/src/main/java/com/navinfo/outdoor/util/Voice.java
new file mode 100644
index 0000000..9b1d99a
--- /dev/null
+++ b/app/src/main/java/com/navinfo/outdoor/util/Voice.java
@@ -0,0 +1,62 @@
+package com.navinfo.outdoor.util;
+
+import com.jacob.activeX.ActiveXComponent;
+import com.jacob.com.Dispatch;
+import com.jacob.com.Variant;
+
+/**
+ * 语音播放
+ */
+public class Voice {
+ /**
+ * @param type 设定文件 0:开始,1停止
+ * @return 返回类型:void
+ * @Title: start
+ * @Description: 该方法的主要作用:朗读
+ */
+ public static void sprat(String content, int type) {
+ ActiveXComponent sap = new ActiveXComponent("Sapi.SpVoice");
+ Dispatch sago = sap.getObject();
+ if (type == 0) {
+ try {
+ // 音量 0-100
+ sap.setProperty("Volume", new Variant(100));
+ // 语音朗读速度 -10 到 +10
+ sap.setProperty("Rate", new Variant(1.3));
+ Variant defaultVoice = sap.getProperty("Voice");
+ Dispatch discrepantVoice = defaultVoice.toDispatch();
+ Variant allVoices = Dispatch.call(sago, "GetVoices");
+ Dispatch disVoices = allVoices.toDispatch();
+ Dispatch serviced = Dispatch.call(disVoices, "Item",
+ new Variant(1)).toDispatch();
+ ActiveXComponent voiceActive = new ActiveXComponent(discrepantVoice);
+ ActiveXComponent servicedActives = new ActiveXComponent(serviced);
+ Variant item = Dispatch.call(servicedActives, "GetDescription");
+ // 执行朗读
+ Dispatch.call(sago, "Speak", new Variant(content));
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ sago.safeRelease();
+ sap.safeRelease();
+ }
+ } else {
+ // 停止
+ try {
+ Dispatch.call(sago, "Speak", new Variant(content), new Variant(2));
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * @return 返回类型:void
+ * @Title: test
+ * @Description: 该方法的主要作用:执行朗读内容
+ */
+ public void test() {
+ sprat("请不要超过 多少", 0);
+ }
+}
diff --git a/app/src/main/res/drawable/btn_corners_bg.xml b/app/src/main/res/drawable/btn_corners_bg.xml
new file mode 100644
index 0000000..db97cb9
--- /dev/null
+++ b/app/src/main/res/drawable/btn_corners_bg.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/corners_bg.xml b/app/src/main/res/drawable/corners_bg.xml
new file mode 100644
index 0000000..ae8058d
--- /dev/null
+++ b/app/src/main/res/drawable/corners_bg.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml
index 004ee82..e83dff2 100644
--- a/app/src/main/res/layout/activity_login.xml
+++ b/app/src/main/res/layout/activity_login.xml
@@ -164,4 +164,16 @@
app:layout_constraintEnd_toEndOf="@+id/et_login_paw"
app:layout_constraintStart_toStartOf="@+id/et_login_paw"
app:layout_constraintTop_toBottomOf="@+id/tv_statement" />
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 263ea7c..a042ae4 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -7,15 +7,6 @@
android:background="@drawable/start_bg"
tools:context="activity.MainActivity">
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_pictures.xml b/app/src/main/res/layout/activity_pictures.xml
index c45457a..8310b7d 100644
--- a/app/src/main/res/layout/activity_pictures.xml
+++ b/app/src/main/res/layout/activity_pictures.xml
@@ -98,7 +98,14 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_marker.xml b/app/src/main/res/layout/item_marker.xml
index 6968718..d009e44 100644
--- a/app/src/main/res/layout/item_marker.xml
+++ b/app/src/main/res/layout/item_marker.xml
@@ -17,8 +17,12 @@
@@ -35,8 +35,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请查看APP使用说明"
- android:textColor="@color/black"
- android:textSize="20dp"
+ android:textColor="#333333"
+ android:textSize="18sp"
android:textStyle="normal"
app:layout_constraintBottom_toTopOf="@+id/btn_login"
app:layout_constraintEnd_toEndOf="parent"
@@ -46,12 +46,14 @@
diff --git a/app/src/main/res/layout/privilege_fragment.xml b/app/src/main/res/layout/privilege_fragment.xml
index 50a0949..7b4a66c 100644
--- a/app/src/main/res/layout/privilege_fragment.xml
+++ b/app/src/main/res/layout/privilege_fragment.xml
@@ -30,4 +30,354 @@
android:layout_toRightOf="@id/iv_find_task"
android:text="@string/tv_privilege_title" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-ldpi/take_poi_video_arrow.png b/app/src/main/res/mipmap-ldpi/take_poi_video_arrow.png
new file mode 100644
index 0000000..ce57cf2
Binary files /dev/null and b/app/src/main/res/mipmap-ldpi/take_poi_video_arrow.png differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 8897b6a..1569a2e 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -17,6 +17,7 @@
#F44236
#87CDF6
#ED1931
+
#BDBDBD
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0b6beb0..1742009 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,4 +1,4 @@
-
+
地图寻宝3.1
HomeActivity
@@ -148,7 +148,7 @@
11.4如果出现您对本条款的违反行为,图新保留针对该违反行为采取法律所能提供的所有补救手段的权利。如果您在使用本软件或参与本活动期间发现有任何在您看来属于
不正当或在其它方面违反本条款的内容,您应及时向图新举报。\n\n
- 我的特权
+ 特权规则
Welcome
欢迎来到地图寻宝
用户名