定时推送逻辑。批量领取的页面显示

This commit is contained in:
wangdongsheng 2021-09-07 19:07:30 +08:00
parent 4911f5df93
commit 1cc7e45c9a
12 changed files with 347 additions and 240 deletions

View File

@ -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"
@ -11,7 +11,6 @@ android {
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {

View File

@ -311,8 +311,7 @@ public class MainActivity extends BaseActivity {
fileOutputStream.flush();
fileOutputStream.close();
}
//apk下载完成使用Handler()通知安装apk
handler.sendEmptyMessage(0);
handler.sendEmptyMessage(0);//apk下载完成使用Handler()通知安装apk
}
} catch (Exception e) {
e.printStackTrace();

View File

@ -225,7 +225,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
} else {
message.what = 0x101;
Toast.makeText(PicturesActivity.this, "保存成功" + (videoIndex+1), Toast.LENGTH_SHORT).show();
handler.sendMessageDelayed(message, 2000);
handler.sendMessageDelayed(message, 1500);
}
}
}

View File

@ -6,9 +6,12 @@ import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;
import com.navinfo.outdoor.R;
@ -25,13 +28,23 @@ import java.util.List;
*/
public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder> {
private Context context;
private List<PoiEntity> allPoi;
private List<PoiEntity> allPoi=new ArrayList<>();
public FilterAdapter(Context context, List<PoiEntity> allPoi) {
public FilterAdapter(Context context) {
this.context = context;
this.allPoi = allPoi;
}
public void setAllPoi(List<PoiEntity> allPoi) {
this.allPoi.clear();
this.allPoi.addAll(allPoi);
notifyDataSetChanged();
}
public void setAddFilter(boolean addFilter) {
for (int i = 0; i < allPoi.size(); i++) {
allPoi.get(i).setChecked(addFilter);
}
}
@NonNull
@Override
@ -44,13 +57,13 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
PoiEntity poiEntity = allPoi.get(position);
holder.tvName.setText(poiEntity.getName());
if (poiEntity.getTaskId() != 0) {
holder.tvTaskId.setText("任务id:" + poiEntity.getTaskId());
} else {
holder.tvTaskId.setText("任务id:" + 0);
}
if (poiEntity.getPrecision() != null) {
holder.tvMoney.setText("" + format2(Double.parseDouble(poiEntity.getPrecision())));
} else {
@ -61,19 +74,31 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
} else {
holder.tvDistance.setText("距离:" + 0);
}
//0.未领取 1.已领取2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功)4已上传结束采集,
if (poiEntity.getTaskStatus() == 0) {//"未领取", "已领取", "未保存", "已保存"
holder.tvTaskStatus.setVisibility(View.GONE);
holder.tvTaskStatus.setText("未领取");
holder.cbFilter.setEnabled(true);
} else if (poiEntity.getTaskStatus() == 1) {
holder.tvTaskStatus.setVisibility(View.VISIBLE);
holder.tvTaskStatus.setText("已领取");
holder.cbFilter.setEnabled(false);
holder.tvTaskStatus.setTextColor(Color.parseColor("#FFC107"));
} else if (poiEntity.getTaskStatus() == 2) {
holder.tvTaskStatus.setVisibility(View.VISIBLE);
holder.tvTaskStatus.setText("未保存");
holder.cbFilter.setEnabled(false);
holder.tvTaskStatus.setTextColor(Color.parseColor("#1CEF7B"));
}/*else if (poiEntity.getTaskStatus()==3){
}
holder.cbFilter.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (itemOnCLick != null) {
itemOnCLick.item(poiEntity,isChecked);
}
}
});
/*else if (poiEntity.getTaskStatus()==3){
holder.tvTaskStatus.setVisibility(View.VISIBLE);
holder.tvTaskStatus.setText("已保存");
holder.tvTaskStatus.setTextColor(Color.parseColor("#00BCD4"));
@ -81,6 +106,16 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
holder.tvTaskStatus.setVisibility(View.VISIBLE);
holder.tvTaskStatus.setText("已上传");
}*/
if (poiEntity.isChecked()) {
holder.cbFilter.setVisibility(View.VISIBLE);
holder.constraintLayout.setEnabled(false);
} else {
holder.cbFilter.setVisibility(View.GONE);
holder.constraintLayout.setEnabled(true);
}
if (poiEntity.getType() == 1) {
holder.tvForm.setText("poi");
} else if (poiEntity.getType() == 2) {
@ -94,7 +129,7 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
} else if (poiEntity.getType() == 6) {
holder.tvForm.setText("面状任务");
}
holder.itemView.setOnClickListener(new View.OnClickListener() {
holder.constraintLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (itemCLick != null) {
@ -103,7 +138,6 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
}
});
}
@Override
@ -113,20 +147,24 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
public static class ViewHolder extends RecyclerView.ViewHolder {
TextView tvName, tvForm, tvTaskId, tvMoney, tvDistance, tvTaskStatus;
CheckBox cbFilter;
ConstraintLayout constraintLayout;
public ViewHolder(@NonNull View itemView) {
super(itemView);
constraintLayout=itemView.findViewById(R.id.constraintLayout);
tvName = itemView.findViewById(R.id.tv_name);
tvForm = itemView.findViewById(R.id.tv_form);
tvTaskId = itemView.findViewById(R.id.tv_task_id);
tvMoney = itemView.findViewById(R.id.tv_money);
tvDistance = itemView.findViewById(R.id.tv_distance);
tvTaskStatus = itemView.findViewById(R.id.tv_task_status);
cbFilter = itemView.findViewById(R.id.cb_filter);
}
}
ItemCLick itemCLick;
ItemCLick itemCLick;
public void setItemCLick(ItemCLick itemCLick) {
this.itemCLick = itemCLick;
}
@ -135,6 +173,16 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
void item(PoiEntity poiEntity);
}
ItemOnCLick itemOnCLick;
public void setItemOnCLick(ItemOnCLick itemOnCLick) {
this.itemOnCLick = itemOnCLick;
}
public interface ItemOnCLick {
void item(PoiEntity poiEntity,boolean view);
}
/**
* 保存小数点后两位
*/
@ -147,25 +195,16 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
public static String format3(double value) {
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(2);
/*setMinimumFractionDigits设置成2
* 如果不这么做那么当value的值是100.00的时候返回100
* 而不是100.00
*/
/*setMinimumFractionDigits设置成2
* 如果不这么做那么当value的值是100.00的时候返回100
* 而不是100.00
*/
nf.setMinimumFractionDigits(2);
nf.setRoundingMode(RoundingMode.HALF_UP);
/*
如果想输出的格式用逗号隔开可以设置成true
*/
/*
如果想输出的格式用逗号隔开可以设置成true
*/
nf.setGroupingUsed(false);
return nf.format(value);

View File

@ -43,6 +43,7 @@ public class Constant {
public static String VIDEOS_;
public static String POI_DAO;
public static String SHARED_PREFERENCES = "navInfo";
public static String MESSAGE_TYPE="messageType";
public static String DATA_FILE = "dataFile";
//下载文件
public static final String NABISCO_APk = ROOT_FOLDER + "/apk/";

View File

@ -1,10 +1,13 @@
package com.navinfo.outdoor.fragment;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
@ -45,6 +48,8 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
private TextView tvType, tvExclusive, tvPhotograph, tvNumber;
private FilterAdapter filterAdapter;
private ArrayList<PoiEntity> poiEntities;
private PoiDao poiDao;
private ArrayList<PoiEntity> btnChock;
public static FilterFragment newInstance(Bundle bundle) {
@ -84,7 +89,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
}
onBackPressed();
}
});
}
@ -154,8 +158,8 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
poiEntities.add(allPoi.get(i));
}
}
}
filterAdapter.setAllPoi(poiEntities);
} else if (data.what == Constant.JOB_SEARCH_WORD) {
JobSearchBean jobSearchBean = (JobSearchBean) data.obj;
if (jobSearchBean != null) {
@ -165,47 +169,52 @@ 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.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);
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {//
LatLng latLng = GeometryTools.createLatLng(geo);
poiEntity.setX(latLng.longitude + "");
poiEntity.setY(latLng.latitude + "");
} else if (geometry.getGeometryType().equals("LineString")) {//线
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
assert latLineString != null;
poiEntity.setX(latLineString.get(0).longitude + "");
poiEntity.setY(latLineString.get(0).latitude + "");
} else if (geometry.getGeometryType().equals("Polygon")) {//
List<LatLng> latPolygon = GeometryTools.getLatLags(geo);
assert latPolygon != null;
poiEntity.setX(latPolygon.get(0).longitude + "");
poiEntity.setY(latPolygon.get(0).latitude + "");
switch (geometry.getGeometryType()) {
case "Point": //
LatLng latLng = GeometryTools.createLatLng(geo);
poiEntity.setX(latLng.longitude + "");
poiEntity.setY(latLng.latitude + "");
break;
case "LineString": //线
case "Polygon": //
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
assert latLineString != null;
poiEntity.setX(latLineString.get(0).longitude + "");
poiEntity.setY(latLineString.get(0).latitude + "");
break;
}
poiEntities.add(poiEntity);
}
}
filterAdapter.setAllPoi(poiEntities);
} else if (data.what == Constant.FILTER_DATA_CLEAR) {
poiEntities.clear();
}
filterAdapter.notifyDataSetChanged();
Log.d("ssssssssssssss", "onEvent: "+"sssssssssssssssssssssssssssss");
}
@SuppressLint("SetTextI18n")
@Override
protected void initData() {
super.initData();
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
PoiDao poiDao = poiDatabase.getPoiDao();
poiDao = poiDatabase.getPoiDao();
poiEntities = 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);
ConstraintLayout clPhotograph = findViewById(R.id.cl_photograph);
clPhotograph.setOnClickListener(this);
tvPhotograph = findViewById(R.id.tv_photograph);
@ -243,12 +252,12 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
tvType.setText("未领取");
} else if (Constant.TASK_STARTUP == 1) {
tvType.setText("已领取");
}/* else if (Constant.TASK_STATUS == 2) {
}
/* else if (Constant.TASK_STATUS == 2) {
tvType.setText("未保存");
} else if (Constant.TASK_STATUS == 3) {
tvType.setText("已保存");
}*/
Button btnFilter = findViewById(R.id.btn_filter);
btnFilter.setOnClickListener(this);
setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT);
@ -261,11 +270,10 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
recyclerFilter.addItemDecoration(new DividerItemDecoration(Objects.requireNonNull(getContext()), DividerItemDecoration.VERTICAL));
recyclerFilter.setRefreshProgressStyle(ProgressStyle.SemiCircleSpin);
recyclerFilter.setLoadingMoreProgressStyle(ProgressStyle.BallRotate);
//取消上啦加载下拉刷新
recyclerFilter.setPullRefreshEnabled(false);
recyclerFilter.setLoadingMoreEnabled(false);
filterAdapter = new FilterAdapter(getContext(), poiEntities);
filterAdapter = new FilterAdapter(getContext());
recyclerFilter.setAdapter(filterAdapter);
recyclerFilter.setScrollAlphaChangeListener(new XRecyclerView.ScrollAlphaChangeListener() {
@Override
@ -275,33 +283,47 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
return 0;
}
});
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.setItemCLick(new FilterAdapter.ItemCLick() {
@Override
public void item(PoiEntity poiEntity) {
//查看详情
Message obtains = Message.obtain();
obtains.what = Constant.FILTER_LIST_ITEM;
obtains.obj = poiEntity;
EventBus.getDefault().post(obtains);
}
});
btnChock = new ArrayList<>();//存储选择中的的数据
filterAdapter.setItemOnCLick(new FilterAdapter.ItemOnCLick() {
@Override
public void item(PoiEntity poiEntity, boolean isChockBox) {
if (isChockBox){
btnChock.add(poiEntity);
}else {
for (int i = 0; i < btnChock.size(); i++) {
if (poiEntity.getId().equals(btnChock.get(i).getId())){
btnChock.remove(poiEntity);
}
}
}
}
});
}
@Override
public void onClick(View v) {
switch (v.getId()) {
@ -339,7 +361,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
}
});
break;
case R.id.cl_photograph:
BottomMenu.show((AppCompatActivity) Objects.requireNonNull(getContext()), new String[]{"全部", "普通任务", "专属任务"}, new OnMenuItemClickListener() {
@Override
@ -363,8 +384,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
}
});
break;
/*
1 "POI"
2 "充电站"
@ -400,7 +419,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
case 6:
Constant.TASK_TYPE = 6;
break;
}
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
@ -409,7 +427,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
}
});
break;
case R.id.cl_type://任务状态 0.未领取 1.已领取2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功)4已上传结束采集,
BottomMenu.show((AppCompatActivity) Objects.requireNonNull(getContext()), new String[]{"全部", "未领取", "已领取"/*, "未保存", "已保存"*/}, new OnMenuItemClickListener() {
@Override
@ -439,7 +456,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
}
});
break;
}
}
@ -454,6 +470,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
protected PoiEntity initPoiEntityByUI(PoiEntity entity) {
return null;
}
@Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
return null;

