Java Code Examples for com.baidu.mapapi.map.MapView#setMapCustomEnable()

The following examples show how to use com.baidu.mapapi.map.MapView#setMapCustomEnable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaiduMapRouteFragment.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
private void configMap() {
    ConfigInteracter configInteracter = new ConfigInteracter(getActivity());
    mBaiduMap.getUiSettings().setZoomGesturesEnabled(configInteracter.isZoomGesturesEnabled());
    mBaiduMap.getUiSettings().setOverlookingGesturesEnabled(configInteracter.isOverlookEnable());
    mBaiduMap.getUiSettings().setRotateGesturesEnabled(configInteracter.isRotateEnable());
    mMapView.showScaleControl(configInteracter.isShowScaleControl());
    mBaiduMap.showMapPoi(configInteracter.isMapPoiEnable());
    mBaiduMap.setTrafficEnabled(configInteracter.isTrafficEnable());
    if (configInteracter.getNightMode() == 2){
        MapView.setMapCustomEnable(true);
    }else {
        MapView.setMapCustomEnable(false);
    }
    mMapView.showZoomControls(false);
    mBaiduMap.setMaxAndMinZoomLevel(20f, 3f);
    CoordinatorLayout.LayoutParams params = new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    if (configInteracter.getZoomControlsPosition()) {
        params.rightMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
    } else {
        params.leftMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
    }
    mCardZoom.setLayoutParams(params);

}
 
Example 2
Source File: BaiduMapFragment.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onDestroyView() {
    // 关闭定位图层
    if (null != mBaiduMap) {
        mBaiduMap.hideInfoWindow();
        mBaiduMap.setMyLocationEnabled(false);
    }

    if (null != mMapView) {
        MapView.setMapCustomEnable(false);
        mMapView.onDestroy();
        mMapView = null;
    }

    if (null != mSearchInteracter) {
        mSearchInteracter.destroy();
    }
    if (null != mFavoriteInteracter) {
        mFavoriteInteracter.destroy();
    }

    super.onDestroyView();
}
 
Example 3
Source File: BaiduMapRouteFragment.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
private void configMap() {
    ConfigInteracter configInteracter = new ConfigInteracter(getActivity());
    mBaiduMap.getUiSettings().setZoomGesturesEnabled(configInteracter.isZoomGesturesEnabled());
    mBaiduMap.getUiSettings().setOverlookingGesturesEnabled(configInteracter.isOverlookEnable());
    mBaiduMap.getUiSettings().setRotateGesturesEnabled(configInteracter.isRotateEnable());
    mMapView.showScaleControl(configInteracter.isShowScaleControl());
    mBaiduMap.showMapPoi(configInteracter.isMapPoiEnable());
    mBaiduMap.setTrafficEnabled(configInteracter.isTrafficEnable());
    if (configInteracter.getNightMode() == 2){
        MapView.setMapCustomEnable(true);
    }else {
        MapView.setMapCustomEnable(false);
    }
    mMapView.showZoomControls(false);
    mBaiduMap.setMaxAndMinZoomLevel(20f, 3f);
    CoordinatorLayout.LayoutParams params = new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    if (configInteracter.getZoomControlsPosition()) {
        params.rightMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
    } else {
        params.leftMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
    }
    mCardZoom.setLayoutParams(params);

}
 
Example 4
Source File: BaiduMapFragment.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
@Override
public void onDestroyView() {
    // 关闭定位图层
    if (null != mBaiduMap) {
        mBaiduMap.hideInfoWindow();
        mBaiduMap.setMyLocationEnabled(false);
    }

    if (null != mMapView) {
        MapView.setMapCustomEnable(false);
        mMapView.onDestroy();
        mMapView = null;
    }

    if (null != mSearchInteracter) {
        mSearchInteracter.destroy();
    }
    if (null != mFavoriteInteracter) {
        mFavoriteInteracter.destroy();
    }

    super.onDestroyView();
}
 
