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