修改bug

This commit is contained in:
md 2021-07-20 20:48:52 +08:00
parent 83a2430076
commit f8805da00e
30 changed files with 594 additions and 342 deletions

View File

@ -11,6 +11,7 @@ import com.navinfo.outdoor.util.NoSlideViewPager;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
import android.content.Context;
import android.content.SharedPreferences;
@ -37,6 +38,7 @@ public class HomeActivity extends BaseActivity{
private final String[] names = {"寻宝", "记录", "发现", "我的"};
private final int[] pic = {R.mipmap.map_select,R.mipmap.task_select,R.mipmap.article_select,R.mipmap.mine_select};
private final int[] pic1 = {R.mipmap.map,R.mipmap.task,R.mipmap.article,R.mipmap.mine};
private RecordFragment recordFragment;
@Override
protected int getLayout() {
@ -55,7 +57,8 @@ public class HomeActivity extends BaseActivity{
mViewPager=findViewById(R.id.no_slide_view_pager);
ArrayList<Fragment> fragments = new ArrayList<>();
fragments.add(new TreasureFragment());
fragments.add(new RecordFragment());
recordFragment = new RecordFragment();
fragments.add(recordFragment);
fragments.add(new FindFragment());
fragments.add(new MineFragment());
mViewPager.setOffscreenPageLimit(3);
@ -71,6 +74,24 @@ public class HomeActivity extends BaseActivity{
return fragments.size();
}
});
mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
if (position == 1) {
recordFragment.refreshData();
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
mViewPager.setCanScroll(true);
mViewPager.setNoScrollAnim(false);
mTab.setupWithViewPager(mViewPager);

View File

@ -457,7 +457,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
layerChange.removeAllViews();
if (widthMap > widthCamera) {
ivPic.setVisibility(View.GONE);
ivPic.setVisibility(View.VISIBLE);
layoutParamsCamera.width = dm.widthPixels;
layoutParamsCamera.height = dm.heightPixels;
layoutParamsMap.height = heightCamera;
@ -467,6 +467,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
layerChange.addView(camera);
layerChange.addView(ivMap);
} else {
ivPic.setVisibility(View.GONE);
layoutParamsMap.height = dm.heightPixels;
layoutParamsMap.width = dm.widthPixels;
layoutParamsCamera.height = heightMap;

View File

@ -46,7 +46,7 @@ public class Constant {
//message word
public static final int TREASURE_FRAGMENT = 100;//抽屉界面的展示和隐藏
public static final int TREASURE_WORD = 0;//poi 对地图页面marker 的一个展示 编辑
public static final int TREASURE_WORD = 39;//poi 对地图页面marker 的一个展示 编辑
public static final int TREASURE_CHECKED_WORD = 40;//poi 对地图页面marker 的一个展示 确定
public static final int CAPACITY_EVALUATION_PAGE = 1;//能力测评的页数
public static final int POI_WORD = 2;//地图页面marker 的经纬都回传
@ -80,6 +80,7 @@ public class Constant {
public static final int EVENT_WHAT_LOCATION_CHANGE = 35; // 定位位置更新的Event的What值
public static final int CHARGING_PILE_BODY=36;//充电装的body
public static final int CHARGING_PILE_PHONE = 37;//充电桩的照片
public static final int EVENT_WHAT_CURRENT_MARKER = 41; // 显示当前正在编辑的POI类型数据的Event的What值
public static String USER_ATTESTATION_NAME; //实名认证姓名 银行卡
public static int NUMBER = 200; //任务个数

View File

@ -0,0 +1,32 @@
package com.navinfo.outdoor.bean;
public class RoadSaveBean {
private Integer code;
private String message;
private Integer body;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Integer getBody() {
return body;
}
public void setBody(Integer body) {
this.body = body;
}
}

View File

@ -97,7 +97,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
private Spinner spinnerType;
String[] ctype = new String[]{"充电站", "充换电站", "充电桩组", "换电站"};//1."充电站"2 "充换电站"3 "充电桩组"4 "换电站"5 ,
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
private int existence=0;
private int existence = 0;
private ArrayAdapter<String> adapter;
private LinearLayout linearChargingPile;
private RecyclerView recyclerStation;
@ -113,7 +113,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
private ContactView contactView;
private Integer chargingPileBody;
private ArrayList<File> chargingStationList;
private ArrayList<File> phoneList;
private ArrayList<File> fileList;
public static ChargingStationFragment newInstance(Bundle bundle) {
ChargingStationFragment fragment = new ChargingStationFragment();
@ -270,13 +270,13 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
switch (position) {
case 0:
existence=0;
existence = 0;
break;
case 1:
existence=1;
existence = 1;
break;
case 2:
existence=2;
existence = 2;
break;
}
}
@ -350,7 +350,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
if (address != null && !address.equals("")) {
editSiteContent.setText(address);
}
body=showPoiEntity.getBodyId();
body = showPoiEntity.getBodyId();
String x = showPoiEntity.getX();
String y = showPoiEntity.getY();
if (x != null && y != null) {
@ -369,7 +369,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
if (telPhone != null && !telPhone.equals("")) {
String[] phones = telPhone.split("\\|");
for (int i = 0; i < phones.length; i++) {
if (i==0) {
if (i == 0) {
if (!StringUtils.isEmpty(phones[i])) {
String[] split = phones[i].split("-");
if (split[0] == phones[i]) {
@ -392,14 +392,14 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
} else {
if (Constant.CODE==null||Constant.CODE.equals("")){
if (Constant.CODE == null || Constant.CODE.equals("")) {
poiBeans.add(new PhoneBean("电话*", "", "", R.drawable.icon_add_bg));
}else {
} else {
poiBeans.add(new PhoneBean("电话*", "", Constant.CODE, R.drawable.icon_add_bg));
}
}
body=showPoiEntity.getBodyId();
body = showPoiEntity.getBodyId();
contactView = new ContactView(getActivity(), linearContact, poiBeans);
contactView.resetView();
//poiRecycleAdapter.setList(poiBeans);
@ -473,6 +473,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
EventBus.getDefault().post(obtain);
}
}
/**
* 得到电话区号电话位数
*/
@ -487,15 +488,15 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
.Builder(getActivity())
.url(HttpInterface.GET_PHONES)
.method(OkGoBuilder.GET)
.params(new HttpParams("geo",encode))
.params(new HttpParams("geo", encode))
.cls(GetPhoneBean.class)
.callback(new Callback<GetPhoneBean>() {
@Override
public void onSuccess(GetPhoneBean getPhoneBean, int id) {
dismissLoadingDialog();
if (getPhoneBean.getCode()==200){
if (getPhoneBean.getCode() == 200) {
String code = getPhoneBean.getBody().getCode();
Constant.CODE=code;
Constant.CODE = code;
}
}
@ -506,6 +507,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
}).build();
}
public void initRemovePileSharePre() {
//获取SharedPreferences对象方法中两个参数的意思为第一个name
//表示文件名系统将会在/dada/dada/包名/shared_prefs目录下生成
@ -554,13 +556,15 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
ArrayList<ChargingPileEntity> chargingPileEntities = new ArrayList<>();
chargingPileEntities.add(chargingPileEntity);
chargingPileAdapter.setChargingPileEntities(chargingPileEntities);
}else if (data.what == Constant.CHARGING_PILE_BODY){
} else if (data.what == Constant.CHARGING_PILE_BODY) {
chargingPileBody = (Integer) data.obj;
}else if (data.what == Constant.CHARGING_PILE_PHONE){
phoneList = (ArrayList<File>) data.obj;
} else if (data.what == Constant.CHARGING_PILE_PHONE) {
fileList = (ArrayList<File>) data.obj;
}
}
private boolean isChargeStationUploaded = false, isChargingPoleUploaded = false;
@Override
public void onClick(View v) {
switch (v.getId()) {
@ -595,25 +599,25 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
chargingStationList.add(new File(tagScutcheon));
}
if (body != null&& chargingPileBody!=null) {
stationUploadByNetWork(body, chargingStationList);
chargingPileUploadNetWork(body,phoneList);
} else {
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
isChargeStationUploaded = false;
isChargingPoleUploaded = false;
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 0 || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2) {
initRoadSaveLocal(true);
} else {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
chargingPileUploadNetWork(poiDaoPoiEntity.getBodyId(), fileList);
stationUploadByNetWork(poiDaoPoiEntity.getBodyId(), chargingStationList);
chargingPileUploadNetWork(poiDaoPoiEntity.getBodyId(),phoneList);
}
});
}
}).start();
}
}
}).start();
break;
case R.id.tv_examine:
Toast.makeText(getContext(), editNameContent.getText().toString(), Toast.LENGTH_SHORT).show();
@ -648,10 +652,10 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
}
private void chargingPileUploadNetWork(int chargingPileBody, ArrayList<File> phoneList) {
private void chargingPileUploadNetWork(int chargingPileBody, ArrayList<File> fileList) {
if (chargingPileBody == 0) {
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
Log.e("TAG", "poiUploadByNetWork: " + body + phoneList);
Log.e("TAG", "poiUploadByNetWork: " + body + fileList);
return;
}
OkGo
@ -659,27 +663,22 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
.<PoiUploadBean>post(HttpInterface.CS_TASK_UP_LOAD_PIC)
// 请求的 tag, 主要用于取消对应的请求
.params("auditId", chargingPileBody)
.addFileParams("file", phoneList)
.addFileParams("file", fileList)
.tag(this)
.execute(new DialogCallback<PoiUploadBean>(PoiUploadBean.class) {
@Override
public void onSuccess(Response<PoiUploadBean> poiUploadBeanResponse) {
dismissLoadingDialog();
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
// new Thread(new Runnable() {
// @Override
// public void run() {
// poiDao.getPoiEntity()
// ChargingPileDao poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
// poiDao.deletePoiEntity(poiDaoPoiEntity);
// getActivity().runOnUiThread(new Runnable() {
// @Override
// public void run() {
// getActivity().onBackPressed();//回退
// }
// });
// }
// }).start();
isChargingPoleUploaded = true;
if (isChargeStationUploaded && isChargingPoleUploaded) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
getActivity().onBackPressed();//回退
}
});
}
}
@Override
@ -728,7 +727,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
poiEntity.setDescribe(describe);
}
boolean phoneBean = contactView.getPhoneBean();
if (phoneBean){
if (phoneBean) {
String list = contactView.getList();
poiEntity.setTelPhone(list);
}
@ -785,7 +784,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
chargingStationSaveByWork(poiEntity,isLocal);
chargingStationSaveByWork(poiEntity, isLocal);
}
});
}
@ -831,6 +830,15 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
public void run() {
poiDao.deletePoiEntity(showPoiEntity);
isChargeStationUploaded = true;
if (isChargeStationUploaded && isChargingPoleUploaded) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
getActivity().onBackPressed();//回退
}
});
}
}
}).start();
@ -877,9 +885,10 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (isLocal){
stationUploadByNetWork(body,chargingStationList);
}else {
if (isLocal) {
stationUploadByNetWork(body, chargingStationList);
chargingPileUploadNetWork(chargingPileBody, fileList);
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
}
Log.d("TAG", "onSuccess: " + chargingStationBean.getBody());
@ -918,7 +927,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
poiEntity.setDescribe(describe);
}
boolean phoneBean = contactView.getPhoneBean();
if (phoneBean){
if (phoneBean) {
String list = contactView.getList();
poiEntity.setTelPhone(list);
}
@ -996,7 +1005,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
poiEntity.setDescribe(describe);
}
boolean phoneBean = contactView.getPhoneBean();
if (phoneBean){
if (phoneBean) {
String list = contactView.getList();
poiEntity.setTelPhone(list);
}
@ -1155,7 +1164,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity.getName() == null) {
if (poiDaoPoiEntity != null && poiDaoPoiEntity.getName() == null) {
poiDao.deletePoiEntity(poiDaoPoiEntity);
chargingPileDao.deleteChargingFidPileEntity(showPoiEntity.getId());
}

View File

@ -65,7 +65,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
boolean aBoolean = getArguments().getBoolean("boolean", true);
boolean aBoolean = getArguments().getBoolean("boolean", false);
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET_RETURN;
obtain.obj = aBoolean;
@ -111,41 +111,65 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
} else {
tvMoney.setText("" + poiEntity.getPrecision());
}
tvTime.setText("到期时间:" + poiEntity.getCreateTime());
tvDescribe.setText("任务描述:" + poiEntity.getDescribe());
if (poiEntity !=null){
if (poiEntity.getMemo()!=null&&!"".equals(poiEntity.getMemo())) {
tvDescribe.setText("任务描述:" + poiEntity.getMemo());
}
if (poiEntity.getMemo()!=null&&!"".equals(poiEntity.getCreateTime())) {
tvTime.setText("到期时间:" + poiEntity.getCreateTime());
}
}
if (poiEntity.getDist() != null) {
tvDistance.setText("距离:" + format5(Double.valueOf(poiEntity.getDist()) / 1000) + "km");
}
}
int taskStatus = poiEntity.getTaskStatus();
switch (taskStatus) {
case 0://未领取
btnCancelGet.setVisibility(View.GONE);
btnGetTask.setVisibility(View.VISIBLE);
btnGather.setVisibility(View.VISIBLE);
btnFinishGather.setVisibility(View.GONE);
break;
case 1://已领取
btnCancelGet.setVisibility(View.VISIBLE);
btnGetTask.setVisibility(View.GONE);
btnGather.setVisibility(View.VISIBLE);
btnFinishGather.setVisibility(View.GONE);
break;
case 2://已保存
btnCancelGet.setVisibility(View.VISIBLE);
btnGetTask.setVisibility(View.GONE);
btnGather.setVisibility(View.GONE);
btnFinishGather.setVisibility(View.VISIBLE);
break;
case 3://已提交
btnCancelGet.setVisibility(View.GONE);
btnGetTask.setVisibility(View.GONE);
btnGather.setVisibility(View.GONE);
btnFinishGather.setVisibility(View.GONE);
break;
}
initViewByTaskStatus(taskStatus);
}
}
/**
* btnGetTask.setVisibility(View.GONE);领取任务
* // btnCancelGet.setVisibility(View.VISIBLE);取消领取
* //btnFinishGather.setVisibility(View.VISIBLE);结束采集
* //btnGather.setVisibility(View.GONE);立即采集
* btnGetTask.setVisibility(View.GONE);
* btnCancelGet.setVisibility(View.VISIBLE);
* btnFinishGather.setVisibility(View.GONE);
* btnGather.setVisibility(View.VISIBLE);
* */
private void initViewByTaskStatus(int taskStatus) {
switch (taskStatus) {
case 0://未领取
btnCancelGet.setVisibility(View.GONE);//取消领取
btnGetTask.setVisibility(View.VISIBLE);//领取任务
btnGather.setVisibility(View.VISIBLE);//立即采集
btnFinishGather.setVisibility(View.GONE);//结束采集
break;
case 1://已领取
btnCancelGet.setVisibility(View.VISIBLE);
btnGetTask.setVisibility(View.GONE);
btnGather.setVisibility(View.VISIBLE);
btnFinishGather.setVisibility(View.GONE);
break;
case 2://已保存
case 3://已提交
btnCancelGet.setVisibility(View.VISIBLE);
btnGetTask.setVisibility(View.GONE);
btnGather.setVisibility(View.GONE);
btnFinishGather.setVisibility(View.VISIBLE);
break;
case 4://结束采集
btnCancelGet.setVisibility(View.GONE);
btnGetTask.setVisibility(View.GONE);
btnGather.setVisibility(View.GONE);
btnFinishGather.setVisibility(View.GONE);
break;
}
}
@Override
public void onClick(View v) {
@ -154,7 +178,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (poiEntity != null) {
int type = poiEntity.getType();
if (type == 6) {
initUnPolygonTask(HttpInterface.UNRECEIVED_POLYGON_TASK, poiEntity.getTaskId());
initUnPolygonTask(HttpInterface.UNRECEIVED_POLYGON_TASK, poiEntity.getTaskId(),poiEntity);
} else {
new Thread(new Runnable() {
@Override
@ -178,17 +202,17 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (poiEntity != null) {
int type = poiEntity.getType();
if (type == 6) {//面状任务的领取类型
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), false);
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), false,poiEntity);
} else if (type == 1) {//poi的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), false);
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), false,poiEntity);
} else if (type == 2) {//充电站的领取类型
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), false);
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), false,poiEntity);
} else if (type == 3) {//poi录像的领取类型
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK,poiEntity.getTaskId(),false);
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK,poiEntity.getTaskId(),false,poiEntity);
} else if (type == 4) {//道路的领取类型
taskByNet(HttpInterface.RECEIVED_ROAD_TASK,poiEntity.getTaskId(),false);
taskByNet(HttpInterface.RECEIVED_ROAD_TASK,poiEntity.getTaskId(),false,poiEntity);
} else if (type == 5) {//其他的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), false);
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), false, poiEntity);
}
}
break;
@ -198,7 +222,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (type == 6) {
int taskStatus = poiEntity.getTaskStatus();
if (taskStatus != 1) {
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), true);
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), true, poiEntity);
} else {
new Thread(new Runnable() {
@Override
@ -215,15 +239,15 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}
} else if (type== 1) {//poi的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), true);
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), true, poiEntity);
} else if (type== 2) {//充电站的领取类型
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), true);
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), true, poiEntity);
} else if (type== 3) {//poi录像的领取类型
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK,poiEntity.getTaskId(),true);
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK,poiEntity.getTaskId(),true, poiEntity);
} else if (type == 4) {//道路的领取类型
taskByNet(HttpInterface.RECEIVED_ROAD_TASK,poiEntity.getTaskId(),true);
taskByNet(HttpInterface.RECEIVED_ROAD_TASK,poiEntity.getTaskId(),true, poiEntity);
} else if (type == 5) {//其他的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), true);
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), true, poiEntity);
}
}
break;
@ -240,6 +264,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
// poiEntity.setTaskStatus(0);
// initViewByTaskStatus(0);
btnGetTask.setVisibility(View.VISIBLE);
btnCancelGet.setVisibility(View.GONE);
btnGather.setVisibility(View.VISIBLE);
@ -256,8 +282,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
/**
* @param url 筛选充电站领取任务
* @param poiEntity
*/
private void chargingTaskByWork(String url, int taskId, boolean isSaver) {
private void chargingTaskByWork(String url, int taskId, boolean isSaver, PoiEntity poiEntity) {
showLoadingDialog();
OkGoBuilder.getInstance()
.Builder(getActivity())
@ -310,6 +337,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}
}).start();
}
//获取当前位置的marker
senMessageMarker(chargingListEntity.getType(),chargingListEntity.getY(),chargingListEntity.getX());
new Thread(new Runnable() {
@Override
public void run() {
@ -317,6 +346,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
// poiEntity.setTaskStatus(1);
// initViewByTaskStatus(1);
btnGetTask.setVisibility(View.GONE);
btnCancelGet.setVisibility(View.VISIBLE);
btnFinishGather.setVisibility(View.VISIBLE);
@ -344,8 +375,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
/**
* @param url 面妆任务领取任务
* @param poiEntity
*/
private void initPolygonTask(String url, int taskId, boolean aBoolean) {
private void initPolygonTask(String url, int taskId, boolean aBoolean, PoiEntity poiEntity) {
if (taskId == 0) {
Toast.makeText(getContext(), "无此任务", Toast.LENGTH_SHORT).show();
return;
@ -390,10 +422,12 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
// poiEntity.setTaskStatus(1);
// initViewByTaskStatus(1);
btnGetTask.setVisibility(View.GONE);
btnCancelGet.setVisibility(View.VISIBLE);
if (aBoolean) {
initCompleteTask(HttpInterface.COMPLETE, poiEntity.getTaskId(), polygonEntity);
initCompleteTask(HttpInterface.COMPLETE, GatherGetFragment.this.poiEntity.getTaskId(), polygonEntity);
}
}
});
@ -413,8 +447,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
/**
* @param url 面妆任务结束领取 结束采集
* @param poiEntity
*/
private void initUnPolygonTask(String url, int taskId) {
private void initUnPolygonTask(String url, int taskId, PoiEntity poiEntity) {
if (taskId == 0) {
Toast.makeText(getContext(), "无此任务", Toast.LENGTH_SHORT).show();
return;
@ -437,8 +472,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
btnGetTask.setVisibility(View.VISIBLE);
btnCancelGet.setVisibility(View.GONE);
poiEntity.setTaskStatus(0);
initViewByTaskStatus(0);
// btnGetTask.setVisibility(View.VISIBLE);
// btnCancelGet.setVisibility(View.GONE);
}
});
}
@ -483,6 +520,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
// poiEntity.setTaskStatus(3);
// initViewByTaskStatus(3);
btnGather.setVisibility(View.GONE);
btnFinishGather.setVisibility(View.VISIBLE);
}
@ -528,8 +567,11 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
btnGather.setVisibility(View.VISIBLE);
btnFinishGather.setVisibility(View.GONE);
poiEntity.setTaskStatus(0);
initViewByTaskStatus(0);
// btnGather.setVisibility(View.VISIBLE);
// btnFinishGather.setVisibility(View.GONE);
}
});
}
@ -550,8 +592,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
/**
* @param url poi类型对应的url
* @param poiEntity
*/
private void receivedTaskByNet(String url, int taskId, boolean isSaver) {
private void receivedTaskByNet(String url, int taskId, boolean isSaver, PoiEntity poiEntity) {
showLoadingDialog();
OkGoBuilder.getInstance()
.Builder(getActivity())
@ -588,6 +631,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setX(latPolygon.get(0).longitude + "");
poiListEntity.setY(latPolygon.get(0).latitude + "");
}
// 通知地图界面显示当前编辑数据的marker
senMessageMarker(poiEntity.getType(),poiEntity.getY(),poiEntity.getX());
new Thread(new Runnable() {
@Override
public void run() {
@ -596,10 +642,12 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
btnGetTask.setVisibility(View.GONE);
btnCancelGet.setVisibility(View.VISIBLE);
btnFinishGather.setVisibility(View.VISIBLE);
btnGather.setVisibility(View.GONE);
poiEntity.setTaskStatus(1);
initViewByTaskStatus(1);
// btnGetTask.setVisibility(View.GONE);
// btnCancelGet.setVisibility(View.VISIBLE);
// btnFinishGather.setVisibility(View.GONE);
// btnGather.setVisibility(View.VISIBLE);
if (isSaver) {
Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET_MAP;
@ -621,10 +669,21 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}
}).build();
}
private void senMessageMarker(int type,String y,String x) {
Message markerMsg = Message.obtain();
markerMsg.what = Constant.EVENT_WHAT_CURRENT_MARKER;
LatLng latLng = new LatLng(Double.parseDouble(y), Double.parseDouble(x));
markerMsg.obj = latLng;
markerMsg.arg1 = type;
EventBus.getDefault().post(markerMsg);
}
/**
* @param url 不同任务类型对应的url
* @param poiEntity
*/
private void taskByNet(String url, int taskId, boolean isSaver) {
private void taskByNet(String url, int taskId, boolean isSaver, PoiEntity poiEntity) {
showLoadingDialog();
OkGoBuilder.getInstance()
.Builder(getActivity())
@ -662,6 +721,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setX(latPolygon.get(0).longitude + "");
poiListEntity.setY(latPolygon.get(0).latitude + "");
}
//获取当前位置的marker
senMessageMarker(poiListEntity.getType(),poiListEntity.getY(),poiListEntity.getX());
new Thread(new Runnable() {
@Override
public void run() {
@ -669,6 +730,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
// poiEntity.setTaskStatus(1);
// initViewByTaskStatus(1);
btnGetTask.setVisibility(View.GONE);
btnCancelGet.setVisibility(View.VISIBLE);
btnFinishGather.setVisibility(View.VISIBLE);

View File

@ -292,16 +292,17 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (poiDaoPoiEntity.getTaskStatus()==1||poiDaoPoiEntity.getTaskStatus()==2||poiDaoPoiEntity.getTaskStatus()==0){
initPoiSaveLocal(true);
}else if (poiDaoPoiEntity.getTaskStatus()==3){
if (poiDaoPoiEntity == null||poiDaoPoiEntity.getTaskStatus()==1||poiDaoPoiEntity.getTaskStatus()==2||poiDaoPoiEntity.getTaskStatus()==0){
initPoiSaveLocal(true);
}else {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
otherUploadByNet(poiDaoPoiEntity.getBodyId(), otherUploadList);
}
}
});
});
}
}
}).start();
break;
@ -593,15 +594,15 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
@Override
public void onDestroy() {
super.onDestroy();
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity!=null&&poiDaoPoiEntity.getName() == null) {
poiDao.deletePoiEntity(poiDaoPoiEntity);
}
}
}).start();
// new Thread(new Runnable() {
// @Override
// public void run() {
// PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
// if (poiDaoPoiEntity!=null&&poiDaoPoiEntity.getName() == null) {
// poiDao.deletePoiEntity(poiDaoPoiEntity);
// }
// }
// }).start();
}
}

