任务搜索 删选界面的数据处理

This commit is contained in:
wds 2021-07-02 18:37:00 +08:00
parent 04b17b37b6
commit db74ba9dc9
21 changed files with 532 additions and 214 deletions

View File

@ -52,7 +52,6 @@ dependencies {
implementation 'androidx.navigation:navigation-ui:2.1.0' implementation 'androidx.navigation:navigation-ui:2.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation files('libs\\jts-1.13.jar') implementation files('libs\\jts-1.13.jar')
implementation files('libs\\jts-1.13.jar')
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

View File

@ -12,6 +12,9 @@ import androidx.recyclerview.widget.RecyclerView;
import com.navinfo.outdoor.R; import com.navinfo.outdoor.R;
import com.navinfo.outdoor.room.PoiEntity; import com.navinfo.outdoor.room.PoiEntity;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -20,7 +23,7 @@ import java.util.List;
*/ */
public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder> { public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder> {
private Context context; private Context context;
private List<PoiEntity> allPoi=new ArrayList<>(); private List<PoiEntity> allPoi = new ArrayList<>();
public FilterAdapter(Context context) { public FilterAdapter(Context context) {
this.context = context; this.context = context;
@ -42,32 +45,60 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
public void onBindViewHolder(@NonNull ViewHolder holder, int position) { public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
PoiEntity poiEntity = allPoi.get(position); PoiEntity poiEntity = allPoi.get(position);
holder.tvName.setText(poiEntity.getName()); holder.tvName.setText(poiEntity.getName());
holder.tvTaskId.setText(poiEntity.getTaskId()+""); if (poiEntity.getTaskId()!=0){
holder.tvMoney.setText(poiEntity.getPrecision()+""); holder.tvTaskId.setText("任务id:" + poiEntity.getTaskId());
holder.tvDistance.setText(poiEntity.getDescribe()+""); }else {
holder.itemView.setOnClickListener(new View.OnClickListener() { holder.tvTaskId.setText("任务id:" + 0);
@Override
public void onClick(View v) {
if (itemCLick!=null){
itemCLick.item(poiEntity);
} }
if (poiEntity.getPrecision()!=null){
holder.tvMoney.setText("" + poiEntity.getPrecision());
}else {
holder.tvMoney.setText("" + 0);
} }
}); if (poiEntity.getDist()!=null){
if (poiEntity.getTaskStatus()==0){ holder.tvDistance.setText("距离:" +format2(Double.valueOf(poiEntity.getDist())/1000)+"km");
}else {
holder.tvDistance.setText("距离:" +0);
}
if (poiEntity.getTaskStatus() == 0) {
holder.tvGit.setVisibility(View.GONE); holder.tvGit.setVisibility(View.GONE);
holder.tvSubmit.setVisibility(View.VISIBLE); holder.tvSubmit.setVisibility(View.GONE);
}else if (poiEntity.getTaskStatus()==1){ } else if (poiEntity.getTaskStatus() == 1) {
holder.tvSubmit.setVisibility(View.GONE); holder.tvSubmit.setVisibility(View.GONE);
holder.tvGit.setVisibility(View.VISIBLE); holder.tvGit.setVisibility(View.VISIBLE);
} }
if (poiEntity.getType()==0){ if (poiEntity.getType() == 1) {
holder.tvForm.setText("poi"); holder.tvForm.setText("poi");
}else if (poiEntity.getType()==1){ } else if (poiEntity.getType() == 2) {
holder.tvForm.setText("道路");
}else if (poiEntity.getType()==2){
holder.tvForm.setText("充电站"); holder.tvForm.setText("充电站");
}else if (poiEntity.getType()==3){ } else if (poiEntity.getType() == 3) {
holder.tvForm.setText("POI录像");
} else if (poiEntity.getType() == 4) {
holder.tvForm.setText("道路录像");
} else if (poiEntity.getType() == 5) {
holder.tvForm.setText("其他"); holder.tvForm.setText("其他");
} else if (poiEntity.getType() == 6) {
holder.tvForm.setText("面状任务");
}
if (poiEntity.getIsLocalData() == 1) {
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (itemCLick != null) {
itemCLick.item(poiEntity, true);
}
}
});
} else {
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (itemCLick != null) {
itemCLick.item(poiEntity, false);
}
}
});
} }
} }
@ -78,25 +109,71 @@ 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, tvGit, tvSubmit;
public ViewHolder(@NonNull View itemView) { public ViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
tvName=itemView.findViewById(R.id.tv_name); tvName = itemView.findViewById(R.id.tv_name);
tvForm=itemView.findViewById(R.id.tv_form); tvForm = itemView.findViewById(R.id.tv_form);
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); tvGit = itemView.findViewById(R.id.tv_git);
tvSubmit=itemView.findViewById(R.id.tv_submit); tvSubmit = itemView.findViewById(R.id.tv_submit);
} }
} }
ItemCLick itemCLick; ItemCLick itemCLick;
public void setItemCLick(ItemCLick itemCLick) { public void setItemCLick(ItemCLick itemCLick) {
this.itemCLick = itemCLick; this.itemCLick = itemCLick;
} }
public interface ItemCLick{ public interface ItemCLick {
void item(PoiEntity poiEntity); void item(PoiEntity poiEntity, boolean a);
}
/**
* 保存小数点后两位
*
* @param value
* @return
*/
public static String format2(double value) {
DecimalFormat df = new DecimalFormat("0.00");
df.setRoundingMode(RoundingMode.HALF_UP);
return df.format(value);
}
public static String format3(double value) {
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(2);
/** setMinimumFractionDigits设置成2
* 如果不这么做那么当value的值是100.00的时候返回100
* 而不是100.00
*/
nf.setMinimumFractionDigits(2);
nf.setRoundingMode(RoundingMode.HALF_UP);
/*
如果想输出的格式用逗号隔开可以设置成true
*/
nf.setGroupingUsed(false);
return nf.format(value);
}
public static String format5(double value) {
return String.format("%.2f", value).toString();
} }
} }

View File

