解决8.13的bug

This commit is contained in:
wds
2021-08-13 23:37:25 +08:00
parent 834353b3c5
commit 8bc3c848e1
19 changed files with 548 additions and 363 deletions

View File

@@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 29 compileSdkVersion 29
buildToolsVersion '29.0.2' buildToolsVersion '29.0.2'
ndkVersion '23.0.7123448' // ndkVersion '23.0.7123448'
defaultConfig { defaultConfig {
applicationId "com.navinfo.outdoor" applicationId "com.navinfo.outdoor"

View File

@@ -14,6 +14,7 @@ import android.graphics.Matrix;
import android.location.Location; import android.location.Location;
import android.media.MediaMetadataRetriever; import android.media.MediaMetadataRetriever;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.Message; import android.os.Message;
import android.os.SystemClock; import android.os.SystemClock;
@@ -99,7 +100,6 @@ import java.util.List;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import static com.navinfo.outdoor.R.drawable.*;
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE; import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE;
@@ -129,6 +129,15 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
private ImageView ivPic; private ImageView ivPic;
private PoiEntity poiEntity; private PoiEntity poiEntity;
private Polyline polyline; private Polyline polyline;
private Handler handler=new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(@NonNull Message msg) {
if (btnSwitch!=null){
btnSwitch.setEnabled(true);
}
return false;
}
});
@Override @Override
protected int getLayout() { protected int getLayout() {
@@ -251,7 +260,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
for (int i = 0; i < lineStringByVideoFileList.size(); i++) { for (int i = 0; i < lineStringByVideoFileList.size(); i++) {
LatLng latLng = lineStringByVideoFileList.get(i); LatLng latLng = lineStringByVideoFileList.get(i);
if (latLng != null) { if (latLng != null) {
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(ic_baseline); BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.ic_baseline);
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor).alpha(0.9f) Marker marker = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor).alpha(0.9f)
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
@@ -411,7 +420,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
// 折线的颜色为绿色 // 折线的颜色为绿色
.color(0xff00ff00) .color(0xff00ff00)
// 折线宽度为5像素 // 折线宽度为5像素
.width(45) .width(20)
.arrow(true) .arrow(true)
.arrowSpacing(150) .arrowSpacing(150)
.arrowTexture(bitmapLine); .arrowTexture(bitmapLine);
@@ -461,6 +470,8 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
// } // }
// break; // break;
case R.id.btn_switch: case R.id.btn_switch:
v.setEnabled(false);
handler.sendEmptyMessageDelayed(0, 2000); // 利用handler延迟发送更改状态信息
btnSwich(); btnSwich();
break; break;
// case R.id.capuretVideo: // case R.id.capuretVideo:
@@ -555,7 +566,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
locationStyle = new MyLocationStyle(); locationStyle = new MyLocationStyle();
locationStyle = locationStyle.myLocationType(LOCATION_TYPE_LOCATION_ROTATE); locationStyle = locationStyle.myLocationType(LOCATION_TYPE_LOCATION_ROTATE);
//创建图标 //创建图标
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap(location)); BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap(R.drawable.location));
locationStyle.icon(bitmapDescriptor); locationStyle.icon(bitmapDescriptor);
//设置定位圆形区域的边框宽度; //设置定位圆形区域的边框宽度;
locationStyle.fillColor(getResources().getColor(android.R.color.transparent)); locationStyle.fillColor(getResources().getColor(android.R.color.transparent));
@@ -683,7 +694,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
} }
sb.append("\r\n"); sb.append("\r\n");
LatLng latLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()); LatLng latLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(ic_baseline); BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.circle);
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor).alpha(0.9f) Marker marker = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor).alpha(0.9f)
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));

View File