View File

@ -59,8 +59,10 @@ import com.navinfo.outdoor.ui.view.ContactView;
import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.PhotoPathUtil;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@ -91,7 +93,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
private PoiEntity showPoiEntity;
private LatLng latLng;
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
private int existence=0;
private int existence = 0;
private RelativeLayout linearExist;
private Spinner spinnerExist;
@ -168,21 +170,21 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
checkBoxLife.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
checkBoxLife.setText("保存");
checkBoxLife.setTextColor(Color.WHITE);
Message obtain = Message.obtain();
obtain.what = Constant.TREASURE_WORD;
obtain.obj = latLng;
EventBus.getDefault().post(obtain);
} else {
checkBoxLife.setText("编辑");
checkBoxLife.setTextColor(Color.BLACK);
Message obtain = Message.obtain();
obtain.what = Constant.TREASURE_CHECKED_WORD;
obtain.obj = true;
EventBus.getDefault().post(obtain);
}
if (isChecked) {
checkBoxLife.setText("保存");
checkBoxLife.setTextColor(Color.WHITE);
Message obtain = Message.obtain();
obtain.what = Constant.TREASURE_WORD;
obtain.obj = latLng;
EventBus.getDefault().post(obtain);
} else {
checkBoxLife.setText("编辑");
checkBoxLife.setTextColor(Color.BLACK);
Message obtain = Message.obtain();
obtain.what = Constant.TREASURE_CHECKED_WORD;
obtain.obj = true;
EventBus.getDefault().post(obtain);
}
}
});
@ -222,13 +224,13 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
switch (position) {
case 0:
existence=0;
existence = 0;
break;
case 1:
existence=1;
existence = 1;
break;
case 2:
existence=2;
existence = 2;
break;
}
}
@ -278,13 +280,13 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
if (telPhone != null && !telPhone.equals("")) {
String[] phones = telPhone.split("\\|");
for (int i = 0; i < phones.length; i++) {
if (i==0) {
if (i == 0) {
if (!StringUtils.isEmpty(phones[i])) {
String[] split = phones[i].split("-");
if (split[0] == phones[i]) {
poiBeans.add(new PhoneBean("电话*", phones[i]+"", "", R.drawable.icon_add_bg));
poiBeans.add(new PhoneBean("电话*", phones[i] + "", "", R.drawable.icon_add_bg));
} else {
poiBeans.add(new PhoneBean("电话*", split[1]+"", split[0]+"", R.drawable.icon_add_bg));
poiBeans.add(new PhoneBean("电话*", split[1] + "", split[0] + "", R.drawable.icon_add_bg));
}
}
@ -292,18 +294,18 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
if (!StringUtils.isEmpty(phones[i])) {
String[] split = phones[i].split("-");
if (split[0] == phones[i]) {
poiBeans.add(new PhoneBean("", phones[i]+"", "", R.drawable.icon_del_bg));
poiBeans.add(new PhoneBean("", phones[i] + "", "", R.drawable.icon_del_bg));
} else {
poiBeans.add(new PhoneBean("", split[1]+"", split[0]+"", R.drawable.icon_del_bg));
poiBeans.add(new PhoneBean("", split[1] + "", split[0] + "", R.drawable.icon_del_bg));
}
}
}
}
} else {
if (Constant.CODE==null||Constant.CODE.equals("")){
if (Constant.CODE == null || Constant.CODE.equals("")) {
poiBeans.add(new PhoneBean("电话*", "", "", R.drawable.icon_add_bg));
}else {
} else {
poiBeans.add(new PhoneBean("电话*", "", Constant.CODE, R.drawable.icon_add_bg));
}
@ -311,7 +313,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
contactView = new ContactView(getActivity(), linearContact, poiBeans);
contactView.resetView();
//poiRecycleAdapter.setList(poiBeans);
if (showPoiEntity.getName()!=null){
if (showPoiEntity.getName() != null) {
linearExist.setVisibility(View.VISIBLE);
spinnerExist.setSelection(showPoiEntity.getExistence(), true);
}
@ -353,15 +355,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
.Builder(getActivity())
.url(HttpInterface.GET_PHONES)
.method(OkGoBuilder.GET)
.params(new HttpParams("geo",encode))
.params(new HttpParams("geo", encode))
.cls(GetPhoneBean.class)
.callback(new Callback<GetPhoneBean>() {
@Override
public void onSuccess(GetPhoneBean getPhoneBean, int id) {
dismissLoadingDialog();
if (getPhoneBean.getCode()==200){
if (getPhoneBean.getCode() == 200) {
String code = getPhoneBean.getBody().getCode();
Constant.CODE=code;
Constant.CODE = code;
}
}
@ -435,22 +437,22 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
if (tagCard != null) {
poiPicList.add(new File(tagCard));
}
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
initPoiSaveLocal(true);
} else {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (poiDaoPoiEntity.getTaskStatus()==1||poiDaoPoiEntity.getTaskStatus()==2||poiDaoPoiEntity.getTaskStatus()==0){
initPoiSaveLocal(true);
}else if (poiDaoPoiEntity.getTaskStatus()==3){
poiUploadByNetWork(poiDaoPoiEntity.getBodyId(), poiPicList);
}
poiUploadByNetWork(poiDaoPoiEntity.getBodyId(), poiPicList);
}
});
}
}).start();
}
}).start();
break;
case R.id.tv_examine:
Toast.makeText(getContext(), editNameContent.getText().toString(), Toast.LENGTH_SHORT).show();
@ -510,11 +512,11 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
poiEntity.setY(String.valueOf(latLng.latitude));
}
String describe = editDescribe.getText().toString().trim();
if (describe != null&&!describe.equals("")) {
if (describe != null && !describe.equals("")) {
poiEntity.setDescribe(describe);
}
boolean phoneBean = contactView.getPhoneBean();
if (phoneBean){
if (phoneBean) {
String list = contactView.getList();
poiEntity.setTelPhone(list);
}
@ -562,7 +564,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
poiSaveByNet(poiEntity,isLocal);
poiSaveByNet(poiEntity, isLocal);
}
});
}
@ -610,7 +612,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
getActivity().onBackPressed();//回退
getActivity().onBackPressed();//回退
}
});
}
@ -627,7 +629,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
});
}
private void poiSaveByNet(PoiEntity poiEntity,boolean isLocal) {
private void poiSaveByNet(PoiEntity poiEntity, boolean isLocal) {
showLoadingDialog();
HttpParams httpParams = new HttpParams();
httpParams.put("taskId", poiEntity.getTaskId());
@ -656,9 +658,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (isLocal){
poiUploadByNetWork(body,poiPicList);//上传
}else {
if (isLocal) {
poiUploadByNetWork(body, poiPicList);//上传
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
}
}
@ -709,10 +711,10 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
poiEntity.setDescribe(describe);
}
boolean phoneBean = contactView.getPhoneBean();
if (phoneBean){
if (phoneBean) {
String list = contactView.getList();
poiEntity.setTelPhone(list);
}else {
} else {
Toast.makeText(getActivity(), "请输入手机号", Toast.LENGTH_SHORT).show();
return;
}
@ -774,7 +776,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}
});
} else {
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivPanorama.setTag(takePhotoPath1);
ivPanorama.setImageBitmap(bitmap);//显示图像
}
@ -794,8 +796,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}
});
} else {
// int angle2 = PictureUtil.readPictureDegree(takePhotoPath2);
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
// int angle2 = PictureUtil.readPictureDegree(takePhotoPath2);
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivName.setTag(takePhotoPath2);
ivName.setImageBitmap(bitmap);//显示图像
}
@ -815,8 +817,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}
});
} else {
// int angle3 = PictureUtil.readPictureDegree(takePhotoPath3);
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
// int angle3 = PictureUtil.readPictureDegree(takePhotoPath3);
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivInternal.setTag(takePhotoPath3);
ivInternal.setImageBitmap(bitmap);//显示图像
}
@ -836,8 +838,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}
});
} else {
// int angle4 = PictureUtil.readPictureDegree(takePhotoPath4);
takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
// int angle4 = PictureUtil.readPictureDegree(takePhotoPath4);
takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivCard.setTag(takePhotoPath4);
ivCard.setImageBitmap(bitmap);//显示图像
}
@ -857,8 +859,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}
});
} else {
// int angle5 = PictureUtil.readPictureDegree(takePhotoPath5);
takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
// int angle5 = PictureUtil.readPictureDegree(takePhotoPath5);
takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivElse.setTag(takePhotoPath5);
ivElse.setImageBitmap(bitmap);//显示图像
}
@ -875,15 +877,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
@Override
public void onDestroy() {
super.onDestroy();
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity!=null&&poiDaoPoiEntity.getName() == null) {
poiDao.deletePoiEntity(poiDaoPoiEntity);
}
}
}).start();
// new Thread(new Runnable() {
// @Override
// public void run() {
// PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
// if (poiDaoPoiEntity!=null&&poiDaoPoiEntity.getName() == null) {
// poiDao.deletePoiEntity(poiDaoPoiEntity);
// }
// }
// }).start();
}