@ -1,7 +1,11 @@
package com.navinfo.outdoor.api; package com.navinfo.outdoor.api;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.bean.JobSearchBean;
import com.navinfo.outdoor.util.SdkFolderCreate; import com.navinfo.outdoor.util.SdkFolderCreate;
import com.tencent.map.geolocation.TencentLocation; import com.tencent.map.geolocation.TencentLocation;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
/** /**
* 常量 * 常量
@ -59,6 +63,8 @@ public class Constant {
public static final int OTHER_WORD = 25;//地图页面marker 的经纬都回传 public static final int OTHER_WORD = 25;//地图页面marker 的经纬都回传
public static final int CHARGING_STATION_PILE = 26;//跳转到充电桩 传给数据 public static final int CHARGING_STATION_PILE = 26;//跳转到充电桩 传给数据
public static final int JOB_SEARCH_WORD = 28;//任务搜索的数据
public static String USER_ATTESTATION_NAME; //实名认证姓名 银行卡 public static String USER_ATTESTATION_NAME; //实名认证姓名 银行卡
public static int NUMBER =200; //任务个数 public static int NUMBER =200; //任务个数
@ -73,5 +79,15 @@ public class Constant {
public static double markerLatitude; public static double markerLatitude;
public static double markerLongitude; public static double markerLongitude;
//marker 图标
public static BitmapDescriptor POI_ICON = BitmapDescriptorFactory.fromResource(R.drawable.poi_icons);
public static BitmapDescriptor ROAD_ICON = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
public static BitmapDescriptor STATION_ICON = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg);
public static BitmapDescriptor PLANAR_TASK_ICON = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg);
public static JobSearchBean jobSearchBean;//数据
} }

View File

@ -1,8 +1,9 @@
package com.navinfo.outdoor.bean; package com.navinfo.outdoor.bean;
import java.io.Serializable;
import java.util.List; import java.util.List;
public class JobSearchBean { public class JobSearchBean implements Serializable {
/** /**
* status : 0 * status : 0
* msg : 成功 * msg : 成功

View File

@ -388,7 +388,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
latLng.setLongitude(Double.parseDouble(split[1])); latLng.setLongitude(Double.parseDouble(split[1]));
} }
String memo = chargingPileEntity.getMemo(); String memo = chargingPileEntity.getMemo();
if (memo != null) { if (memo != null&&!memo.equals("")) {
editDescribe.setText(memo); editDescribe.setText(memo);
} }
int fid = chargingPileEntity.getFid(); int fid = chargingPileEntity.getFid();
@ -760,57 +760,57 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
chargingPileEntity.setP(latLng.latitude+","+latLng.longitude); chargingPileEntity.setP(latLng.latitude+","+latLng.longitude);
} }
String name = editNameContent.getText().toString().trim();//名称 String name = editNameContent.getText().toString().trim();//名称
if (name != null ||!name.equals("")) { if (name != null &&!name.equals("")) {
chargingPileEntity.setName(name); chargingPileEntity.setName(name);
} }
if (cp_floor != 0) { if (cp_floor != 0) {
chargingPileEntity.setCp_floor(cp_floor); chargingPileEntity.setCp_floor(cp_floor);
} }
String tagPanorama = (String) ivPanorama.getTag(); String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama != null) { if (tagPanorama != null &&!tagPanorama.equals("")) {
photo.add(tagPanorama); photo.add(tagPanorama);
} }
String tagCoding = (String) ivCoding.getTag(); String tagCoding = (String) ivCoding.getTag();
if (tagCoding != null) { if (tagCoding != null&&!tagCoding.equals("")) {
photo.add(tagCoding); photo.add(tagCoding);
} }
String tagEquipment = (String) ivEquipment.getTag(); String tagEquipment = (String) ivEquipment.getTag();
if (tagEquipment != null) { if (tagEquipment != null&&!tagEquipment.equals("")) {
photo.add(tagEquipment); photo.add(tagEquipment);
} }
String tagFacility = (String) ivFacility.getTag(); String tagFacility = (String) ivFacility.getTag();
if (tagFacility != null) { if (tagFacility != null&&!tagFacility.equals("")) {
photo.add(tagFacility); photo.add(tagFacility);
} }
String tagScutcheon = (String) ivScutcheon.getTag(); String tagScutcheon = (String) ivScutcheon.getTag();
if (tagScutcheon != null) { if (tagScutcheon != null&&!tagScutcheon.equals("")) {
photo.add(tagScutcheon); photo.add(tagScutcheon);
} }
String tagDevice = (String) ivDevice.getTag(); String tagDevice = (String) ivDevice.getTag();
if (tagDevice != null) { if (tagDevice != null&&!tagDevice.equals("")) {
photo.add(tagDevice); photo.add(tagDevice);
} }
String tagUsable = (String) ivUsable.getTag(); String tagUsable = (String) ivUsable.getTag();
if (tagUsable != null ) { if (tagUsable != null &&!tagUsable.equals("")) {
photo.add(tagUsable); photo.add(tagUsable);
} }
String tagAvailable = (String) ivAvailable.getTag(); String tagAvailable = (String) ivAvailable.getTag();
if (tagAvailable != null) { if (tagAvailable != null&&!tagAvailable.equals("")) {
photo.add(tagAvailable); photo.add(tagAvailable);
} }
String tagParking = (String) ivParking.getTag(); String tagParking = (String) ivParking.getTag();
if (tagParking != null) { if (tagParking != null&&!tagParking.equals("")) {
photo.add(tagPanorama); photo.add(tagPanorama);
} }
String tagNumber = (String) ivNumber.getTag(); String tagNumber = (String) ivNumber.getTag();
if (tagNumber != null) { if (tagNumber != null&&!tagNumber.equals("")) {
photo.add(tagNumber); photo.add(tagNumber);
} }
chargingPileEntity.setPhotos(photo); chargingPileEntity.setPhotos(photo);
chargingPileEntity.setSign_exist(sign_exist); chargingPileEntity.setSign_exist(sign_exist);
chargingPileEntity.setCp_availableState(cp_availableState); chargingPileEntity.setCp_availableState(cp_availableState);
String describe = editDescribe.getText().toString().trim(); String describe = editDescribe.getText().toString().trim();
if (describe != null || !describe.equals("")) { if (describe != null && !describe.equals("")) {
chargingPileEntity.setMemo(describe); chargingPileEntity.setMemo(describe);
} }
if (pid != 0) { if (pid != 0) {

View File

@ -309,11 +309,11 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity"); showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
if (showPoiEntity != null) { if (showPoiEntity != null) {
String name = showPoiEntity.getName();//名称 String name = showPoiEntity.getName();//名称
if (name != null) { if (name != null &&!name.equals("")) {
editNameContent.setText(name + ""); editNameContent.setText(name + "");
} }
String address = showPoiEntity.getAddress();//地址 String address = showPoiEntity.getAddress();//地址
if (address != null) { if (address != null&&! address.equals("")) {
editSiteContent.setText(address); editSiteContent.setText(address);
} }
String x = showPoiEntity.getX(); String x = showPoiEntity.getX();
@ -324,11 +324,11 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
latLng.setLongitude(Double.parseDouble(x)); latLng.setLongitude(Double.parseDouble(x));
} }
String describe = showPoiEntity.getDescribe();//任务描述 String describe = showPoiEntity.getDescribe();//任务描述
if (describe != null) { if (describe != null&&!describe.equals("")) {
editDescribe.setText(describe); editDescribe.setText(describe);
} }
String telPhone = showPoiEntity.getTelPhone(); String telPhone = showPoiEntity.getTelPhone();
if (telPhone != null) { if (telPhone != null&&!telPhone.equals("")) {
phoneData.add(showPoiEntity.getTelPhone()); phoneData.add(showPoiEntity.getTelPhone());
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg)); poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
poiRecycleAdapter.setList(poiBeans); poiRecycleAdapter.setList(poiBeans);
@ -554,7 +554,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
String format = formatter.format(calendar.getTime()); String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format); poiEntity.setCreateTime(format);
poiEntity.setType(2); poiEntity.setType(2);
poiEntity.setTaskStatus(0); poiEntity.setTaskStatus(1);
poiEntity.setIsLocalData(1);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -628,11 +630,11 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
PoiEntity poiEntity = new PoiEntity(); PoiEntity poiEntity = new PoiEntity();
List<Info> infoPhoto = new ArrayList<>(); List<Info> infoPhoto = new ArrayList<>();
String name = editNameContent.getText().toString().trim();//名称 String name = editNameContent.getText().toString().trim();//名称
if (name != null || !name.equals("")) { if (name != null && !name.equals("")) {
poiEntity.setName(name); poiEntity.setName(name);
} }
String site = editSiteContent.getText().toString().trim(); String site = editSiteContent.getText().toString().trim();
if (site != null || !site.equals("")) { if (site != null && !site.equals("")) {
poiEntity.setAddress(site); poiEntity.setAddress(site);
} }
if (latLng != null) { if (latLng != null) {
@ -640,30 +642,30 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
poiEntity.setY(String.valueOf(latLng.latitude)); poiEntity.setY(String.valueOf(latLng.latitude));
} }
String describe = editDescribe.getText().toString().trim(); String describe = editDescribe.getText().toString().trim();
if (describe != null || !describe.equals("")) { if (describe != null && !describe.equals("")) {
poiEntity.setDescribe(describe); poiEntity.setDescribe(describe);
} }
if (phoneData.size() > 0) { if (phoneData.size() > 0) {
poiEntity.setTelPhone(phoneData.get(0)); poiEntity.setTelPhone(phoneData.get(0));
} }
String tagPanorama = (String) ivPanorama.getTag(); String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama != null) { if (tagPanorama != null&&!tagPanorama.equals("")) {
infoPhoto.add(new Info(tagPanorama)); infoPhoto.add(new Info(tagPanorama));
} }
String tagName = (String) ivName.getTag(); String tagName = (String) ivName.getTag();
if (tagName != null) { if (tagName != null&&!tagName.equals("")) {
infoPhoto.add(new Info(tagName)); infoPhoto.add(new Info(tagName));
} }
String tagInternal = (String) ivInternal.getTag(); String tagInternal = (String) ivInternal.getTag();
if (tagInternal != null) { if (tagInternal != null&&!tagInternal.equals("")) {
infoPhoto.add(new Info(tagInternal)); infoPhoto.add(new Info(tagInternal));
} }
String tagElse = (String) ivElse.getTag(); String tagElse = (String) ivElse.getTag();
if (tagElse != null) { if (tagElse != null&&!tagElse.equals("")) {
infoPhoto.add(new Info(tagElse)); infoPhoto.add(new Info(tagElse));
} }
String tagScutcheon = (String) ivScutcheon.getTag(); String tagScutcheon = (String) ivScutcheon.getTag();
if (tagScutcheon != null) { if (tagScutcheon != null&&!tagScutcheon.equals("")) {
infoPhoto.add(new Info(tagScutcheon)); infoPhoto.add(new Info(tagScutcheon));
} }
poiEntity.setPhotoInfo(infoPhoto); poiEntity.setPhotoInfo(infoPhoto);
@ -674,7 +676,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
String format = formatter.format(calendar.getTime()); String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format); poiEntity.setCreateTime(format);
poiEntity.setType(2); poiEntity.setType(2);
poiEntity.setTaskStatus(0); poiEntity.setTaskStatus(1);
poiEntity.setIsLocalData(1);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -713,11 +716,11 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
PoiEntity poiEntity = new PoiEntity(); PoiEntity poiEntity = new PoiEntity();
List<Info> infoPhoto = new ArrayList<>(); List<Info> infoPhoto = new ArrayList<>();
String name = editNameContent.getText().toString().trim();//名称 String name = editNameContent.getText().toString().trim();//名称
if (name != null || !name.equals("")) { if (name != null && !name.equals("")) {
poiEntity.setName(name); poiEntity.setName(name);
} }
String site = editSiteContent.getText().toString().trim(); String site = editSiteContent.getText().toString().trim();
if (site != null || !site.equals("")) { if (site != null && !site.equals("")) {
poiEntity.setAddress(site); poiEntity.setAddress(site);
} }
if (latLng != null) { if (latLng != null) {
@ -725,30 +728,30 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
poiEntity.setY(String.valueOf(latLng.latitude)); poiEntity.setY(String.valueOf(latLng.latitude));
} }
String describe = editDescribe.getText().toString().trim(); String describe = editDescribe.getText().toString().trim();
if (describe != null || !describe.equals("")) { if (describe != null && !describe.equals("")) {
poiEntity.setDescribe(describe); poiEntity.setDescribe(describe);
} }
if (phoneData.size() > 0) { if (phoneData.size() > 0) {
poiEntity.setTelPhone(phoneData.get(0)); poiEntity.setTelPhone(phoneData.get(0));
} }
String tagPanorama = (String) ivPanorama.getTag(); String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama != null) { if (tagPanorama != null&&!tagPanorama.equals("")) {
infoPhoto.add(new Info(tagPanorama)); infoPhoto.add(new Info(tagPanorama));
} }
String tagName = (String) ivName.getTag(); String tagName = (String) ivName.getTag();
if (tagName != null) { if (tagName != null&&!tagName.equals("")) {
infoPhoto.add(new Info(tagName)); infoPhoto.add(new Info(tagName));
} }
String tagInternal = (String) ivInternal.getTag(); String tagInternal = (String) ivInternal.getTag();
if (tagInternal != null) { if (tagInternal != null&&!tagInternal.equals("")) {
infoPhoto.add(new Info(tagInternal)); infoPhoto.add(new Info(tagInternal));
} }
String tagElse = (String) ivElse.getTag(); String tagElse = (String) ivElse.getTag();
if (tagElse != null) { if (tagElse != null&&!tagElse.equals("")) {
infoPhoto.add(new Info(tagElse)); infoPhoto.add(new Info(tagElse));
} }
String tagScutcheon = (String) ivScutcheon.getTag(); String tagScutcheon = (String) ivScutcheon.getTag();
if (tagScutcheon != null) { if (tagScutcheon != null&&!tagScutcheon.equals("")) {
infoPhoto.add(new Info(tagScutcheon)); infoPhoto.add(new Info(tagScutcheon));
} }
poiEntity.setPhotoInfo(infoPhoto); poiEntity.setPhotoInfo(infoPhoto);
@ -759,7 +762,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
String format = formatter.format(calendar.getTime()); String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format); poiEntity.setCreateTime(format);
poiEntity.setType(2); poiEntity.setType(2);
poiEntity.setTaskStatus(0); poiEntity.setTaskStatus(1);
poiEntity.setIsLocalData(1);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@ -20,10 +20,18 @@ import com.navinfo.outdoor.R;
import com.navinfo.outdoor.adapter.FilterAdapter; import com.navinfo.outdoor.adapter.FilterAdapter;
import com.navinfo.outdoor.api.Constant; import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment; import com.navinfo.outdoor.base.BaseDrawerFragment;
import com.navinfo.outdoor.bean.JobSearchBean;
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;
import com.navinfo.outdoor.util.GeometryTools;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.vividsolutions.jts.geom.Geometry;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -78,7 +86,14 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
}); });
} }
} }
@Override
public void onStart() {
super.onStart();
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this);
}
}
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
@ -159,15 +174,77 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
}); });
filterAdapter.setItemCLick(new FilterAdapter.ItemCLick() { filterAdapter.setItemCLick(new FilterAdapter.ItemCLick() {
@Override @Override
public void item(PoiEntity poiEntity) { public void item(PoiEntity poiEntity,boolean aBoolean) {
if (aBoolean){
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET;
obtain.obj = poiEntity;
EventBus.getDefault().post(obtain);
}else {
Message obtain = Message.obtain(); Message obtain = Message.obtain();
obtain.what = Constant.FILTER_LIST_ITEM; obtain.what = Constant.FILTER_LIST_ITEM;
obtain.obj = poiEntity; obtain.obj = poiEntity;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
} }
}
}); });
} }
@Subscribe
public void onEvent(Message data) {
if (data.what == Constant.JOB_SEARCH_WORD) {
/*
* id : 0
* name :
* address : http://10.130.23.166:8080/cbt/img/blue.png
* telephone : 11
* geo : 标题11
* price : 通过
* type :
* dist :
**/
new Thread(new Runnable() {
@Override
public void run() {
List<PoiEntity> allPoi = poiDao.getAllPoi();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("TAG", "run: " + allPoi.toString());
poiEntities.clear();
JobSearchBean jobSearchBean = (JobSearchBean) data.obj;
List<JobSearchBean.BodyBean.ListBean> list = jobSearchBean.getBody().getList();
for (int i = 0; i < list.size(); i++) {
PoiEntity poiEntity = new PoiEntity();
poiEntity.setTaskId(list.get(i).getId());
poiEntity.setName(list.get(i).getName());
poiEntity.setAddress(list.get(i).getAddress());
poiEntity.setTelPhone(list.get(i).getTelephone()+"");
poiEntity.setPrecision(list.get(i).getPrice());
poiEntity.setDist(list.get(i).getDist());
poiEntity.setType(Integer.valueOf(list.get(i).getType()));
String geo = list.get(i).getGeo();
Geometry geometry = GeometryTools.createGeometry(geo);
if ( geometry.getGeometryType().equals("Point")){//
LatLng latLng = GeometryTools.createLatLng(geo);
poiEntity.setX(latLng.longitude+"");
poiEntity.setY(latLng.altitude+"");
}else if ( geometry.getGeometryType().equals("LineString")){//线
}else if ( geometry.getGeometryType().equals("Polygon")) {//
}
poiEntities.add(poiEntity);
}
poiEntities.addAll(allPoi);
filterAdapter.setAllPoi(poiEntities);
}
});
}
}).start();
}
}
@Override @Override
@ -186,6 +263,29 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
public void run() { public void run() {
Log.d("TAG", "run: " + allPoi.toString()); Log.d("TAG", "run: " + allPoi.toString());
poiEntities.clear(); poiEntities.clear();
JobSearchBean jobSearchBean = (JobSearchBean) getArguments().getSerializable("body");
List<JobSearchBean.BodyBean.ListBean> list = jobSearchBean.getBody().getList();
for (int i = 0; i < list.size(); i++) {
PoiEntity poiEntity = new PoiEntity();
poiEntity.setTaskId(list.get(i).getId());
poiEntity.setName(list.get(i).getName());
poiEntity.setAddress(list.get(i).getAddress());
poiEntity.setTelPhone(list.get(i).getTelephone()+"");
poiEntity.setPrecision(list.get(i).getPrice());
poiEntity.setDist(list.get(i).getDist());
poiEntity.setType(Integer.valueOf(list.get(i).getType()));
String geo = list.get(i).getGeo();
Geometry geometry = GeometryTools.createGeometry(geo);
if ( geometry.getGeometryType().equals("Point")){//
LatLng latLng = GeometryTools.createLatLng(geo);
poiEntity.setX(latLng.longitude+"");
poiEntity.setY(latLng.altitude+"");
}else if ( geometry.getGeometryType().equals("LineString")){//线
}else if ( geometry.getGeometryType().equals("Polygon")) {//
}
poiEntities.add(poiEntity);
}
poiEntities.addAll(allPoi); poiEntities.addAll(allPoi);
filterAdapter.setAllPoi(poiEntities); filterAdapter.setAllPoi(poiEntities);
} }
@ -240,4 +340,11 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
}); });
} }
} }
@Override
public void onDestroy() {
if (EventBus.getDefault().isRegistered(this))//加上判断
EventBus.getDefault().unregister(this);
super.onDestroy();
}
} }

