地图中心点移动到屏幕上的3/1
This commit is contained in:
@@ -105,6 +105,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
|||||||
startActivity(forgetPaw);
|
startActivity(forgetPaw);
|
||||||
break;
|
break;
|
||||||
case R.id.btn_login:
|
case R.id.btn_login:
|
||||||
|
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
String name = etLoginName.getText().toString().trim();
|
String name = etLoginName.getText().toString().trim();
|
||||||
if (name == null||name.equals("")) {
|
if (name == null||name.equals("")) {
|
||||||
Toast.makeText(this, "请输入账号", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "请输入账号", Toast.LENGTH_SHORT).show();
|
||||||
@@ -115,7 +117,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
|||||||
Toast.makeText(this, "请输入密码", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "请输入密码", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
initLogIn(name,paw);
|
//initLogIn(name,paw);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,8 @@ public class MainActivity extends BaseActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onGranted(List<String> permissions, boolean all) {
|
public void onGranted(List<String> permissions, boolean all) {
|
||||||
if (all) {
|
if (all) {
|
||||||
initCheckVersion();
|
// initCheckVersion();
|
||||||
|
initTime();
|
||||||
} else {
|
} else {
|
||||||
initPermission();
|
initPermission();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ import com.navinfo.outdoor.room.PoiEntity;
|
|||||||
import com.navinfo.outdoor.util.Base64;
|
import com.navinfo.outdoor.util.Base64;
|
||||||
import com.navinfo.outdoor.util.Geohash;
|
import com.navinfo.outdoor.util.Geohash;
|
||||||
import com.navinfo.outdoor.util.GeometryTools;
|
import com.navinfo.outdoor.util.GeometryTools;
|
||||||
|
import com.navinfo.outdoor.util.MapManager;
|
||||||
import com.navinfo.outdoor.util.MyTecentLocationSource;
|
import com.navinfo.outdoor.util.MyTecentLocationSource;
|
||||||
import com.navinfo.outdoor.util.NetWorkUtils;
|
import com.navinfo.outdoor.util.NetWorkUtils;
|
||||||
import com.navinfo.outdoor.util.ToastUtil;
|
import com.navinfo.outdoor.util.ToastUtil;
|
||||||
@@ -179,6 +180,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
ivMessage.setOnClickListener(this::onClick);
|
ivMessage.setOnClickListener(this::onClick);
|
||||||
treasureMap = (MapView) findViewById(R.id.treasure_map);
|
treasureMap = (MapView) findViewById(R.id.treasure_map);
|
||||||
tencentMap = treasureMap.getMap();
|
tencentMap = treasureMap.getMap();
|
||||||
|
MapManager.getInstance().init(getActivity(), tencentMap);
|
||||||
// if (getClass().getCanonicalName().equals("PioFragment")){
|
// if (getClass().getCanonicalName().equals("PioFragment")){
|
||||||
// ivMessage.setVisibility(View.VISIBLE);
|
// ivMessage.setVisibility(View.VISIBLE);
|
||||||
// }else {
|
// }else {
|
||||||
@@ -874,7 +876,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
bundle.putSerializable("poiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
||||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||||
// showPoiMarkerByType(1, newPoiLatLng);
|
showPoiMarkerByType(1, newPoiLatLng);
|
||||||
showSlidingFragment(poiFragment);
|
showSlidingFragment(poiFragment);
|
||||||
initRemovePoiSharePre();
|
initRemovePoiSharePre();
|
||||||
return false;
|
return false;
|
||||||
@@ -890,7 +892,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
bundle.putSerializable("poiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
||||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||||
//showPoiMarkerByType(4, newPoiLatLng);
|
showPoiMarkerByType(4, newPoiLatLng);
|
||||||
showSlidingFragment(chargingStationFragment);
|
showSlidingFragment(chargingStationFragment);
|
||||||
initRemovePoiSharePre();
|
initRemovePoiSharePre();
|
||||||
return false;
|
return false;
|
||||||
@@ -906,7 +908,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
bundle.putSerializable("poiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
||||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||||
//showPoiMarkerByType(2, newPoiLatLng);
|
showPoiMarkerByType(2, newPoiLatLng);
|
||||||
showSlidingFragment(poiVideoFragment);
|
showSlidingFragment(poiVideoFragment);
|
||||||
initRemovePoiSharePre();
|
initRemovePoiSharePre();
|
||||||
return false;
|
return false;
|
||||||
@@ -922,7 +924,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
bundle.putSerializable("poiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
||||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||||
// showPoiMarkerByType(3, newPoiLatLng);
|
showPoiMarkerByType(3, newPoiLatLng);
|
||||||
showSlidingFragment(roadFragment);
|
showSlidingFragment(roadFragment);
|
||||||
initRemovePoiSharePre();
|
initRemovePoiSharePre();
|
||||||
return false;
|
return false;
|
||||||
@@ -938,7 +940,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
bundle.putSerializable("poiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
||||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||||
//showPoiMarkerByType(5, newPoiLatLng);
|
showPoiMarkerByType(5, newPoiLatLng);
|
||||||
showSlidingFragment(otherFragment);
|
showSlidingFragment(otherFragment);
|
||||||
initRemovePoiSharePre();
|
initRemovePoiSharePre();
|
||||||
return false;
|
return false;
|
||||||
@@ -1154,7 +1156,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
} else if (data.what == Constant.EVENT_WHAT_CURRENT_MARKER) {
|
} else if (data.what == Constant.EVENT_WHAT_CURRENT_MARKER) {
|
||||||
LatLng latLng = (LatLng) data.obj;
|
LatLng latLng = (LatLng) data.obj;
|
||||||
int type = data.arg1;
|
int type = data.arg1;
|
||||||
//showPoiMarkerByType(type, latLng);
|
showPoiMarkerByType(type, latLng);
|
||||||
} else if (data.what == Constant.EVENT_WHAT_COMPLETE_TASK) {
|
} else if (data.what == Constant.EVENT_WHAT_COMPLETE_TASK) {
|
||||||
// initRemoveFragment();
|
// initRemoveFragment();
|
||||||
PoiEntity poiEntity = (PoiEntity) data.obj;
|
PoiEntity poiEntity = (PoiEntity) data.obj;
|
||||||
@@ -1190,25 +1192,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
}else if (data.what==Constant.POI_DRAWER){//设置每个点的中心位置
|
}else if (data.what==Constant.POI_DRAWER){//设置每个点的中心位置
|
||||||
LatLng latLng = (LatLng) data.obj;
|
LatLng latLng = (LatLng) data.obj;
|
||||||
if (latLng!=null){
|
if (latLng!=null){
|
||||||
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
MapManager.getInstance().animateMapLocation2TopCenter(latLng, 0.5f, 0.25f);
|
||||||
latLng, //中心点坐标,地图目标经纬度
|
|
||||||
tencentMap.getCameraPosition().zoom, //目标缩放级别
|
|
||||||
tencentMap.getCameraPosition().tilt, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
|
|
||||||
tencentMap.getCameraPosition().bearing)); //目标旋转角 0~360° (正北方为0)
|
|
||||||
tencentMap.animateCamera(cameraSigma, new TencentMap.CancelableCallback() {
|
|
||||||
@Override
|
|
||||||
public void onFinish() {
|
|
||||||
screenPosition = tencentMap.getProjection().toScreenLocation(latLng);
|
|
||||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
|
||||||
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor1).zIndex(2));
|
|
||||||
if (markerPoi != null) {
|
|
||||||
markerPoi.setFixingPoint(screenPosition.x, screenPosition.y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onCancel() {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1230,7 +1214,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initPoiMarker(LatLng latLng) {
|
private void initPoiMarker(LatLng latLng) {
|
||||||
//LatLng mapCenterPoint = getMapCenterPoint();
|
LatLng mapCenterPoint = getMapCenterPoint();
|
||||||
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||||
latLng, //中心点坐标,地图目标经纬度
|
latLng, //中心点坐标,地图目标经纬度
|
||||||
tencentMap.getCameraPosition().zoom, //目标缩放级别
|
tencentMap.getCameraPosition().zoom, //目标缩放级别
|
||||||
@@ -1266,7 +1250,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
screenPosition = tencentMap.getProjection().toScreenLocation(latLng);
|
screenPosition = tencentMap.getProjection().toScreenLocation(latLng);
|
||||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||||
//创建Marker对象之前,设置属性
|
//创建Marker对象之前,设置属性
|
||||||
|
if (markerPile!=null){
|
||||||
|
markerPile.setFixingPoint(screenPosition.x, screenPosition.y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onCancel() {
|
public void onCancel() {
|
||||||
@@ -1457,29 +1443,29 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
public boolean onClick(ShareDialog shareDialog, int index, ShareDialog.Item item) {
|
public boolean onClick(ShareDialog shareDialog, int index, ShareDialog.Item item) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: // POI
|
case 0: // POI
|
||||||
//showPoiMarkerByType(1, newPoiLatLng);
|
showPoiMarkerByType(1, newPoiLatLng);
|
||||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
||||||
showSlidingFragment(poiFragment);
|
showSlidingFragment(poiFragment);
|
||||||
break;
|
break;
|
||||||
case 1: // POI录像
|
case 1: // POI录像
|
||||||
//showPoiMarkerByType(2, newPoiLatLng);
|
showPoiMarkerByType(2, newPoiLatLng);
|
||||||
poiEntity.setWork_type(1);
|
poiEntity.setWork_type(1);
|
||||||
bundle.putSerializable("poiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
||||||
showSlidingFragment(poiVideoFragment);
|
showSlidingFragment(poiVideoFragment);
|
||||||
break;
|
break;
|
||||||
case 2://道路录像
|
case 2://道路录像
|
||||||
//showPoiMarkerByType(3, newPoiLatLng);
|
showPoiMarkerByType(3, newPoiLatLng);
|
||||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
||||||
showSlidingFragment(roadFragment);
|
showSlidingFragment(roadFragment);
|
||||||
break;
|
break;
|
||||||
case 3://充电站
|
case 3://充电站
|
||||||
//showPoiMarkerByType(4, newPoiLatLng);
|
showPoiMarkerByType(4, newPoiLatLng);
|
||||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
||||||
showSlidingFragment(chargingStationFragment);
|
showSlidingFragment(chargingStationFragment);
|
||||||
break;
|
break;
|
||||||
case 4://其他
|
case 4://其他
|
||||||
//showPoiMarkerByType(5, newPoiLatLng);
|
showPoiMarkerByType(5, newPoiLatLng);
|
||||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
||||||
showSlidingFragment(otherFragment);
|
showSlidingFragment(otherFragment);
|
||||||
break;
|
break;
|
||||||
@@ -1501,7 +1487,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private void showPoiMarkerByType(int type, LatLng latLng) {
|
private void showPoiMarkerByType(int type, LatLng latLng) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor1).zIndex(2));
|
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor1).zIndex(2));
|
||||||
} else if (type == 2) {
|
} else if (type == 2) {
|
||||||
@@ -1513,7 +1499,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
} else if (type == 5) {
|
} else if (type == 5) {
|
||||||
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor5).zIndex(2));
|
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor5).zIndex(2));
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将fragment显示到抽屉内
|
* 将fragment显示到抽屉内
|
||||||
|
|||||||
Reference in New Issue
Block a user