本文整理汇总了Java中com.google.android.gms.maps.CameraUpdateFactory.newLatLngZoom方法的典型用法代码示例。如果您正苦于以下问题:Java CameraUpdateFactory.newLatLngZoom方法的具体用法?Java CameraUpdateFactory.newLatLngZoom怎么用?Java CameraUpdateFactory.newLatLngZoom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.maps.CameraUpdateFactory
的用法示例。
在下文中一共展示了CameraUpdateFactory.newLatLngZoom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showColegiElectoralData
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
public void showColegiElectoralData(final ColegiElectoral colegiElectoral) {
LatLng latLng = new LatLng(colegiElectoral.getLat(), colegiElectoral.getLon());
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 16);
mGoogleMap.animateCamera(cameraUpdate);
txtNomLocal.setText(colegiElectoral.getLocal());
txtAdresa.setText(colegiElectoral.getAdresa());
txtLocalitat.setText(colegiElectoral.getMunicipi());
txtDistricte.setText(colegiElectoral.getDistricte() != null ? StringsManager.getString("data_districte", colegiElectoral.getDistricte()) : "");
txtSeccio.setText(colegiElectoral.getSeccio() != null ? StringsManager.getString("data_seccio", colegiElectoral.getSeccio()) : "");
txtMesa.setText(colegiElectoral.getMesa() != null ? StringsManager.getString("data_mesa", colegiElectoral.getMesa()) : "");
icnCalendari.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
addEventToCalendar(colegiElectoral);
}
});
bsb.setState(BottomSheetBehavior.STATE_EXPANDED);
}
示例2: gotoLocation
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
/**
* For actually moving the map to the desired location.
* @param fctx
* @param loc
*/
public static void gotoLocation(Activity fctx, Location loc) {
Location locc = loc;
sloc = loc;
if(loc == null){
locc = getCurrentLocation(fctx);
}
if(code == AddHabitEventActivity.EVENT_PERMISSION_CHECK){
}
float zoom = 15.0f;
if(locc == null){
DummyMainActivity.toastMe("Could not get location", fctx);
}else{
double[] d = {locc.getLatitude(), locc.getLongitude()};
AddHabitEventActivity.setLocation(d);
LatLng ll = new LatLng(locc.getLatitude(), locc.getLongitude());
CameraUpdate update = CameraUpdateFactory.newLatLngZoom(ll, zoom);
gmap.moveCamera(update);
}
}
示例3: getMapFragmentInitialState
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
@Override
public CameraUpdate getMapFragmentInitialState(HyperTrackMapFragment hyperTrackMapFragment) {
if (SharedPreferenceManager.getLastKnownLocation(context) != null) {
LatLng latLng = new LatLng(SharedPreferenceManager.getLastKnownLocation(context).getLatitude(),
SharedPreferenceManager.getLastKnownLocation(context).getLongitude());
return CameraUpdateFactory.newLatLngZoom(latLng, 15.0f);
}
return super.getMapFragmentInitialState(hyperTrackMapFragment);
}
示例4: createMarker
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
private void createMarker(String acode, LatLng location, double latitude, double longitude) {
Marker mMarker = null;
if (acode!= null) {
mMap.setOnMarkerClickListener(this);
mMap.addMarker(new MarkerOptions().position(new LatLng(latitude,longitude)).anchor(0.5f, 0.5f).title(acode));
//mMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.pegman));
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(new LatLng(latitude,longitude), 10);
mMap.animateCamera(cameraUpdate);
}
}
示例5: createMarkerLatLng
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
private void createMarkerLatLng(CharSequence name, LatLng latLng_local) {
Marker mMarker = null;
if (name!= null) {
mMap.setOnMarkerClickListener(this);
mMap.addMarker(new MarkerOptions().position(latLng_local).anchor(0.5f, 0.5f).title(name.toString()));
//mMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.pegman));
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng_local, 10);
mMap.animateCamera(cameraUpdate);
}
}
示例6: onLocationChanged
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
/**
* Notifier for change in device's location
* @param location
*/
@Override
public void onLocationChanged(Location location) {
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 10);
mMap.moveCamera(cameraUpdate);
if (client != null) {
LocationServices.FusedLocationApi.removeLocationUpdates(client, this);
}
}
示例7: onMapReady
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.getUiSettings().setMapToolbarEnabled(false);
LatLng latLng = new LatLng(Prefs.LastLatitude.getDouble(), Prefs.LastLongitude.getDouble());
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 16);
googleMap.moveCamera(cameraUpdate);
setMarkers(mMap, mRestaurants);
}
示例8: zoomToCurrentPosition
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
public void zoomToCurrentPosition() {
if (mMap == null) {
return;
}
LatLng latLng = new LatLng(Prefs.LastLatitude.getDouble(), Prefs.LastLongitude.getDouble());
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 16);
mMap.animateCamera(cameraUpdate);
}
示例9: updateUI
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
private void updateUI() {
if (mMap == null) {
return;
}
LatLng placePoint = new LatLng(mLocation.getLatitude(), mLocation.getLongitude());
MarkerOptions placeMarker = new MarkerOptions().position(placePoint);
mMap.clear();
CameraUpdate update = CameraUpdateFactory.newLatLngZoom(placePoint, MAP_ZOOM_LEVEL);
mMap.animateCamera(update);
mMap.addMarker(placeMarker);
}
示例10: onLocationChanged
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
public void onLocationChanged(Location location) {
// Called when a new location is found by the network location provider.
//makeUseOfNewLocation(location);
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 20);
map.animateCamera(cameraUpdate);
locationManager.removeUpdates(this);
}
示例11: updateMapView
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
private void updateMapView() {
if (mMap == null || !isMapLoaded) {
return;
}
if (currentLocationMarker == null && expectedPlace == null) {
return;
}
LatLngBounds.Builder builder = new LatLngBounds.Builder();
if (currentLocationMarker != null) {
LatLng current = currentLocationMarker.getPosition();
builder.include(current);
}
if (expectedPlace != null && expectedPlace.getLocation() != null &&
expectedPlace.getLocation().getLatLng() != null) {
LatLng destination = expectedPlace.getLocation().getLatLng();
builder.include(destination);
}
LatLngBounds bounds = builder.build();
try {
CameraUpdate cameraUpdate;
if (expectedPlace != null && currentLocationMarker != null) {
int width = getResources().getDisplayMetrics().widthPixels;
int height = getResources().getDisplayMetrics().heightPixels;
int padding = (int) (width * 0.12);
cameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, width, height, padding);
} else {
LatLng latLng = currentLocationMarker != null ?
currentLocationMarker.getPosition() : expectedPlace.getLocation().getLatLng();
cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, zoomLevel);
}
mMap.animateCamera(cameraUpdate, 1000, null);
} catch (Exception e) {
e.printStackTrace();
Crashlytics.logException(e);
}
}
示例12: goToLocation
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
private void goToLocation(double lon, double lat, int zoom) {
LatLng lg = new LatLng(lon, lat);
CameraUpdate update = CameraUpdateFactory.newLatLngZoom(lg, zoom);
mGoogleMap.animateCamera(update);
}
示例13: getCameraUpdate
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
protected static CameraUpdate getCameraUpdate(Location location, float zoom) {
return CameraUpdateFactory.newLatLngZoom(LocationAdapter.getLatLng(location), zoom);
}
示例14: muoviCamera
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
/**
* Riposiziona la camera con un'animazione
*/
public void muoviCamera(LatLng coordinate) {
CameraUpdate location = CameraUpdateFactory.newLatLngZoom(coordinate, 16);
mGoogleMap.animateCamera(location);
}
示例15: muoviMappaConAnimazione
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
/**
* Metodo per muovere la mappa in una determinata posizione
*/
void muoviMappaConAnimazione(LatLng posizione) {
CameraUpdate location = CameraUpdateFactory.newLatLngZoom(posizione, 16);
mMappa.animateCamera(location);
}