View File

@ -23,7 +23,7 @@ import org.greenrobot.eventbus.Subscribe;
public class GatherGetFragment extends BaseFragment implements View.OnClickListener { public class GatherGetFragment extends BaseFragment implements View.OnClickListener {
private Button btnBank; private Button btnBank;
private TextView tvTitle, tvMoney, tvTime, tvLength, tvDistance, tvDescribe; private TextView tvTitle, tvMoney, tvTime, tvDistance, tvDescribe;
private PoiEntity poiEntity; private PoiEntity poiEntity;
public static GatherGetFragment newInstance(Bundle bundle) { public static GatherGetFragment newInstance(Bundle bundle) {
@ -72,9 +72,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
tvTitle.setText(poiEntity.getName()); tvTitle.setText(poiEntity.getName());
tvMoney.setText("3.5元"); tvMoney.setText("3.5元");
tvTime.setText("到期时间:" + poiEntity.getCreateTime()); tvTime.setText("到期时间:" + poiEntity.getCreateTime());
tvLength.setText("长度:" + poiEntity.getDetail());
tvDescribe.setText("任务描述:" + poiEntity.getDescribe()); tvDescribe.setText("任务描述:" + poiEntity.getDescribe());
tvDistance.setText("距离:" + poiEntity.getX()); tvDistance.setText("距离:" + poiEntity.getDist());
} }
} }
@ -89,7 +88,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
tvTitle = findViewById(R.id.tv_title); tvTitle = findViewById(R.id.tv_title);
tvMoney = findViewById(R.id.tv_money); tvMoney = findViewById(R.id.tv_money);
tvTime = findViewById(R.id.tv_time); tvTime = findViewById(R.id.tv_time);
tvLength = findViewById(R.id.tv_length);
tvDistance = findViewById(R.id.tv_distance); tvDistance = findViewById(R.id.tv_distance);
tvDescribe = findViewById(R.id.tv_describe); tvDescribe = findViewById(R.id.tv_describe);
btnBank = findViewById(R.id.btn_bank); btnBank = findViewById(R.id.btn_bank);
@ -99,15 +97,12 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (arguments!=null) { if (arguments!=null) {
poiEntity = (PoiEntity) arguments.getSerializable("poiEntity"); poiEntity = (PoiEntity) arguments.getSerializable("poiEntity");
tvTitle.setText(poiEntity.getName()); tvTitle.setText(poiEntity.getName());
tvMoney.setText("3.5元"); tvMoney.setText(""+poiEntity.getPrecision());
tvTime.setText("到期时间:" + poiEntity.getCreateTime()); tvTime.setText("到期时间:" + poiEntity.getCreateTime());
tvLength.setText("长度:" + poiEntity.getDetail());
tvDescribe.setText("任务描述:" + poiEntity.getDescribe()); tvDescribe.setText("任务描述:" + poiEntity.getDescribe());
tvDistance.setText("距离:" ); tvDistance.setText("距离:"+format5(Double.valueOf(poiEntity.getDist())/1000)+"km");
} }
} }
@Override @Override
@ -126,7 +121,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
} }
} }
public static String format5(double value) {
return String.format("%.2f", value).toString();
}
@Override @Override
public void onDestroy() { public void onDestroy() {
if (EventBus.getDefault().isRegistered(this))//加上判断 if (EventBus.getDefault().isRegistered(this))//加上判断

View File

@ -210,7 +210,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity"); showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
if (showPoiEntity != null) { if (showPoiEntity != null) {
String name = showPoiEntity.getName();//名称 String name = showPoiEntity.getName();//名称
if (name != null) { if (name != null&&!name.equals("")) {
editTaskName.setText(name + ""); editTaskName.setText(name + "");
} }
String x = showPoiEntity.getX(); String x = showPoiEntity.getX();
@ -221,7 +221,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
latLng.setLatitude(Double.parseDouble(y)); latLng.setLatitude(Double.parseDouble(y));
} }
String describe = showPoiEntity.getDescribe();//任务描述 String describe = showPoiEntity.getDescribe();//任务描述
if (describe != null) { if (describe != null &&!describe.equals("")) {
editOtherDescribe.setText(describe); editOtherDescribe.setText(describe);
} }
if (showPoiEntity.getPhotoInfo() != null) { if (showPoiEntity.getPhotoInfo() != null) {
@ -307,8 +307,9 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
calendar.setTimeInMillis(System.currentTimeMillis()); calendar.setTimeInMillis(System.currentTimeMillis());
String format = formatter.format(calendar.getTime()); String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format); poiEntity.setCreateTime(format);
poiEntity.setType(3); poiEntity.setType(5);
poiEntity.setTaskStatus(0); poiEntity.setTaskStatus(1);
poiEntity.setIsLocalData(1);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -353,7 +354,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
PoiEntity poiEntity = new PoiEntity(); PoiEntity poiEntity = new PoiEntity();
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("")) {
poiEntity.setName(name); poiEntity.setName(name);
} }
@ -362,15 +363,15 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
poiEntity.setY(String.valueOf(latLng.latitude)); poiEntity.setY(String.valueOf(latLng.latitude));
} }
String describe = editOtherDescribe.getText().toString().trim(); String describe = editOtherDescribe.getText().toString().trim();
if (describe != null || !describe.equals("")) { if (describe != null && !describe.equals("")) {
poiEntity.setDescribe(describe); poiEntity.setDescribe(describe);
} }
String tagPicture = (String) ivPicture.getTag(); String tagPicture = (String) ivPicture.getTag();
if (tagPicture != null) { if (tagPicture != null &&!tagPicture.equals("")) {
arrayList.add(new Info(tagPicture)); arrayList.add(new Info(tagPicture));
} }
String tagPictures = (String) ivPictures.getTag(); String tagPictures = (String) ivPictures.getTag();
if (tagPictures != null) { if (tagPictures != null&&!tagPictures.equals("")) {
arrayList.add(new Info(tagPictures)); arrayList.add(new Info(tagPictures));
} }
poiEntity.setPhotoInfo(arrayList); poiEntity.setPhotoInfo(arrayList);
@ -379,8 +380,9 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
calendar.setTimeInMillis(System.currentTimeMillis()); calendar.setTimeInMillis(System.currentTimeMillis());
String format = formatter.format(calendar.getTime()); String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format); poiEntity.setCreateTime(format);
poiEntity.setType(3); poiEntity.setType(5);
poiEntity.setTaskStatus(0); poiEntity.setTaskStatus(1);
poiEntity.setIsLocalData(1);
String newPoiEntity = new Gson().toJson(poiEntity); String newPoiEntity = new Gson().toJson(poiEntity);
//以键值对的形式添加新值 //以键值对的形式添加新值
edit.putString("poiEntity", newPoiEntity); edit.putString("poiEntity", newPoiEntity);