View File

@ -309,11 +309,13 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
public void run() {
roadEntities.clear();
roadEntities.addAll(roadAll);
// for (int i = 0; i < roadAll.size(); i++) {
// if (roadAll.get(i).getType()!=6){
// roadEntities.add(roadAll.get(i));
// }
// }
Log.d("TAG", "run: " + roadEntities.toString());
staySubmitAdapter.setAllRoad(roadEntities);
staySubmitAdapter.notifyDataSetChanged();

View File

@ -1,5 +1,6 @@
package com.navinfo.outdoor.fragment;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@ -161,6 +162,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
private ArrayList<PoiEntity> poiEntityArrayList;
private ImageView ivMassNotification;
private int messageType = 0;//0: 已读消息 1新消息
private SharedPreferences.Editor sharedEdit;
private SharedPreferences sharedPreferences;
public static TreasureFragment newInstance(Bundle bundle) {
@ -178,30 +181,34 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
* 刷新筛选界面数据
*/
private void refreshFilterData() {
//获取系统当前的时间
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
String format = formatter.format(calendar.getTime());
SharedPreferences messageTypeSp = getActivity().getSharedPreferences("messageType", Context.MODE_PRIVATE);
String dataTime = messageTypeSp.getString("dataTime", null);
int messageTypeSpInt = messageTypeSp.getInt("messageType", 0);
try {
Date parse = formatter.parse(format);
if (dataTime!=null){
Date parse1 = formatter.parse(dataTime);
if (parse.getTime() + parse1.getTime() >= 1) {
// initMessageNotice();
Log.d("TAG", "refreshFilterData: " + parse + "" + parse1);
} else {
return;
}
String dataTime = sharedPreferences.getString("dataTime", null);
int type = sharedPreferences.getInt("type", 0);
if (type == 0) {//隐藏
ivMassNotification.setVisibility(View.GONE);
} else {//显示S
ivMassNotification.setVisibility(View.VISIBLE);
}
if (dataTime == null) {
initMessageNotice();
} else {
String newData = addDateMinot(dataTime, 3);//是否三个小时之后
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
String presentData = formatter.format(calendar.getTime());//当前时间
int result = presentData.compareTo(newData);
if (result>=0){
//进行请求
initMessageNotice();
}else {
//无需请求
}
} catch (ParseException e) {
e.printStackTrace();
}
Message msg = Message.obtain();
msg.what = Constant.FILTER_DATA_CLEAR;
EventBus.getDefault().post(msg);
@ -272,10 +279,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
String format = formatter.format(calendar.getTime());
SharedPreferences.Editor spMessageType = getActivity().getSharedPreferences("messageType", getActivity().MODE_PRIVATE).edit();
spMessageType.putInt("messageType", messageType);
spMessageType.putString("dataTime", format);
spMessageType.commit();
Log.d("TAG", "onSuccessssss: " + format);
sharedEdit.putInt("type", messageType);
sharedEdit.putString("dataTime", format);
sharedEdit.commit();
} else {
Toast.makeText(getActivity(), messageNoticeBean.getMessage() + "", Toast.LENGTH_SHORT).show();
}
@ -290,10 +297,14 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
@SuppressLint("CommitPrefEdits")
@Override
protected void initView() {
super.initView();
EventBus.getDefault().register(this);
sharedPreferences = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
sharedEdit = sharedPreferences.edit();
//fragment 管理器
supportFragmentManager = Objects.requireNonNull(getActivity()).getSupportFragmentManager();
@ -622,8 +633,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
poiMarker.setZIndex(MARKER_DOT);
poiMarker.setTag(listBean);
removables.add(poiMarker);
/*String poiGeo = initGeo(latLng);
geoMarker(poiGeo, poiMarker);*/
String poiGeo = initGeo(latLng);
geoMarker(poiGeo, poiMarker);
poiMarker.setClickable(true);
break;
case 2://充电站
@ -636,8 +647,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
stationMarker.setZIndex(MARKER_DOT);
stationMarker.setTag(listBean);
removables.add(stationMarker);
/* String stationGeo = initGeo(latLng);
geoMarker(stationGeo, stationMarker);*/
String stationGeo = initGeo(latLng);
geoMarker(stationGeo, stationMarker);
stationMarker.setClickable(true);
break;
@ -651,8 +662,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
poiVideoMarker.setTag(listBean);
poiVideoMarker.setZIndex(MARKER_DOT);
removables.add(poiVideoMarker);
/* String poiVideoGeo = initGeo(latLng);
geoMarker(poiVideoGeo, poiVideoMarker);*/
String poiVideoGeo = initGeo(latLng);
geoMarker(poiVideoGeo, poiVideoMarker);
poiVideoMarker.setClickable(true);
break;
case 4://道路录像
@ -665,8 +676,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
roadMarker.setZIndex(MARKER_DOT);
roadMarker.setTag(listBean);
removables.add(roadMarker);
/* String roadGeo = initGeo(latLng);
geoMarker(roadGeo, roadMarker);*/
String roadGeo = initGeo(latLng);
geoMarker(roadGeo, roadMarker);
roadMarker.setClickable(true);
break;
case 5://其他
@ -679,8 +690,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
otherMarker.setZIndex(MARKER_DOT);
otherMarker.setTag(listBean);
removables.add(otherMarker);
/* String otherGeo = initGeo(latLng);
geoMarker(otherGeo, otherMarker);*/
String otherGeo = initGeo(latLng);
geoMarker(otherGeo, otherMarker);
otherMarker.setClickable(true);
break;
case 6://面状任务
@ -693,8 +704,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
planarMarker.setZIndex(MARKER_DOT);
planarMarker.setTag(listBean);
removables.add(planarMarker);
// String planarGeo = initGeo(latLng);
// geoMarker(planarGeo, planarMarker);
String planarGeo = initGeo(latLng);
geoMarker(planarGeo, planarMarker);
planarMarker.setClickable(true);
break;
}
@ -953,8 +964,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
poiMarker.setTitle(poiEntity.getName() + "");
poiMarker.setTag(poiEntity);
removablesLocality.add(poiMarker);
// String poiGeo = initGeo(latLng);
// geoMarker(poiGeo, poiMarker);
String poiGeo = initGeo(latLng);
geoMarker(poiGeo, poiMarker);
break;
case 2://充电站
BitmapDescriptor chargeDescriptor = null;
@ -973,8 +984,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
stationMarker.setTitle(poiEntity.getName() + "");
stationMarker.setTag(poiEntity);
removablesLocality.add(stationMarker);
// String stationGeo = initGeo(latLng);
// geoMarker(stationGeo, stationMarker);
String stationGeo = initGeo(latLng);
geoMarker(stationGeo, stationMarker);
break;
case 3://poi录像
BitmapDescriptor poiVideoDescriptor = null;
@ -993,8 +1004,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
poiVideoMarker.setTitle(poiEntity.getName() + "");
poiVideoMarker.setTag(poiEntity);
removablesLocality.add(poiVideoMarker);
// String poiVideoGeo = initGeo(latLng);
// geoMarker(poiVideoGeo, poiVideoMarker);
String poiVideoGeo = initGeo(latLng);
geoMarker(poiVideoGeo, poiVideoMarker);
break;
case 4://道路录像
BitmapDescriptor roadDescriptor = null;
@ -1013,8 +1024,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
roadMarker.setTitle(poiEntity.getName() + "");
roadMarker.setTag(poiEntity);
removablesLocality.add(roadMarker);
// String roadGeo = initGeo(latLng);
// geoMarker(roadGeo, roadMarker);
String roadGeo = initGeo(latLng);
geoMarker(roadGeo, roadMarker);
break;
case 5://其他
BitmapDescriptor otherDescriptor = null;
@ -1033,8 +1044,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
otherMarker.setTitle(poiEntity.getName() + "");
otherMarker.setTag(poiEntity);
removablesLocality.add(otherMarker);
// String otherGeo = initGeo(latLng);
// geoMarker(otherGeo, otherMarker);
String otherGeo = initGeo(latLng);
geoMarker(otherGeo, otherMarker);
break;
case 6://面状任务
BitmapDescriptor Descriptor = null;
@ -1053,8 +1064,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
planarMarker.setTitle(poiEntity.getName() + "");
planarMarker.setTag(poiEntity);
removablesLocality.add(planarMarker);
// String planarGeo = initGeo(latLng);
// geoMarker(planarGeo, planarMarker);
String planarGeo = initGeo(latLng);
geoMarker(planarGeo, planarMarker);
break;
}
}
@ -1646,54 +1657,51 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
TencentMap.OnMarkerClickListener markerClickListener = new TencentMap.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker marker) {
initEntity(marker, true);
// LatLng latLng = marker.getPosition();
// ArrayList<LatLng> 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;
// point.set(minX, minY);
// lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
// point.set(maxX, minY);
// lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
// point.set(maxX, maxY);
// lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
// point.set(minX, maxY);
// lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
// point.set(minX, minY);
// lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
// poiEntityArrayList = new ArrayList<>();
// com.vividsolutions.jts.geom.Polygon polygon = GeometryTools.createPolygon(lngArrayList);
// //多点
// MultiPoint multiPoint = GeometryTools.createMultiPoint(latList);
// //拿到覆蓋點
// Geometry intersection = polygon.intersection(multiPoint);
// if (intersection == null) {
// initEntity(marker, true);
// } else {
// initEntity(marker, true);
// /*if (intersection.getGeometryType().equals("MultiPoint")) {
// List<LatLng> latList = GeometryTools.getLatList(intersection);
// for (int i = 0; i < latList.size(); i++) {
// LatLng latL = latList.get(i);
// Geometry geometry = GeometryTools.createGeometry(latL);
// Log.d("TAG", "onMarkerClick: " + geometry.toString());
// List<Marker> markerList = removableHashMap.get(geometry.toText());
// if (markerList != null) {
// for (Marker mar : markerList) {
// initEntity(mar, false);
// }
// }
// }
// customDialog(poiEntityArrayList, marker);
// } else {
// initEntity(marker, true);
// }*/
// }
LatLng latLng = marker.getPosition();
ArrayList<LatLng> 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;
point.set(minX, minY);
lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
point.set(maxX, minY);
lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
point.set(maxX, maxY);
lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
point.set(minX, maxY);
lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
point.set(minX, minY);
lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
poiEntityArrayList = new ArrayList<>();
com.vividsolutions.jts.geom.Polygon polygon = GeometryTools.createPolygon(lngArrayList);
//多点
MultiPoint multiPoint = GeometryTools.createMultiPoint(latList);
//拿到覆蓋點
Geometry intersection = polygon.intersection(multiPoint);
if (intersection == null) {
initEntity(marker, true);
} else {
if (intersection.getGeometryType().equals("MultiPoint")) {
List<LatLng> latList = GeometryTools.getLatList(intersection);
for (int i = 0; i < latList.size(); i++) {
LatLng latL = latList.get(i);
Geometry geometry = GeometryTools.createGeometry(latL);
Log.d("TAG", "onMarkerClick: " + geometry.toString());
List<Marker> markerList = removableHashMap.get(geometry.toText());
if (markerList != null) {
for (Marker mar : markerList) {
initEntity(mar, false);
}
}
}
customDialog(poiEntityArrayList, marker);
} else {
initEntity(marker, true);
}
}
return false;
}
};

View File

@ -179,11 +179,41 @@
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<RelativeLayout
android:id="@+id/rl_draw"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/road_shape"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_filter">
<CheckBox
android:id="@+id/check_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="批量领取"
/>
<Button
android:id="@+id/btn_draw"
style="@style/user_style"
android:layout_width="80dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="20dp"
android:gravity="center"
android:text="批量领取"
android:textColor="@color/white"
android:textSize="15sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_filters"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_height="50dp"
android:background="@drawable/road_shape"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -194,10 +224,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_margin="20dp"
android:text="筛选结果"
android:layout_marginLeft="10dp"
android:textSize="20sp" />
<Button
android:id="@+id/btn_filter"
style="@style/user_style"
@ -211,7 +242,6 @@
android:textColor="@color/white"
android:textSize="15sp" />
</RelativeLayout>
<com.jcodecraeer.xrecyclerview.XRecyclerView
android:id="@+id/recycler_filter"
android:layout_width="match_parent"

View File

@ -164,7 +164,6 @@
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:gravity="center"
android:visibility="gone"
android:text="点击查看成果"
android:textColor="@color/white"
android:textSize="15sp" />

View File

@ -6,80 +6,93 @@
android:layout_height="wrap_content">
<!-- android:lines="1"-->
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/cb_filter"
app:layout_constraintTop_toTopOf="@+id/tv_form"
app:layout_constraintLeft_toLeftOf="parent"/>
<TextView
android:id="@+id/tv_name"
android:layout_width="260dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="35dp"
android:text="测试彼此"
android:textColor="#333"
android:textSize="15sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/tv_form"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:layout_marginTop="5dp"
android:background="@drawable/underline"
android:padding="5dp"
android:text="道路"
android:textColor="#00BCD4"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_name" />
<TextView
android:id="@+id/tv_task_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/underline"
android:padding="5dp"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/tv_form"
app:layout_constraintStart_toEndOf="@+id/tv_form"
app:layout_constraintTop_toTopOf="@+id/tv_form" />
<TextView
android:id="@+id/tv_task_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginBottom="20dp"
android:text="任务id:11315"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/tv_name"
app:layout_constraintTop_toBottomOf="@+id/tv_name"/>
<TextView
android:id="@+id/tv_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp"
android:text="¥3.5"
android:textColor="#000"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toRightOf="@+id/tv_name"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_distance"
android:layout_width="wrap_content"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="距离0.05km"
app:layout_constraintBottom_toBottomOf="@+id/tv_task_id"
app:layout_constraintEnd_toEndOf="@+id/tv_money"
app:layout_constraintTop_toTopOf="@+id/tv_task_id" />
</androidx.constraintlayout.widget.ConstraintLayout>
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/cb_filter"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_name"
android:layout_width="260dp"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:layout_marginTop="20dp"
android:text="测试彼此"
android:textColor="#333"
android:textSize="15sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_form"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:layout_marginTop="5dp"
android:background="@drawable/underline"
android:padding="5dp"
android:text="道路"
android:textColor="#00BCD4"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_name" />
<TextView
android:id="@+id/tv_task_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/underline"
android:padding="5dp"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/tv_form"
app:layout_constraintStart_toEndOf="@+id/tv_form"
app:layout_constraintTop_toTopOf="@+id/tv_form" />
<TextView
android:id="@+id/tv_task_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginBottom="20dp"
android:text="任务id:11315"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/tv_name"
app:layout_constraintTop_toBottomOf="@+id/tv_name" />
<TextView
android:id="@+id/tv_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp"
android:text="¥3.5"
android:textColor="#000"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toRightOf="@+id/tv_name"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="距离0.05km"
app:layout_constraintBottom_toBottomOf="@+id/tv_task_id"
app:layout_constraintEnd_toEndOf="@+id/tv_money"
app:layout_constraintTop_toTopOf="@+id/tv_task_id" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -174,7 +174,7 @@
<TextView
android:id="@+id/tv_photo_album"
style="@style/user_style"
android:visibility="gone"
android:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"