Example 5
Source File: BaiduMapFragment.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
private void configMap() {
        ConfigInteracter configInteracter = new ConfigInteracter(getActivity());
        mBaiduMap.getUiSettings().setZoomGesturesEnabled(configInteracter.isZoomGesturesEnabled());
        mBaiduMap.getUiSettings().setOverlookingGesturesEnabled(configInteracter.isOverlookEnable());
        mBaiduMap.getUiSettings().setRotateGesturesEnabled(configInteracter.isRotateEnable());
        mMapView.showScaleControl(configInteracter.isShowScaleControl());
        mBaiduMap.showMapPoi(configInteracter.isMapPoiEnable());
        mBaiduMap.setTrafficEnabled(configInteracter.isTrafficEnable());
        if (configInteracter.getNightMode() == 2) {
            MapView.setMapCustomEnable(true);
        } else {
            MapView.setMapCustomEnable(false);
        }

        mMapView.showZoomControls(false);
//        mBaiduMap.setMaxAndMinZoomLevel(20f, 3f);
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        FrameLayout.LayoutParams params2 = new FrameLayout.LayoutParams(AppUtils.dip2Px(getActivity(), 36), ViewGroup.LayoutParams.WRAP_CONTENT);
        if (configInteracter.getZoomControlsPosition()) {
            params.rightMargin = AppUtils.dip2Px(getActivity(), 10);
            params.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
            params2.leftMargin = AppUtils.dip2Px(getActivity(), 10);
            params2.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
        } else {
            params.leftMargin = AppUtils.dip2Px(getActivity(), 10);
            params.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
            params2.rightMargin = AppUtils.dip2Px(getActivity(), 10);
            params2.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
        }
        mCardZoom.setLayoutParams(params);
        mCardFloor.setLayoutParams(params2);

    }
 
Example 6
Source File: BaiduMapSelectPoiFragment.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
private void configMap() {
    ConfigInteracter configInteracter = new ConfigInteracter(getActivity());
    mBaiduMap.getUiSettings().setZoomGesturesEnabled(configInteracter.isZoomGesturesEnabled());
    mBaiduMap.getUiSettings().setOverlookingGesturesEnabled(configInteracter.isOverlookEnable());
    mBaiduMap.getUiSettings().setRotateGesturesEnabled(configInteracter.isRotateEnable());
    mMapView.showScaleControl(configInteracter.isShowScaleControl());
    mBaiduMap.showMapPoi(configInteracter.isMapPoiEnable());
    mBaiduMap.setTrafficEnabled(configInteracter.isTrafficEnable());
    if (configInteracter.getNightMode() == 2){
        MapView.setMapCustomEnable(true);
    }else {
        MapView.setMapCustomEnable(false);
    }

    mMapView.showZoomControls(false);
    mBaiduMap.setMaxAndMinZoomLevel(20f, 3f);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    if (configInteracter.getZoomControlsPosition()) {
        params.rightMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
    } else {
        params.leftMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
    }
    mCardZoom.setLayoutParams(params);

}
 
Example 7
Source File: RouteBaiduBusActivity.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
private void configMap() {
        ConfigInteracter configInteracter = new ConfigInteracter(this);
        mBaiduMap.getUiSettings().setZoomGesturesEnabled(configInteracter.isZoomGesturesEnabled());
        mBaiduMap.getUiSettings().setOverlookingGesturesEnabled(configInteracter.isOverlookEnable());
        mBaiduMap.getUiSettings().setRotateGesturesEnabled(configInteracter.isRotateEnable());
        mMapView.showScaleControl(configInteracter.isShowScaleControl());
        mBaiduMap.showMapPoi(configInteracter.isMapPoiEnable());
        mBaiduMap.setTrafficEnabled(configInteracter.isTrafficEnable());
        if (configInteracter.getNightMode() == 2) {
            MapView.setMapCustomEnable(true);
        } else {
            MapView.setMapCustomEnable(false);
        }

        mMapView.showZoomControls(false);
        mBaiduMap.setMaxAndMinZoomLevel(20f, 3f);
        CoordinatorLayout.LayoutParams params = new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        if (configInteracter.getZoomControlsPosition()) {
            params.rightMargin = AppUtils.dip2Px(this, 10);
            params.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
        } else {
            params.leftMargin = AppUtils.dip2Px(this, 10);
            params.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
        }
        mCardZoom.setLayoutParams(params);

//        if (configInteracter.getZoomControlsPosition()) {
//            mMapView.setZoomControlsPosition(new Point(mMapView.getWidth() - 150, mMapView.getHeight() / 2));
//        } else {
//            mMapView.setZoomControlsPosition(new Point(20, mMapView.getHeight() / 2));
//        }
    }
 
Example 8
Source File: BaiduMapFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
private void configMap() {
        ConfigInteracter configInteracter = new ConfigInteracter(getActivity());
        mBaiduMap.getUiSettings().setZoomGesturesEnabled(configInteracter.isZoomGesturesEnabled());
        mBaiduMap.getUiSettings().setOverlookingGesturesEnabled(configInteracter.isOverlookEnable());
        mBaiduMap.getUiSettings().setRotateGesturesEnabled(configInteracter.isRotateEnable());
        mMapView.showScaleControl(configInteracter.isShowScaleControl());
        mBaiduMap.showMapPoi(configInteracter.isMapPoiEnable());
        mBaiduMap.setTrafficEnabled(configInteracter.isTrafficEnable());
        if (configInteracter.getNightMode() == 2) {
            MapView.setMapCustomEnable(true);
        } else {
            MapView.setMapCustomEnable(false);
        }

        mMapView.showZoomControls(false);
//        mBaiduMap.setMaxAndMinZoomLevel(20f, 3f);
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        FrameLayout.LayoutParams params2 = new FrameLayout.LayoutParams(AppUtils.dip2Px(getActivity(), 36), ViewGroup.LayoutParams.WRAP_CONTENT);
        if (configInteracter.getZoomControlsPosition()) {
            params.rightMargin = AppUtils.dip2Px(getActivity(), 10);
            params.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
            params2.leftMargin = AppUtils.dip2Px(getActivity(), 10);
            params2.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
        } else {
            params.leftMargin = AppUtils.dip2Px(getActivity(), 10);
            params.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
            params2.rightMargin = AppUtils.dip2Px(getActivity(), 10);
            params2.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
        }
        mCardZoom.setLayoutParams(params);
        mCardFloor.setLayoutParams(params2);

    }
 
Example 9
Source File: BaiduMapSelectPoiFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
private void configMap() {
    ConfigInteracter configInteracter = new ConfigInteracter(getActivity());
    mBaiduMap.getUiSettings().setZoomGesturesEnabled(configInteracter.isZoomGesturesEnabled());
    mBaiduMap.getUiSettings().setOverlookingGesturesEnabled(configInteracter.isOverlookEnable());
    mBaiduMap.getUiSettings().setRotateGesturesEnabled(configInteracter.isRotateEnable());
    mMapView.showScaleControl(configInteracter.isShowScaleControl());
    mBaiduMap.showMapPoi(configInteracter.isMapPoiEnable());
    mBaiduMap.setTrafficEnabled(configInteracter.isTrafficEnable());
    if (configInteracter.getNightMode() == 2){
        MapView.setMapCustomEnable(true);
    }else {
        MapView.setMapCustomEnable(false);
    }

    mMapView.showZoomControls(false);
    mBaiduMap.setMaxAndMinZoomLevel(20f, 3f);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    if (configInteracter.getZoomControlsPosition()) {
        params.rightMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
    } else {
        params.leftMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
    }
    mCardZoom.setLayoutParams(params);

}
 
Example 10
Source File: RouteBaiduBusActivity.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
private void configMap() {
        ConfigInteracter configInteracter = new ConfigInteracter(this);
        mBaiduMap.getUiSettings().setZoomGesturesEnabled(configInteracter.isZoomGesturesEnabled());
        mBaiduMap.getUiSettings().setOverlookingGesturesEnabled(configInteracter.isOverlookEnable());
        mBaiduMap.getUiSettings().setRotateGesturesEnabled(configInteracter.isRotateEnable());
        mMapView.showScaleControl(configInteracter.isShowScaleControl());
        mBaiduMap.showMapPoi(configInteracter.isMapPoiEnable());
        mBaiduMap.setTrafficEnabled(configInteracter.isTrafficEnable());
        if (configInteracter.getNightMode() == 2) {
            MapView.setMapCustomEnable(true);
        } else {
            MapView.setMapCustomEnable(false);
        }

        mMapView.showZoomControls(false);
        mBaiduMap.setMaxAndMinZoomLevel(20f, 3f);
        CoordinatorLayout.LayoutParams params = new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        if (configInteracter.getZoomControlsPosition()) {
            params.rightMargin = AppUtils.dip2Px(this, 10);
            params.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
        } else {
            params.leftMargin = AppUtils.dip2Px(this, 10);
            params.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
        }
        mCardZoom.setLayoutParams(params);

//        if (configInteracter.getZoomControlsPosition()) {
//            mMapView.setZoomControlsPosition(new Point(mMapView.getWidth() - 150, mMapView.getHeight() / 2));
//        } else {
//            mMapView.setZoomControlsPosition(new Point(20, mMapView.getHeight() / 2));
//        }
    }