View File

@ -223,11 +223,11 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity"); showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
if (showPoiEntity != null) { if (showPoiEntity != null) {
String name = showPoiEntity.getName();//名称 String name = showPoiEntity.getName();//名称
if (name != null) { if (name != null && !name.equals("")) {
editNameContent.setText(name + ""); editNameContent.setText(name + "");
} }
String address = showPoiEntity.getAddress();//地址 String address = showPoiEntity.getAddress();//地址
if (address != null) { if (address != null && !address.equals("")) {
editSiteContent.setText(address); editSiteContent.setText(address);
} }
String x = showPoiEntity.getX(); String x = showPoiEntity.getX();
@ -238,11 +238,11 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
latLng.setLongitude(Double.parseDouble(x)); latLng.setLongitude(Double.parseDouble(x));
} }
String describe = showPoiEntity.getDescribe();//任务描述 String describe = showPoiEntity.getDescribe();//任务描述
if (describe != null) { if (describe != null&&!describe.equals("")) {
editDescribe.setText(describe); editDescribe.setText(describe);
} }
String telPhone = showPoiEntity.getTelPhone(); String telPhone = showPoiEntity.getTelPhone();
if (telPhone != null) { if (telPhone != null&&!telPhone.equals("")) {
phoneData.add(showPoiEntity.getTelPhone()); phoneData.add(showPoiEntity.getTelPhone());
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg)); poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
poiRecycleAdapter.setList(poiBeans); poiRecycleAdapter.setList(poiBeans);
@ -390,8 +390,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
calendar.setTimeInMillis(System.currentTimeMillis()); calendar.setTimeInMillis(System.currentTimeMillis());
String format = formatter.format(calendar.getTime()); String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format); poiEntity.setCreateTime(format);
poiEntity.setType(0); poiEntity.setType(1);
poiEntity.setTaskStatus(0); poiEntity.setTaskStatus(1);
poiEntity.setIsLocalData(1);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -470,11 +471,11 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
PoiEntity poiEntity = new PoiEntity(); PoiEntity poiEntity = new PoiEntity();
ArrayList<Info> infoPhoto = new ArrayList<>(); ArrayList<Info> infoPhoto = new ArrayList<>();
String name = editNameContent.getText().toString().trim();//名称 String name = editNameContent.getText().toString().trim();//名称
if (name != null || !name.equals("")) { if (name != null && !name.equals("")) {
poiEntity.setName(name); poiEntity.setName(name);
} }
String site = editSiteContent.getText().toString().trim(); String site = editSiteContent.getText().toString().trim();
if (site != null || !site.equals("")) { if (site != null && !site.equals("")) {
poiEntity.setAddress(site); poiEntity.setAddress(site);
} }
if (latLng != null) { if (latLng != null) {
@ -482,30 +483,30 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
poiEntity.setY(String.valueOf(latLng.latitude)); poiEntity.setY(String.valueOf(latLng.latitude));
} }
String describe = editDescribe.getText().toString().trim(); String describe = editDescribe.getText().toString().trim();
if (describe!= null || !describe.equals("")) { if (describe!= null && !describe.equals("")) {
poiEntity.setDescribe(describe); poiEntity.setDescribe(describe);
} }
if (phoneData.size() > 0) { if (phoneData.size() > 0) {
poiEntity.setTelPhone(phoneData.get(0)); poiEntity.setTelPhone(phoneData.get(0));
} }
String tagPanorama = (String) ivPanorama.getTag(); String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama!=null) { if (tagPanorama!=null&&!tagPanorama.equals("")) {
infoPhoto.add(new Info(tagPanorama)); infoPhoto.add(new Info(tagPanorama));
} }
String tagName = (String) ivName.getTag(); String tagName = (String) ivName.getTag();
if (tagName!= null) { if (tagName!= null&&!tagName.equals("")) {
infoPhoto.add(new Info(tagName)); infoPhoto.add(new Info(tagName));
} }
String tagInternal = (String) ivInternal.getTag(); String tagInternal = (String) ivInternal.getTag();
if (tagInternal!= null) { if (tagInternal!= null&&!tagInternal.equals("")) {
infoPhoto.add(new Info(tagInternal)); infoPhoto.add(new Info(tagInternal));
} }
String tagElse = (String) ivElse.getTag(); String tagElse = (String) ivElse.getTag();
if (tagElse!=null) { if (tagElse!=null&&!tagElse.equals("")) {
infoPhoto.add(new Info(tagElse)); infoPhoto.add(new Info(tagElse));
} }
String tagCard = (String) ivCard.getTag(); String tagCard = (String) ivCard.getTag();
if (tagCard != null) { if (tagCard != null&&!tagCard.equals("")) {
infoPhoto.add(new Info(tagCard)); infoPhoto.add(new Info(tagCard));
} }
poiEntity.setPhotoInfo(infoPhoto); poiEntity.setPhotoInfo(infoPhoto);
@ -514,8 +515,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
calendar.setTimeInMillis(System.currentTimeMillis()); calendar.setTimeInMillis(System.currentTimeMillis());
String format = formatter.format(calendar.getTime()); String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format); poiEntity.setCreateTime(format);
poiEntity.setType(0); poiEntity.setType(1);
poiEntity.setTaskStatus(0); poiEntity.setTaskStatus(1);
poiEntity.setIsLocalData(1);
String newPoiEntity = new Gson().toJson(poiEntity); String newPoiEntity = new Gson().toJson(poiEntity);
//以键值对的形式添加新值 //以键值对的形式添加新值
edit.putString("poiEntity", newPoiEntity); edit.putString("poiEntity", newPoiEntity);

View File

@ -134,17 +134,17 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity"); showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
if (showPoiEntity != null) { if (showPoiEntity != null) {
String name = showPoiEntity.getName();//名称 String name = showPoiEntity.getName();//名称
if (name != null || !name.equals("")) { if (name != null && !name.equals("")) {
etRoadName.setText(name + ""); etRoadName.setText(name + "");
} }
String extend = showPoiEntity.getExtend(); String extend = showPoiEntity.getExtend();
if (extend!=null||!extend.equals("")){ if (extend!=null&&!extend.equals("")){
RoadExtend roadExtend = new Gson().fromJson(extend, RoadExtend.class); RoadExtend roadExtend = new Gson().fromJson(extend, RoadExtend.class);
int type= roadExtend.getType(); int type= roadExtend.getType();
showPictureType(type); showPictureType(type);
} }
String describe = showPoiEntity.getDescribe();//任务描述 String describe = showPoiEntity.getDescribe();//任务描述
if (describe != null || !describe.equals("")) { if (describe != null && !describe.equals("")) {
etDesc.setText(describe); etDesc.setText(describe);
} }
} }
@ -225,6 +225,9 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
calendar.setTimeInMillis(System.currentTimeMillis()); calendar.setTimeInMillis(System.currentTimeMillis());
String format = formatter.format(calendar.getTime()); String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format); poiEntity.setCreateTime(format);
poiEntity.setType(3);
poiEntity.setTaskStatus(1);
poiEntity.setIsLocalData(1);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -278,7 +281,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
PoiEntity poiEntity = new PoiEntity(); PoiEntity poiEntity = new PoiEntity();
String roadName = etRoadName.getText().toString().trim(); String roadName = etRoadName.getText().toString().trim();
if (roadName != null || !roadName.equals("")) { if (roadName != null && !roadName.equals("")) {
poiEntity.setName(roadName); poiEntity.setName(roadName);
} }
RoadExtend roadExtend = new RoadExtend(); RoadExtend roadExtend = new RoadExtend();
@ -290,7 +293,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
poiEntity.setExtend(roadExtendJson); poiEntity.setExtend(roadExtendJson);
} }
String desc = etDesc.getText().toString().trim(); String desc = etDesc.getText().toString().trim();
if (desc != null || !desc.equals("")) { if (desc != null && !desc.equals("")) {
poiEntity.setDescribe(desc); poiEntity.setDescribe(desc);
} }
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -298,7 +301,9 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
calendar.setTimeInMillis(System.currentTimeMillis()); calendar.setTimeInMillis(System.currentTimeMillis());
String format = formatter.format(calendar.getTime()); String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format); poiEntity.setCreateTime(format);
poiEntity.setType(4); poiEntity.setType(3);
poiEntity.setTaskStatus(1);
poiEntity.setIsLocalData(1);
String newPoiEntity = new Gson().toJson(poiEntity); String newPoiEntity = new Gson().toJson(poiEntity);
//以键值对的形式添加新值 //以键值对的形式添加新值
edit.putString("poiEntity", newPoiEntity); edit.putString("poiEntity", newPoiEntity);

