From 6f8b730b40a60ed8a7c009a3adb6820a828cb7ea Mon Sep 17 00:00:00 2001 From: wangdongsheng Date: Wed, 8 Sep 2021 18:34:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=89=B9=E9=87=8F=E9=A2=86?= =?UTF-8?q?=E5=8F=96=EF=BC=8C=E4=BF=AE=E6=94=B9=E7=82=B9=E4=BD=8D=E5=8E=8B?= =?UTF-8?q?=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 +- .../outdoor/activity/LoginActivity.java | 1 - .../outdoor/activity/PictureActivity.java | 22 +- .../outdoor/adapter/FilterAdapter.java | 50 +-- .../navinfo/outdoor/bean/FilterBatchBean.java | 382 ++++++++++++++++++ .../outdoor/fragment/FilterFragment.java | 290 ++++++++++--- .../outdoor/fragment/TreasureFragment.java | 46 +-- .../navinfo/outdoor/http/HttpInterface.java | 15 +- app/src/main/res/layout/fragment_filter.xml | 88 ++-- app/src/main/res/layout/item_filter.xml | 4 +- 10 files changed, 726 insertions(+), 176 deletions(-) create mode 100644 app/src/main/java/com/navinfo/outdoor/bean/FilterBatchBean.java diff --git a/app/build.gradle b/app/build.gradle index 0649669..d3987bb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 29 buildToolsVersion '29.0.2' - ndkVersion '23.0.7123448' + // ndkVersion '23.0.7123448' defaultConfig { applicationId "com.navinfo.outdoor" @@ -96,7 +96,7 @@ dependencies { //省市区 https://github.com/Bigkoo/Android-PickerView compile 'com.contrarywind:Android-PickerView:4.1.6' implementation 'com.contrarywind:Android-PickerView:4.1.8' -/* //加载html +/* //加载html implementation 'com.github.sendtion:XRichText:1.9.4'*/ //加载图片的依赖包 implementation 'com.github.bumptech.glide:glide:4.8.0' diff --git a/app/src/main/java/com/navinfo/outdoor/activity/LoginActivity.java b/app/src/main/java/com/navinfo/outdoor/activity/LoginActivity.java index f391777..3f98643 100644 --- a/app/src/main/java/com/navinfo/outdoor/activity/LoginActivity.java +++ b/app/src/main/java/com/navinfo/outdoor/activity/LoginActivity.java @@ -148,7 +148,6 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener initLogIn(name, paw); } break; - case R.id.tv_statement: Intent stateIntent = new Intent(this, StatementActivity.class); startActivity(stateIntent); diff --git a/app/src/main/java/com/navinfo/outdoor/activity/PictureActivity.java b/app/src/main/java/com/navinfo/outdoor/activity/PictureActivity.java index 6af020c..aa02483 100644 --- a/app/src/main/java/com/navinfo/outdoor/activity/PictureActivity.java +++ b/app/src/main/java/com/navinfo/outdoor/activity/PictureActivity.java @@ -99,7 +99,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene private TextureMapView ivMap; private CheckBox captureVideo; // 拍摄视频 private Button btnVideo; - private String finalVideoPath; // 摄像后最终保存的文件名 // private File tmpFile; // 合并文件的临时文件路径 private Timer timer; @@ -153,20 +152,20 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene } videoChronometer = findViewById(R.id.video_chronometer); // if (finalVideoPath == null) { -// finalVideoPath = Constant.PICTURE_FOLDER+"/final.mp4"; -// } +//// finalVideoPath = Constant.PICTURE_FOLDER+"/final.mp4"; +//// } this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); ivZoomAdd = findViewById(R.id.iv_zoom_add); ivZoomAdd.setOnClickListener(this); ivZoomDel = findViewById(R.id.iv_zoom_del); ivZoomDel.setOnClickListener(this); -// cbMapType = findViewById(R.id.cb_map_type); -// cbMapType.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { -// @Override -// public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { -// setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER); -// } -// }); +/* cbMapType = findViewById(R.id.cb_map_type); + cbMapType.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER); + } + });*/ ivLocation = findViewById(R.id.iv_location); ivLocation.setOnClickListener(this); layerChange = findViewById(R.id.layer_change); @@ -575,7 +574,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene private void setLocMarkerStyle(int type) { tencentMap.setLocationSource(new MyTecentLocationSource(this)); tencentMap.setMyLocationEnabled(true); - MyLocationStyle locationStyle = new MyLocationStyle(); locationStyle = locationStyle.myLocationType(type); //创建图标 @@ -590,6 +588,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene public void benSwitch() { DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); + System.out.println("width-display :" + dm.widthPixels); System.out.println("height-display :" + dm.heightPixels); FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//地图的宽高 @@ -598,7 +597,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene FrameLayout.LayoutParams layoutParamsCamera = (FrameLayout.LayoutParams) camera.getLayoutParams();//相机的宽高 int heightCamera = camera.getMeasuredHeight(); int widthCamera = camera.getMeasuredWidth(); - layerChange.removeAllViews(); if (widthMap > widthCamera) { ivPic.setVisibility(View.VISIBLE); diff --git a/app/src/main/java/com/navinfo/outdoor/adapter/FilterAdapter.java b/app/src/main/java/com/navinfo/outdoor/adapter/FilterAdapter.java index 6a3b88c..fa0e7db 100644 --- a/app/src/main/java/com/navinfo/outdoor/adapter/FilterAdapter.java +++ b/app/src/main/java/com/navinfo/outdoor/adapter/FilterAdapter.java @@ -8,6 +8,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; import android.widget.CompoundButton; +import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; @@ -28,7 +29,7 @@ import java.util.List; */ public class FilterAdapter extends RecyclerView.Adapter { private Context context; - private List allPoi=new ArrayList<>(); + private List allPoi = new ArrayList<>(); public FilterAdapter(Context context) { this.context = context; @@ -42,8 +43,15 @@ public class FilterAdapter extends RecyclerView.Adapter fail; + private List success; + + public List getFail() { + return fail; + } + + public void setFail(List fail) { + this.fail = fail; + } + + public List getSuccess() { + return success; + } + + public void setSuccess(List success) { + this.success = success; + } + + public static class SuccessBean { + /** + * fid : 20200806hjc00000054 + * endDate : 1653840000000 + * updateUserid : 10 + * batchtaskId : 15 + * origin : 1 + * projectType : + * memo : 任务备注8687 + * sptype : 1 + * type : 2 + * geo : 78XeZHM0UPGQufeL4DN0WNZQlA7jT5b72qfqO2yFloc= + * isExclusive : 0 + * price : 20.25 + * classcode : 230218 + * csTaskList : [{"geo":"78XeZHM0UPEuIhFDihbAyDgeG0KtdNff7u3MHoPjIm4U9COTBeS3hw==","address":"xx路x号","price":4.95,"name":"XX充电桩1","id":25},{"geo":"78XeZHM0UPGQufeL4DN0WNZQlA7jT5b72qfqO2yFloc=","address":"xx路x号","price":4.95,"name":"XX充电桩1","id":30}] + * id : 8687 + * locked : 0 + * createUserid : 1 + * address : xx路x号 + * received : 10 + * telephone : + * updateTime : 1629947885562 + * version : 13 + * createTime : 1625722418724 + * regionId : 110101 + * publish : 1 + * name : XX充电站19 + */ + + private String fid; + private long endDate; + private int updateUserid; + private int batchtaskId; + private int origin; + private String projectType; + private String memo; + private int sptype; + private int type; + private String geo; + private int isExclusive; + private double price; + private int classcode; + private int id; + private int locked; + private int createUserid; + private String address; + private int received; + private String telephone; + private long updateTime; + private int version; + private long createTime; + private int regionId; + private int publish; + private String name; + private List csTaskList; + + public String getFid() { + return fid; + } + + public void setFid(String fid) { + this.fid = fid; + } + + public long getEndDate() { + return endDate; + } + + public void setEndDate(long endDate) { + this.endDate = endDate; + } + + public int getUpdateUserid() { + return updateUserid; + } + + public void setUpdateUserid(int updateUserid) { + this.updateUserid = updateUserid; + } + + public int getBatchtaskId() { + return batchtaskId; + } + + public void setBatchtaskId(int batchtaskId) { + this.batchtaskId = batchtaskId; + } + + public int getOrigin() { + return origin; + } + + public void setOrigin(int origin) { + this.origin = origin; + } + + public String getProjectType() { + return projectType; + } + + public void setProjectType(String projectType) { + this.projectType = projectType; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public int getSptype() { + return sptype; + } + + public void setSptype(int sptype) { + this.sptype = sptype; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getGeo() { + return geo; + } + + public void setGeo(String geo) { + this.geo = geo; + } + + public int getIsExclusive() { + return isExclusive; + } + + public void setIsExclusive(int isExclusive) { + this.isExclusive = isExclusive; + } + + public double getPrice() { + return price; + } + + public void setPrice(double price) { + this.price = price; + } + + public int getClasscode() { + return classcode; + } + + public void setClasscode(int classcode) { + this.classcode = classcode; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getLocked() { + return locked; + } + + public void setLocked(int locked) { + this.locked = locked; + } + + public int getCreateUserid() { + return createUserid; + } + + public void setCreateUserid(int createUserid) { + this.createUserid = createUserid; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public int getReceived() { + return received; + } + + public void setReceived(int received) { + this.received = received; + } + + public String getTelephone() { + return telephone; + } + + public void setTelephone(String telephone) { + this.telephone = telephone; + } + + public long getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(long updateTime) { + this.updateTime = updateTime; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public long getCreateTime() { + return createTime; + } + + public void setCreateTime(long createTime) { + this.createTime = createTime; + } + + public int getRegionId() { + return regionId; + } + + public void setRegionId(int regionId) { + this.regionId = regionId; + } + + public int getPublish() { + return publish; + } + + public void setPublish(int publish) { + this.publish = publish; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getCsTaskList() { + return csTaskList; + } + + public void setCsTaskList(List csTaskList) { + this.csTaskList = csTaskList; + } + + public static class CsTaskListBean { + /** + * geo : 78XeZHM0UPEuIhFDihbAyDgeG0KtdNff7u3MHoPjIm4U9COTBeS3hw== + * address : xx路x号 + * price : 4.95 + * name : XX充电桩1 + * id : 25 + */ + + private String geo; + private String address; + private double price; + private String name; + private int id; + + public String getGeo() { + return geo; + } + + public void setGeo(String geo) { + this.geo = geo; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public double getPrice() { + return price; + } + + public void setPrice(double price) { + this.price = price; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + } + } + } +} diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/FilterFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/FilterFragment.java index ac901e3..0b6bae7 100644 --- a/app/src/main/java/com/navinfo/outdoor/fragment/FilterFragment.java +++ b/app/src/main/java/com/navinfo/outdoor/fragment/FilterFragment.java @@ -9,6 +9,7 @@ import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.TextView; +import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import androidx.constraintlayout.widget.ConstraintLayout; @@ -19,15 +20,26 @@ import com.jcodecraeer.xrecyclerview.ProgressStyle; import com.jcodecraeer.xrecyclerview.XRecyclerView; import com.kongzue.dialog.interfaces.OnMenuItemClickListener; import com.kongzue.dialog.v3.BottomMenu; +import com.lzy.okgo.model.HttpParams; import com.navinfo.outdoor.R; import com.navinfo.outdoor.adapter.FilterAdapter; import com.navinfo.outdoor.api.Constant; import com.navinfo.outdoor.base.BaseDrawerFragment; +import com.navinfo.outdoor.bean.BaseBean; +import com.navinfo.outdoor.bean.BolBean; +import com.navinfo.outdoor.bean.FilterBatchBean; import com.navinfo.outdoor.bean.JobSearchBean; +import com.navinfo.outdoor.bean.ReceivedBean; +import com.navinfo.outdoor.bean.ReceivedPoiBean; +import com.navinfo.outdoor.http.Callback; +import com.navinfo.outdoor.http.HttpInterface; +import com.navinfo.outdoor.http.OkGoBuilder; import com.navinfo.outdoor.room.ChargingPileEntity; +import com.navinfo.outdoor.room.InsertAndUpdateUtils; import com.navinfo.outdoor.room.PoiDao; import com.navinfo.outdoor.room.PoiDatabase; import com.navinfo.outdoor.room.PoiEntity; +import com.navinfo.outdoor.util.Geohash; import com.navinfo.outdoor.util.GeometryTools; import com.tencent.tencentmap.mapsdk.maps.model.LatLng; import com.vividsolutions.jts.geom.Geometry; @@ -37,6 +49,7 @@ import org.greenrobot.eventbus.Subscribe; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -48,9 +61,9 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi private TextView tvType, tvExclusive, tvPhotograph, tvNumber; private FilterAdapter filterAdapter; private ArrayList poiEntities; - private PoiDao poiDao; private ArrayList btnChock; - + private PoiDao poiDao; + private CheckBox checkOk; public static FilterFragment newInstance(Bundle bundle) { FilterFragment fragment = new FilterFragment(); @@ -63,7 +76,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi super.onHiddenChanged(hidden); if (!hidden) { setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT); - if (slidingPaneLayout!=null) { + if (slidingPaneLayout != null) { slidingPaneLayout.setScrollableView(recyclerFilter); } initHeader(); @@ -98,7 +111,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi if (!EventBus.getDefault().isRegistered(this)) {//加上判断 EventBus.getDefault().register(this); } - } @Override @@ -112,49 +124,13 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi return R.layout.fragment_filter; } - - @Override - protected void initView() { - super.initView(); - /* JobSearchBean jobSearchBean = (JobSearchBean) getArguments().getSerializable("body");//服务数据 - ArrayList showAllPoi = (ArrayList) getArguments().getSerializable("showAllPoi");//本地数据 - if (jobSearchBean != null) { - List 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); - } - } - if (showAllPoi != null) { - poiEntities.addAll(showAllPoi); - } - filterAdapter.setAllPoi(poiEntities);*/ - } - @Subscribe public void onEvent(@NotNull Message data) { if (data.what == Constant.JOB_SEARCH_POI_WORD) { List allPoi = (List) data.obj; if (allPoi != null) { for (int i = 0; i < allPoi.size(); i++) { - if (allPoi.get(i).getTaskStatus()==0|| allPoi.get(i).getTaskStatus()==1){ + if (allPoi.get(i).getTaskStatus() == 0 || allPoi.get(i).getTaskStatus() == 1) { poiEntities.add(allPoi.get(i)); } } @@ -169,9 +145,9 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi 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.setTelPhone(list.get(i).getTelephone() + ""); + poiEntity.setPrecision(list.get(i).getPrice() + ""); + poiEntity.setDist(list.get(i).getDist() + ""); poiEntity.setType(list.get(i).getType()); String geo = list.get(i).getGeo(); poiEntity.setGeoWkt(geo); @@ -197,8 +173,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi } else if (data.what == Constant.FILTER_DATA_CLEAR) { poiEntities.clear(); } - - Log.d("ssssssssssssss", "onEvent: "+"sssssssssssssssssssssssssssss"); } @SuppressLint("SetTextI18n") @@ -208,13 +182,12 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext()); poiDao = poiDatabase.getPoiDao(); poiEntities = new ArrayList<>(); + btnChock = new ArrayList<>();//存储选择中的的数据 ConstraintLayout clNumber = findViewById(R.id.cl_number); clNumber.setOnClickListener(this); tvNumber = findViewById(R.id.tv_number); tvNumber.setText(Constant.NUMBER + ""); - CheckBox checkOk = findViewById(R.id.check_ok); - Button btnDraw = findViewById(R.id.btn_draw); - btnDraw.setOnClickListener(this); + checkOk = findViewById(R.id.check_ok); ConstraintLayout clPhotograph = findViewById(R.id.cl_photograph); clPhotograph.setOnClickListener(this); tvPhotograph = findViewById(R.id.tv_photograph); @@ -260,9 +233,11 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi }*/ Button btnFilter = findViewById(R.id.btn_filter); btnFilter.setOnClickListener(this); + Button btnDraw = findViewById(R.id.btn_draw); + btnDraw.setOnClickListener(this); setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT); recyclerFilter = findViewById(R.id.recycler_filter); - if (slidingPaneLayout!=null) { + if (slidingPaneLayout != null) { slidingPaneLayout.setScrollableView(recyclerFilter); } //设置下划线 @@ -277,7 +252,9 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi recyclerFilter.setAdapter(filterAdapter); recyclerFilter.setScrollAlphaChangeListener(new XRecyclerView.ScrollAlphaChangeListener() { @Override - public void onAlphaChange(int alpha) { } + public void onAlphaChange(int alpha) { + } + @Override public int setLimitHeight() { return 0; @@ -286,15 +263,20 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi recyclerFilter.getDefaultFootView().setNoMoreHint("成功加载完毕"); recyclerFilter.setLoadingListener(new XRecyclerView.LoadingListener() { @Override - public void onRefresh() {} + public void onRefresh() { + } + @Override - public void onLoadMore() {} + public void onLoadMore() { + } + }); checkOk.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - filterAdapter.setAddFilter(true); - filterAdapter.notifyDataSetChanged(); + filterAdapter.setAddFilter(isChecked); + filterAdapter.notifyDataSetChanged(); + btnChock.clear(); } }); filterAdapter.setItemCLick(new FilterAdapter.ItemCLick() { @@ -307,15 +289,15 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi EventBus.getDefault().post(obtains); } }); - btnChock = new ArrayList<>();//存储选择中的的数据 + filterAdapter.setItemOnCLick(new FilterAdapter.ItemOnCLick() { @Override public void item(PoiEntity poiEntity, boolean isChockBox) { - if (isChockBox){ + if (isChockBox) { btnChock.add(poiEntity); - }else { + } else { for (int i = 0; i < btnChock.size(); i++) { - if (poiEntity.getId().equals(btnChock.get(i).getId())){ + if (poiEntity.getId().equals(btnChock.get(i).getId())) { btnChock.remove(poiEntity); } } @@ -327,6 +309,20 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi @Override public void onClick(View v) { switch (v.getId()) { + case R.id.btn_draw: + if (btnChock==null){ + return; + } + StringBuilder a = new StringBuilder(); + for (int i = 0; i < btnChock.size(); i++) { + if (i == btnChock.size() - 1) { + a.append(btnChock.get(i).getTaskId()); + } else { + a.append(btnChock.get(i).getTaskId()).append(","); + } + } + initBatch(a.toString()); + break; case R.id.btn_filter: Message obtain = Message.obtain(); obtain.what = Constant.TREASURE_FRAGMENT; @@ -459,6 +455,182 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi } } + /** + * 批量领取 + * @param taskId + */ + private void initBatch(String taskId) { + HttpParams httpParams = new HttpParams(); + httpParams.put("taskIds", taskId); + showLoadingDialog(); + OkGoBuilder.getInstance() + .Builder(getActivity()) + .token(Constant.ACCESS_TOKEN) + .params(httpParams) + .cls(FilterBatchBean.class) + .url(HttpInterface.RECEIVE_TASK) + .getRequest(new Callback() { + @Override + public void onSuccess(FilterBatchBean response, int id) { + dismissLoadingDialog(); + List success = response.getBody().getSuccess(); + for (int i = 0; i < success.size(); i++) { + initType(success.get(i)); + } + filterAdapter.setAddFilter(false); + filterAdapter.notifyDataSetChanged(); + btnChock.clear(); + checkOk.setChecked(false); + Message obtain = Message.obtain(); + obtain.what = Constant.JOB_WORD_MONITOR; + obtain.obj = true; + EventBus.getDefault().post(obtain); + Toast.makeText(getContext(), "领取成功", Toast.LENGTH_SHORT).show(); + } + @Override + public void onError(Throwable e, int id) { + dismissLoadingDialog(); + + } + }); + + } + + /** + * 通过不同类型的type 进行批量领取 + * @param successBean + */ + private void initType(FilterBatchBean.BodyBean.SuccessBean successBean) { + switch (successBean.getType()) { + case 2://充电站 + new Thread(new Runnable() { + @Override + public void run() { + PoiEntity chargingStationEntity = new PoiEntity(); + chargingStationEntity.setTaskId(successBean.getId()); + chargingStationEntity.setStation_type(successBean.getSptype()); + chargingStationEntity.setName(successBean.getName()); + chargingStationEntity.setDescribe(successBean.getMemo()); + chargingStationEntity.setCreateTime(String.valueOf(successBean.getEndDate())); + chargingStationEntity.setPrecision(String.valueOf(successBean.getPrice())); + chargingStationEntity.setAddress(successBean.getAddress()); + if(successBean.getTelephone()==null||successBean.getTelephone().equals("")||successBean.getTelephone().equals("null")){ + chargingStationEntity.setTelPhone(null); + }else { + chargingStationEntity.setTelPhone(successBean.getTelephone()); + } + chargingStationEntity.setType(successBean.getType()); + chargingStationEntity.setTaskStatus(1); + String encodeStr = successBean.getGeo(); + String geo = Geohash.getInstance().decode(encodeStr); + chargingStationEntity.setGeoWkt(geo); + Geometry geometry = GeometryTools.createGeometry(geo); + switch (geometry.getGeometryType()) { + case "Point": //点 + LatLng latLng = GeometryTools.createLatLng(geo); + chargingStationEntity.setX(latLng.longitude + ""); + chargingStationEntity.setY(latLng.latitude + ""); + break; + case "LineString": //线 + case "Polygon": //面 + List latLineString = GeometryTools.getLatLags(geo); + assert latLineString != null; + chargingStationEntity.setX(latLineString.get(0).longitude + ""); + chargingStationEntity.setY(latLineString.get(0).latitude + ""); + break; + } + //充电桩 + List csTaskList = successBean.getCsTaskList(); + if (csTaskList != null && !csTaskList.isEmpty()) { + ChargingPileEntity[] chargingPileEntityList = new ChargingPileEntity[csTaskList.size()]; + for (int i = 0; i < csTaskList.size(); i++) { + ChargingPileEntity chargingPileEntity = new ChargingPileEntity(); + chargingPileEntity.setFid(chargingStationEntity.getId()); + chargingPileEntity.setName(csTaskList.get(i).getName()); + chargingPileEntity.setMemo(csTaskList.get(i).getAddress()); + chargingPileEntity.setP(csTaskList.get(i).getGeo()); + chargingPileEntityList[i] = chargingPileEntity; + } + InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getActivity(), chargingPileEntityList); + } + InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), chargingStationEntity); + + } + }).start(); + break; + case 1://poi + case 3://poi录像 + case 4://道路 + case 5://其他 + new Thread(new Runnable() { + @Override + public void run() { + PoiEntity poiListEntity = new PoiEntity(); + poiListEntity.setTaskId(successBean.getId()); + poiListEntity.setName(successBean.getName()); + poiListEntity.setDescribe(successBean.getMemo()); + poiListEntity.setCreateTime(successBean.getEndDate()+""); + poiListEntity.setAddress(successBean.getAddress()); + poiListEntity.setType(successBean.getType()); + poiListEntity.setPrecision(String.valueOf(successBean.getPrice())); + poiListEntity.setIsExclusive(successBean.getIsExclusive()); + poiListEntity.setTaskStatus(1); + String encodeStr = successBean.getGeo(); + String geo = Geohash.getInstance().decode(encodeStr); + poiListEntity.setGeoWkt(geo); + Geometry geometry = GeometryTools.createGeometry(geo); + switch (geometry.getGeometryType()) { + case "Point": //点 + LatLng latLng = GeometryTools.createLatLng(geo); + poiListEntity.setX(latLng.longitude + ""); + poiListEntity.setY(latLng.latitude + ""); + break; + case "LineString": //线 + case "Polygon": //面 + List latLineString = GeometryTools.getLatLags(geo); + assert latLineString != null; + poiListEntity.setX(latLineString.get(0).longitude + ""); + poiListEntity.setY(latLineString.get(0).latitude + ""); + break; + } + InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity); + } + }).start(); + break; + case 6://面 + new Thread(new Runnable() { + @Override + public void run() { + PoiEntity polygonEntity = new PoiEntity(); + polygonEntity.setTaskId(successBean.getId()); + polygonEntity.setName(successBean.getName()); + polygonEntity.setType(successBean.getType()); + polygonEntity.setTaskStatus(1); + String encodeStr = successBean.getGeo(); + String geo = Geohash.getInstance().decode(encodeStr); + polygonEntity.setGeoWkt(geo); + Geometry geometry = GeometryTools.createGeometry(geo); + switch (geometry.getGeometryType()) { + case "Point": //点 + LatLng latLng = GeometryTools.createLatLng(geo); + polygonEntity.setX(latLng.longitude + ""); + polygonEntity.setY(latLng.latitude + ""); + break; + case "LineString": //线 + case "Polygon": //面 + List latLineString = GeometryTools.getLatLags(geo); + assert latLineString != null; + polygonEntity.setX(latLineString.get(0).longitude + ""); + polygonEntity.setY(latLineString.get(0).latitude + ""); + break; + } + InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), polygonEntity); + } + }).start(); + break; + } + } + @Override public void onDestroy() { if (EventBus.getDefault().isRegistered(this))//加上判断 diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/TreasureFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/TreasureFragment.java index 80efab5..7bbafa0 100644 --- a/app/src/main/java/com/navinfo/outdoor/fragment/TreasureFragment.java +++ b/app/src/main/java/com/navinfo/outdoor/fragment/TreasureFragment.java @@ -164,7 +164,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen private int messageType = 0;//0: 已读消息 1:新消息 private SharedPreferences.Editor sharedEdit; private SharedPreferences sharedPreferences; - private int getMessageType; public static TreasureFragment newInstance(Bundle bundle) { @@ -184,10 +183,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen private void refreshFilterData() { String dataTime = sharedPreferences.getString("dataTime", null); - getMessageType = sharedPreferences.getInt("type", 0); + int type = sharedPreferences.getInt("type", 0); - - if (getMessageType == 0) {//隐藏 + if (type == 0) {//隐藏 ivMassNotification.setVisibility(View.GONE); } else {//显示S ivMassNotification.setVisibility(View.VISIBLE); @@ -200,12 +198,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); String presentData = formatter.format(calendar.getTime());//当前时间 - int result = presentData.compareTo(newData);//当前时间和请求时间进行比较 + int result = presentData.compareTo(newData); if (result>=0){ //进行请求 initMessageNotice(); }else { //无需请求 + } } @@ -406,7 +405,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen int[] widthHeight = DensityUtil.getDeviceInfo(getActivity()); treasureMap.getLayoutParams().width = widthHeight[0]; treasureMap.getLayoutParams().height = widthHeight[1]; - } /** @@ -551,7 +549,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen } else { ivSubmit.setEnabled(false); } - Log.d("TAG", "onSuccess: " + response.getBody().toString() + "sassafras's"); + Log.d("TAG", "onSuccess: " + response.getBody().toString()); for (int i = 0; i < removables.size(); i++) { removables.get(i).remove(); } @@ -567,10 +565,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen Geometry geometry = GeometryTools.createGeometry(geo); LatLng latLng = null; switch (geometry.getGeometryType()) { - case "Point": //点 - latLng = GeometryTools.createLatLng(geo); - break; case "LineString": //线 + case "MultiLineString"://多线 BitmapDescriptor bitmapLine = null; if (listBean.getType() == 3) {//poi录像 bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows); @@ -586,7 +582,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen // 折线的颜色为绿色 .color(Color.parseColor("#0096FF")) // 折线宽度为5像素 - .width(15) + .width(10) // 还可以添加描边颜色 //.borderColor(0xffff0000) // 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth` @@ -594,7 +590,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen .arrow(true) .arrowSpacing(100) .arrowTexture(bitmapLine); - // 绘制折线 Polyline polyline = tencentMap.addPolyline(polylineOptions); polyline.setZIndex(MARKER_LINE); @@ -602,6 +597,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen if (latLineString != null && latLineString.size() > 0) { latLng = latLineString.get(0); } + + break; + case "Point": //点 + latLng = GeometryTools.createLatLng(geo); break; case "Polygon": //面 List latPolygon = GeometryTools.getLatLags(geo); @@ -773,6 +772,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen latLng = GeometryTools.createLatLng(geo); break; case "LineString": //线 + case "MultiLineString"://多线 BitmapDescriptor bitmapLine = null; if (poiEntity.getType() == 3) {//poi录像 bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows); @@ -897,6 +897,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen latLng = GeometryTools.createLatLng(geo); break; case "LineString": //线 + case "MultiLineString"://多线 BitmapDescriptor bitmapLine = null; if (type == 3) {//poi录像 bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows); @@ -1414,14 +1415,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen @Override public void onResume() { super.onResume(); - ivMessage.setVisibility(View.VISIBLE); treasureMap.onResume(); } @Override public void onPause() { super.onPause(); - ivMessage.setVisibility(View.GONE); treasureMap.onPause(); } @@ -1479,7 +1478,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen Toast.makeText(getActivity(), "网络请求失败", Toast.LENGTH_SHORT).show(); return; } - //分享 CharSequence title = "请选择上报类型"; // 如果当前fragment是筛选,则移除该fragment @@ -1555,16 +1553,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen refreshFilterData(); break; case R.id.iv_message: - if (getMessageType ==1){//判断获取sp里面的type是否是1 - messageType =0; - ivMassNotification.setVisibility(View.GONE); - - }else { - return; - } Intent messageIntent = new Intent(getContext(), FragmentManagement.class); messageIntent.putExtra("tag", 35); startActivity(messageIntent); + ivMassNotification.setVisibility(View.GONE); + sharedEdit.putInt("type", 0); + sharedEdit.commit(); break; } } @@ -1671,10 +1665,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen ArrayList lngArrayList = new ArrayList<>();//存储的是内部的屏幕点坐标 Projection projection = tencentMap.getProjection(); android.graphics.Point point = projection.toScreenLocation(latLng);//转换为屏幕坐标 - int minX = point.x - 200; - int minY = point.y - 200; - int maxX = point.x + 200; - int maxY = point.y + 200; + int minX = point.x - 40; + int minY = point.y - 40; + int maxX = point.x + 40; + int maxY = point.y + 40; point.set(minX, minY); lngArrayList.add(new LatLng(projection.fromScreenLocation(point))); point.set(maxX, minY); diff --git a/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java b/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java index 845f912..3a75e25 100644 --- a/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java +++ b/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java @@ -3,14 +3,13 @@ package com.navinfo.outdoor.http; import com.navinfo.outdoor.api.Constant; public class HttpInterface { - public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口 + public static final String IP_TEST = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口 public static final String DATA_IP = "http://172.23.139.4:9999/m4";//接口 - public static final String IP_TEST = "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口 + public static final String IP = "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口 public static final String TEST_GUIDANCE_IP = "http://172.21.98.90:9999/m4";//引导页完成接口 public static final String APKIP = "http://172.23.139.4:8001/"; - public static final String USER_PATH = "/user/";//我的 public static final String MSG_LIST_PATH = "/msgList/";//发现 public static final String USER_LOGIN_PATH = "/userlogin/";//登录 @@ -21,10 +20,10 @@ public class HttpInterface { */ //dtxbmaps.navinfo.com/dtxb/m4/user/appVersion/checkVersion?version=155&operationType=android //172.23.139.4:8001/appVersion/checkVersion?version=155&operationType=android version是版本 operationType固定值 安卓 get - public static String APP_CHECK_VERSION ; //版本升级 + public static String APP_CHECK_VERSION; //版本升级 public static void initAppPath(String userId) { - APP_CHECK_VERSION = IP + USER_PATH + "appVersion/"+userId+"/checkVersion"; //版本升级 + APP_CHECK_VERSION = IP + USER_PATH + "appVersion/" + userId + "/checkVersion"; //版本升级 } @@ -88,6 +87,8 @@ public class HttpInterface { * 任务 * Path=/m4/task/** */ + ///m4/task/task/10/receiveTasks 参数:taskIds + public static String RECEIVE_TASK;//批量领取 //172.23.139.4:8003/m4/task/1/getList public static String TASK_LIST; //任务搜索 //172.23.139.4:8003/othertask/1/receivedOthertask @@ -170,7 +171,7 @@ public class HttpInterface { EXAM_CONTENT = IP + MSG_LIST_PATH + "findAndMessage/" + USERID + "/exam_content";//发现 -能力测评获取试题接口 //http://172.23.139.4:8002/findAndMessage/1/submitExam EXAM_SUBMIT = IP + MSG_LIST_PATH + "findAndMessage/" + USERID + "/submitExam";//发现 -能力测评提交试卷 post - MESSAGE_INFO_PUSH = IP+MSG_LIST_PATH+"InfoPush/"+USERID+"/push";//寻宝-消息通知 + MESSAGE_INFO_PUSH = IP + MSG_LIST_PATH + "InfoPush/" + USERID + "/push";//寻宝-消息通知 /** * 提现 金额 * Path=/m4/price/** @@ -185,6 +186,8 @@ public class HttpInterface { * 任务 *Path=/m4/task/** */ + ///m4/task/task/10/receiveTasks 参数:taskIds + RECEIVE_TASK=IP +TASK_PATH+"task/"+USERID+"/receiveTasks";//批量领取 //172.23.139.4:8003/m4/task/1/getList TASK_LIST = IP + TASK_PATH + "task/" + USERID + "/getList"; //任务搜索 //172.23.139.4:8003/othertask/1/receivedOthertask diff --git a/app/src/main/res/layout/fragment_filter.xml b/app/src/main/res/layout/fragment_filter.xml index 6476535..6f86956 100644 --- a/app/src/main/res/layout/fragment_filter.xml +++ b/app/src/main/res/layout/fragment_filter.xml @@ -14,7 +14,7 @@ @@ -66,7 +66,7 @@ style="@style/text_style" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="18dp" + android:layout_marginTop="12dp" android:layout_marginBottom="5dp" android:text="任务类型" app:layout_constraintBottom_toTopOf="@+id/tv_exclusive" @@ -79,7 +79,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="10dp" - android:layout_marginBottom="20dp" + android:layout_marginBottom="15dp" android:text="全部" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" /> @@ -99,7 +99,7 @@ @@ -152,7 +152,7 @@ style="@style/text_style" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="18dp" + android:layout_marginTop="12dp" android:layout_marginBottom="5dp" android:text="任务个数" app:layout_constraintBottom_toTopOf="@+id/tv_number" @@ -165,7 +165,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="10dp" - android:layout_marginBottom="20dp" + android:layout_marginBottom="15dp" android:text="200" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" /> @@ -179,10 +179,43 @@ app:layout_constraintTop_toTopOf="parent" /> + + + + + + +