@@ -27,6 +27,10 @@ public class ChargingPileAdapter extends RecyclerView.Adapter<ChargingPileAdapte
this.context = context; this.context = context;
} }
public List<ChargingPileEntity> getChargingPileEntities() {
return chargingPileEntities;
}
public void setChargingPileEntities(List<ChargingPileEntity> chargingPileEntities) { public void setChargingPileEntities(List<ChargingPileEntity> chargingPileEntities) {
this.chargingPileEntities.addAll(chargingPileEntities); this.chargingPileEntities.addAll(chargingPileEntities);
notifyDataSetChanged(); notifyDataSetChanged();

View File

@@ -92,25 +92,15 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
} else if (poiEntity.getType() == 6) { } else if (poiEntity.getType() == 6) {
holder.tvForm.setText("面状任务"); holder.tvForm.setText("面状任务");
} }
if (poiEntity.getIsLocalData() == 1) {
holder.itemView.setOnClickListener(new View.OnClickListener() { holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (itemCLick != null) { if (itemCLick != null) {
itemCLick.item(poiEntity, true); itemCLick.item(poiEntity);
} }
} }
}); });
} else {
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (itemCLick != null) {
itemCLick.item(poiEntity, false);
}
}
});
}
} }
@@ -140,7 +130,7 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
} }
public interface ItemCLick { public interface ItemCLick {
void item(PoiEntity poiEntity, boolean a); void item(PoiEntity poiEntity);
} }
/** /**

View File

@@ -8,6 +8,7 @@ import com.navinfo.outdoor.util.SdkFolderCreate;
import com.sothree.slidinguppanel.SlidingUpPanelLayout; import com.sothree.slidinguppanel.SlidingUpPanelLayout;
import com.tencent.map.geolocation.TencentLocation; import com.tencent.map.geolocation.TencentLocation;
import com.tencent.tencentmap.mapsdk.maps.MapView; import com.tencent.tencentmap.mapsdk.maps.MapView;
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor; import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory; import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng; import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
@@ -33,6 +34,7 @@ public class Constant {
public static final String GET_ERR_MESSAGE1 = "设备缺少使用腾讯定位服务需要的基本条件"; public static final String GET_ERR_MESSAGE1 = "设备缺少使用腾讯定位服务需要的基本条件";
public static final String GET_ERR_MESSAGE2 = "manifest 中配置的 key 不正确"; public static final String GET_ERR_MESSAGE2 = "manifest 中配置的 key 不正确";
public static final String GET_ERR_MESSAGE3 = "自动加载libtencentloc.so失败"; public static final String GET_ERR_MESSAGE3 = "自动加载libtencentloc.so失败";
public static String BASE_FOLDER = SdkFolderCreate.getSDPath() + "/navinfoOutDoor"; public static String BASE_FOLDER = SdkFolderCreate.getSDPath() + "/navinfoOutDoor";
// 保存图片的目录 // 保存图片的目录
public static String PICTURE_FOLDER; public static String PICTURE_FOLDER;
@@ -123,6 +125,7 @@ public class Constant {
public static final int JOB_SEARCH_POI_WORD = 29;//任务搜索的本地数据 public static final int JOB_SEARCH_POI_WORD = 29;//任务搜索的本地数据
public static final int GATHER_GET_MAP = 30;//地图点击marker 后弹窗点击开始采集 public static final int GATHER_GET_MAP = 30;//地图点击marker 后弹窗点击开始采集
public static final int HOME_MINE = 32;//点击我的实时监听刷新 public static final int HOME_MINE = 32;//点击我的实时监听刷新
public static final int PILE_MARKER_SHOW = 33;//刷新充电桩的显示
public static final int JOB_WORD_MONITOR = 34;//寻宝界面和删选的刷新 public static final int JOB_WORD_MONITOR = 34;//寻宝界面和删选的刷新
public static final int EVENT_WHAT_LOCATION_CHANGE = 35; // 定位位置更新的Event的What值 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_BODY = 36;//充电装的body
@@ -166,6 +169,8 @@ public class Constant {
public static boolean IS_FILTER_LIST_ITEM = true;//poi页面的查重 public static boolean IS_FILTER_LIST_ITEM = true;//poi页面的查重
public static TencentMap.OnMarkerClickListener markerClickListener=null;
//--/ //--/
} }

View File

@@ -52,7 +52,6 @@ public abstract class BaseDrawerFragment extends BaseFragment {
// } // }
} }
@Override @Override
public void initEvent() { public void initEvent() {
super.initEvent(); super.initEvent();
@@ -96,6 +95,7 @@ public abstract class BaseDrawerFragment extends BaseFragment {
latLng.setLongitude(Double.valueOf(showPoiEntity.getX())); latLng.setLongitude(Double.valueOf(showPoiEntity.getX()));
obtain.obj = latLng; obtain.obj = latLng;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
MapManager.getInstance().getTencentMap().setOnMarkerClickListener(null);
} }
} }
public void setSlidingUpPanelLayout(SlidingUpPanelLayout slidingUpPanelLayout) { public void setSlidingUpPanelLayout(SlidingUpPanelLayout slidingUpPanelLayout) {
@@ -103,6 +103,13 @@ public abstract class BaseDrawerFragment extends BaseFragment {
this.slidingPaneLayout = slidingUpPanelLayout; this.slidingPaneLayout = slidingUpPanelLayout;
} }
} }
@Override
public void onStop() {
super.onStop();
MapManager.getInstance().getTencentMap().setOnMarkerClickListener(Constant.markerClickListener);
}
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();

View File

@@ -128,6 +128,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
private NestedScrollView nestedScrollView; private NestedScrollView nestedScrollView;
private Marker markerPile; private Marker markerPile;
private Point screenPilePositions; private Point screenPilePositions;
private ChargingPileEntity chargingPileEntity;
public static ChargingPileFragment newInstance(Bundle bundle) { public static ChargingPileFragment newInstance(Bundle bundle) {
ChargingPileFragment fragment = new ChargingPileFragment(); ChargingPileFragment fragment = new ChargingPileFragment();
@@ -381,7 +382,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
break; break;
case 2: case 2:
cp_availableState = 2; cp_availableState = 2;
break; break;
case 3: case 3:
cp_availableState = 3; cp_availableState = 3;
@@ -601,7 +601,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
taskId = showPoiEntity.getTaskId(); taskId = showPoiEntity.getTaskId();
} }
// 添加信息: // 添加信息:
ChargingPileEntity chargingPileEntity = (ChargingPileEntity) getArguments().getSerializable("chargingPileEntity"); chargingPileEntity = (ChargingPileEntity) getArguments().getSerializable("chargingPileEntity");
if (chargingPileEntity != null) { if (chargingPileEntity != null) {
String name = chargingPileEntity.getName();//名称 String name = chargingPileEntity.getName();//名称
if (name != null) { if (name != null) {
@@ -614,7 +614,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
String decodeGeometry = Geohash.getInstance().decode(p); String decodeGeometry = Geohash.getInstance().decode(p);
latLng = GeometryTools.createLatLng(decodeGeometry); latLng = GeometryTools.createLatLng(decodeGeometry);
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen); BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen);
markerPile = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor)); markerPile = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor).anchor(0.5f,1.0f));
markerPile.setZIndex(4); markerPile.setZIndex(4);
moveLatlng(latLng, null); moveLatlng(latLng, null);
} }
@@ -639,9 +639,48 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
} }
int cp_availableState = chargingPileEntity.getCp_availableState(); int cp_availableState = chargingPileEntity.getCp_availableState();
spinnerStake.setSelection(cp_availableState, true); spinnerStake.setSelection(cp_availableState, true);
String cp_openType = chargingPileEntity.getCp_openType();
if (cp_openType!=null&&!cp_openType.equals("")){
String[] split = cp_openType.split(",");
for (int i = 0; i < split.length; i++) {
if (Integer.valueOf(split[i])==1){
checkButton1.setChecked(true);
}else if (Integer.valueOf(split[i])==2){
checkButton2.setChecked(true);
}else if (Integer.valueOf(split[i])==3){
checkButton3.setChecked(true);
}else if (Integer.valueOf(split[i])==4){
checkButton4.setChecked(true);
}else if (Integer.valueOf(split[i])==5){
checkButton5.setChecked(true);
}
}
}
int cp_floor = chargingPileEntity.getCp_floor(); int cp_floor = chargingPileEntity.getCp_floor();
spinnerType.setSelection(cp_floor, true); //"地上五层", "地上四层", "地上三层", "地上二层", "地上一层", "地下一层", "地下二层", "地下三层", "地下四层", "地下五层"};
if (cp_floor==0){
spinnerType.setSelection(4, true);
}else if (cp_floor==1){
spinnerType.setSelection(4, true);
}else if (cp_floor==2){
spinnerType.setSelection(3, true);
}else if (cp_floor==3){
spinnerType.setSelection(2, true);
}else if (cp_floor==4){
spinnerType.setSelection(1, true);
}else if (cp_floor==5){
spinnerType.setSelection(0, true);
}else if (cp_floor==-1){
spinnerType.setSelection(5, true);
}else if (cp_floor==-2){
spinnerType.setSelection(6, true);
}else if (cp_floor==-3){
spinnerType.setSelection(7, true);
}else if (cp_floor==-4){
spinnerType.setSelection(8, true);
}else if (cp_floor==-5){
spinnerType.setSelection(9, true);
}
if (chargingPileEntity.getPhotos() != null) { if (chargingPileEntity.getPhotos() != null) {
ArrayList<String> cList = new ArrayList<>(); ArrayList<String> cList = new ArrayList<>();
ArrayList<String> dList = new ArrayList<>(); ArrayList<String> dList = new ArrayList<>();
@@ -828,7 +867,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
public void onGranted(List<String> permissions, boolean all) { public void onGranted(List<String> permissions, boolean all) {
if (all) { if (all) {
//保存数据库: //保存数据库:
ChargingPileEntity chargingPileEntity = initChargingPileEntityByUI(new ChargingPileEntity()); chargingPileEntity = initChargingPileEntityByUI(chargingPileEntity);
PoiCheckResult poiCheckResult = checkChargingPileEntity(chargingPileEntity); PoiCheckResult poiCheckResult = checkChargingPileEntity(chargingPileEntity);
if (poiCheckResult.getCode() == 1) { if (poiCheckResult.getCode() == 1) {
Toast.makeText(getActivity(), poiCheckResult.getMsg() + "", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), poiCheckResult.getMsg() + "", Toast.LENGTH_SHORT).show();
@@ -842,12 +881,17 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override @Override
public void run() { public void run() {
if (result[0] != 0) { if (result[0] != 0) {
chargingPileEntity.setPileId(result[0]);
ToastUtil.showShort(getActivity(), "充电桩保存成功"); ToastUtil.showShort(getActivity(), "充电桩保存成功");
Message obtain = Message.obtain(); Message obtain = Message.obtain();
obtain.what = Constant.CHARGING_PILE_STATION; obtain.what = Constant.CHARGING_PILE_STATION;
obtain.obj = chargingPileEntity; obtain.obj = chargingPileEntity;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
Message obtains = Message.obtain();
obtains.what = Constant.PILE_MARKER_SHOW;
obtains.obj = true;
EventBus.getDefault().post(obtains);
// chargingPileByWork(chargingPileEntity); // chargingPileByWork(chargingPileEntity);
getActivity().onBackPressed(); getActivity().onBackPressed();
} else { } else {

View File

@@ -64,9 +64,11 @@ import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity; import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.ui.view.ContactView; import com.navinfo.outdoor.ui.view.ContactView;
import com.navinfo.outdoor.util.Geohash; import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.PhotoUtils; import com.navinfo.outdoor.util.PhotoUtils;
import com.navinfo.outdoor.util.ToastUtil; import com.navinfo.outdoor.util.ToastUtil;
import com.tencent.tencentmap.mapsdk.maps.TencentMap; import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.interfaces.Removable;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor; import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory; import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng; import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
@@ -132,6 +134,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
private NestedScrollView nestedScrollView; private NestedScrollView nestedScrollView;
private Marker markerStation; private Marker markerStation;
private Point screenStationPositions; private Point screenStationPositions;
private List<Removable> removablesLocality;
public static ChargingStationFragment newInstance(Bundle bundle) { public static ChargingStationFragment newInstance(Bundle bundle) {
ChargingStationFragment fragment = new ChargingStationFragment(); ChargingStationFragment fragment = new ChargingStationFragment();
@@ -212,6 +215,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
checkBoxLife = findViewById(R.id.check_pot_life); checkBoxLife = findViewById(R.id.check_pot_life);
checkBoxRight = findViewById(R.id.check_pot_right); checkBoxRight = findViewById(R.id.check_pot_right);
nestedScrollView = findViewById(R.id.nested_scroll_view); nestedScrollView = findViewById(R.id.nested_scroll_view);
removablesLocality=new ArrayList<>();
setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT); setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT);
if (slidingPaneLayout!=null) { if (slidingPaneLayout!=null) {
slidingPaneLayout.setScrollableView(nestedScrollView); slidingPaneLayout.setScrollableView(nestedScrollView);
@@ -484,7 +488,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
latLng.setLatitude(Double.parseDouble(y)); latLng.setLatitude(Double.parseDouble(y));
latLng.setLongitude(Double.parseDouble(x)); latLng.setLongitude(Double.parseDouble(x));
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen); BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen);
markerStation = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor)); markerStation = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor).anchor(0.5f,1.0f));
markerStation.setZIndex(4); markerStation.setZIndex(4);
moveLatlng(latLng,null); moveLatlng(latLng,null);
} }
@@ -591,6 +595,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override @Override
public void run() { public void run() {
chargingPileAdapter.setChargingPileEntities(chargingPileList); chargingPileAdapter.setChargingPileEntities(chargingPileList);
initPileMarkerShow();
} }
}); });
@@ -701,9 +706,41 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
latLng = (LatLng) data.obj; latLng = (LatLng) data.obj;
} else if (data.what == Constant.CHARGING_PILE_STATION) { // 新增充电桩 } else if (data.what == Constant.CHARGING_PILE_STATION) { // 新增充电桩
ChargingPileEntity chargingPileEntity = (ChargingPileEntity) data.obj; ChargingPileEntity chargingPileEntity = (ChargingPileEntity) data.obj;
ArrayList<ChargingPileEntity> chargingPileEntities = new ArrayList<>(); List<ChargingPileEntity> currentChargingPileList = chargingPileAdapter.getChargingPileEntities();
chargingPileEntities.add(chargingPileEntity); m: if (currentChargingPileList!=null&&!currentChargingPileList.isEmpty()) {
chargingPileAdapter.setChargingPileEntities(chargingPileEntities); for (int i = 0; i < currentChargingPileList.size(); i++) {
if (currentChargingPileList.get(i).getPileId() == chargingPileEntity.getPileId()) {
currentChargingPileList.add(i, chargingPileEntity);
currentChargingPileList.remove(i+1);
break m;
}
}
currentChargingPileList.add(chargingPileEntity);
} else {
currentChargingPileList.add(chargingPileEntity);
}
chargingPileAdapter.notifyDataSetChanged();
}else if (data.what==Constant.PILE_MARKER_SHOW){
initPileMarkerShow();
}
}
public void initPileMarkerShow(){
for (int i = 0; i < removablesLocality.size(); i++) {
removablesLocality.get(i).remove();
}
removablesLocality.clear();
List<ChargingPileEntity> chargingPileEntities = chargingPileAdapter.getChargingPileEntities();
for (int i = 0; i < chargingPileEntities.size(); i++) {
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_chang_pile);
String p = chargingPileEntities.get(i).getP();
if (p != null) {
// 解密geo
String decodeGeometry = Geohash.getInstance().decode(p);
LatLng latLngPile = GeometryTools.createLatLng(decodeGeometry);
Marker markerPile = tencentMap.addMarker(new MarkerOptions(latLngPile).icon(pileDescriptor).anchor(0.5f,1.0f));
markerPile.setZIndex(3);
removablesLocality.add(markerPile);
}
} }
} }
@@ -1445,6 +1482,10 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
if (markerStation!=null){ if (markerStation!=null){
markerStation.remove(); markerStation.remove();
} }
for (int i = 0; i < removablesLocality.size(); i++) {
removablesLocality.get(i).remove();
}
removablesLocality.clear();
} }
@Override @Override
@@ -1547,6 +1588,11 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
poiCheckResult.setMsg("请确定 点位"); poiCheckResult.setMsg("请确定 点位");
return poiCheckResult; return poiCheckResult;
} }
if (contactView.getPhoneList()!=-1){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("您第"+contactView.getPhoneList()+"手机号输入有误");
return poiCheckResult;
}
if (entity.getTelPhone()==null){ if (entity.getTelPhone()==null){
poiCheckResult.setCode(1); poiCheckResult.setCode(1);
poiCheckResult.setMsg("请输入 手机号"); poiCheckResult.setMsg("请输入 手机号");

View File

@@ -56,7 +56,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
private FilterAdapter filterAdapter; private FilterAdapter filterAdapter;
private ArrayList<PoiEntity> poiEntities; private ArrayList<PoiEntity> poiEntities;
private List<PoiEntity> allPoi; private List<PoiEntity> allPoi;
private int page;
@@ -266,7 +265,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
if (slidingPaneLayout!=null) { if (slidingPaneLayout!=null) {
slidingPaneLayout.setScrollableView(recyclerFilter); slidingPaneLayout.setScrollableView(recyclerFilter);
} }
//设置下划线 //设置下划线
recyclerFilter.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerFilter.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerFilter.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL)); recyclerFilter.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
@@ -278,39 +276,49 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
recyclerFilter.setLoadingMoreEnabled(false); recyclerFilter.setLoadingMoreEnabled(false);
filterAdapter = new FilterAdapter(getContext(), poiEntities); filterAdapter = new FilterAdapter(getContext(), poiEntities);
recyclerFilter.setAdapter(filterAdapter); recyclerFilter.setAdapter(filterAdapter);
recyclerFilter.setScrollAlphaChangeListener(new XRecyclerView.ScrollAlphaChangeListener() {
@Override
public void onAlphaChange(int alpha) {
}
@Override
public int setLimitHeight() {
return 0;
}
});
recyclerFilter.getDefaultFootView().setNoMoreHint("成功加载完毕"); recyclerFilter.getDefaultFootView().setNoMoreHint("成功加载完毕");
recyclerFilter.setLoadingListener(new XRecyclerView.LoadingListener() { recyclerFilter.setLoadingListener(new XRecyclerView.LoadingListener() {
@Override @Override
public void onRefresh() { public void onRefresh() {
page=1;
Message obtain = Message.obtain();
obtain.what = Constant.Filter_WhAT_RECYCLER;
obtain.obj = true;
EventBus.getDefault().post(obtain);
} }
@Override @Override
public void onLoadMore() { public void onLoadMore() {
Message obtain = Message.obtain();
obtain.what = Constant.Filter_WhAT_RECYCLER;
obtain.obj = false;
EventBus.getDefault().post(obtain);
} }
}); });
filterAdapter.setItemCLick(new FilterAdapter.ItemCLick() { filterAdapter.setItemCLick(new FilterAdapter.ItemCLick() {
@Override @Override
public void item(PoiEntity poiEntity, boolean aBoolean) { public void item(PoiEntity poiEntity) {
if (aBoolean) {//本地 if (poiEntity.getTaskStatus()!=1) {
Message obtain = Message.obtain(); Message obtain = Message.obtain();
obtain.what = Constant.GATHER_GET; obtain.what = Constant.GATHER_GET;
obtain.obj = poiEntity; obtain.obj = poiEntity;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
} else {//服务 } else {//1:表示領取的本地認爲
Message obtain = Message.obtain(); Message obtain = Message.obtain();
obtain.what = Constant.FILTER_LIST_ITEM; obtain.what = Constant.TREASURE_FRAGMENT;
obtain.obj = poiEntity; obtain.obj = true;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
Message obtains = Message.obtain();
obtains.what = Constant.FILTER_LIST_ITEM;
obtains.obj = poiEntity;
EventBus.getDefault().post(obtains);
} }
} }
}); });
@@ -326,6 +334,10 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
obtain.what = Constant.TREASURE_FRAGMENT; obtain.what = Constant.TREASURE_FRAGMENT;
obtain.obj = true; obtain.obj = true;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
Message obtains = Message.obtain();
obtains.what = Constant.JOB_WORD_MONITOR;
obtains.obj = true;
EventBus.getDefault().post(obtains);
onBackPressed(); onBackPressed();
break; break;
case R.id.cl_number: case R.id.cl_number:

View File

@@ -364,7 +364,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getActivity(), chargingPileEntityList); InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getActivity(), chargingPileEntityList);
} }
// senMessageMarker(chargingStationEntity.getType(), chargingStationEntity.getY(), chargingStationEntity.getX()); // senMessageMarker(chargingStationEntity.getType(), chargingStationEntity.getY(), chargingStationEntity.getX());
if (statusId==1){
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), chargingStationEntity); InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), chargingStationEntity);
}
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@@ -375,6 +377,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
obtain.obj = chargingStationEntity; obtain.obj = chargingStationEntity;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
} }
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
EventBus.getDefault().post(obtain);
} }
}); });
} else { } else {
@@ -388,6 +394,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
obtain.obj = taskIdPoiEntity; obtain.obj = taskIdPoiEntity;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
} }
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
EventBus.getDefault().post(obtain);
} }
}); });
} }
@@ -693,7 +703,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setY(latPolygon.get(0).latitude + ""); poiListEntity.setY(latPolygon.get(0).latitude + "");
} }
//senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX()); //senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
if (statusId==1){
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity); InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
}
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@@ -704,6 +716,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
obtain.obj = poiListEntity; obtain.obj = poiListEntity;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
} }
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
EventBus.getDefault().post(obtain);
} }
}); });
} else { } else {
@@ -717,6 +733,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
obtain.obj = taskIdPoiEntity; obtain.obj = taskIdPoiEntity;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
} }
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
EventBus.getDefault().post(obtain);
} }
}); });
} }
@@ -805,7 +825,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setY(latPolygon.get(0).latitude + ""); poiListEntity.setY(latPolygon.get(0).latitude + "");
} }
//senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX()); //senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
if (statusId==1){
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity); InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
}
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@@ -816,6 +838,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
obtain.obj = poiListEntity; obtain.obj = poiListEntity;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
} }
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
EventBus.getDefault().post(obtain);
} }
}); });
} else { } else {
@@ -829,14 +855,16 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
obtain.obj = taskIdPoiEntity; obtain.obj = taskIdPoiEntity;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
} }
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
EventBus.getDefault().post(obtain);
} }
}); });
} }
} }
}).start(); }).start();
} }
} else { } else {
Toast.makeText(getContext(), "" + response.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "" + response.getMessage(), Toast.LENGTH_SHORT).show();
} }

View File

@@ -316,7 +316,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
latLng.setLongitude(Double.parseDouble(x)); latLng.setLongitude(Double.parseDouble(x));
latLng.setLatitude(Double.parseDouble(y)); latLng.setLatitude(Double.parseDouble(y));
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen); BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen);
markerOther = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor)); markerOther = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor) .anchor(0.5f,1.0f));
markerOther.setZIndex(4); markerOther.setZIndex(4);
moveLatlng(latLng, null); moveLatlng(latLng, null);
} }

View File

@@ -385,7 +385,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
(y)); (y));
latLng.setLongitude(Double.parseDouble(x)); latLng.setLongitude(Double.parseDouble(x));
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen); BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen);
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor)); markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor) .anchor(0.5f,1.0f));
markerPoi.setZIndex(4); markerPoi.setZIndex(4);
moveLatlng(latLng, null); moveLatlng(latLng, null);
} }
@@ -1073,7 +1073,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
if (phoneBean) { if (phoneBean) {
String list = contactView.getList(); String list = contactView.getList();
poiEntity.setTelPhone(list); poiEntity.setTelPhone(list);
} }
String tagPanorama = (String) tvPanorama.getTag(); String tagPanorama = (String) tvPanorama.getTag();
if (tagPanorama != null && !tagPanorama.equals("")) { if (tagPanorama != null && !tagPanorama.equals("")) {
@@ -1131,6 +1130,11 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
poiCheckResult.setMsg("请确定 点位"); poiCheckResult.setMsg("请确定 点位");
return poiCheckResult; return poiCheckResult;
} }
if (contactView.getPhoneList()!=-1){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("您第"+contactView.getPhoneList()+"手机号输入有误");
return poiCheckResult;
}
if (entity.getTelPhone() == null) { if (entity.getTelPhone() == null) {
poiCheckResult.setCode(1); poiCheckResult.setCode(1);
poiCheckResult.setMsg("请输入 手机号"); poiCheckResult.setMsg("请输入 手机号");

View File

@@ -233,8 +233,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
latLng = new LatLng(); latLng = new LatLng();
latLng.setLongitude(Double.parseDouble(x)); latLng.setLongitude(Double.parseDouble(x));
latLng.setLatitude(Double.parseDouble(y)); latLng.setLatitude(Double.parseDouble(y));
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen); BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bag);
markerPoiVideo = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor)); markerPoiVideo = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor) .anchor(0.5f,1.0f));
markerPoiVideo.setZIndex(4); markerPoiVideo.setZIndex(4);
moveLatlng(latLng,null); moveLatlng(latLng,null);
} }

View File

@@ -240,7 +240,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
latLng.setLongitude(Double.parseDouble(x)); latLng.setLongitude(Double.parseDouble(x));
latLng.setLatitude(Double.parseDouble(y)); latLng.setLatitude(Double.parseDouble(y));
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bag); BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bag);
markerRoad = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor)); markerRoad = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor).anchor(0.5f,1.0f));
markerRoad.setZIndex(4); markerRoad.setZIndex(4);
moveLatlng(latLng,null); moveLatlng(latLng,null);
} }

View File

@@ -234,9 +234,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
iniUserLocation(); iniUserLocation();
//检查是否有没有填完的页面 //检查是否有没有填完的页面
initSharePre(); initSharePre();
removables = new ArrayList<>();//存储网络数据的marker removables = new ArrayList<>();//存储网络数据的marker数据(线,面,点)
removablesLocality = new ArrayList<>(); //存储本地数据的marker removablesLocality = new ArrayList<>(); //存储本地的marker数据(线,面,点)
removableScreenMarker = new ArrayList<>();//存储点击屏幕上的marker数据的marker removableScreenMarker = new ArrayList<>();//存储点击屏幕上的marker的marker数据(线,面,点)
tencentMap.addOnMapLoadedCallback(new TencentMap.OnMapLoadedCallback() { tencentMap.addOnMapLoadedCallback(new TencentMap.OnMapLoadedCallback() {
@Override @Override
public void onMapLoaded() { public void onMapLoaded() {
@@ -262,96 +262,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} else { } else {
dismissLoadingDialog(); dismissLoadingDialog();
} }
tencentMap.setOnMarkerClickListener(new TencentMap.OnMarkerClickListener() { Constant.markerClickListener=markerClickListener;
@Override tencentMap.setOnMarkerClickListener(Constant.markerClickListener);
public boolean onMarkerClick(Marker marker) {
if (marker.getTitle() != null && !marker.getTitle().equals("")) {//是本地数据直接跳转到采集页面
frameLayout.setVisibility(View.GONE);
if (gatherGetFragment != null) {
fragmentTransaction.remove(gatherGetFragment);
}
if (markerPoi != null) {
markerPoi.remove();
}
if (bigMarker != null) {
bigMarker.setVisible(false);
}
for (int i = 0; i < removableScreenMarker.size(); i++) {
removableScreenMarker.get(i).remove();
}
removableScreenMarker.clear();
PoiEntity poiEntity = (PoiEntity) marker.getTag();
Bundle bundle = new Bundle();
bundle.putSerializable("poiEntity", poiEntity);
switch (poiEntity.getType()) {
case 1:
// initMarker(poiEntity,false);
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
showSlidingFragment(poiFragment);
break;
case 2:
// initMarker(poiEntity,false);
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
showSlidingFragment(chargingStationFragment);
break;
case 3:
// initMarker(poiEntity,false);
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
showSlidingFragment(poiVideoFragment);
break;
case 4:
// initMarker(poiEntity,false);
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
showSlidingFragment(roadFragment);
break;
case 5:
// initMarker(poiEntity,false);
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
showSlidingFragment(otherFragment);
break;
case 6:
initMarker(poiEntity, true);
break;
}
} else {
JobSearchBean.BodyBean.ListBean listBean = (JobSearchBean.BodyBean.ListBean) marker.getTag();
if (listBean != null) {
PoiEntity poiListEntity = new PoiEntity();
poiListEntity.setTaskId(listBean.getId());
poiListEntity.setGeoWkt(listBean.getGeo());
poiListEntity.setName(listBean.getName());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setTelPhone(listBean.getTelephone() + "");
poiListEntity.setPrecision(listBean.getPrice() + "");
poiListEntity.setDist(listBean.getDist() + "");
poiListEntity.setDescribe(listBean.getMemo());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setType(Integer.valueOf(listBean.getType()));
String geo = listBean.getGeo();
poiListEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {//点
LatLng latLng = GeometryTools.createLatLng(geo);
poiListEntity.setX(latLng.longitude + "");
poiListEntity.setY(latLng.latitude + "");
} else if (geometry.getGeometryType().equals("LineString")) {//线
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
poiListEntity.setX(latLineString.get(0).longitude + "");
poiListEntity.setY(latLineString.get(0).latitude + "");
} else if (geometry.getGeometryType().equals("Polygon")) {//面
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
poiListEntity.setX(latPolygon.get(0).longitude + "");
poiListEntity.setY(latPolygon.get(0).latitude + "");
}
initMarker(poiListEntity, true);
} else {
Toast.makeText(getActivity(), "数据为空", Toast.LENGTH_SHORT).show();
}
}
return false;
}
});
} }
}); });
// 设置地图宽高为屏幕的宽高 // 设置地图宽高为屏幕的宽高
@@ -461,6 +373,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
@Override @Override
public void onSuccess(JobSearchBean response, int id) { public void onSuccess(JobSearchBean response, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
if (response.getCode()==200){
JobSearchBean.BodyBean body = response.getBody(); JobSearchBean.BodyBean body = response.getBody();
upload = response.getBody().getUpload(); upload = response.getBody().getUpload();
@@ -547,8 +460,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
case 1://poi case 1://poi
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg1); BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg1);
poiDescriptor.getFormater().setScale(50); poiDescriptor.getFormater().setScale(50);
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor) Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
.anchor(0.5f,1f) .anchor(0.5f,1.0f)
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
poiMarker.setZIndex(MARKER_DOT); poiMarker.setZIndex(MARKER_DOT);
@@ -558,7 +471,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break; break;
case 2://充电站 case 2://充电站
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg1); BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg1);
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor) Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
.anchor(0.5f,1.0f)
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
stationMarker.setZIndex(MARKER_DOT); stationMarker.setZIndex(MARKER_DOT);
@@ -569,7 +483,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break; break;
case 3://poi录像 case 3://poi录像
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video_bg1); BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video_bg1);
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor) Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
.anchor(0.5f,1.0f)
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
poiVideoMarker.setTag(listBean); poiVideoMarker.setTag(listBean);
@@ -579,7 +494,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break; break;
case 4://道路录像 case 4://道路录像
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg); BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor) Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
.anchor(0.5f,1.0f)
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
roadMarker.setZIndex(MARKER_DOT); roadMarker.setZIndex(MARKER_DOT);
@@ -590,7 +506,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break; break;
case 5://其他 case 5://其他
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1); BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1);
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor) Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
.anchor(0.5f,1.0f)
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
otherMarker.setZIndex(MARKER_DOT); otherMarker.setZIndex(MARKER_DOT);
@@ -600,7 +517,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break; break;
case 6://面状任务 case 6://面状任务
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_facet_bg1); BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_facet_bg1);
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor) Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
.anchor(0.5f,1.0f)
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
planarMarker.setZIndex(MARKER_DOT); planarMarker.setZIndex(MARKER_DOT);
@@ -615,6 +533,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
obtain.what = Constant.JOB_SEARCH_WORD; obtain.what = Constant.JOB_SEARCH_WORD;
obtain.obj = response; obtain.obj = response;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
}else {
Toast.makeText(getActivity(), response.getMessage(), Toast.LENGTH_SHORT).show();
}
} }
@Override @Override
@@ -627,13 +549,18 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} }
public void initMarker(PoiEntity poiEntity, boolean aBoolean) { public void initMarker(PoiEntity poiEntity, boolean aBoolean) {
String geo = poiEntity.getGeoWkt();
Log.d("TAG", "onSuccess: " + geo);
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry == null) {
return;
}
for (int i = 0; i < removableScreenMarker.size(); i++) { for (int i = 0; i < removableScreenMarker.size(); i++) {
removableScreenMarker.get(i).remove(); removableScreenMarker.get(i).remove();
} }
removableScreenMarker.clear(); removableScreenMarker.clear();
String geo = poiEntity.getGeoWkt();
Log.d("TAG", "onSuccess: " + geo);
Geometry geometry = GeometryTools.createGeometry(geo);
LatLng latLng = null; LatLng latLng = null;
if (geometry.getGeometryType().equals("Point")) {//点 if (geometry.getGeometryType().equals("Point")) {//点
latLng = GeometryTools.createLatLng(geo); latLng = GeometryTools.createLatLng(geo);
@@ -708,6 +635,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} else if (poiEntity.getType() == 6) { } else if (poiEntity.getType() == 6) {
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_facet_bag); descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_facet_bag);
} }
MapManager.getInstance().moveLatlng(latLng,null);
if (bigMarker == null) { if (bigMarker == null) {
bigMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(descriptor) bigMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(descriptor)
.anchor(0.5f,1f) .anchor(0.5f,1f)
@@ -1048,23 +976,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
public void onEvent(Message data) { public void onEvent(Message data) {
if (data.what == Constant.FILTER_LIST_ITEM) { // 点击筛选的item if (data.what == Constant.FILTER_LIST_ITEM) { // 点击筛选的item
PoiEntity poiEntity = (PoiEntity) data.obj; PoiEntity poiEntity = (PoiEntity) data.obj;
if (poiEntity.getX() != null && poiEntity.getY() != null) { initMarker(poiEntity,true);
LatLng position = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
CameraUpdateFactory.newCameraPosition(new CameraPosition(
position, //中心点坐标,地图目标经纬度
tencentMap.getCameraPosition().zoom, //目标缩放级别
tencentMap.getCameraPosition().tilt, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
tencentMap.getCameraPosition().bearing));//目标旋转角 0~360° (正北方为0)
}
sliding_layout.setPanelHeight(0);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
frameLayout.setVisibility(View.VISIBLE);
fragmentTransaction = supportFragmentManager.beginTransaction();
Bundle bundle = new Bundle();
bundle.putSerializable("poiEntity", poiEntity);
gatherGetFragment = GatherGetFragment.newInstance(bundle);
fragmentTransaction.replace(R.id.frame_layout, gatherGetFragment);
fragmentTransaction.commit();
// 如果当前fragment是筛选则移除该fragment // 如果当前fragment是筛选则移除该fragment
FilterFragment filterFragment = (FilterFragment) supportFragmentManager.findFragmentByTag(FilterFragment.class.getName()); FilterFragment filterFragment = (FilterFragment) supportFragmentManager.findFragmentByTag(FilterFragment.class.getName());
if (filterFragment != null) { if (filterFragment != null) {
@@ -1162,9 +1074,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
sliding_layout.setPanelHeight(0); sliding_layout.setPanelHeight(0);
setMainButtonVisiable(View.VISIBLE); setMainButtonVisiable(View.VISIBLE);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
if (markerPoi != null) {
markerPoi.remove();
}
if (bigMarker != null) { if (bigMarker != null) {
bigMarker.setVisible(false); bigMarker.setVisible(false);
} }
@@ -1174,7 +1083,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
removableScreenMarker.clear(); removableScreenMarker.clear();
} }
} else if (data.what == Constant.MAIN_BUTTON_VISIABLE) {//控制主界面各个按钮显隐状态的what值 } else if (data.what == Constant.MAIN_BUTTON_VISIABLE) {//控制主界面各个按钮显隐状态的what值
setMainButtonVisiable((Integer) data.obj); setMainButtonVisiable((Integer) data.obj);
} else if (data.what == Constant.GATHER_GET_RETURN) {//item 点击页面的返回事件的处理 } else if (data.what == Constant.GATHER_GET_RETURN) {//item 点击页面的返回事件的处理
@@ -1194,6 +1102,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
removableScreenMarker.get(i).remove(); removableScreenMarker.get(i).remove();
} }
removableScreenMarker.clear(); removableScreenMarker.clear();
} else if (data.what == Constant.CHARGING_STATION) {//充电站的充电桩-新增 } else if (data.what == Constant.CHARGING_STATION) {//充电站的充电桩-新增
if ((HashMap<String, Object>) data.obj != null) { if ((HashMap<String, Object>) data.obj != null) {
HashMap<String, Object> stationHashMap = (HashMap<String, Object>) data.obj; HashMap<String, Object> stationHashMap = (HashMap<String, Object>) data.obj;
@@ -1215,6 +1124,14 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
showSlidingFragment(chargingPileFragment); showSlidingFragment(chargingPileFragment);
} else if (data.what == Constant.JOB_WORD_MONITOR) {//筛选条件界面的刷新 } else if (data.what == Constant.JOB_WORD_MONITOR) {//筛选条件界面的刷新
if ((boolean) data.obj) { if ((boolean) data.obj) {
for (int i = 0; i < removables.size(); i++) {
removables.get(i).remove();
}
removables.clear();
for (int i = 0; i < removablesLocality.size(); i++) {
removablesLocality.get(i).remove();
}
removablesLocality.clear();
refreshFilterData(); refreshFilterData();
} }
} /*else if (data.what == Constant.EVENT_WHAT_CURRENT_MARKER) { } /*else if (data.what == Constant.EVENT_WHAT_CURRENT_MARKER) {
@@ -1544,7 +1461,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} else if (item.getText().equals("其他")) { } else if (item.getText().equals("其他")) {
// showPoiMarkerByType(5, newPoiLatLng); // showPoiMarkerByType(5, newPoiLatLng);
OtherFragment otherFragment = OtherFragment.newInstance(bundle); OtherFragment otherFragment = OtherFragment.newInstance(bundle);
otherFragment.setSlidingUpPanelLayout(sliding_layout);
showSlidingFragment(otherFragment); showSlidingFragment(otherFragment);
} }
return false; return false;
@@ -1672,6 +1588,103 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}); });
} }
TencentMap.OnMarkerClickListener markerClickListener=new TencentMap.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker marker) {
if (marker.getTitle() != null && !marker.getTitle().equals("")) {//是本地数据直接跳转到采集页面
PoiEntity poiEntity = (PoiEntity) marker.getTag();
frameLayout.setVisibility(View.GONE);
if (gatherGetFragment != null) {
fragmentTransaction.remove(gatherGetFragment);
}
if (markerPoi != null) {
markerPoi.remove();
}
if (bigMarker != null) {
bigMarker.setVisible(false);
}
for (int i = 0; i < removableScreenMarker.size(); i++) {
removableScreenMarker.get(i).remove();
}
removableScreenMarker.clear();
if (poiEntity.getTaskStatus()==1){//已领取
initMarker(poiEntity, true);
}else {
Bundle bundle = new Bundle();
bundle.putSerializable("poiEntity", poiEntity);
switch (poiEntity.getType()) {
case 1:
initMarker(poiEntity,false);
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
showSlidingFragment(poiFragment);
break;
case 2:
initMarker(poiEntity,false);
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
showSlidingFragment(chargingStationFragment);
break;
case 3:
initMarker(poiEntity,false);
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
showSlidingFragment(poiVideoFragment);
break;
case 4:
initMarker(poiEntity,false);
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
showSlidingFragment(roadFragment);
break;
case 5:
initMarker(poiEntity,false);
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
showSlidingFragment(otherFragment);
break;
case 6:
initMarker(poiEntity, true);
break;
}
}
} else {
JobSearchBean.BodyBean.ListBean listBean = (JobSearchBean.BodyBean.ListBean) marker.getTag();
if (listBean != null) {
PoiEntity poiListEntity = new PoiEntity();
poiListEntity.setTaskId(listBean.getId());
poiListEntity.setGeoWkt(listBean.getGeo());
poiListEntity.setName(listBean.getName());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setTelPhone(listBean.getTelephone() + "");
poiListEntity.setPrecision(listBean.getPrice() + "");
poiListEntity.setDist(listBean.getDist() + "");
poiListEntity.setDescribe(listBean.getMemo());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setType(Integer.valueOf(listBean.getType()));
String geo = listBean.getGeo();
poiListEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {//点
LatLng latLng = GeometryTools.createLatLng(geo);
poiListEntity.setX(latLng.longitude + "");
poiListEntity.setY(latLng.latitude + "");
} else if (geometry.getGeometryType().equals("LineString")) {//线
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
poiListEntity.setX(latLineString.get(0).longitude + "");
poiListEntity.setY(latLineString.get(0).latitude + "");
} else if (geometry.getGeometryType().equals("Polygon")) {//面
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
poiListEntity.setX(latPolygon.get(0).longitude + "");
poiListEntity.setY(latPolygon.get(0).latitude + "");
}
initMarker(poiListEntity, true);
} else {
Toast.makeText(getActivity(), "数据为空", Toast.LENGTH_SHORT).show();
}
}
return false;
}
};
@Override @Override
public boolean onBackPressed() { public boolean onBackPressed() {

View File

@@ -162,7 +162,11 @@ public class ContactView {
View itemView = rootView.getChildAt(i); View itemView = rootView.getChildAt(i);
EditText editAreaCode = itemView.findViewById(R.id.edit_area_code); EditText editAreaCode = itemView.findViewById(R.id.edit_area_code);
EditText editPhoneNumber = itemView.findViewById(R.id.edit_phone_number); EditText editPhoneNumber = itemView.findViewById(R.id.edit_phone_number);
poiBeans.add(new PhoneBean(null, editPhoneNumber.getText().toString().trim(), editAreaCode.getText().toString().trim(), 0)); String areaCode = "";
if (editAreaCode.isShown()) {
areaCode = editAreaCode.getText().toString().trim();
}
poiBeans.add(new PhoneBean(null, editPhoneNumber.getText().toString().trim(), areaCode, 0));
} }
} }
return poiBeans; return poiBeans;
@@ -177,12 +181,12 @@ public class ContactView {
List<PhoneBean> list = getPoiBeanListByRootView(); List<PhoneBean> list = getPoiBeanListByRootView();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
PhoneBean poiBean = list.get(i); PhoneBean poiBean = list.get(i);
if (poiBean.getPhone().indexOf('1') == 0) { if (poiBean.getPhone().startsWith("1")) {
if (poiBean.getPhone().length()!=11){ if (poiBean.getPhone().length()!=11){
return false; return false;
} }
} else { } else {
if (poiBean.getArea().length()+poiBean.getPhone().length()==11){ if (poiBean.getArea().length()+poiBean.getPhone().length()<10 || poiBean.getArea().length()+poiBean.getPhone().length()>12||poiBean.getArea().length()<2){
return false; return false;
} }
} }
@@ -191,6 +195,28 @@ public class ContactView {
return true; return true;
} }
/**
* 检验数据
*
* @return
*/
public int getPhoneList() {
List<PhoneBean> list = getPoiBeanListByRootView();
for (int i = 0; i < list.size(); i++) {
PhoneBean poiBean = list.get(i);
if (poiBean.getPhone().startsWith("1")) {
if (poiBean.getPhone().length()!=11){
return i+1;
}
} else {
if (poiBean.getArea().length()+poiBean.getPhone().length()<10 || poiBean.getArea().length()+poiBean.getPhone().length()>12||poiBean.getArea().length()<2){
return i+1;
}
}
}
return -1;
}
/** /**
* 整理数据 * 整理数据
* *
@@ -198,34 +224,21 @@ public class ContactView {
*/ */
public String getList() { public String getList() {
List<PhoneBean> list = getPoiBeanListByRootView(); List<PhoneBean> list = getPoiBeanListByRootView();
String a = ""; StringBuffer phoneSb = new StringBuffer("");
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
PhoneBean poiBean = list.get(i); PhoneBean poiBean = list.get(i);
if (list.size() == 1) { if (poiBean.getPhone().startsWith("1")) {
if (poiBean.getPhone().indexOf('1') == 0) { phoneSb.append(poiBean.getPhone());
a = poiBean.getPhone();
} else { } else {
a = poiBean.getArea() + "-" + poiBean.getPhone(); phoneSb.append(poiBean.getArea()).append("-").append(poiBean.getPhone());
} }
} else { phoneSb.append("|");
if (i == list.size() - 1) {
if (poiBean.getPhone().indexOf('1') == 0) {
a += poiBean.getPhone();
} else {
a += poiBean.getArea() + "-" + poiBean.getPhone();
} }
} else { String result = phoneSb.toString();
if (poiBean.getPhone().indexOf('1') == 0) { if (result.length()>0&&result.endsWith("|")) {
a += poiBean.getPhone() + "|"; result = result.substring(0, result.length()-1);
} else {
a += poiBean.getArea() + "-" + poiBean.getPhone() + "|";
} }
} return result;
}
}
return a;
} }
/** /**

View File

@@ -41,4 +41,12 @@ public class MapManager {
tencentMap.animateCamera(cameraSigma); tencentMap.animateCamera(cameraSigma);
} }
} }
public void moveLatlng(LatLng latLng, TencentMap.CancelableCallback cancelableCallback) {
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
latLng, //中心点坐标,地图目标经纬度
tencentMap.getCameraPosition().zoom, //目标缩放级别
tencentMap.getCameraPosition().tilt, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
tencentMap.getCameraPosition().bearing)); //目标旋转角 0~360° (正北方为0)
tencentMap.animateCamera(cameraSigma, cancelableCallback);
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB