当前位置: 首页>>代码示例>>Java>>正文


Java MapsInitializer类代码示例

本文整理汇总了Java中com.google.android.gms.maps.MapsInitializer的典型用法代码示例。如果您正苦于以下问题:Java MapsInitializer类的具体用法?Java MapsInitializer怎么用?Java MapsInitializer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MapsInitializer类属于com.google.android.gms.maps包,在下文中一共展示了MapsInitializer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onMapReady

import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    MapsInitializer.initialize(getActivity());
    final ViewOption viewOption = getViewOption();
    calculateAreaAndLength(viewOption);
    MapUtils.showElements(viewOption, googleMap, getActivity());
    googleMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
        @Override
        public void onMapClick(LatLng latLng) {
            Bundle args = new Bundle();
            args.putParcelable("optionView", viewOption);
            Intent intent = new Intent(getActivity(), MapsActivity.class);
            intent.putExtra("args", args);
            startActivity(intent);
        }
    });
}
 
开发者ID:bkhezry,项目名称:ExtraMapUtils,代码行数:18,代码来源:BasicFragment.java

示例2: initMap

import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
protected void initMap(GoogleMap map) {
    goToLocation = true;
    firstLocationRefresh = true;
    if (map != null) {
        MapsInitializer.initialize(getActivity());
        RAApplication.getInstance().getGpsDetector().setGpsMapListener(new GPSDetector.GpsMapListener() {
            @Override
            public void onGpsMapListener(final Location location) {
                ActivityUtil.runOnMainThread(new Runnable() {
                    @Override
                    public void run() {
                        if (refreshMyLocation) {
                            setCurrentLocation(location);
                        }
                    }
                });
            }
        });
        clearMap();
        LatLng loc = new LatLng(Constants.LATITUDE_BELARUS, Constants.LONGITUDE_BELARUS);
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, Constants.DEFAULT_CAMERA_ZOOM));
        refreshMyLocation(loc);
        initMapData();
    }
}
 
开发者ID:WorldBank-Transport,项目名称:RoadLab-Pro,代码行数:26,代码来源:BaseStartMeasurementMapFragment.java

示例3: onCreateView

import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_bootprint_map, container, false);

    ButterKnife.bind(this, view);

    MapsInitializer.initialize(getActivity());
    mMapView.onCreate(savedInstanceState);

    // init bootprints
    //TOmaybeDO better data structure for this
    mBootprintLocations = new ArrayList<>(MAX_BOOTPRINTS);

    mLeftBootprint = BitmapDescriptorFactory.fromResource(R.drawable.bootprint_left);
    mRightBootprint = BitmapDescriptorFactory.fromResource(R.drawable.bootprint_right);

    // init map
    mHasSetInitialCameraPosition = false;

    mMapView.getMapAsync(this);

    return view;
}
 
开发者ID:BloopApp,项目名称:Bloop,代码行数:25,代码来源:BootprintMapFragment.java

示例4: onCreateView

import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public View onCreateView(
    LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  View rootView = inflater.inflate(R.layout.map_fragment, container, false);
  mMapView = ((MapView) rootView.findViewById(R.id.map));
  mMapView.onCreate(savedInstanceState);
  mMapView.getMapAsync(this);
  MapsInitializer.initialize(getActivity());

  RealTimePositionVelocityCalculator currentPositionVelocityCalculator =
      mPositionVelocityCalculator;
  if (currentPositionVelocityCalculator != null) {
    currentPositionVelocityCalculator.setMapFragment(this);
  }

  return rootView;
}
 
开发者ID:google,项目名称:gps-measurement-tools,代码行数:18,代码来源:MapFragment.java

示例5: onCreate

import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    instance = this;

    if (!FirebaseApp.getApps(this).isEmpty()) {
        analytics = FirebaseAnalytics.getInstance(this);
    }

    MapsInitializer.initialize(this);

    Deelgebied.initialize(this.getResources());

    AppData.initialize(this.getFilesDir());
    File dir = this.getFilesDir();
    String file = dir.getAbsolutePath();
    dir.exists();
}
 
开发者ID:RSDT,项目名称:Japp16,代码行数:19,代码来源:Japp.java

示例6: onCreateView

import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.location_fragment, container, false);

    mMapView = (MapView) rootView.findViewById(R.id.mapView);
    mMapView.onCreate(savedInstanceState);

    mMapView.onResume(); // needed to get the map to display immediately

    try {
        MapsInitializer.initialize(getActivity().getApplicationContext());
    } catch (Exception e) {
        e.printStackTrace();
    }

    mMapView.getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap mMap) {
            googleMap = mMap;
            refreshMap(null);
        }
    });

    return rootView;
}
 
开发者ID:gautamgitspace,项目名称:CellularNetworkMonitor,代码行数:26,代码来源:MapFragment.java

示例7: onCreateView

import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_map, container, false);

    mapView = (MapView) v.findViewById(R.id.map);
    mapView.onCreate(savedInstanceState);

    mapView.onResume();// needed to get the googleMap to display immediately

    try {
        MapsInitializer.initialize(getActivity().getApplicationContext());
    } catch (Exception e) {
        e.printStackTrace();
    }

    mapView.getMapAsync(this);

    progressBar = (ProgressBar) v.findViewById(R.id.progressBar);
    emptyListTextView = (TextView) v.findViewById(R.id.emptyListText);

    mapUpdateHandler = new Handler();

    mapUpdater.run();

    return v;
}
 
开发者ID:Gaso-UFS,项目名称:gaso,代码行数:27,代码来源:MapGasoFragment.java

示例8: onCreateView

import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.location_fragment, container, false);
    // Gets the MapView from the XML layout and creates it
    mapView = (MapView) view.findViewById(R.id.map);
    mapView.onCreate(savedInstanceState);

    // Gets to GoogleMap from the MapView and does initialization stuff
    map = mapView.getMap();
    map.getUiSettings().setMyLocationButtonEnabled(false);
    map.setMyLocationEnabled(true);

    // Needs to call MapsInitializer before doing any CameraUpdateFactory calls
    MapsInitializer.initialize(this.getActivity());
    map.setOnMarkerDragListener(this);

    mNetworkConnection = new NetworkConnection(getActivity());
    mLocationProvider = new LocationProvider(getActivity(), this);

    return view;
}
 
开发者ID:mojo1643,项目名称:margarita,代码行数:23,代码来源:LocationFragment.java

示例9: initializeMap

import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
private void initializeMap() throws GooglePlayServicesNotAvailableException {
	try {
		MapsInitializer.initialize(getActivity());
		if (getActivity().getSupportFragmentManager().findFragmentById(
				R.id.mapContainer) == null) {
			mapSupportFragment = MySupportMapFragment
					.newInstatnce(new Bundle());
			mapSupportFragment.setTargetFragment(this, 100);
			if (getArguments() != null)
				mapSupportFragment.setArguments(getArguments());

			getActivity().getSupportFragmentManager().beginTransaction()
					.add(R.id.mapContainer, mapSupportFragment).commit();
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:himanshuagarwal77225,项目名称:BookMySkills,代码行数:19,代码来源:MyHomeFragment.java

示例10: onMapReady

import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    mGoogleMap = googleMap;
    if (mGoogleMap != null) {
        // Needs to call MapsInitializer before doing any CameraUpdateFactory calls
        try {
            initializeGoogleMap();
            MapsInitializer.initialize(mContext);
        } catch (Exception e) {
            e.printStackTrace();
        }
        mGoogleMap.setOnMyLocationChangeListener(myLocationChangeListener);
    } else {
        Log.i(TAG, "MapView is NULL");
    }

}
 
开发者ID:pmk2429,项目名称:investickation,代码行数:18,代码来源:GoogleMapController.java

示例11: onMapReady

import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    mGoogleMap = googleMap;
    MapsInitializer.initialize(getContext());
    googleMap.getUiSettings().setMapToolbarEnabled(true);
    if (mMapLocation != null && !mOptionView.isMultipleMarker() && mOptionView.isSingleMarker()) {
        updateMapContents();
    }
    if(mOptionView.getLatLngArray() != null && mOptionView.getLatLngArray().length > 0 && mOptionView.isMultipleMarker() && !mOptionView.isSingleMarker())
    {
        updateMapContents();
    }
    if(mOptionView.getLatLngList() != null && mOptionView.getLatLngList().size() > 0 && mOptionView.isMultipleMarker() && !mOptionView.isSingleMarker())
    {
        updateMapContents();
    }
}
 
开发者ID:michelelacorte,项目名称:SwipeableCard,代码行数:18,代码来源:SwipeableCard.java

示例12: onMapReady

import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
	MapsInitializer.initialize(getActivity()); // required for the CameraUpdateFactory to be initialized
	googleMap.clear();
	googleMap.setMyLocationEnabled(true);

	googleMap.addMarker(new MarkerOptions().position(fromLocation).title(fromTitle));
	googleMap.addMarker(new MarkerOptions().position(toLocation).title(toTitle));

	List<LatLng> route = PolyUtil.decode(encodedRoute);
	googleMap.addPolyline(new PolylineOptions().addAll(route).color(R.color.green));

	LatLngBounds bounds = new LatLngBounds.Builder()
			.include(fromLocation)
			.include(toLocation)
			.build();
	googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 100));
}
 
开发者ID:FauDroids,项目名称:TripWeather,代码行数:19,代码来源:MapFragment.java

示例13: setMap

import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
private void setMap() {
    MapsInitializer.initialize(getActivity().getApplicationContext());

    GoogleMap googleMap = mMapView.getMap();

    LatLng latLng = new LatLng(49.426863, 32.095314);
    MarkerOptions marker = new MarkerOptions().position(latLng);

    marker.icon(BitmapDescriptorFactory
            .defaultMarker(BitmapDescriptorFactory.HUE_ROSE));

    googleMap.addMarker(marker);
    CameraPosition cameraPosition = new CameraPosition.Builder()
            .target(latLng).zoom(12).build();
    googleMap.animateCamera(CameraUpdateFactory
            .newCameraPosition(cameraPosition));
}
 
开发者ID:CheDream-Android,项目名称:CheDream,代码行数:18,代码来源:ContactsFragment.java

示例14: onCreateView

import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_map, container, false);
    if (rootView == null) {
        Log.e(TAG, "rootView is null in onCreateView in QPMapFragment");
        return null;
    }

    MapsInitializer.initialize(getMyActivity());

    mMapView = (MapView) rootView.findViewById(R.id.map);
    if (mMapView != null) {
        mMapView.onCreate(mBundle);
        setUpMapIfNeeded(rootView);
    }

    MainActivity mainActivity = (MainActivity) getActivity();

    CheckBox followingUserCB = (CheckBox) rootView.findViewById(R.id.follow_user_checkBox);
    followingUserCB.setChecked(mainActivity.isFollowingUser());

    return rootView;
}
 
开发者ID:Preston-Landers,项目名称:QuietPlaces,代码行数:25,代码来源:QPMapFragment.java

示例15: onMapReady

import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap map) {
    this.map = map;

    if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED ||
            ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
        map.getUiSettings().setMyLocationButtonEnabled(true);
        map.setMyLocationEnabled(true);
        map.setOnMyLocationButtonClickListener(this);
    }

    MapsInitializer.initialize(this);

    if (inViewMode) {
        drawMarker();
    }
    setupMapListeners();
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:19,代码来源:GeoPointMapActivity.java


注:本文中的com.google.android.gms.maps.MapsInitializer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。