地图中心点移动到屏幕上的3/1

This commit is contained in:
wds
2021-08-10 20:39:20 +08:00
parent 401a03b429
commit 0aac301e3c
3 changed files with 25 additions and 36 deletions

View File

@@ -105,6 +105,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
startActivity(forgetPaw);
break;
case R.id.btn_login:
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
startActivity(intent);
String name = etLoginName.getText().toString().trim();
if (name == null||name.equals("")) {
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();
return;
}
initLogIn(name,paw);
//initLogIn(name,paw);
break;
}
}

View File

@@ -116,7 +116,8 @@ public class MainActivity extends BaseActivity {
@Override
public void onGranted(List<String> permissions, boolean all) {
if (all) {
initCheckVersion();
// initCheckVersion();
initTime();
} else {
initPermission();
}

View File

@@ -60,6 +60,7 @@ import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.Base64;
import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.MapManager;
import com.navinfo.outdoor.util.MyTecentLocationSource;
import com.navinfo.outdoor.util.NetWorkUtils;
import com.navinfo.outdoor.util.ToastUtil;
@@ -179,6 +180,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
ivMessage.setOnClickListener(this::onClick);
treasureMap = (MapView) findViewById(R.id.treasure_map);
tencentMap = treasureMap.getMap();
MapManager.getInstance().init(getActivity(), tencentMap);
// if (getClass().getCanonicalName().equals("PioFragment")){
// ivMessage.setVisibility(View.VISIBLE);
// }else {
@@ -874,7 +876,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
bundle.putSerializable("poiEntity", poiEntity);
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
// showPoiMarkerByType(1, newPoiLatLng);
showPoiMarkerByType(1, newPoiLatLng);
showSlidingFragment(poiFragment);
initRemovePoiSharePre();
return false;
@@ -890,7 +892,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
bundle.putSerializable("poiEntity", poiEntity);
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
//showPoiMarkerByType(4, newPoiLatLng);
showPoiMarkerByType(4, newPoiLatLng);
showSlidingFragment(chargingStationFragment);
initRemovePoiSharePre();
return false;
@@ -906,7 +908,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
bundle.putSerializable("poiEntity", poiEntity);
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
//showPoiMarkerByType(2, newPoiLatLng);
showPoiMarkerByType(2, newPoiLatLng);
showSlidingFragment(poiVideoFragment);
initRemovePoiSharePre();
return false;
@@ -922,7 +924,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
bundle.putSerializable("poiEntity", poiEntity);
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
// showPoiMarkerByType(3, newPoiLatLng);
showPoiMarkerByType(3, newPoiLatLng);
showSlidingFragment(roadFragment);
initRemovePoiSharePre();
return false;
@@ -938,7 +940,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
bundle.putSerializable("poiEntity", poiEntity);
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
//showPoiMarkerByType(5, newPoiLatLng);
showPoiMarkerByType(5, newPoiLatLng);
showSlidingFragment(otherFragment);
initRemovePoiSharePre();
return false;
@@ -1154,7 +1156,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} else if (data.what == Constant.EVENT_WHAT_CURRENT_MARKER) {
LatLng latLng = (LatLng) data.obj;
int type = data.arg1;
//showPoiMarkerByType(type, latLng);
showPoiMarkerByType(type, latLng);
} else if (data.what == Constant.EVENT_WHAT_COMPLETE_TASK) {
// initRemoveFragment();
PoiEntity poiEntity = (PoiEntity) data.obj;
@@ -1190,25 +1192,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}else if (data.what==Constant.POI_DRAWER){//设置每个点的中心位置
LatLng latLng = (LatLng) data.obj;
if (latLng!=null){
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, 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() {
}
});
MapManager.getInstance().animateMapLocation2TopCenter(latLng, 0.5f, 0.25f);
}
}
@@ -1230,7 +1214,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
private void initPoiMarker(LatLng latLng) {
//LatLng mapCenterPoint = getMapCenterPoint();
LatLng mapCenterPoint = getMapCenterPoint();
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
latLng, //中心点坐标,地图目标经纬度
tencentMap.getCameraPosition().zoom, //目标缩放级别
@@ -1266,7 +1250,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
screenPosition = tencentMap.getProjection().toScreenLocation(latLng);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
//创建Marker对象之前设置属性
if (markerPile!=null){
markerPile.setFixingPoint(screenPosition.x, screenPosition.y);
}
}
@Override
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) {
switch (index) {
case 0: // POI
//showPoiMarkerByType(1, newPoiLatLng);
showPoiMarkerByType(1, newPoiLatLng);
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
showSlidingFragment(poiFragment);
break;
case 1: // POI录像
//showPoiMarkerByType(2, newPoiLatLng);
showPoiMarkerByType(2, newPoiLatLng);
poiEntity.setWork_type(1);
bundle.putSerializable("poiEntity", poiEntity);
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
showSlidingFragment(poiVideoFragment);
break;
case 2://道路录像
//showPoiMarkerByType(3, newPoiLatLng);
showPoiMarkerByType(3, newPoiLatLng);
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
showSlidingFragment(roadFragment);
break;
case 3://充电站
//showPoiMarkerByType(4, newPoiLatLng);
showPoiMarkerByType(4, newPoiLatLng);
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
showSlidingFragment(chargingStationFragment);
break;
case 4://其他
//showPoiMarkerByType(5, newPoiLatLng);
showPoiMarkerByType(5, newPoiLatLng);
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
showSlidingFragment(otherFragment);
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) {
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor1).zIndex(2));
} else if (type == 2) {
@@ -1513,7 +1499,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} else if (type == 5) {
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor5).zIndex(2));
}
}*/
}
/**
* 将fragment显示到抽屉内