任务搜索 请求接口,以及数据的显示
This commit is contained in:
parent
286b9dfc89
commit
c6a76059ae
@ -51,6 +51,7 @@ dependencies {
|
||||
implementation 'androidx.navigation:navigation-fragment:2.1.0'
|
||||
implementation 'androidx.navigation:navigation-ui:2.1.0'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation files('libs\\jts-1.13.jar')
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
BIN
app/libs/jts-1.13.jar
Normal file
BIN
app/libs/jts-1.13.jar
Normal file
Binary file not shown.
@ -44,7 +44,6 @@ public class Constant {
|
||||
public static final int FILTER_LIST = 4;//筛选列表所有数据地图显示
|
||||
public static final int FILTER_LIST_ITEM = 5;//点击筛选的item
|
||||
public static final int GATHER_GET = 6;//点击开始采集
|
||||
public static final int GATHER_IS_SLIDING_GET =2;//通知抽屉不收回
|
||||
public static final int TREASURE_GATHER_GET_WORD = 7;//领取采集页面其他marker 的回传
|
||||
public static final int MAIN_BUTTON_VISIABLE = 8; // 控制主界面各个按钮显隐状态的what值
|
||||
public static final int MAIN_HEADER = 9; // 控制主界面各个header
|
||||
@ -62,6 +61,10 @@ public class Constant {
|
||||
|
||||
|
||||
public static String USER_ATTESTATION_NAME; //实名认证姓名 银行卡
|
||||
public static int NUMBER =200; //任务个数
|
||||
public static String PHOTOGRAPH ="全部"; //任务类型
|
||||
public static String EXCLUSIVE ="全部";
|
||||
public static String TYPE ="全部";
|
||||
/**
|
||||
* 用户当前位置
|
||||
*/
|
||||
|
@ -8,6 +8,9 @@ import android.os.Bundle;
|
||||
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
@ -15,6 +18,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.UserApplication;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
|
||||
@ -69,16 +73,16 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
return false;
|
||||
});
|
||||
//loading样式
|
||||
//View view = LayoutInflater.from(this).inflate(R.layout.loading_alert, null);
|
||||
//alertDialog.setView(view);
|
||||
View view = LayoutInflater.from(this).inflate(R.layout.loading, null);
|
||||
alertDialog.setView(view);
|
||||
alertDialog.setCanceledOnTouchOutside(false);
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
public void setLoadingDialogText(String s) {
|
||||
//给loading 添加文字
|
||||
/* TextView view = alertDialog.findViewById(R.id.progressBar_tx);
|
||||
view.setText(s);*/
|
||||
TextView view = alertDialog.findViewById(R.id.progressBar_tx);
|
||||
view.setText(s);
|
||||
}
|
||||
|
||||
public void dismissLoadingDialog() {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.navinfo.outdoor.base;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
|
||||
@ -7,14 +8,19 @@ import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.kongzue.dialog.interfaces.OnBackClickListener;
|
||||
import com.kongzue.dialog.v3.WaitDialog;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.util.BackHandlerHelper;
|
||||
import com.navinfo.outdoor.util.FragmentBackHandler;
|
||||
|
||||
@ -66,16 +72,16 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
|
||||
|
||||
});
|
||||
//loading样式
|
||||
//View view = LayoutInflater.from(this).inflate(R.layout.loading, null);
|
||||
//alertDialog.setView(view);
|
||||
View view = LayoutInflater.from(getActivity()).inflate(R.layout.loading, null);
|
||||
alertDialog.setView(view);
|
||||
alertDialog.setCanceledOnTouchOutside(false);
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
public void setLoadingDialogText(String s) {
|
||||
//给loading 添加文字
|
||||
/* TextView view = alertDialog.findViewById(R.id.progressBar_tx);
|
||||
view.setText(s);*/
|
||||
TextView view = alertDialog.findViewById(R.id.progressBar_tx);
|
||||
view.setText(s);
|
||||
}
|
||||
|
||||
public void dismissLoadingDialog() {
|
||||
|
226
app/src/main/java/com/navinfo/outdoor/bean/JobSearchBean.java
Normal file
226
app/src/main/java/com/navinfo/outdoor/bean/JobSearchBean.java
Normal file
@ -0,0 +1,226 @@
|
||||
package com.navinfo.outdoor.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JobSearchBean {
|
||||
/**
|
||||
* status : 0
|
||||
* msg : 成功
|
||||
* body : {"pageNum":0,"list":[{"id":0,"name":"","address":"http://10.130.23.166:8080/cbt/img/blue.png","telephone":11,"geo":"标题11","price":"通过","type":"","dist":""}],"total":100,"pageSize":10,"totalPage":0}
|
||||
* upload : []
|
||||
*/
|
||||
|
||||
private int status;
|
||||
private String msg;
|
||||
private BodyBean body;
|
||||
private List<?> upload;
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public BodyBean getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(BodyBean body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public List<?> getUpload() {
|
||||
return upload;
|
||||
}
|
||||
|
||||
public void setUpload(List<?> upload) {
|
||||
this.upload = upload;
|
||||
}
|
||||
|
||||
public static class BodyBean {
|
||||
/**
|
||||
* pageNum : 0
|
||||
* list : [{"id":0,"name":"","address":"http://10.130.23.166:8080/cbt/img/blue.png","telephone":11,"geo":"标题11","price":"通过","type":"","dist":""}]
|
||||
* total : 100
|
||||
* pageSize : 10
|
||||
* totalPage : 0
|
||||
*/
|
||||
|
||||
private int pageNum;
|
||||
private int total;
|
||||
private int pageSize;
|
||||
private int totalPage;
|
||||
private List<ListBean> list;
|
||||
|
||||
public int getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public void setPageNum(int pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public int getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(int total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public int getTotalPage() {
|
||||
return totalPage;
|
||||
}
|
||||
|
||||
public void setTotalPage(int totalPage) {
|
||||
this.totalPage = totalPage;
|
||||
}
|
||||
|
||||
public List<ListBean> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<ListBean> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public static class ListBean {
|
||||
/**
|
||||
* id : 0
|
||||
* name :
|
||||
* address : http://10.130.23.166:8080/cbt/img/blue.png
|
||||
* telephone : 11
|
||||
* geo : 标题11
|
||||
* price : 通过
|
||||
* type :
|
||||
* dist :
|
||||
*/
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private String address;
|
||||
private int telephone;
|
||||
private String geo;
|
||||
private String price;
|
||||
private String type;
|
||||
private String dist;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public int getTelephone() {
|
||||
return telephone;
|
||||
}
|
||||
|
||||
public void setTelephone(int telephone) {
|
||||
this.telephone = telephone;
|
||||
}
|
||||
|
||||
public String getGeo() {
|
||||
return geo;
|
||||
}
|
||||
|
||||
public void setGeo(String geo) {
|
||||
this.geo = geo;
|
||||
}
|
||||
|
||||
public String getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(String price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getDist() {
|
||||
return dist;
|
||||
}
|
||||
|
||||
public void setDist(String dist) {
|
||||
this.dist = dist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ListBean{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", address='" + address + '\'' +
|
||||
", telephone=" + telephone +
|
||||
", geo='" + geo + '\'' +
|
||||
", price='" + price + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
", dist='" + dist + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BodyBean{" +
|
||||
"pageNum=" + pageNum +
|
||||
", total=" + total +
|
||||
", pageSize=" + pageSize +
|
||||
", totalPage=" + totalPage +
|
||||
", list=" + list +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "JobSearchBean{" +
|
||||
"status=" + status +
|
||||
", msg='" + msg + '\'' +
|
||||
", body=" + body +
|
||||
", upload=" + upload +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -52,6 +52,7 @@ import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -72,7 +73,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
private EditText editDescribe, editNameContent;
|
||||
private Button btnSaveLocal;
|
||||
private PoiDatabase poiDatabase;
|
||||
private String inode;
|
||||
private CheckBox checkBoxLife, checkBoxRight;
|
||||
private Spinner spinnerType, spinnerScutcheon, spinnerStake;
|
||||
String[] type = new String[]{"地上五层", "地上四层", "地上三层", "地上二层", "地上一层", "地下一层", "地下二层", "地下三层", "地下四层", "地下五层"};
|
||||
@ -88,6 +88,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
private CheckBox checkButton1, checkButton2, checkButton3, checkButton4, checkButton5, checkButton6;
|
||||
private int pid;
|
||||
private String station;
|
||||
private LatLng latLng;
|
||||
|
||||
public static ChargingPileFragment newInstance(Bundle bundle) {
|
||||
ChargingPileFragment fragment = new ChargingPileFragment();
|
||||
@ -381,7 +382,10 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
String p = chargingPileEntity.getP();
|
||||
if (p != null) {
|
||||
inode = p;
|
||||
String[] split = p.split(",");
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(Double.parseDouble(split[0]));
|
||||
latLng.setLongitude(Double.parseDouble(split[1]));
|
||||
}
|
||||
String memo = chargingPileEntity.getMemo();
|
||||
if (memo != null) {
|
||||
@ -516,8 +520,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
if (data.what == Constant.CHARGING_PILE_WORD) {
|
||||
inode = data.obj.toString();
|
||||
Toast.makeText(getContext(), inode, Toast.LENGTH_SHORT).show();
|
||||
latLng = (LatLng) data.obj;
|
||||
}
|
||||
}
|
||||
|
||||
@ -535,11 +538,11 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
//保存数据库:
|
||||
ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
|
||||
ArrayList<String> photoBean = new ArrayList<>();
|
||||
if (inode == null || inode.equals("")) {
|
||||
if (latLng == null || latLng.equals("")) {
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
chargingPileEntity.setP(inode);
|
||||
chargingPileEntity.setP(latLng.latitude+","+latLng.longitude);
|
||||
}
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name == null || name.equals("")) {
|
||||
@ -736,8 +739,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
//根据要保存的数据的类型,调用对应的put方法,
|
||||
ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
|
||||
ArrayList<String> photo = new ArrayList<>();
|
||||
if (inode != null) {
|
||||
chargingPileEntity.setP(inode);
|
||||
if (latLng != null) {
|
||||
chargingPileEntity.setP(latLng.latitude+","+latLng.longitude);
|
||||
}
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name != null ||!name.equals("")) {
|
||||
|
@ -52,6 +52,7 @@ import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -84,10 +85,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
private Button btnUploading;
|
||||
private PoiDatabase poiDatabase;
|
||||
private PoiDao poiDao;
|
||||
private String inode;
|
||||
private CheckBox checkBoxLife;
|
||||
private CheckBox checkBoxRight;
|
||||
private String phone=null;
|
||||
private String phone = null;
|
||||
private Spinner spinnerType;
|
||||
String[] ctype = new String[]{"全部", "poi", "道路", "充电站", "其他"};
|
||||
private ArrayAdapter<String> adapter;
|
||||
@ -98,6 +98,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
private boolean aBoolean = false;
|
||||
private PoiEntity showPoiEntity;
|
||||
private ChargingPileDao chargingPileDao;
|
||||
private LatLng latLng;
|
||||
|
||||
public static ChargingStationFragment newInstance(Bundle bundle) {
|
||||
ChargingStationFragment fragment = new ChargingStationFragment();
|
||||
@ -228,8 +229,10 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {}
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
}
|
||||
});
|
||||
//添加桩
|
||||
linearChargingPile = findViewById(R.id.linear_charging_pile);
|
||||
@ -316,7 +319,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
String x = showPoiEntity.getX();
|
||||
String y = showPoiEntity.getY();
|
||||
if (x != null && y != null) {
|
||||
inode = x + "," + y;
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(Double.parseDouble(y));
|
||||
latLng.setLongitude(Double.parseDouble(x));
|
||||
}
|
||||
String describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null) {
|
||||
@ -381,7 +386,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
//根据保存时所用的name属性,获取SharedPreferences对象
|
||||
SharedPreferences dataFile = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||
String pileFileString = dataFile.getString("chargingPileEntity", null);
|
||||
if (pileFileString!=null){
|
||||
if (pileFileString != null) {
|
||||
ChargingPileEntity chargingPileEntity = new Gson().fromJson(pileFileString, ChargingPileEntity.class);
|
||||
Message obtains = Message.obtain();
|
||||
obtains.what = Constant.CHARGING_STATION_PILE;
|
||||
@ -410,6 +415,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
//提交新值。必须执行,否则前面的操作都无效。
|
||||
edit.commit();
|
||||
}
|
||||
|
||||
//禁用所有可操作性控件
|
||||
private void disables() {
|
||||
checkBoxLife.setEnabled(false);
|
||||
@ -438,8 +444,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
if (data.what == Constant.CHARGING_STATION_WORD) {
|
||||
inode = data.obj.toString();
|
||||
Toast.makeText(getContext(), inode, Toast.LENGTH_SHORT).show();
|
||||
latLng = (LatLng) data.obj;
|
||||
} else if (data.what == Constant.CHARGING_PILE_STATION) {
|
||||
ChargingPileEntity chargingPileEntity = (ChargingPileEntity) data.obj;
|
||||
ArrayList<ChargingPileEntity> chargingPileEntities = new ArrayList<>();
|
||||
@ -477,13 +482,12 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
} else {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (inode == null || inode.equals("")) {
|
||||
if (latLng == null) {
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
String[] split = inode.split(",");
|
||||
poiEntity.setX(split[0]);
|
||||
poiEntity.setY(split[1]);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe == null || describe.equals("")) {
|
||||
@ -521,7 +525,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
infoPhoto.add(new Info(tagInternal));
|
||||
}
|
||||
String tagElse = (String) ivElse.getTag();
|
||||
if (tagElse == null ) {
|
||||
if (tagElse == null) {
|
||||
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
@ -557,7 +561,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiEntity.setTaskId(allPoi.size()+1);
|
||||
poiEntity.setTaskId(allPoi.size() + 1);
|
||||
}
|
||||
});
|
||||
poiDao.insertPoiEntity(poiEntity);
|
||||
@ -630,10 +634,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
if (site != null || !site.equals("")) {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (inode != null) {
|
||||
String[] split = inode.split(",");
|
||||
poiEntity.setX(split[0]);
|
||||
poiEntity.setY(split[1]);
|
||||
if (latLng != null) {
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe != null || !describe.equals("")) {
|
||||
@ -659,7 +662,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
infoPhoto.add(new Info(tagElse));
|
||||
}
|
||||
String tagScutcheon = (String) ivScutcheon.getTag();
|
||||
if (tagScutcheon != null ) {
|
||||
if (tagScutcheon != null) {
|
||||
infoPhoto.add(new Info(tagScutcheon));
|
||||
}
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
@ -678,7 +681,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiEntity.setTaskId(allPoi.size()+1);
|
||||
poiEntity.setTaskId(allPoi.size() + 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -716,10 +719,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
if (site != null || !site.equals("")) {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (inode != null) {
|
||||
String[] split = inode.split(",");
|
||||
poiEntity.setX(split[0]);
|
||||
poiEntity.setY(split[1]);
|
||||
if (latLng != null) {
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe != null || !describe.equals("")) {
|
||||
@ -745,7 +747,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
infoPhoto.add(new Info(tagElse));
|
||||
}
|
||||
String tagScutcheon = (String) ivScutcheon.getTag();
|
||||
if (tagScutcheon != null ) {
|
||||
if (tagScutcheon != null) {
|
||||
infoPhoto.add(new Info(tagScutcheon));
|
||||
}
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
@ -764,7 +766,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiEntity.setTaskId(allPoi.size()+1);
|
||||
poiEntity.setTaskId(allPoi.size() + 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -208,6 +208,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
@Override
|
||||
public void onClick(String text, int index) {
|
||||
tvNumber.setText(text);
|
||||
Constant.NUMBER=Integer.getInteger(text);
|
||||
}
|
||||
});
|
||||
break;
|
||||
@ -216,7 +217,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
@Override
|
||||
public void onClick(String text, int index) {
|
||||
tvPhotograph.setText(text);
|
||||
|
||||
Constant.PHOTOGRAPH=text;
|
||||
}
|
||||
});
|
||||
break;
|
||||
@ -225,6 +226,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
@Override
|
||||
public void onClick(String text, int index) {
|
||||
tvExclusive.setText(text);
|
||||
Constant.EXCLUSIVE=text;
|
||||
}
|
||||
});
|
||||
break;
|
||||
@ -233,6 +235,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
@Override
|
||||
public void onClick(String text, int index) {
|
||||
tvType.setText(text);
|
||||
Constant.TYPE=text;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -62,8 +63,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
|
||||
|
||||
private Spinner spinnerOther;
|
||||
String[] others = new String[]{ "门牌", "道路施工", "标牌采集", "公交", "其他"};
|
||||
private String inode;
|
||||
String[] others = new String[]{"门牌", "道路施工", "标牌采集", "公交", "其他"};
|
||||
private EditText editTaskName, editOtherDescribe;
|
||||
private RelativeLayout rlPicture;
|
||||
private ImageView ivPicture;
|
||||
@ -74,6 +74,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
private PoiDatabase poiDatabase;
|
||||
private PoiDao poiDao;
|
||||
private PoiEntity showPoiEntity;
|
||||
private LatLng latLng;
|
||||
|
||||
public static OtherFragment newInstance(Bundle bundle) {
|
||||
OtherFragment fragment = new OtherFragment();
|
||||
@ -195,8 +196,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
if (data.what == Constant.OTHER_WORD) {
|
||||
inode = data.obj.toString();
|
||||
Toast.makeText(getContext(), inode, Toast.LENGTH_SHORT).show();
|
||||
latLng = (LatLng) data.obj;
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,15 +210,20 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||
if (showPoiEntity != null) {
|
||||
String name = showPoiEntity.getName();//名称
|
||||
if (name != null ) {
|
||||
editTaskName.setText(name + ""); }
|
||||
if (name != null) {
|
||||
editTaskName.setText(name + "");
|
||||
}
|
||||
String x = showPoiEntity.getX();
|
||||
String y = showPoiEntity.getY();
|
||||
if (x != null && y != null) {
|
||||
inode = x + "," + y; }
|
||||
latLng = new LatLng();
|
||||
latLng.setLongitude(Double.parseDouble(x));
|
||||
latLng.setLatitude(Double.parseDouble(y));
|
||||
}
|
||||
String describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null) {
|
||||
editOtherDescribe.setText(describe); }
|
||||
editOtherDescribe.setText(describe);
|
||||
}
|
||||
if (showPoiEntity.getPhotoInfo() != null) {
|
||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||
String photo = showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||
@ -268,13 +273,12 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
|
||||
if (inode == null || inode.equals("")) {
|
||||
if (latLng == null) {
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
String[] split = inode.split(",");
|
||||
poiEntity.setX(split[0]);
|
||||
poiEntity.setY(split[1]);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editOtherDescribe.getText().toString().trim();
|
||||
if (describe == null || describe.equals("")) {
|
||||
@ -291,7 +295,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
infoList.add(new Info(tagPicture));
|
||||
}
|
||||
String tagPictures = (String) ivPictures.getTag();
|
||||
if (tagPictures == null ) {
|
||||
if (tagPictures == null) {
|
||||
Toast.makeText(getActivity(), "请 拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
@ -353,10 +357,9 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
|
||||
if (inode != null) {
|
||||
String[] split = inode.split(",");
|
||||
poiEntity.setX(split[0]);
|
||||
poiEntity.setY(split[1]);
|
||||
if (latLng != null) {
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editOtherDescribe.getText().toString().trim();
|
||||
if (describe != null || !describe.equals("")) {
|
||||
@ -367,7 +370,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
arrayList.add(new Info(tagPicture));
|
||||
}
|
||||
String tagPictures = (String) ivPictures.getTag();
|
||||
if (tagPictures!= null) {
|
||||
if (tagPictures != null) {
|
||||
arrayList.add(new Info(tagPictures));
|
||||
}
|
||||
poiEntity.setPhotoInfo(arrayList);
|
||||
|
@ -46,6 +46,7 @@ import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -78,10 +79,10 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
private Button btnUploading;
|
||||
private PoiDatabase poiDatabase;
|
||||
private PoiDao poiDao;
|
||||
private String inode;
|
||||
private CheckBox checkBoxLife;
|
||||
private CheckBox checkBoxRight;
|
||||
private PoiEntity showPoiEntity;
|
||||
private LatLng latLng;
|
||||
|
||||
public static PoiFragment newInstance(Bundle bundle) {
|
||||
PoiFragment fragment = new PoiFragment();
|
||||
@ -232,7 +233,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
String x = showPoiEntity.getX();
|
||||
String y = showPoiEntity.getY();
|
||||
if (x != null && y != null) {
|
||||
inode = x + "," + y;
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(Double.parseDouble(y));
|
||||
latLng.setLongitude(Double.parseDouble(x));
|
||||
}
|
||||
String describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null) {
|
||||
@ -303,8 +306,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
if (data.what == Constant.POI_WORD) {
|
||||
inode = data.obj.toString();
|
||||
Toast.makeText(getContext(), inode, Toast.LENGTH_SHORT).show();
|
||||
latLng = (LatLng) data.obj;
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,13 +338,12 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
} else {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (inode == null || inode.equals("")) {
|
||||
if (latLng == null) {
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
String[] split = inode.split(",");
|
||||
poiEntity.setX(split[0]);
|
||||
poiEntity.setY(split[1]);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe == null || describe.equals("")) {
|
||||
@ -476,10 +477,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
if (site != null || !site.equals("")) {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (inode!=null) {
|
||||
String[] split = inode.split(",");
|
||||
poiEntity.setX(split[0]);
|
||||
poiEntity.setY(split[1]);
|
||||
if (latLng != null) {
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe!= null || !describe.equals("")) {
|
||||
|
@ -4,6 +4,7 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Point;
|
||||
import android.location.Location;
|
||||
@ -34,15 +35,23 @@ import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.kongzue.dialog.v3.ShareDialog;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.bean.JobSearchBean;
|
||||
import com.navinfo.outdoor.bean.NameAuthenticationBean;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.GeometryTools;
|
||||
import com.navinfo.outdoor.util.NetWorkUtils;
|
||||
import com.navinfo.outdoor.util.ToastUtil;
|
||||
import com.sothree.slidinguppanel.ScrollableViewHelper;
|
||||
@ -55,15 +64,23 @@ import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.LocationSource;
|
||||
import com.tencent.tencentmap.mapsdk.maps.MapView;
|
||||
import com.tencent.tencentmap.mapsdk.maps.Projection;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||
import com.tencent.tencentmap.mapsdk.maps.UiSettings;
|
||||
import com.tencent.tencentmap.mapsdk.maps.interfaces.Removable;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLngBounds;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Polygon;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.PolygonOptions;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -100,6 +117,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
private ImageView ivMessage;
|
||||
private PoiDao poiDao;
|
||||
private ChargingPileEntity chargingPileEntity;
|
||||
private String userEncode;
|
||||
private String centerEncode;
|
||||
|
||||
public static TreasureFragment newInstance(Bundle bundle) {
|
||||
TreasureFragment fragment = new TreasureFragment();
|
||||
@ -172,6 +191,93 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
//数据库
|
||||
initThread();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void initList(TencentLocation tencentLocation) {
|
||||
//获取中心点位置
|
||||
LatLng mapCenterPoint = getMapCenterPoint();
|
||||
ArrayList<Removable> removables = new ArrayList<>();
|
||||
if (mapCenterPoint != null) {
|
||||
centerEncode = Geohash.getInstance().encode(mapCenterPoint.latitude, mapCenterPoint.longitude);
|
||||
}
|
||||
|
||||
userEncode = Geohash.getInstance().encode(tencentLocation.getLatitude(),tencentLocation.getLongitude());
|
||||
|
||||
long date = System.currentTimeMillis();
|
||||
// 请求方式和请求url
|
||||
OkGo.<JobSearchBean>get(HttpInterface.TASK_LIST)
|
||||
.tag(this)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("userGeo", userEncode)
|
||||
.params("centerGeo", centerEncode)
|
||||
.params("date", date)
|
||||
.params("pageSize", Constant.NUMBER)
|
||||
.params("pageNum", "1")
|
||||
.execute(new DialogCallback<JobSearchBean>(JobSearchBean.class) {
|
||||
@Override
|
||||
public void onSuccess(Response<JobSearchBean> response) {
|
||||
Log.d("TAG", "onSuccess: " + response.body().toString() + "sssssssssssss");
|
||||
if (removables.size() > 0) {
|
||||
for (int i = 0; i < removables.size(); i++) {
|
||||
removables.get(i).remove();
|
||||
}
|
||||
removables.clear();
|
||||
}
|
||||
List<JobSearchBean.BodyBean.ListBean> list = response.body().getBody().getList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
String geo = list.get(i).getGeo();
|
||||
Log.d("TAG", "onSuccess: " + geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
if ( geometry.getGeometryType().equals("Point")){//点
|
||||
LatLng latLng = GeometryTools.createLatLng(geo);
|
||||
BitmapDescriptor custom = BitmapDescriptorFactory.fromResource(R.drawable.marker_road);
|
||||
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng));
|
||||
marker.setClickable(true);
|
||||
removables.add(marker);
|
||||
|
||||
}else if ( geometry.getGeometryType().equals("LineString")){//线
|
||||
List<LatLng> latLineString= GeometryTools.getLatLngs(geo);
|
||||
// 构造 PolylineOpitons
|
||||
PolylineOptions polylineOptions = new PolylineOptions()
|
||||
.addAll(latLineString)
|
||||
// 折线设置圆形线头
|
||||
.lineCap(true)
|
||||
// 折线的颜色为绿色
|
||||
.color(0xff00ff00)
|
||||
// 折线宽度为5像素
|
||||
.width(5)
|
||||
// 还可以添加描边颜色
|
||||
.borderColor(0xffff0000)
|
||||
// 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth`
|
||||
.borderWidth(1);
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
removables.add(polyline);
|
||||
}else if ( geometry.getGeometryType().equals("Polygon")){//面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
|
||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
|
||||
//连接封闭图形的点
|
||||
addAll(latPolygon).
|
||||
//填充颜色为红色
|
||||
fillColor(Color.parseColor("#97E0E7EC")).
|
||||
//边线颜色为黑色
|
||||
strokeColor(0xff000000).
|
||||
//边线宽度15像素
|
||||
strokeWidth(5));
|
||||
removables.add(polygon);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<JobSearchBean> response) {
|
||||
super.onError(response);
|
||||
Log.d("TAG", "onError: " + response.message());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initThread() {
|
||||
@ -183,7 +289,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < allPoi.size(); i++) {
|
||||
LatLng position = new LatLng(Double.valueOf(allPoi.get(i).getX()), Double.valueOf(allPoi.get(i).getY()));
|
||||
LatLng position = new LatLng(Double.valueOf(allPoi.get(i).getY()), Double.valueOf(allPoi.get(i).getX()));
|
||||
Marker marker = tencentMap.addMarker(new MarkerOptions(position));
|
||||
marker.setClickable(true);
|
||||
PoiEntity poiEntity = allPoi.get(i);
|
||||
@ -196,12 +302,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
setMainButtonVisiable(View.GONE);
|
||||
fragmentTransaction = supportFragmentManager.beginTransaction();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity",poiEntity);
|
||||
bundle.putBoolean("boolean",false);
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
bundle.putBoolean("boolean", false);
|
||||
gatherGetFragment = GatherGetFragment.newInstance(bundle);
|
||||
fragmentTransaction.replace(R.id.frame_layout, gatherGetFragment);
|
||||
fragmentTransaction.commit();
|
||||
Toast.makeText(getActivity(), marker.getId()+"", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getActivity(), marker.getId() + "", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@ -218,9 +324,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
SharedPreferences dataFile = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||
//根据数据类型,调用对应的get方法,通过键取得对应的值。
|
||||
String dataFileString = dataFile.getString("poiEntity", null);
|
||||
if (dataFileString!=null){
|
||||
if (dataFileString != null) {
|
||||
PoiEntity poiEntity = new Gson().fromJson(dataFileString, PoiEntity.class);
|
||||
switch (poiEntity.getType()){
|
||||
switch (poiEntity.getType()) {
|
||||
case 0:
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你poi页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||
@ -241,7 +347,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity",poiEntity);
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
||||
showSlidingFragment(roadFragment);
|
||||
initRemovePoiSharePre();
|
||||
@ -255,7 +361,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity",poiEntity);
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
||||
showSlidingFragment(chargingStationFragment);
|
||||
initRemovePoiSharePre();
|
||||
@ -269,7 +375,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity",poiEntity);
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
||||
showSlidingFragment(otherFragment);
|
||||
initRemovePoiSharePre();
|
||||
@ -283,7 +389,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity",poiEntity);
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
||||
showSlidingFragment(poiVideoFragment);
|
||||
initRemovePoiSharePre();
|
||||
@ -294,6 +400,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void initRemovePoiSharePre() {
|
||||
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||
@ -313,7 +420,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
public void onEvent(Message data) {
|
||||
if (data.what == Constant.FILTER_LIST_ITEM) { // 点击筛选的item
|
||||
PoiEntity poiEntity = (PoiEntity) data.obj;
|
||||
LatLng position = new LatLng(Double.valueOf(poiEntity.getX()), Double.valueOf(poiEntity.getY()));
|
||||
LatLng position = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
tencentMap.addMarker(new MarkerOptions(position));
|
||||
sliding_layout.setPanelHeight(0);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
|
||||
@ -383,15 +490,15 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
frameLayout.setVisibility(View.GONE);
|
||||
sliding_layout.setPanelHeight(1000);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
}else {
|
||||
} else {
|
||||
setMainButtonVisiable(View.VISIBLE);
|
||||
}
|
||||
} else if (data.what == Constant.CHARGING_STATION) {//充电站的充电桩
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
|
||||
bundle.putString("station", (String) data.obj);
|
||||
if (chargingPileEntity!=null){
|
||||
bundle.putSerializable("chargingPileEntity",chargingPileEntity);
|
||||
if (chargingPileEntity != null) {
|
||||
bundle.putSerializable("chargingPileEntity", chargingPileEntity);
|
||||
}
|
||||
ChargingPileFragment chargingPileFragment = ChargingPileFragment.newInstance(bundle);
|
||||
showSlidingFragment(chargingPileFragment);
|
||||
@ -418,7 +525,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
sliding_layout.setPanelHeight(1000);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
for (int i = 0; i < poiEntities.size(); i++) {
|
||||
LatLng position = new LatLng(Double.valueOf(poiEntities.get(i).getX()), Double.valueOf(poiEntities.get(i).getY()));
|
||||
LatLng position = new LatLng(Double.valueOf(poiEntities.get(i).getY()), Double.valueOf(poiEntities.get(i).getX()));
|
||||
tencentMap.addMarker(new MarkerOptions(position));
|
||||
}
|
||||
}
|
||||
@ -459,7 +566,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
Constant.markerLongitude = latLng.longitude;
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = aInt;
|
||||
obtain.obj = Constant.markerLatitude + "," + Constant.markerLongitude;
|
||||
obtain.obj = latLng;
|
||||
EventBus.getDefault().post(obtain);
|
||||
|
||||
}
|
||||
@ -565,6 +672,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
CameraUpdate cameraUpdateOut = CameraUpdateFactory.zoomOut();
|
||||
tencentMap.animateCamera(cameraUpdateOut);
|
||||
break;
|
||||
case R.id.iv_refrish://刷新
|
||||
initList(Constant.currentLocation);
|
||||
break;
|
||||
case R.id.iv_location://定位:
|
||||
if (Constant.currentLocation != null) {
|
||||
Constant.currentLocation.getLongitude();
|
||||
@ -706,6 +816,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
if (all) {
|
||||
//建立定位
|
||||
initLocation();
|
||||
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "申请权限失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@ -767,6 +878,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
location.setAccuracy(tencentLocation.getAccuracy());
|
||||
locationChangedListener.onLocationChanged(location);
|
||||
locationStyle = locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_FOLLOW_NO_CENTER);
|
||||
if (Constant.currentLocation == null) {
|
||||
initList(tencentLocation);
|
||||
}
|
||||
Constant.currentLocation = tencentLocation;
|
||||
Constant.markerCurrentLocation = tencentLocation;
|
||||
Constant.markerLatitude = tencentLocation.getLatitude();
|
||||
@ -786,4 +900,22 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取屏幕中心点位置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public LatLng getMapCenterPoint() {
|
||||
int left = treasureMap.getLeft();
|
||||
int top = treasureMap.getTop();
|
||||
int right = treasureMap.getRight();
|
||||
int bottom = treasureMap.getBottom();
|
||||
// 获得屏幕点击的位置
|
||||
int x = (int) (treasureMap.getX() + (right - left) / 2);
|
||||
int y = (int) (treasureMap.getY() + (bottom - top) / 2);
|
||||
Projection projection = tencentMap.getProjection();
|
||||
LatLng pt = projection.fromScreenLocation(new Point(x, y));
|
||||
return pt;
|
||||
}
|
||||
|
||||
}
|
@ -28,8 +28,14 @@ public class HttpInterface {
|
||||
public static final String USER_AUTH_ADD = IPm4 + "/userAuth/add"; //实名认证
|
||||
|
||||
//172.23.139.4:8001/m4/user/update
|
||||
public static final String USER_UPDATE = IPm4+"/user/update";//用户资料
|
||||
public static final String USER_UPDATE = IPm4 + "/user/update";//用户资料
|
||||
|
||||
//172.23.139.4:8001/m4/userBankcard/update
|
||||
public static final String USER_BANKCARD_UP_DATA = IPm4 + "/userBankcard/update"; //绑定银行卡
|
||||
|
||||
|
||||
public static final String IPM3 = "http://172.23.139.4:8003/m4";
|
||||
|
||||
//172.23.139.4:8003/m4/task/1/getList
|
||||
public static final String TASK_LIST = IPM3 + "/task/1/getList"; //任务搜索
|
||||
}
|
||||
|
153
app/src/main/java/com/navinfo/outdoor/util/Geohash.java
Normal file
153
app/src/main/java/com/navinfo/outdoor/util/Geohash.java
Normal file
@ -0,0 +1,153 @@
|
||||
package com.navinfo.outdoor.util;
|
||||
|
||||
import java.util.BitSet;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class Geohash {
|
||||
|
||||
private Geohash(){}
|
||||
|
||||
private static class GeohashInstance{
|
||||
private static final Geohash INSTANCE = new Geohash();
|
||||
}
|
||||
|
||||
public static Geohash getInstance(){
|
||||
return GeohashInstance.INSTANCE;
|
||||
}
|
||||
|
||||
private static int numbits = 6 * 5;
|
||||
/*
|
||||
* final static char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7',
|
||||
* '8', '9', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm', 'n', 'p',
|
||||
* 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
|
||||
*/
|
||||
// 为了加密,所以改了base32编码代码表
|
||||
final static char[] digits = { 'd', 'f', 'g', 'y', 'n', 't', 'u', 'v', 'q',
|
||||
'b', '9', 's', 'z', '7', 'i', '2', 'h', '5', '0', 'p', '4', 'm',
|
||||
'8', 'x', 'c', 'j', '6', 'e', '1', 'r', '3', 'k' };
|
||||
|
||||
final static HashMap<Character, Integer> lookup = new HashMap<Character, Integer>();
|
||||
static {
|
||||
int i = 0;
|
||||
for (char c : digits)
|
||||
lookup.put(c, i++);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String s = "1rn7exd5uhxy";
|
||||
System.out.println(s);
|
||||
System.out.println(new Geohash().decode(s)[0]);
|
||||
System.out.println(new Geohash().decode(s)[1]);
|
||||
System.out.println(new Geohash().encode(40.073556024581194, 116.24643344432116));
|
||||
}
|
||||
|
||||
//数据解密
|
||||
/**
|
||||
* @param geohash 需要被解密的字符串
|
||||
* @return double[] 经纬度double数组,纬度(latitude)在前,经度在后(longitude)
|
||||
* */
|
||||
public double[] decode(String geohash) {
|
||||
try {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
for (char c : geohash.toCharArray()) {
|
||||
|
||||
int i = lookup.get(c) + 32;
|
||||
buffer.append(Integer.toString(i, 2).substring(1));
|
||||
}
|
||||
|
||||
long a = Long.parseLong(buffer.toString(), 2);
|
||||
buffer.setLength(0);
|
||||
buffer.append(Long.toBinaryString(a));
|
||||
|
||||
BitSet lonset = new BitSet();
|
||||
BitSet latset = new BitSet();
|
||||
|
||||
// even bits
|
||||
int j = 0;
|
||||
for (int i = 0; i < numbits * 2; i += 2) {
|
||||
boolean isSet = false;
|
||||
if (i < buffer.length())
|
||||
isSet = buffer.charAt(i) == '1';
|
||||
lonset.set(j++, isSet);
|
||||
}
|
||||
|
||||
// odd bits
|
||||
j = 0;
|
||||
for (int i = 1; i < numbits * 2; i += 2) {
|
||||
boolean isSet = false;
|
||||
if (i < buffer.length())
|
||||
isSet = buffer.charAt(i) == '1';
|
||||
latset.set(j++, isSet);
|
||||
}
|
||||
|
||||
double lon = decode(lonset, -180, 180);
|
||||
double lat = decode(latset, -90, 90);
|
||||
|
||||
return new double[] { lat, lon };
|
||||
} catch (RuntimeException re) {
|
||||
re.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private double decode(BitSet bs, double floor, double ceiling) {
|
||||
double mid = 0;
|
||||
for (int i = 0; i < bs.length(); i++) {
|
||||
mid = (floor + ceiling) / 2;
|
||||
if (bs.get(i))
|
||||
floor = mid;
|
||||
else
|
||||
ceiling = mid;
|
||||
}
|
||||
return mid;
|
||||
}
|
||||
|
||||
//数据加密
|
||||
/**
|
||||
* @param lat,lon 需要被加密的double 值
|
||||
* */
|
||||
public String encode(double lat, double lon) {
|
||||
BitSet latbits = getBits(lat, -90, 90);
|
||||
BitSet lonbits = getBits(lon, -180, 180);
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
for (int i = 0; i < numbits; i++) {
|
||||
buffer.append((lonbits.get(i)) ? '1' : '0');
|
||||
buffer.append((latbits.get(i)) ? '1' : '0');
|
||||
}
|
||||
return base32(Long.parseLong(buffer.toString(), 2));
|
||||
}
|
||||
|
||||
private BitSet getBits(double lat, double floor, double ceiling) {
|
||||
BitSet buffer = new BitSet(numbits);
|
||||
for (int i = 0; i < numbits; i++) {
|
||||
double mid = (floor + ceiling) / 2;
|
||||
if (lat >= mid) {
|
||||
buffer.set(i);
|
||||
floor = mid;
|
||||
} else {
|
||||
ceiling = mid;
|
||||
}
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public static String base32(long i) {
|
||||
char[] buf = new char[65];
|
||||
int charPos = 64;
|
||||
boolean negative = (i < 0);
|
||||
if (!negative)
|
||||
i = -i;
|
||||
while (i <= -32) {
|
||||
buf[charPos--] = digits[(int) (-(i % 32))];
|
||||
i /= 32;
|
||||
}
|
||||
buf[charPos] = digits[(int) (-i)];
|
||||
|
||||
if (negative)
|
||||
buf[--charPos] = '-';
|
||||
return new String(buf, charPos, (65 - charPos));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
1258
app/src/main/java/com/navinfo/outdoor/util/GeometryTools.java
Normal file
1258
app/src/main/java/com/navinfo/outdoor/util/GeometryTools.java
Normal file
File diff suppressed because it is too large
Load Diff
BIN
app/src/main/res/drawable/marker_charge_bg.png
Normal file
BIN
app/src/main/res/drawable/marker_charge_bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/main/res/drawable/marker_other_bg.png
Normal file
BIN
app/src/main/res/drawable/marker_other_bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
app/src/main/res/drawable/marker_poi_bg.png
Normal file
BIN
app/src/main/res/drawable/marker_poi_bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
BIN
app/src/main/res/drawable/marker_road.png
Normal file
BIN
app/src/main/res/drawable/marker_road.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
BIN
app/src/main/res/drawable/marker_road_bg.png
Normal file
BIN
app/src/main/res/drawable/marker_road_bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
31
app/src/main/res/layout/loading.xml
Normal file
31
app/src/main/res/layout/loading.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar1"
|
||||
style="@style/AppTheme.NoActionBar"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:indeterminateTint="#1BA5F1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/progressBar_tx"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/progressBar1"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="加载中..."
|
||||
android:textColor="#f1f1f1"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:focusableInTouchMode="true"
|
||||
android:focusable="true"/>
|
||||
</RelativeLayout>
|
Loading…
x
Reference in New Issue
Block a user