View File

@ -293,16 +293,17 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (poiDaoPoiEntity.getTaskStatus()==1||poiDaoPoiEntity.getTaskStatus()==2||poiDaoPoiEntity.getTaskStatus()==0){
initPoiSaveLocal(true);
}else if (poiDaoPoiEntity.getTaskStatus()==3){
if (poiDaoPoiEntity == null||poiDaoPoiEntity.getTaskStatus()==1||poiDaoPoiEntity.getTaskStatus()==2||poiDaoPoiEntity.getTaskStatus()==0){
initPoiSaveLocal(true);
}else {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
}
}
});
});
}
}
}).start();
break;
@ -326,8 +327,22 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
String formats = formatters.format(calendars.getTime());
String city = Constant.currentLocation.getCity();//返回当前位置的城市.
String district = Constant.currentLocation.getDistrict();//返回当前位置的区县.
poiEntity.setName("poi录像上报-"+city+district+"-"+formats);
etRoadName.setText("poi录像上报-"+city+district+"-"+formats);
StringBuilder sb = new StringBuilder("poi录像上报");
if (city!=null&&!"".equals(city)) {
sb.append("-");
sb.append(city);
}
if (district!=null&&!"".equals(district)) {
sb.append(district);
}
sb.append("-").append(formats);
poiEntity.setName(sb.toString());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
etRoadName.setText(sb);
}
});
}
RoadExtend roadExtend = new RoadExtend();
int type = getPictureType();
@ -429,7 +444,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
@Override
public void onSuccess(Response<OtherUploadPicBean> otherUploadPicBeanResponse) {
dismissLoadingDialog();
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
Toast.makeText(getContext(), "上传成功", Toast.LENGTH_SHORT).show();
new Thread(new Runnable() {
@Override
public void run() {

View File

@ -1,5 +1,6 @@
package com.navinfo.outdoor.fragment;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
@ -28,6 +29,8 @@ public class RecordFragment extends BaseFragment implements View.OnClickListener
private TabLayout tabRecord;
private NoSlideViewPager vpRecord;
private final String[] names = {"待提交", "已提交"};
private StaySubmitFragment staySubmitFragment; // 待提交
private HasSubmitFragment hasSubmitFragment;// 已提交
public static RecordFragment newInstance(Bundle bundle) {
RecordFragment fragment = new RecordFragment();
@ -47,8 +50,11 @@ public class RecordFragment extends BaseFragment implements View.OnClickListener
vpRecord = (NoSlideViewPager) findViewById(R.id.vp_record);
ArrayList<Fragment> fragments = new ArrayList<>();
fragments.add(new StaySubmitFragment());
fragments.add(new HasSubmitFragment());
new StaySubmitFragment();
staySubmitFragment = new StaySubmitFragment();
fragments.add(staySubmitFragment);
hasSubmitFragment = new HasSubmitFragment();
fragments.add(hasSubmitFragment);
vpRecord.setAdapter(new FragmentPagerAdapter(getFragmentManager()) {
@NonNull
@NotNull
@ -78,4 +84,16 @@ public class RecordFragment extends BaseFragment implements View.OnClickListener
public void onClick(View v) {
}
/**
* 刷新fragment内的所有数据
* */
public void refreshData() {
if (staySubmitFragment!=null) {
staySubmitFragment.refreshData();
}
// if (hasSubmitFragment!=null) {
// hasSubmitFragment.refreshData();
// }
}
}

View File

@ -41,6 +41,7 @@ import com.navinfo.outdoor.base.BaseDrawerFragment;
import com.navinfo.outdoor.bean.OtherUploadPicBean;
import com.navinfo.outdoor.bean.PoiVideoBean;
import com.navinfo.outdoor.bean.RoadExtend;
import com.navinfo.outdoor.bean.RoadSaveBean;
import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.DialogCallback;
import com.navinfo.outdoor.http.HttpInterface;
@ -70,7 +71,7 @@ import java.util.List;
public class RoadFragment extends BaseDrawerFragment implements View.OnClickListener {
private TextView tvPictures;
private EditText etRoadName;
private TextView etRoadName;
private ImageView ivRoadPicture;
private RadioButton rbCar;
private RadioButton rbBicycle;
@ -139,7 +140,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
poiDao = poiDatabase.getPoiDao();
tvPictures = (TextView) findViewById(R.id.tv_pictures);
tvPictures.setOnClickListener(this::onClick);
etRoadName = (EditText) findViewById(R.id.et_road_name);
etRoadName = (TextView) findViewById(R.id.et_road_name);
ivRoadPicture = (ImageView) findViewById(R.id.iv_road_picture);
// Glide.with(getContext()).load(getLocalVideoBitmap(String.valueOf(R.drawable.bg_01))).into(ivRoadPicture);
rbCar = (RadioButton) findViewById(R.id.rb_car);
@ -245,7 +246,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_road_save:
initPoiSaveLocal(false);
initPoiSaveLocal(false);
break;
case R.id.tv_pictures:
// 根据用户点击的时间为视频名称赋值
@ -268,22 +269,24 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (poiDaoPoiEntity.getTaskStatus()==1||poiDaoPoiEntity.getTaskStatus()==2||poiDaoPoiEntity.getTaskStatus()==0){
initPoiSaveLocal(true);
}else if (poiDaoPoiEntity.getTaskStatus()==3){
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
initPoiSaveLocal(true);
} else {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
}
}
});
});
}
}
}).start();
break;
}
}
public void initPoiSaveLocal(boolean isLocal) {
XXPermissions.with(getContext())
.permission(Permission.MANAGE_EXTERNAL_STORAGE)
@ -295,15 +298,29 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
String roadName = etRoadName.getText().toString().trim();
if (roadName != null && !roadName.equals("")) {
poiEntity.setName(roadName);
}else {
} else {
DateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
Calendar calendars = Calendar.getInstance();
calendars.setTimeInMillis(System.currentTimeMillis());
String formats = formatters.format(calendars.getTime());
String city = Constant.currentLocation.getCity();//返回当前位置的城市.
String district = Constant.currentLocation.getDistrict();//返回当前位置的区县.
poiEntity.setName("道路录像上报-"+city+district+"-"+formats);
etRoadName.setText("道路录像上报-"+city+district+"-"+formats);
StringBuffer sb = new StringBuffer("poi录像上报");
if (city != null && !"".equals(city)) {
sb.append("-");
sb.append(city);
}
if (district != null && !"".equals(district)) {
sb.append(district);
}
sb.append("-").append(formats);
poiEntity.setName(sb.toString());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
etRoadName.setText(sb);
}
});
}
RoadExtend roadExtend = new RoadExtend();
int type = getPictureType();
@ -316,7 +333,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
String roadExtendJson = gson.toJson(roadExtend);
poiEntity.setExtend(roadExtendJson);
String desc = etDesc.getText().toString().trim();
if (desc != null&& !desc.equals("")) {
if (desc != null && !desc.equals("")) {
poiEntity.setDescribe(desc);
}
if (showPoiEntity != null) {
@ -361,12 +378,14 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
poiVideoSave(poiEntity,isLocal);
roadSaveBetWork(poiEntity, isLocal);
}
});
}
}).start();
//onBackPressed();
} else {
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
}
}
@ -387,7 +406,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
Toast.makeText(getActivity(), "请先保存本地在上传", Toast.LENGTH_SHORT).show();
return;
}
if (fileZip==null){
if (fileZip == null) {
Toast.makeText(getActivity(), "未压缩完成", Toast.LENGTH_SHORT).show();
return;
}
@ -395,8 +414,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
// 请求方式和请求url
.<OtherUploadPicBean>post(HttpInterface.POI_VIDEO_UPLOAD_PIC)
// 请求的 tag, 主要用于取消对应的请求
.params("auditId",body)
.params("file",fileZip)
.params("auditId", body)
.params("file", fileZip)
.tag(this)
.execute(new DialogCallback<OtherUploadPicBean>(OtherUploadPicBean.class) {
@Override
@ -423,14 +442,13 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
public void onError(Response<OtherUploadPicBean> response) {
super.onError(response);
dismissLoadingDialog();
Toast.makeText(getActivity(), response.code()+"", Toast.LENGTH_SHORT).show();
Log.d("TAG", "onError: " + response.code()+"");
Toast.makeText(getActivity(), response.code() + "", Toast.LENGTH_SHORT).show();
Log.d("TAG", "onError: " + response.code() + "");
}
});
}
private void poiVideoSave(PoiEntity poiEntity,boolean isLocal) {
private void roadSaveBetWork(PoiEntity poiEntity, boolean isLocal) {
showLoadingDialog();
int pictureType = getPictureType();
if (pictureType == -1) {
@ -445,15 +463,16 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
httpParams.put("memo", poiEntity.getMemo());
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.INSIDE_API_LIST)
.url(HttpInterface.ROAD_TASK_SUBMIT)
.method(OkGoBuilder.GET)
.cls(PoiVideoBean.class)
.callback(new Callback<PoiVideoBean>() {
.cls(RoadSaveBean.class)
.params(httpParams)
.callback(new Callback<RoadSaveBean>() {
@Override
public void onSuccess(PoiVideoBean poiVideoBean, int id) {
public void onSuccess(RoadSaveBean roadSaveBean, int id) {
dismissLoadingDialog();
Integer body = poiVideoBean.getBody();
poiEntity.setBodyId(body);
Integer poiVideoBody = roadSaveBean.getBody();
poiEntity.setBodyId(poiVideoBody);
poiEntity.setTaskStatus(3);
new Thread(new Runnable() {
@Override
@ -462,12 +481,11 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (isLocal){
poiVideoUpload(body,fileZip);
}else {
if (isLocal) {
poiVideoUpload(poiVideoBody, fileZip);
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
}
}
});
}
@ -482,7 +500,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
}
@Override
@ -499,6 +516,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
}
}
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
@ -590,14 +608,14 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
@Override
public void onDestroy() {
super.onDestroy();
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity!=null&&poiDaoPoiEntity.getName() == null) {
poiDao.deletePoiEntity(poiDaoPoiEntity);
}
}
}).start();
// new Thread(new Runnable() {
// @Override
// public void run() {
// PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
// if (poiDaoPoiEntity!=null&&poiDaoPoiEntity.getName() == null) {
// poiDao.deletePoiEntity(poiDaoPoiEntity);
// }
// }
// }).start();
}
}