View File

@ -139,17 +139,17 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity"); showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
if (showPoiEntity != null) { if (showPoiEntity != null) {
String name = showPoiEntity.getName();//名称 String name = showPoiEntity.getName();//名称
if (name != null || !name.equals("")) { if (name != null && !name.equals("")) {
etRoadName.setText(name + ""); etRoadName.setText(name + "");
} }
String extend = showPoiEntity.getExtend(); String extend = showPoiEntity.getExtend();
if (extend!=null||!extend.equals("")){ if (extend!=null&& !extend.equals("")){
RoadExtend roadExtend = new Gson().fromJson(extend, RoadExtend.class); RoadExtend roadExtend = new Gson().fromJson(extend, RoadExtend.class);
int type= roadExtend.getType(); int type= roadExtend.getType();
showPictureType(type); showPictureType(type);
} }
String describe = showPoiEntity.getDescribe();//任务描述 String describe = showPoiEntity.getDescribe();//任务描述
if (describe != null || !describe.equals("")) { if (describe != null && !describe.equals("")) {
etDesc.setText(describe); etDesc.setText(describe);
} }
} }
@ -231,7 +231,9 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
calendar.setTimeInMillis(System.currentTimeMillis()); calendar.setTimeInMillis(System.currentTimeMillis());
String format = formatter.format(calendar.getTime()); String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format); poiEntity.setCreateTime(format);
poiEntity.setType(1); poiEntity.setType(4);
poiEntity.setTaskStatus(1);
poiEntity.setIsLocalData(1);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -286,7 +288,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
PoiEntity poiEntity = new PoiEntity(); PoiEntity poiEntity = new PoiEntity();
String roadName = etRoadName.getText().toString().trim(); String roadName = etRoadName.getText().toString().trim();
if (roadName != null || !roadName.equals("")) { if (roadName != null && !roadName.equals("")) {
poiEntity.setName(roadName); poiEntity.setName(roadName);
} }
RoadExtend roadExtend = new RoadExtend(); RoadExtend roadExtend = new RoadExtend();
@ -298,7 +300,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
poiEntity.setExtend(roadExtendJson); poiEntity.setExtend(roadExtendJson);
} }
String desc = etDesc.getText().toString().trim(); String desc = etDesc.getText().toString().trim();
if (desc != null || !desc.equals("")) { if (desc != null && !desc.equals("")) {
poiEntity.setDescribe(desc); poiEntity.setDescribe(desc);
} }
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -306,7 +308,9 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
calendar.setTimeInMillis(System.currentTimeMillis()); calendar.setTimeInMillis(System.currentTimeMillis());
String format = formatter.format(calendar.getTime()); String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format); poiEntity.setCreateTime(format);
poiEntity.setType(1); poiEntity.setType(4);
poiEntity.setTaskStatus(1);
poiEntity.setIsLocalData(1);
String newPoiEntity = new Gson().toJson(poiEntity); String newPoiEntity = new Gson().toJson(poiEntity);
//以键值对的形式添加新值 //以键值对的形式添加新值
edit.putString("poiEntity", newPoiEntity); edit.putString("poiEntity", newPoiEntity);

View File

