接口联调,筛选,poi和其他保存的接口
This commit is contained in:
parent
308373e9f4
commit
4d6212e6d0
@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion '29.0.2'
|
||||
ndkVersion '23.0.7123448'
|
||||
// ndkVersion '23.0.7123448'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.navinfo.outdoor"
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.navinfo.outdoor.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -62,12 +63,25 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
|
||||
}else {
|
||||
holder.tvDistance.setText("距离:" +0);
|
||||
}
|
||||
//0.未领取 1.已领取,2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功),4已上传(结束采集),
|
||||
if (poiEntity.getTaskStatus() == 0) {
|
||||
holder.tvGit.setVisibility(View.GONE);
|
||||
holder.tvSubmit.setVisibility(View.GONE);
|
||||
holder.tvTaskStatus.setVisibility(View.GONE);
|
||||
holder.tvTaskStatus.setText("未领取");
|
||||
} else if (poiEntity.getTaskStatus() == 1) {
|
||||
holder.tvSubmit.setVisibility(View.GONE);
|
||||
holder.tvGit.setVisibility(View.VISIBLE);
|
||||
holder.tvTaskStatus.setVisibility(View.VISIBLE);
|
||||
holder.tvTaskStatus.setText("已领取");
|
||||
holder.tvTaskStatus.setTextColor(Color.parseColor("#FFC107"));
|
||||
}else if (poiEntity.getTaskStatus()==2){
|
||||
holder.tvTaskStatus.setVisibility(View.VISIBLE);
|
||||
holder.tvTaskStatus.setText("未保存");
|
||||
holder.tvTaskStatus.setTextColor(Color.parseColor("#1CEF7B"));
|
||||
}else if (poiEntity.getTaskStatus()==3){
|
||||
holder.tvTaskStatus.setVisibility(View.VISIBLE);
|
||||
holder.tvTaskStatus.setText("已保存");
|
||||
holder.tvTaskStatus.setTextColor(Color.parseColor("#00BCD4"));
|
||||
}else if (poiEntity.getTaskStatus()==4){
|
||||
holder.tvTaskStatus.setVisibility(View.VISIBLE);
|
||||
holder.tvTaskStatus.setText("已上传");
|
||||
}
|
||||
if (poiEntity.getType() == 1) {
|
||||
holder.tvForm.setText("poi");
|
||||
@ -110,7 +124,7 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView tvName, tvForm, tvTaskId, tvMoney, tvDistance, tvGit, tvSubmit;
|
||||
TextView tvName, tvForm, tvTaskId, tvMoney, tvDistance, tvTaskStatus;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@ -119,8 +133,7 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
|
||||
tvTaskId = itemView.findViewById(R.id.tv_task_id);
|
||||
tvMoney = itemView.findViewById(R.id.tv_money);
|
||||
tvDistance = itemView.findViewById(R.id.tv_distance);
|
||||
tvGit = itemView.findViewById(R.id.tv_git);
|
||||
tvSubmit = itemView.findViewById(R.id.tv_submit);
|
||||
tvTaskStatus = itemView.findViewById(R.id.tv_task_status);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
if (data.what == Constant.JOB_SEARCH_POI_WORD) {
|
||||
if (data.what == Constant.JOB_SEARCH_POI_WORD) {
|
||||
allPoi = (List<PoiEntity>) data.obj;
|
||||
} else if (data.what == Constant.JOB_SEARCH_WORD) {
|
||||
poiEntities.clear();
|
||||
@ -414,8 +414,8 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
});
|
||||
break;
|
||||
|
||||
case R.id.cl_type:
|
||||
BottomMenu.show((AppCompatActivity) getContext(), new String[]{"全部", "已领取", "待提交", "未领取"}, new OnMenuItemClickListener() {
|
||||
case R.id.cl_type://任务状态 0.未领取 1.已领取,2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功),4已上传(结束采集),
|
||||
BottomMenu.show((AppCompatActivity) getContext(), new String[]{"全部", "未领取", "已领取", "未保存","已保存"}, new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public void onClick(String text, int index) {
|
||||
tvType.setText(text);
|
||||
@ -424,12 +424,15 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
Constant.TASK_STASTUS = -1;
|
||||
break;
|
||||
case 1:
|
||||
Constant.TASK_STASTUS = 1;
|
||||
Constant.TASK_STASTUS = 0;
|
||||
break;
|
||||
case 2:
|
||||
Constant.TASK_STASTUS = 2;
|
||||
Constant.TASK_STASTUS = 1;
|
||||
break;
|
||||
case 3:
|
||||
Constant.TASK_STASTUS = 2;
|
||||
break;
|
||||
case 4:
|
||||
Constant.TASK_STASTUS = 3;
|
||||
break;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.room.ChargingPileDao;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
@ -42,6 +43,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
private PoiEntity poiEntity;
|
||||
private PoiDao poiDao;
|
||||
private ChargingPileDao chargingPileDao;
|
||||
|
||||
public static GatherGetFragment newInstance(Bundle bundle) {
|
||||
GatherGetFragment fragment = new GatherGetFragment();
|
||||
fragment.setArguments(bundle);
|
||||
@ -157,7 +159,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
poiDao.deletePoiEntity(poiEntity);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
@ -173,11 +175,11 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
btnCancelGet.setVisibility(View.VISIBLE);
|
||||
//网络请求:
|
||||
if (poiEntity.getType() == 1) {//poi的领取类型
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK , poiEntity.getTaskId(), false);
|
||||
} else if (poiEntity.getType() == 5) {//其他的领取类型
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK , poiEntity.getTaskId(), false);
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), false);
|
||||
} else if (poiEntity.getType() == 2) {//充电站的领取类型
|
||||
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(),false);
|
||||
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), false);
|
||||
} else if (poiEntity.getType() == 5) {//其他的领取类型
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -194,13 +196,13 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
initCompleteTask(HttpInterface.COMPLETE, poiEntity.getTaskId());
|
||||
}
|
||||
|
||||
}else {
|
||||
} else {
|
||||
if (poiEntity.getType() == 1) {//poi的领取类型
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK , poiEntity.getTaskId(), true);
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), true);
|
||||
} else if (poiEntity.getType() == 2) {//充电站的领取类型
|
||||
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), true);
|
||||
} else if (poiEntity.getType() == 5) {//其他的领取类型
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), true);
|
||||
}else if (poiEntity.getType() == 2){//充电站的领取类型
|
||||
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(),true);
|
||||
}
|
||||
btnFinishGather.setVisibility(View.VISIBLE);
|
||||
btnGather.setVisibility(View.GONE);
|
||||
@ -218,7 +220,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
poiDao.deletePoiEntity(poiEntity);
|
||||
|
||||
}
|
||||
}).start();
|
||||
@ -231,11 +233,11 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
/**
|
||||
* @param url 筛选充电站领取任务
|
||||
*/
|
||||
private void chargingTaskByWork(String url,int taskId, boolean isSaver) {
|
||||
private void chargingTaskByWork(String url, int taskId, boolean isSaver) {
|
||||
showLoadingDialog();
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url+"/"+taskId)
|
||||
.url(url + "/" + taskId)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(ReceivedBean.class)
|
||||
.callback(new Callback<ReceivedBean>() {
|
||||
@ -251,6 +253,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
chargingListEntity.setAddress(listBean.getAddress());
|
||||
chargingListEntity.setTelPhone(listBean.getTelephone() + "");
|
||||
chargingListEntity.setType(Integer.valueOf(listBean.getType()));
|
||||
chargingListEntity.setTaskStatus(1);
|
||||
chargingListEntity.setIsLocalData(1);
|
||||
String geo = listBean.getGeo();
|
||||
chargingListEntity.setGeoWkt(geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
@ -493,11 +497,11 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
/**
|
||||
* @param url 不同任务类型对应的url
|
||||
*/
|
||||
private void receivedTaskByNet(String url,int taskId ,boolean isSaver) {
|
||||
private void receivedTaskByNet(String url, int taskId, boolean isSaver) {
|
||||
showLoadingDialog();
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url+"/"+taskId)
|
||||
.url(url + "/" + taskId)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(ReceivedPoiBean.class)
|
||||
.callback(new Callback<ReceivedPoiBean>() {
|
||||
@ -511,6 +515,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
poiListEntity.setAddress(listBean.getAddress());
|
||||
poiListEntity.setTelPhone(listBean.getTelephone() + "");
|
||||
poiListEntity.setType(Integer.valueOf(listBean.getType()));
|
||||
poiListEntity.setTaskStatus(1);
|
||||
poiListEntity.setIsLocalData(1);
|
||||
String geo = listBean.getGeo();
|
||||
poiListEntity.setGeoWkt(geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
@ -530,7 +536,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiDao.insertPoiEntity(poiListEntity);
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
|
||||
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -551,6 +558,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
Toast.makeText(getContext(), e.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).build();
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ 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.InsertAndUpdateUtils;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
@ -184,12 +185,12 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
checkPot.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
if (isChecked){
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_OTHER;
|
||||
obtain.obj = latLng;
|
||||
EventBus.getDefault().post(obtain);
|
||||
} else {
|
||||
}else {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_CHECKED_OTHER;
|
||||
obtain.obj = true;
|
||||
@ -325,7 +326,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude,latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
@ -364,17 +365,17 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiDao.insertPoiEntity(poiEntity);
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
otherSaveByNetWork(poiEntity);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}).start();
|
||||
|
||||
// onBackPressed();
|
||||
// onBackPressed();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@ -401,34 +402,28 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
if (tagPictures != null) {
|
||||
otherUploadList.add(new File(tagPictures));
|
||||
}
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (showPoiEntity.getId()!=0){
|
||||
PoiEntity poiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
int taskStatus = poiEntity.getTaskStatus();
|
||||
if (body!=0){
|
||||
otherUploadByNet(body, otherUploadList);
|
||||
}else {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (taskStatus == 2) {//保存本地未提交
|
||||
Toast.makeText(getActivity(), "请保存本地", Toast.LENGTH_SHORT).show();
|
||||
} else if (taskStatus == 3) {//保存本地已提交
|
||||
otherUploadByNet(body, otherUploadList);
|
||||
}
|
||||
otherUploadByNet(poiDaoPoiEntity.getBodyId(), otherUploadList);
|
||||
}
|
||||
});
|
||||
}else {
|
||||
Toast.makeText(getActivity(), "请保存本地", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}).start();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void otherUploadByNet(int body, List<File> otherUploadList) {
|
||||
if (body == 0) {
|
||||
if (body == 0 ){
|
||||
Toast.makeText(getActivity(), "没有保存不能上传", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
@ -446,20 +441,13 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
|
||||
// new Thread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// PoiEntity poiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
// poiDao.deletePoiEntity(poiEntity);
|
||||
// }
|
||||
// }).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<OtherUploadPicBean> response) {
|
||||
super.onError(response);
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), response.code() + "", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getActivity(), response.code()+"", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.code());
|
||||
}
|
||||
});
|
||||
@ -486,17 +474,22 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
@Override
|
||||
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
body = poiSaveBean.getBody();
|
||||
poiEntity.setTaskStatus(3);
|
||||
poiEntity.setBodyId(body);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiDao.insertPoiEntity(poiEntity);
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + poiSaveBean.getBody());
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
// Log.d("TAG", " 其他其他其他其他" + poiSaveBean.getBody());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -520,7 +513,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
//获取Editor对象
|
||||
SharedPreferences.Editor edit = poi.edit();
|
||||
//根据要保存的数据的类型,调用对应的put方法,
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
PoiEntity poiEntity =showPoiEntity;
|
||||
ArrayList<Info> arrayList = new ArrayList<>();
|
||||
String name = editTaskName.getText().toString().trim();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
|
@ -56,6 +56,7 @@ 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.InsertAndUpdateUtils;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
@ -73,7 +74,12 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
@ -280,60 +286,62 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
private void initShowPoi() {
|
||||
// 添加信息:
|
||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||
String name = showPoiEntity.getName();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
editNameContent.setText(name + "");
|
||||
}
|
||||
String address = showPoiEntity.getAddress();//地址
|
||||
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 describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null && !describe.equals("")) {
|
||||
editDescribe.setText(describe);
|
||||
}
|
||||
String telPhone = showPoiEntity.getTelPhone();
|
||||
if (telPhone != null && !telPhone.equals("")) {
|
||||
phoneData.add(showPoiEntity.getTelPhone());
|
||||
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
|
||||
|
||||
} else {
|
||||
poiBeans.add(new PoiBean("电话*", "", R.drawable.icon_add_bg));
|
||||
}
|
||||
poiRecycleAdapter.setList(poiBeans);
|
||||
linearExist.setVisibility(View.VISIBLE);
|
||||
if (showPoiEntity.getPhotoInfo() != null) {
|
||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||
String photo = showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||
String[] split = photo.split("/");
|
||||
if (split[split.length - 1].startsWith("a")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
||||
ivPanorama.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("b")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivName);
|
||||
ivName.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("c")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivInternal);
|
||||
ivInternal.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("d")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivCard);
|
||||
ivCard.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("e")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivElse);
|
||||
ivElse.setTag(photo);
|
||||
if (showPoiEntity != null) {
|
||||
String name = showPoiEntity.getName();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
editNameContent.setText(name + "");
|
||||
}
|
||||
String address = showPoiEntity.getAddress();//地址
|
||||
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 describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null && !describe.equals("")) {
|
||||
editDescribe.setText(describe);
|
||||
}
|
||||
String telPhone = showPoiEntity.getTelPhone();
|
||||
if (telPhone != null && !telPhone.equals("")) {
|
||||
phoneData.add(showPoiEntity.getTelPhone());
|
||||
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
|
||||
} else {
|
||||
poiBeans.add(new PoiBean("电话*", "", R.drawable.icon_add_bg));
|
||||
}
|
||||
poiRecycleAdapter.setList(poiBeans);
|
||||
linearExist.setVisibility(View.VISIBLE);
|
||||
if (showPoiEntity.getPhotoInfo() != null) {
|
||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||
String photo = showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||
String[] split = photo.split("/");
|
||||
if (split[split.length - 1].startsWith("a")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
||||
ivPanorama.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("b")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivName);
|
||||
ivName.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("c")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivInternal);
|
||||
ivInternal.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("d")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivCard);
|
||||
ivCard.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("e")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivElse);
|
||||
ivElse.setTag(photo);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
poiBeans.add(new PoiBean("电话*", "", R.drawable.icon_add_bg));
|
||||
poiRecycleAdapter.setList(poiBeans);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -402,7 +410,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude,latLng.longitude);
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
@ -459,11 +467,17 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiDao.insertPoiEntity(poiEntity);
|
||||
//
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiSaveByNet(poiEntity);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
poiSaveByNet(poiEntity);
|
||||
// onBackPressed();
|
||||
// onBackPressed();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@ -491,7 +505,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
poiPicList.add(new File(tagPanorama));
|
||||
}
|
||||
String tagName = (String) ivName.getTag();
|
||||
if (tagName!= null) {
|
||||
if (tagName != null) {
|
||||
poiPicList.add(new File(tagName));
|
||||
}
|
||||
|
||||
@ -507,7 +521,23 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
if (tagCard != null) {
|
||||
poiPicList.add(new File(tagCard));
|
||||
}
|
||||
poiUploadByNetWork(body,poiPicList);
|
||||
|
||||
if (body!=null){
|
||||
poiUploadByNetWork(body, poiPicList);
|
||||
}else {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiUploadByNetWork(poiDaoPoiEntity.getBodyId(), poiPicList);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
break;
|
||||
case R.id.tv_examine:
|
||||
Toast.makeText(getContext(), editNameContent.getText().toString(), Toast.LENGTH_SHORT).show();
|
||||
@ -532,14 +562,13 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
Intent intentElse = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
startActivityForResult(intentElse, 105);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void poiUploadByNetWork(int body, ArrayList<File> poiPicList) {
|
||||
if (body==0){
|
||||
if (body == 0) {
|
||||
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
|
||||
Log.e("TAG", "poiUploadByNetWork: "+body+poiPicList);
|
||||
Log.e("TAG", "poiUploadByNetWork: " + body + poiPicList);
|
||||
return;
|
||||
}
|
||||
OkGo
|
||||
@ -547,7 +576,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
.<OtherUploadPicBean>post(HttpInterface.POI_TASK_UPLOAD_PIC)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("auditId", body)
|
||||
.addFileParams("file",poiPicList)
|
||||
.addFileParams("file", poiPicList)
|
||||
.tag(this)
|
||||
.execute(new DialogCallback<OtherUploadPicBean>(OtherUploadPicBean.class) {
|
||||
@Override
|
||||
@ -555,28 +584,27 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + otherUploadPicBeanResponse.toString() + "sssssssssssss");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<OtherUploadPicBean> response) {
|
||||
super.onError(response);
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), response.code()+"", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.code()+"");
|
||||
Toast.makeText(getActivity(), response.code()+ "", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.code() + "");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void poiSaveByNet(PoiEntity poiEntity) {
|
||||
showLoadingDialog();
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("taskId", poiEntity.getTaskId());
|
||||
httpParams.put("name", poiEntity.getName());
|
||||
httpParams.put("address", poiEntity.getAddress());
|
||||
httpParams.put("existence", poiEntity.getExistence());
|
||||
httpParams.put("geo", poiEntity.getGeoWkt());
|
||||
httpParams.put("memo", poiEntity.getMemo());
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("taskId", poiEntity.getTaskId());
|
||||
httpParams.put("name", poiEntity.getName());
|
||||
httpParams.put("address", poiEntity.getAddress());
|
||||
httpParams.put("existence", poiEntity.getExistence());
|
||||
httpParams.put("geo", poiEntity.getGeoWkt());
|
||||
httpParams.put("memo", poiEntity.getMemo());
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.SUBMIT_POI_TASK)
|
||||
@ -588,8 +616,22 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
body = poiSaveBean.getBody();
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: "+poiSaveBean.getBody());
|
||||
poiEntity.setBodyId(body);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + poiSaveBean.getBody());
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -613,7 +655,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
//获取Editor对象
|
||||
SharedPreferences.Editor edit = poi.edit();
|
||||
//根据要保存的数据的类型,调用对应的put方法,
|
||||
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
ArrayList<Info> infoPhoto = new ArrayList<>();
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
@ -660,7 +701,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
@ -702,7 +742,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
ivPanorama.setTag(takePhotoPath1);
|
||||
ivPanorama.setImageBitmap(bitmap);//显示图像
|
||||
}
|
||||
|
||||
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
@ -722,9 +761,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b");
|
||||
ivName.setTag(takePhotoPath2);
|
||||
ivName.setImageBitmap(bitmap);//显示图像
|
||||
|
||||
}
|
||||
|
||||
} else if (requestCode == 103 && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
||||
|
@ -284,7 +284,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
int task_type = Constant.TASK_TYPE;
|
||||
int limit_type = Constant.LIMIT_TTPE;
|
||||
int taskStatus = Constant.TASK_STASTUS;
|
||||
if (taskStatus == 1 || taskStatus == 2) {
|
||||
if (taskStatus == 1 || taskStatus == 2 || taskStatus == 3 || taskStatus == 4) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_WORD;
|
||||
obtain.obj = null;
|
||||
@ -368,8 +368,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
switch (Integer.valueOf(list.get(i).getType())) {
|
||||
case 1://poi
|
||||
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg);
|
||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.7f)
|
||||
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg);
|
||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.7f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
poiMarker.setTag(listBean);
|
||||
@ -377,7 +377,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
poiMarker.setClickable(true);
|
||||
break;
|
||||
case 2://充电站
|
||||
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg);
|
||||
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg);
|
||||
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.7f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
@ -386,8 +386,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
stationMarker.setClickable(true);
|
||||
break;
|
||||
case 3://poi录像
|
||||
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
|
||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.7f)
|
||||
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
|
||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.7f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
poiVideoMarker.setTag(listBean);
|
||||
@ -395,7 +395,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
poiVideoMarker.setClickable(true);
|
||||
break;
|
||||
case 4://道路录像
|
||||
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
|
||||
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
|
||||
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.7f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
@ -404,7 +404,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
roadMarker.setClickable(true);
|
||||
break;
|
||||
case 5://其他
|
||||
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg);
|
||||
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg);
|
||||
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.7f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
@ -413,7 +413,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
otherMarker.setClickable(true);
|
||||
break;
|
||||
case 6://面状任务
|
||||
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg);
|
||||
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg);
|
||||
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.7f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
@ -460,14 +460,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
int taskStatus = Constant.TASK_STASTUS;
|
||||
int type = Constant.TASK_TYPE;
|
||||
int limit = Constant.LIMIT_TTPE;
|
||||
if (taskStatus == 3) {
|
||||
showAllPoi.clear();
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_POI_WORD;
|
||||
obtain.obj = showAllPoi;
|
||||
EventBus.getDefault().post(obtain);
|
||||
return;
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -487,8 +479,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
LatLng latLng = new LatLng(Double.valueOf(allTaskStatus.get(i).getY()), Double.valueOf(allTaskStatus.get(i).getX()));
|
||||
switch (Integer.valueOf(poiEntity.getType())) {
|
||||
case 1://poi
|
||||
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_have_bg);
|
||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.7f)
|
||||
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_have_bg);
|
||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.7f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
poiMarker.setClickable(true);
|
||||
@ -497,7 +489,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
removablesLocality.add(poiMarker);
|
||||
break;
|
||||
case 2://充电站
|
||||
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_have_bg);
|
||||
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_have_bg);
|
||||
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.7f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
@ -507,8 +499,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
removablesLocality.add(stationMarker);
|
||||
break;
|
||||
case 3://poi录像
|
||||
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_have_bg);
|
||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.7f)
|
||||
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_have_bg);
|
||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.7f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
poiVideoMarker.setClickable(true);
|
||||
@ -517,7 +509,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
removablesLocality.add(poiVideoMarker);
|
||||
break;
|
||||
case 4://道路录像
|
||||
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_have_bg);
|
||||
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_have_bg);
|
||||
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.7f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
@ -527,7 +519,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
removablesLocality.add(roadMarker);
|
||||
break;
|
||||
case 5://其他
|
||||
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bg);
|
||||
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bg);
|
||||
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.7f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
@ -537,7 +529,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
removablesLocality.add(otherMarker);
|
||||
break;
|
||||
case 6://面状任务
|
||||
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bg);
|
||||
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bg);
|
||||
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.7f)
|
||||
.clockwise(false)
|
||||
.flat(true));
|
||||
@ -671,7 +663,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
fragmentTransaction = supportFragmentManager.beginTransaction();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
bundle.putInt("aInt", 1);
|
||||
gatherGetFragment = GatherGetFragment.newInstance(bundle);
|
||||
fragmentTransaction.replace(R.id.frame_layout, gatherGetFragment);
|
||||
fragmentTransaction.commit();
|
||||
@ -708,6 +699,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
PoiEntity poiEntity = (PoiEntity) data.obj;
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
|
||||
switch (poiEntity.getType()) {
|
||||
case 1:
|
||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
||||
@ -738,25 +730,25 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
} else if (data.what == Constant.TREASURE_WORD) { // POI采集-移动位置
|
||||
initPoiMarker((LatLng) data.obj);
|
||||
} else if (data.what == Constant.TREASURE_CHECKED_WORD) {//poi采集 -确定位置
|
||||
if((boolean)data.obj){
|
||||
if ((boolean) data.obj) {
|
||||
initCheckedMarker(Constant.POI_WORD);
|
||||
}
|
||||
} else if (data.what == Constant.MAIN_CHARGING_STATION) {//充电站采集-移动位置
|
||||
initPoiMarker((LatLng) data.obj);
|
||||
} else if (data.what == Constant.MAIN_CHARGING_CHECKED_STATION) {//充电站采集 -确定位置
|
||||
if((boolean)data.obj){
|
||||
if ((boolean) data.obj) {
|
||||
initCheckedMarker(Constant.CHARGING_STATION_WORD);
|
||||
}
|
||||
} else if (data.what == Constant.MAIN_CHARGING_PILE) {//充电桩采集-移动位置
|
||||
initPileMarker((LatLng) data.obj);
|
||||
} else if (data.what == Constant.MAIN_CHARGING_CHECKED_PILE) {//充电桩采集-确定位置
|
||||
if((boolean)data.obj){
|
||||
if ((boolean) data.obj) {
|
||||
initCheckedMarker(Constant.CHARGING_PILE_WORD);
|
||||
}
|
||||
} else if (data.what == Constant.MAIN_OTHER) {//其他采集-移动位置
|
||||
initPoiMarker((LatLng) data.obj);
|
||||
} else if (data.what == Constant.MAIN_CHECKED_OTHER) {//其他采集-确定位置
|
||||
if((boolean)data.obj){
|
||||
if ((boolean) data.obj) {
|
||||
initCheckedMarker(Constant.OTHER_WORD);
|
||||
}
|
||||
} else if (data.what == Constant.TREASURE_FRAGMENT) {
|
||||
@ -813,7 +805,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
removablesLocality.get(i).remove();
|
||||
}
|
||||
removablesLocality.clear();
|
||||
|
||||
initThread();// 查询本地数据库
|
||||
initList(Constant.currentLocation);//网络数据
|
||||
}
|
||||
@ -866,27 +857,28 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
});
|
||||
|
||||
}
|
||||
private void initPileMarker(LatLng latLng) {
|
||||
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
latLng, //中心点坐标,地图目标经纬度
|
||||
tencentMap.getCameraPosition().zoom, //目标缩放级别
|
||||
tencentMap.getCameraPosition().tilt, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
|
||||
tencentMap.getCameraPosition().bearing)); //目标旋转角 0~360° (正北方为0)
|
||||
tencentMap.animateCamera(cameraSigma, new TencentMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onFinish() {
|
||||
screenPosition = tencentMap.getProjection().toScreenLocation(latLng);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
//创建Marker对象之前,设置属性
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng));
|
||||
markerPoi.setFixingPoint(screenPosition.x, screenPosition.y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
private void initPileMarker(LatLng latLng) {
|
||||
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
latLng, //中心点坐标,地图目标经纬度
|
||||
tencentMap.getCameraPosition().zoom, //目标缩放级别
|
||||
tencentMap.getCameraPosition().tilt, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
|
||||
tencentMap.getCameraPosition().bearing)); //目标旋转角 0~360° (正北方为0)
|
||||
tencentMap.animateCamera(cameraSigma, new TencentMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onFinish() {
|
||||
screenPosition = tencentMap.getProjection().toScreenLocation(latLng);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
//创建Marker对象之前,设置属性
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng));
|
||||
markerPoi.setFixingPoint(screenPosition.x, screenPosition.y);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onCancel() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initCheckedMarker(int poiWord) {
|
||||
@ -904,7 +896,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 设置定位图标样式
|
||||
*/
|
||||
private void setLocMarkerStyle() {
|
||||
@ -982,10 +973,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (treasureMap!=null) {
|
||||
treasureMap.onDestroy();
|
||||
treasureMap.onDestroy();
|
||||
if (markerPoi != null) {
|
||||
markerPoi.remove();
|
||||
}
|
||||
if (markerPoi!=null) {
|
||||
if (markerPoi != null) {
|
||||
markerPoi.remove();
|
||||
}
|
||||
EventBus.getDefault().unregister(this);
|
||||
@ -1041,25 +1033,32 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
public boolean onClick(ShareDialog shareDialog, int index, ShareDialog.Item item) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint));
|
||||
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_have_bg);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(poiDescriptor));
|
||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
||||
showSlidingFragment(poiFragment);
|
||||
break;
|
||||
case 1:
|
||||
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_have_bg);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(poiVideoDescriptor));
|
||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(new Bundle());
|
||||
showSlidingFragment(poiVideoFragment);
|
||||
break;
|
||||
case 2:
|
||||
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_have_bg);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(roadDescriptor));
|
||||
RoadFragment roadFragment = RoadFragment.newInstance(new Bundle());
|
||||
showSlidingFragment(roadFragment);
|
||||
break;
|
||||
case 3:
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint));
|
||||
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_have_bg);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(chargeDescriptor));
|
||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
||||
showSlidingFragment(chargingStationFragment);
|
||||
break;
|
||||
case 4:
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint));
|
||||
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bg);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(otherDescriptor));
|
||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
||||
showSlidingFragment(otherFragment);
|
||||
break;
|
||||
|
@ -52,13 +52,13 @@ public class HttpInterface {
|
||||
public static final String IPm6 = "http://172.23.139.4:8003/othertask/1/";
|
||||
|
||||
//172.23.139.4:8003/othertask/1/receivedOthertask/5001
|
||||
public static final String RECEIVED_OTHER_TASK = IPm6 + "receivedOthertask/5001";//其他-领取任务
|
||||
public static final String RECEIVED_OTHER_TASK = IPm6 + "receivedOthertask";//其他-领取任务
|
||||
|
||||
|
||||
public static final String IPm7 = "http://172.23.139.4:8003/poitask/1/";
|
||||
|
||||
//172.23.139.4:8003/poitask/1/receivedPoitask/1
|
||||
public static final String RECEIVED_POI_TASK = IPm7 + "receivedPoitask/1";//poi-领取任务
|
||||
public static final String RECEIVED_POI_TASK = IPm7 + "receivedPoitask";//poi-领取任务
|
||||
|
||||
|
||||
public static final String IPm8 = "http://172.23.139.4:8003/poitask/1/";
|
||||
|
@ -0,0 +1,29 @@
|
||||
package com.navinfo.outdoor.room;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.room.Database;
|
||||
|
||||
/**
|
||||
* 数据库插入
|
||||
*/
|
||||
public class InsertAndUpdateUtils {
|
||||
private static InsertAndUpdateUtils instance;
|
||||
|
||||
public static InsertAndUpdateUtils getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new InsertAndUpdateUtils();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public long[] insertOrUpdate(Context mContext,PoiEntity... entities) {
|
||||
long[] ids = PoiDatabase.getInstance(mContext).getPoiDao().insertPoiEntity(entities);
|
||||
if (ids!=null) {
|
||||
for (int i = 0; i < entities.length&&i<ids.length; i++) {
|
||||
entities[i].setId(ids[i]);
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
}
|
@ -32,14 +32,17 @@ public interface PoiDao {
|
||||
|
||||
|
||||
@Query("SELECT * FROM poi where id=:id")
|
||||
PoiEntity getPoiEntity(int id);
|
||||
PoiEntity getPoiEntity(long id);
|
||||
|
||||
@Query("SELECT * FROM poi where taskId=:taskId")
|
||||
PoiEntity getTaskIdPoiEntity(int taskId);
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param poiEntities
|
||||
*/
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insertPoiEntity(PoiEntity... poiEntities);
|
||||
long[] insertPoiEntity(PoiEntity... poiEntities);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
@ -82,9 +85,6 @@ public interface PoiDao {
|
||||
@Query("DELETE FROM poi where taskId=:taskId")
|
||||
void deleteFormTaskID(int taskId);
|
||||
|
||||
|
||||
@Query("DELETE FROM poi where id =:id")
|
||||
void deleteFormID(int id);
|
||||
/**
|
||||
* 全部删除
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
||||
@Entity(tableName = "poi")
|
||||
public class PoiEntity implements Serializable {
|
||||
@PrimaryKey(autoGenerate = true) // 设置主键,并且自动生长
|
||||
private int id;
|
||||
private long id;
|
||||
private int pid; //采集id 保存本地或提交数据时时返回
|
||||
private int taskId;//任务id
|
||||
private int userId;//用户id
|
||||
@ -31,16 +31,6 @@ public class PoiEntity implements Serializable {
|
||||
private String extend;//添加字段
|
||||
private boolean checked;
|
||||
private String geoWkt; // 数据的wkt
|
||||
private int bodyId;//保存本地的bodyId
|
||||
|
||||
public int getBodyId() {
|
||||
return bodyId;
|
||||
}
|
||||
|
||||
public void setBodyId(int bodyId) {
|
||||
this.bodyId = bodyId;
|
||||
}
|
||||
|
||||
public String getGeoWkt() {
|
||||
return geoWkt;
|
||||
}
|
||||
@ -78,6 +68,15 @@ public class PoiEntity implements Serializable {
|
||||
private int station_type;//1."全部"2 "POI"3 "充电站"4 "POI录像"5 "道路录像", "门牌:6 公交:7 情报:8
|
||||
private int isLocalData;//是否是本地数据 0,服务 1,本地
|
||||
private int isExclusive;//任务类型 0.普通任务,1.专属任务
|
||||
private int bodyId;//保存本地的bodyId
|
||||
|
||||
public int getBodyId() {
|
||||
return bodyId;
|
||||
}
|
||||
|
||||
public void setBodyId(int bodyId) {
|
||||
this.bodyId = bodyId;
|
||||
}
|
||||
|
||||
public int getIsExclusive() {
|
||||
return isExclusive;
|
||||
@ -127,11 +126,11 @@ public class PoiEntity implements Serializable {
|
||||
this.taskStatus = taskStatus;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
android:text="测试彼此"
|
||||
android:textColor="#333"
|
||||
android:textSize="18sp"
|
||||
android:maxLength="15"
|
||||
android:maxLength="10"
|
||||
android:lines="1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@ -33,30 +33,13 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_name"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_name" />
|
||||
<TextView
|
||||
android:id="@+id/tv_git"
|
||||
android:id="@+id/tv_task_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:text="已领取"
|
||||
android:padding="5dp"
|
||||
android:textColor="#FFC107"
|
||||
android:background="@drawable/underline"
|
||||
android:textSize="15sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_form"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_form"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_form" />
|
||||
<TextView
|
||||
android:id="@+id/tv_submit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:text="待提交"
|
||||
android:padding="5dp"
|
||||
android:textColor="#1CEF7B"
|
||||
android:background="@drawable/underline"
|
||||
android:textSize="15sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_form"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_form"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_form" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user