View File

@ -97,33 +97,13 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
staySubmitAdapter.notifyDataSetChanged();
}
});
refreshData();
}
@Override
protected void initData() {
super.initData();
roadDatabase = PoiDatabase.getInstance(getContext());
roadDao = roadDatabase.getPoiDao();
roadEntities = new ArrayList<>();
newEntities = new ArrayList<>();
new Thread(new Runnable() {
@Override
public void run() {
List<PoiEntity> roadAll = roadDao.getAllPoi();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("TAG", "run: " + roadEntities.toString());
roadEntities.clear();
roadEntities.addAll(roadAll);
staySubmitAdapter.setAllRoad(roadEntities);
staySubmitAdapter.notifyDataSetChanged();
}
});
}
}).start();
}
// @Override
// protected void initData() {
// super.initData();
// }
public List<PoiEntity> initRoadWord(int type){
newEntities.clear();
@ -196,7 +176,31 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
}
}
public void refreshData() {
roadDatabase = PoiDatabase.getInstance(getContext());
roadDao = roadDatabase.getPoiDao();
if (roadEntities ==null) {
roadEntities = new ArrayList<>();
}
if (newEntities == null) {
newEntities = new ArrayList<>();
}
new Thread(new Runnable() {
@Override
public void run() {
List<PoiEntity> roadAll = roadDao.getAllPoi();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("TAG", "run: " + roadEntities.toString());
roadEntities.clear();
roadEntities.addAll(roadAll);
staySubmitAdapter.setAllRoad(roadEntities);
}
});
}
}).start();
}
}