@ -89,6 +89,8 @@ import org.greenrobot.eventbus.Subscribe;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import okhttp3.OkHttpClient;
/** /**
* 寻宝的Fragment * 寻宝的Fragment
* 2021-5-25 * 2021-5-25
@ -120,6 +122,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
private ChargingPileEntity chargingPileEntity; private ChargingPileEntity chargingPileEntity;
private String userEncode; private String userEncode;
private String centerEncode; private String centerEncode;
private JobSearchBean body;
public static TreasureFragment newInstance(Bundle bundle) { public static TreasureFragment newInstance(Bundle bundle) {
TreasureFragment fragment = new TreasureFragment(); TreasureFragment fragment = new TreasureFragment();
@ -181,6 +184,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
tencentMap.setMapStyle(2); tencentMap.setMapStyle(2);
//启用3d视图 //启用3d视图
tencentMap.setBuilding3dEffectEnable(true); tencentMap.setBuilding3dEffectEnable(true);
tencentMap.setOnCameraChangeListener(cameraChangeListener);
//获取地图UI 设置对象 //获取地图UI 设置对象
UiSettings uiSettings = tencentMap.getUiSettings(); UiSettings uiSettings = tencentMap.getUiSettings();
//设置logo的大小 //设置logo的大小
@ -191,21 +196,41 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
initSharePre(); initSharePre();
//数据库 //数据库
initThread(); initThread();
}
private TencentMap.OnCameraChangeListener cameraChangeListener = new TencentMap.OnCameraChangeListener() {
@Override
public void onCameraChange(CameraPosition cameraPosition) { // 地图移动中
} }
@Override
public void onCameraChangeFinished(CameraPosition cameraPosition) { // 地图移动结束
if (Constant.currentLocation != null) {
initList(Constant.currentLocation);
}
}
};
private void initList(TencentLocation tencentLocation) { private void initList(TencentLocation tencentLocation) {
//获取中心点位置 //获取中心点位置
LatLng mapCenterPoint = getMapCenterPoint(); LatLng mapCenterPoint = getMapCenterPoint();
ArrayList<Removable> removables = new ArrayList<>(); ArrayList<Removable> removables = new ArrayList<>();
if (removables.size() != 0) {
for (int i = 0; i < removables.size(); i++) {
removables.get(i).remove();
}
removables.clear();
}
if (mapCenterPoint != null) { if (mapCenterPoint != null) {
centerEncode = Geohash.getInstance().encode(mapCenterPoint.latitude, mapCenterPoint.longitude); centerEncode = Geohash.getInstance().encode(mapCenterPoint.latitude, mapCenterPoint.longitude);
} }
userEncode = Geohash.getInstance().encode(tencentLocation.getLatitude(),tencentLocation.getLongitude()); userEncode = Geohash.getInstance().encode(tencentLocation.getLatitude(), tencentLocation.getLongitude());
long date = System.currentTimeMillis(); long date = System.currentTimeMillis();
// showLoadingDialog();
OkGo.getInstance().cancelTag(this);
// 请求方式和请求url // 请求方式和请求url
OkGo.<JobSearchBean>get(HttpInterface.TASK_LIST) OkGo.<JobSearchBean>get(HttpInterface.TASK_LIST)
.tag(this) .tag(this)
@ -215,30 +240,59 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.params("date", date) .params("date", date)
.params("pageSize", Constant.NUMBER) .params("pageSize", Constant.NUMBER)
.params("pageNum", "1") .params("pageNum", "1")
// .client(new OkHttpClient())
.execute(new DialogCallback<JobSearchBean>(JobSearchBean.class) { .execute(new DialogCallback<JobSearchBean>(JobSearchBean.class) {
@Override @Override
public void onSuccess(Response<JobSearchBean> response) { public void onSuccess(Response<JobSearchBean> response) {
dismissLoadingDialog();
body = response.body();
Log.d("TAG", "onSuccess: " + response.body().toString() + "sssssssssssss"); Log.d("TAG", "onSuccess: " + response.body().toString() + "sssssssssssss");
if (removables.size() > 0) { if (removables.size() != 0) {
for (int i = 0; i < removables.size(); i++) { for (int i = 0; i < removables.size(); i++) {
removables.get(i).remove(); removables.get(i).remove();
} }
removables.clear(); removables.clear();
} } else {
List<JobSearchBean.BodyBean.ListBean> list = response.body().getBody().getList(); List<JobSearchBean.BodyBean.ListBean> list = response.body().getBody().getList();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
String geo = list.get(i).getGeo(); String geo = list.get(i).getGeo();
Log.d("TAG", "onSuccess: " + geo); Log.d("TAG", "onSuccess: " + geo);
Geometry geometry = GeometryTools.createGeometry(geo); Geometry geometry = GeometryTools.createGeometry(geo);
if ( geometry.getGeometryType().equals("Point")){// if (geometry.getGeometryType().equals("Point")) {//
LatLng latLng = GeometryTools.createLatLng(geo); LatLng latLng = GeometryTools.createLatLng(geo);
BitmapDescriptor custom = BitmapDescriptorFactory.fromResource(R.drawable.marker_road); switch (Integer.valueOf(list.get(i).getType())) {
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng)); case 1://poi
marker.setClickable(true); Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Constant.POI_ICON).alpha(0.5f)
removables.add(marker); .flat(true)
.clockwise(false));
removables.add(poiMarker);
}else if ( geometry.getGeometryType().equals("LineString")){//线 break;
List<LatLng> latLineString= GeometryTools.getLatLngs(geo); case 2://充电站
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Constant.STATION_ICON).alpha(0.7f)
.flat(true)
.clockwise(false));
removables.add(stationMarker);
break;
case 3://poi录像
break;
case 4://道路录像
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Constant.ROAD_ICON).alpha(0.7f)
.flat(true)
.clockwise(false));
removables.add(roadMarker);
break;
case 5://其他
break;
case 6://面状任务
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Constant.PLANAR_TASK_ICON).alpha(0.7f)
.flat(true)
.clockwise(false));
removables.add(planarMarker);
break;
}
} else if (geometry.getGeometryType().equals("LineString")) {//线
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
// 构造 PolylineOpitons // 构造 PolylineOpitons
PolylineOptions polylineOptions = new PolylineOptions() PolylineOptions polylineOptions = new PolylineOptions()
.addAll(latLineString) .addAll(latLineString)
@ -255,7 +309,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
// 绘制折线 // 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions); Polyline polyline = tencentMap.addPolyline(polylineOptions);
removables.add(polyline); removables.add(polyline);
}else if ( geometry.getGeometryType().equals("Polygon")){// } else if (geometry.getGeometryType().equals("Polygon")) {//
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo); List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
Polygon polygon = tencentMap.addPolygon(new PolygonOptions(). Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
//连接封闭图形的点 //连接封闭图形的点
@ -268,13 +322,18 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
strokeWidth(5)); strokeWidth(5));
removables.add(polygon); removables.add(polygon);
} }
} }
} }
Message obtain = Message.obtain();
obtain.what = Constant.JOB_SEARCH_WORD;
obtain.obj = body;
EventBus.getDefault().post(obtain);
}
@Override @Override
public void onError(Response<JobSearchBean> response) { public void onError(Response<JobSearchBean> response) {
super.onError(response); super.onError(response);
dismissLoadingDialog();
Log.d("TAG", "onError: " + response.message()); Log.d("TAG", "onError: " + response.message());
} }
}); });
@ -421,8 +480,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
public void onEvent(Message data) { public void onEvent(Message data) {
if (data.what == Constant.FILTER_LIST_ITEM) { // 点击筛选的item if (data.what == Constant.FILTER_LIST_ITEM) { // 点击筛选的item
PoiEntity poiEntity = (PoiEntity) data.obj; PoiEntity poiEntity = (PoiEntity) data.obj;
if (poiEntity.getX() != null && poiEntity.getY() != null) {
LatLng position = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX())); LatLng position = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
tencentMap.addMarker(new MarkerOptions(position)); tencentMap.addMarker(new MarkerOptions(position));
}
sliding_layout.setPanelHeight(0); sliding_layout.setPanelHeight(0);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
frameLayout.setVisibility(View.VISIBLE); frameLayout.setVisibility(View.VISIBLE);
@ -437,26 +498,30 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putBoolean("isSliding", false); // 通知抽屉不收回 bundle.putBoolean("isSliding", false); // 通知抽屉不收回
bundle.putSerializable("poiEntity", poiEntity); bundle.putSerializable("poiEntity", poiEntity);
frameLayout.setVisibility(View.GONE);
fragmentTransaction.remove(gatherGetFragment);
switch (poiEntity.getType()) { switch (poiEntity.getType()) {
case 0: case 1:
PoiFragment poiFragment = PoiFragment.newInstance(bundle); PoiFragment poiFragment = PoiFragment.newInstance(bundle);
showSlidingFragment(poiFragment); showSlidingFragment(poiFragment);
break; break;
case 1:
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
showSlidingFragment(roadFragment);
break;
case 2: case 2:
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle); ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
showSlidingFragment(chargingStationFragment); showSlidingFragment(chargingStationFragment);
break; break;
case 3: case 3:
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
showSlidingFragment(poiVideoFragment);
break;
case 4:
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
showSlidingFragment(roadFragment);
break;
case 5:
OtherFragment otherFragment = OtherFragment.newInstance(bundle); OtherFragment otherFragment = OtherFragment.newInstance(bundle);
showSlidingFragment(otherFragment); showSlidingFragment(otherFragment);
break; break;
} }
frameLayout.setVisibility(View.GONE);
fragmentTransaction.remove(gatherGetFragment);
} else if (data.what == Constant.FILTER_LIST) { // 筛选列表所有数据地图显示 } else if (data.what == Constant.FILTER_LIST) { // 筛选列表所有数据地图显示
List<PoiEntity> poiEntities = (List<PoiEntity>) data.obj; List<PoiEntity> poiEntities = (List<PoiEntity>) data.obj;
initFilterMarker(poiEntities); initFilterMarker(poiEntities);
@ -493,6 +558,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
} else { } else {
setMainButtonVisiable(View.VISIBLE); setMainButtonVisiable(View.VISIBLE);
frameLayout.setVisibility(View.GONE);
fragmentTransaction.remove(gatherGetFragment);
} }
} else if (data.what == Constant.CHARGING_STATION) {//充电站的充电桩 } else if (data.what == Constant.CHARGING_STATION) {//充电站的充电桩
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
@ -731,13 +798,19 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}).setTitle(title); }).setTitle(title);
break; break;
case R.id.iv_filter: case R.id.iv_filter:
FilterFragment filterFragment = FilterFragment.newInstance(new Bundle()); Bundle bundle = new Bundle();
if (body != null) {
bundle.putSerializable("body", body);
}
FilterFragment filterFragment = FilterFragment.newInstance(bundle);
showSlidingFragment(filterFragment); showSlidingFragment(filterFragment);
break; break;
case R.id.iv_message: case R.id.iv_message:
Intent messageIntent = new Intent(getContext(), FragmentManagement.class); Intent messageIntent = new Intent(getContext(), FragmentManagement.class);
messageIntent.putExtra("tag", 35); messageIntent.putExtra("tag", 35);
startActivity(messageIntent); startActivity(messageIntent);
break; break;
} }
} }
@ -879,9 +952,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
location.setAccuracy(tencentLocation.getAccuracy()); location.setAccuracy(tencentLocation.getAccuracy());
locationChangedListener.onLocationChanged(location); locationChangedListener.onLocationChanged(location);
locationStyle = locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_FOLLOW_NO_CENTER); locationStyle = locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_FOLLOW_NO_CENTER);
if (Constant.currentLocation == null) {
initList(tencentLocation);
}
Constant.currentLocation = tencentLocation; Constant.currentLocation = tencentLocation;
Constant.markerCurrentLocation = tencentLocation; Constant.markerCurrentLocation = tencentLocation;
Constant.markerLatitude = tencentLocation.getLatitude(); Constant.markerLatitude = tencentLocation.getLatitude();

View File

@ -26,7 +26,7 @@ public class PoiEntity implements Serializable {
private String address;//地址 private String address;//地址
private String telPhone;//电话 private String telPhone;//电话
private String memo;//备注 private String memo;//备注
private double precision;//金额 private String precision;//金额
private String photo;//照片信息 private String photo;//照片信息
private String extend;//添加字段 private String extend;//添加字段
private boolean checked; private boolean checked;
@ -54,9 +54,27 @@ public class PoiEntity implements Serializable {
private String x;//经度 private String x;//经度
private String y;//纬度 private String y;//纬度
private String detail;//深度信息 private String detail;//深度信息
private int taskStatus;//任务状态 0.待提交1.已提交,2 已领取 private String dist;//距离用户位置
private int type;//0.poi,1.道路2.充电站3.其他 ,4,poi录像 private int taskStatus;//任务状态 1.待提交2.已提交,3已领取
private int station_type;//0.全部1.poi,2.道路3.充电站4.其他 private int type;//1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务"
private int station_type;//1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务"
private int isLocalData;//是否是本地数据 0,服务 1,本地
public int getIsLocalData() {
return isLocalData;
}
public void setIsLocalData(int isLocalData) {
this.isLocalData = isLocalData;
}
public String getDist() {
return dist;
}
public void setDist(String dist) {
this.dist = dist;
}
public int getStation_type() { public int getStation_type() {
return station_type; return station_type;
@ -162,11 +180,11 @@ public class PoiEntity implements Serializable {
this.memo = memo; this.memo = memo;
} }
public double getPrecision() { public String getPrecision() {
return precision; return precision;
} }
public void setPrecision(double precision) { public void setPrecision(String precision) {
this.precision = precision; this.precision = precision;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 KiB

View File

@ -41,29 +41,26 @@
app:layout_constraintStart_toStartOf="@+id/tv_title" app:layout_constraintStart_toStartOf="@+id/tv_title"
app:layout_constraintTop_toBottomOf="@+id/tv_title" /> app:layout_constraintTop_toBottomOf="@+id/tv_title" />
<TextView <View
android:id="@+id/tv_length" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="1dp"
android:layout_height="wrap_content" android:background="#BFB8B8"
android:layout_margin="10dp" android:layout_marginStart="20dp"
android:text="长度:" android:layout_marginEnd="20dp"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="@+id/tv_time" app:layout_constraintBottom_toBottomOf="@+id/tv_time"
app:layout_constraintEnd_toStartOf="@+id/tv_distance" app:layout_constraintTop_toTopOf="@+id/tv_describe" />
app:layout_constraintStart_toEndOf="@+id/tv_time"
app:layout_constraintTop_toTopOf="@+id/tv_time" />
<TextView <TextView
android:id="@+id/tv_distance" android:id="@+id/tv_distance"
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:layout_marginEnd="20dp"
android:maxLength="10"
android:text="距离:" android:text="距离:"
android:textSize="15sp" android:textSize="15sp"
android:maxLength="10" app:layout_constraintBottom_toBottomOf="@+id/tv_time"
app:layout_constraintBottom_toBottomOf="@+id/tv_length"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/tv_length" /> app:layout_constraintTop_toTopOf="@+id/tv_time" />
<TextView <TextView
android:id="@+id/tv_describe" android:id="@+id/tv_describe"
@ -83,15 +80,6 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_describe"> app:layout_constraintTop_toBottomOf="@+id/tv_describe">
<Button
android:id="@+id/btn_bank"
style="@style/user_data_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:layout_weight="1"
android:text="立即采集" />
<Button <Button
android:id="@+id/btn_draw" android:id="@+id/btn_draw"
style="@style/user_data_style" style="@style/user_data_style"
@ -100,6 +88,14 @@
android:layout_margin="20dp" android:layout_margin="20dp"
android:layout_weight="1" android:layout_weight="1"
android:text="领取任务" /> android:text="领取任务" />
<Button
android:id="@+id/btn_bank"
style="@style/user_data_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:layout_weight="1"
android:text="立即采集" />
</LinearLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="10dp"
android:layout_height="10dp">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:background="@drawable/marker_poi_bg"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -13,7 +13,9 @@
android:layout_margin="20dp" android:layout_margin="20dp"
android:text="测试彼此" android:text="测试彼此"
android:textColor="#333" android:textColor="#333"
android:textSize="25sp" android:textSize="18sp"
android:maxLength="15"
android:lines="1"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@ -74,14 +76,14 @@
android:id="@+id/tv_money" android:id="@+id/tv_money"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:text="¥3.5" android:text="¥3.5"
android:textColor="#000" android:textColor="#000"
android:textSize="25sp" android:textSize="15sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/tv_name"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/tv_name" /> app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/tv_distance" android:id="@+id/tv_distance"