View File

@ -19,6 +19,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentTransaction;
@ -103,13 +104,18 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
private FrameLayout frameLayout;
private GatherGetFragment gatherGetFragment;
private LinearLayout dragView;
private ImageView ivMessage;
public ImageView ivMessage;
private PoiDao poiDao;
private ChargingPileEntity chargingPileEntity;
private String userEncode;
private String centerEncode;
private List<Removable> removables;
private List<Removable> removablesLocality;
/**
* bitmapDescriptor1
*/
private BitmapDescriptor bitmapDescriptor1, bitmapDescriptor2, bitmapDescriptor3, bitmapDescriptor4, bitmapDescriptor5;
public static TreasureFragment newInstance(Bundle bundle) {
TreasureFragment fragment = new TreasureFragment();
@ -126,6 +132,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
@Override
protected void initView() {
super.initView();
bitmapDescriptor1 = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg);
bitmapDescriptor2 = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
bitmapDescriptor3 = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
bitmapDescriptor4 = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg);
bitmapDescriptor5 = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg);
EventBus.getDefault().register(this);
//fragment 管理器
supportFragmentManager = getActivity().getSupportFragmentManager();
@ -144,7 +156,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
ivMessage.setOnClickListener(this::onClick);
treasureMap = (MapView) findViewById(R.id.treasure_map);
tencentMap = treasureMap.getMap();
// if (getClass().getCanonicalName().equals("PioFragment")){
// ivMessage.setVisibility(View.VISIBLE);
// }else {
// ivMessage.setVisibility(View.GONE);
// }
cbMapType = (CheckBox) findViewById(R.id.cb_map_type);
cbFootType = (CheckBox) findViewById(R.id.cb_foot_type);
// sliding_layout.setScrollableViewHelper(new NestedScrollableViewHelper());
@ -351,7 +367,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
switch (Integer.valueOf(list.get(i).getType())) {
case 1://poi
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg);
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.7f)
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
poiMarker.setTag(listBean);
@ -360,7 +376,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
case 2://充电站
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg);
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.7f)
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
stationMarker.setTag(listBean);
@ -369,7 +385,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
case 3://poi录像
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.7f)
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
poiVideoMarker.setTag(listBean);
@ -378,7 +394,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
case 4://道路录像
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.7f)
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
roadMarker.setTag(listBean);
@ -387,7 +403,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
case 5://其他
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg);
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.7f)
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
otherMarker.setTag(listBean);
@ -395,8 +411,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
otherMarker.setClickable(true);
break;
case 6://面状任务
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg);
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.7f)
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
Log.d("面妆任务", "onSuccess: " + planarMarker);
@ -505,7 +521,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
switch (Integer.valueOf(poiEntity.getType())) {
case 1://poi
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_have_bg);
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.7f)
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
poiMarker.setClickable(true);
@ -515,7 +531,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
case 2://充电站
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_have_bg);
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.7f)
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
stationMarker.setClickable(true);
@ -525,7 +541,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
case 3://poi录像
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_have_bg);
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.7f)
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
poiVideoMarker.setClickable(true);
@ -535,7 +551,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
case 4://道路录像
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_have_bg);
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.7f)
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
roadMarker.setClickable(true);
@ -545,7 +561,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
case 5://其他
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bg);
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.7f)
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
otherMarker.setClickable(true);
@ -555,7 +571,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
case 6://面状任务
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bg);
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.7f)
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
.clockwise(false)
.flat(true));
planarMarker.setClickable(true);
@ -695,10 +711,24 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
gatherGetFragment = GatherGetFragment.newInstance(bundle);
fragmentTransaction.replace(R.id.frame_layout, gatherGetFragment);
fragmentTransaction.commit();
} else if (data.what == Constant.GATHER_GET) { //删选item 点击开始采集
// 如果当前fragment是筛选则移除该fragment
FilterFragment filterFragment = (FilterFragment) supportFragmentManager.findFragmentByTag(FilterFragment.class.getName());
if (filterFragment != null) {
fragmentTransaction.remove(filterFragment);
fragmentTransaction.commit();
}
} else if (data.what == Constant.GATHER_GET) { //筛选item 点击开始采集
// 如果当前fragment是筛选则移除该fragment
FilterFragment filterFragment = (FilterFragment) supportFragmentManager.findFragmentByTag(FilterFragment.class.getName());
if (filterFragment != null) {
fragmentTransaction.remove(filterFragment);
fragmentTransaction.commit();
}
PoiEntity poiEntity = (PoiEntity) data.obj;
Bundle bundle = new Bundle();
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
bundle.putBoolean("isSliding", true); // 通知抽屉不收回
bundle.putSerializable("poiEntity", poiEntity);
switch (poiEntity.getType()) {
case 1:
@ -728,7 +758,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
PoiEntity poiEntity = (PoiEntity) data.obj;
Bundle bundle = new Bundle();
bundle.putSerializable("poiEntity", poiEntity);
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
bundle.putBoolean("isSliding", true); // 通知抽屉不收回
switch (poiEntity.getType()) {
case 1:
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
@ -845,6 +875,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
removablesLocality.clear();
initThread();// 查询本地数据库
initList(Constant.currentLocation);//网络数据
} else if (data.what == Constant.EVENT_WHAT_CURRENT_MARKER) {
LatLng latLng = (LatLng) data.obj;
int type = data.arg1;
showPoiMarkerByType(type, latLng);
}
}
@ -885,7 +919,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
screenPosition = tencentMap.getProjection().toScreenLocation(latLng);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
//创建Marker对象之前设置属性
markerPoi.setFixingPoint(screenPosition.x, screenPosition.y);
if (markerPoi!=null){
markerPoi.setFixingPoint(screenPosition.x, screenPosition.y);
}
}
@Override
@ -970,12 +1007,14 @@ 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();
}
@ -1029,7 +1068,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
break;
case R.id.iv_submit://弹窗
//分享
CharSequence title = "请选择上报类型";
DialogSettings.style = DialogSettings.STYLE.STYLE_MIUI;
@ -1039,11 +1077,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_road, "道路"));
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_chongdianzhuang, "充电站"));
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_qingbao, "其他"));
if (!ivSubmit.isClickable()){
ivMessage.setVisibility(View.VISIBLE);
}else {
ivMessage.setVisibility(View.GONE);
}
Bundle bundle = new Bundle();
PoiEntity poiEntity = new PoiEntity();
LatLng mapCenterPoint = getMapCenterPoint();
@ -1053,17 +1087,16 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
@Override
public boolean onClick(ShareDialog shareDialog, int index, ShareDialog.Item item) {
switch (index) {
case 0:
case 0: // POI
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
// InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
bundle.putSerializable("poiEntity", poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg);
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(poiDescriptor));
showPoiMarkerByType(1, mapCenterPoint);
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
showSlidingFragment(poiFragment);
}
@ -1071,17 +1104,17 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
}).start();
break;
case 1:
case 1: // POI录像
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
// InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
bundle.putSerializable("poiEntity", poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(poiVideoDescriptor));
showPoiMarkerByType(2, mapCenterPoint);
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
showSlidingFragment(poiVideoFragment);
}
@ -1090,18 +1123,17 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}).start();
break;
case 2:
case 2://道路录像
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
// InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
bundle.putSerializable("poiEntity", poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
bundle.putSerializable("poiEntity", poiEntity);
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(roadDescriptor));
showPoiMarkerByType(3, mapCenterPoint);
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
showSlidingFragment(roadFragment);
}
@ -1109,7 +1141,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
}).start();
break;
case 3:
case 3://充电站
new Thread(new Runnable() {
@Override
public void run() {
@ -1118,8 +1150,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg);
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(chargeDescriptor));
showPoiMarkerByType(4, mapCenterPoint);
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
showSlidingFragment(chargingStationFragment);
}
@ -1127,24 +1158,22 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
}).start();
break;
case 4:
case 4://其他
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
// InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
bundle.putSerializable("poiEntity", poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg);
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(otherDescriptor));
showPoiMarkerByType(5, mapCenterPoint);
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
showSlidingFragment(otherFragment);
}
});
}
}).start();
break;
}
return false;
@ -1165,6 +1194,21 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
}
private void showPoiMarkerByType(int type, LatLng latLng) {
if (type == 1) {
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor1));
}else if (type == 2){
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor2));
}else if (type == 3){
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor3));
}else if (type == 4){
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor4));
}else if (type == 5){
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor5));
}
}
/**
* header 头部布局
*

View File

@ -64,6 +64,8 @@ public class HttpInterface {
public static final String RECEIVED_POI_VIDEO_TASK = IPm6 + "poivideotask/1/receivedPoivideotask";//poi录像任务获取
// 172.23.139.4:8003/poivideotask/1/submitPoivideotask
public static final String INSIDE_API_LIST = IPm6 + "poivideotask/1/submitPoivideotask";//poi录像 保存
//172.23.139.4:8003/roadtask/1/submitRoadtask?taskId=0&name=段哥&address=二娃&memo=1rn7exd5uhxy&workType=2
public static final String ROAD_TASK_SUBMIT = IPm6+"roadtask/1/submitRoadtask";
//172.23.139.4:8003/poivideotask/1/uploadpic
public static final String POI_VIDEO_UPLOAD_PIC = IPm6 + "poivideotask/1/uploadpic";//poi录像-上传
//http://172.23.139.4:8003/m4/task/1/getPhone?geo=1rn7exd5uhxy

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#AFADAD"
android:viewportHeight="24" android:viewportWidth="30"
android:width="28dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -41,7 +41,6 @@
android:text="用户名"
app:layout_constraintLeft_toLeftOf="@id/tv_login_deck"
app:layout_constraintTop_toBottomOf="@id/tv_login_deck" />
<EditText
android:id="@+id/et_login_name"
android:layout_width="match_parent"
@ -51,13 +50,19 @@
android:paddingBottom="20dp"
android:layout_marginRight="35dp"
android:layout_marginLeft="35dp"
style="@style/register_hint_style"
android:textColorHint="@color/colorTransparent"
android:textCursorDrawable="@drawable/text_color"
android:theme="@style/MyEditText"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/login_name"
app:layout_constraintLeft_toLeftOf="@id/login_name"
app:layout_constraintTop_toBottomOf="@id/login_name" />
<View
android:layout_width="300dp"
android:layout_height="1dp"
android:background="@color/colorHui"
app:layout_constraintTop_toBottomOf="@id/et_login_name"
app:layout_constraintLeft_toLeftOf="@id/et_login_name"/>
<TextView
android:id="@+id/login_paw"
@ -68,23 +73,31 @@
android:text="密码"
app:layout_constraintLeft_toLeftOf="@id/et_login_name"
app:layout_constraintTop_toBottomOf="@id/et_login_name" />
<EditText
android:id="@+id/et_login_paw"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="35dp"
android:layout_marginLeft="35dp"
android:layout_marginTop="8dp"
android:hint=" 请输入密码"
android:paddingBottom="15dp"
android:layout_marginRight="35dp"
android:layout_marginLeft="35dp"
style="@style/register_hint_style"
android:textColorHint="@color/colorTransparent"
android:textCursorDrawable="@drawable/text_color"
android:theme="@style/MyEditText"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="@id/login_paw"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/login_paw" />
app:layout_constraintTop_toBottomOf="@id/login_paw" />
<View
android:layout_width="300dp"
android:layout_height="1dp"
android:background="@color/colorHui"
app:layout_constraintTop_toBottomOf="@id/et_login_paw"
app:layout_constraintLeft_toLeftOf="@id/et_login_paw"/>
<CheckBox
android:id="@+id/iv_login_check"

View File

@ -51,7 +51,7 @@
android:textColor="@color/black"
android:textSize="15sp" />
<EditText
<TextView
android:id="@+id/et_road_name"
android:layout_width="200dp"
android:layout_height="match_parent"

View File

@ -56,8 +56,8 @@
android:id="@+id/image_share"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:layout_marginRight="15dp"
android:background="@drawable/shares"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -77,10 +77,12 @@
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginLeft="35dp"
android:layout_marginTop="95dp"
android:layout_marginRight="35dp"
app:layout_constraintBottom_toTopOf="@+id/linearLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/constraintLayout">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@ -154,10 +156,11 @@
android:text="我的等级" />
<TextView
android:layout_width="wrap_content"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:drawableRight="@drawable/ic_baseline_arrow_forward"
android:layout_marginRight="0dp"
android:drawableRight="@drawable/ic_baseline_navigate"
android:gravity="center"
android:text="LV.1"
android:textSize="16sp" />
@ -199,7 +202,7 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_baseline_arrow_forward"
android:background="@drawable/ic_baseline_navigate"
android:gravity="center"
android:textSize="18sp" />
</RelativeLayout>
@ -228,7 +231,7 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_baseline_arrow_forward"
android:background="@drawable/ic_baseline_navigate"
android:textSize="18sp" />
</RelativeLayout>
@ -256,7 +259,7 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_baseline_arrow_forward"
android:background="@drawable/ic_baseline_navigate"
android:textSize="18sp" />
</RelativeLayout>
@ -284,7 +287,7 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_baseline_arrow_forward"
android:background="@drawable/ic_baseline_navigate"
android:textSize="18sp" />
</RelativeLayout>
@ -312,7 +315,7 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_baseline_arrow_forward"
android:background="@drawable/ic_baseline_navigate"
android:textSize="18sp" />
</RelativeLayout>
@ -339,7 +342,7 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/ic_baseline_arrow_forward"
android:background="@drawable/ic_baseline_navigate"
android:textSize="18sp" />
</RelativeLayout>