當前位置: 首頁>>代碼示例>>Java>>正文


Java GoogleMap.setOnCameraIdleListener方法代碼示例

本文整理匯總了Java中com.google.android.gms.maps.GoogleMap.setOnCameraIdleListener方法的典型用法代碼示例。如果您正苦於以下問題:Java GoogleMap.setOnCameraIdleListener方法的具體用法?Java GoogleMap.setOnCameraIdleListener怎麽用?Java GoogleMap.setOnCameraIdleListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.gms.maps.GoogleMap的用法示例。


在下文中一共展示了GoogleMap.setOnCameraIdleListener方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUpClusterer

import com.google.android.gms.maps.GoogleMap; //導入方法依賴的package包/類
private void setUpClusterer(@NonNull CivifyMap map) {
    GoogleMap googleMap = map.getGoogleMap();
    setRenderer(new IssueMarkerClusterRenderer(map, this));
    setOnClusterItemClickListener(this);
    googleMap.setOnMarkerClickListener(this);
    googleMap.setOnCameraIdleListener(this);
}
 
開發者ID:ArnauBlanch,項目名稱:civify-app,代碼行數:8,代碼來源:CivifyMarkers.java

示例2: enableSubMap

import com.google.android.gms.maps.GoogleMap; //導入方法依賴的package包/類
public void enableSubMap(GoogleMap subMap) {
    mMaps.add(MAP_CODE_SUB, subMap);
    mMapTiles.add(MAP_CODE_SUB, null);

    subMap.setMapType(MAP_TYPE_HYBRID);
    subMap.moveCamera(CameraUpdateFactory.newCameraPosition(mMaps.get(MAP_CODE_MAIN).getCameraPosition()));
    onCameraMove();

    // 在Activity和Map物件註冊ClusterManager
    mClusterManagers.add(MAP_CODE_SUB, new ClusterManager<CustomMarker>(mContext, subMap));
    // The Rule about Cluster Managing
    mClusterManagers.get(MAP_CODE_SUB).setRenderer(
            new CustomRenderer(mContext, subMap, mClusterManagers.get(MAP_CODE_SUB)));
    mClusterManagers.get(MAP_CODE_SUB).setOnClusterClickListener(
            (CustomRenderer) mClusterManagers.get(MAP_CODE_SUB).getRenderer());
    // Click on marker to open infoWindow
    subMap.setOnMarkerClickListener(mClusterManagers.get(MAP_CODE_SUB));
    // Click on Cluster to zoom to Markers
    subMap.setOnCameraIdleListener(this);

    // Test for new info window
    subMap.setInfoWindowAdapter(new CustomAdapter(mContext));
}
 
開發者ID:typebrook,項目名稱:FiveMinsMore,代碼行數:24,代碼來源:MapsManager.java

示例3: onMapReady

import com.google.android.gms.maps.GoogleMap; //導入方法依賴的package包/類
@Override
public void onMapReady(final GoogleMap googleMap) {
    googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
        @Override
        public void onMapLoaded() {
            googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(NETHERLANDS, 0));
        }
    });

    ClusterManager<SampleClusterItem> clusterManager = new ClusterManager<>(this, googleMap);
    clusterManager.setCallbacks(new ClusterManager.Callbacks<SampleClusterItem>() {
        @Override
        public boolean onClusterClick(@NonNull Cluster<SampleClusterItem> cluster) {
            Log.d(TAG, "onClusterClick");
            return false;
        }

        @Override
        public boolean onClusterItemClick(@NonNull SampleClusterItem clusterItem) {
            Log.d(TAG, "onClusterItemClick");
            return false;
        }
    });
    googleMap.setOnCameraIdleListener(clusterManager);

    List<SampleClusterItem> clusterItems = new ArrayList<>();
    for (int i = 0; i < 20000; i++) {
        clusterItems.add(new SampleClusterItem(
                RandomLocationGenerator.generate(NETHERLANDS)));
    }
    clusterManager.setItems(clusterItems);
}
 
開發者ID:sharewire,項目名稱:google-maps-clustering,代碼行數:33,代碼來源:MapsActivity.java

示例4: onMapReady

import com.google.android.gms.maps.GoogleMap; //導入方法依賴的package包/類
@Override
public void onMapReady(final GoogleMap map) {
	gmaps = map;
	checkPerms();
	map.getUiSettings(). setMyLocationButtonEnabled(false);
	map.setPadding(20, 0, 20, 10);
	map.moveCamera(CameraUpdateFactory.newLatLngZoom(home, 16f));
	// camera move listener
	map.setOnCameraMoveListener(new GoogleMap.OnCameraMoveListener(){
			@Override
			public void onCameraMove() {
				// atur centerMarker samar saat maps digerakan
				centerMarker.setAlpha(0.5f);
				// hanya saat maps digerakan menggunakan tangan (buka programatically)
				if (mMapIsTouched) {
					// one shot action
					/*if (sbOnceMove) { // remove hideable searchBar
						// animasi sembunyi pada searchbar
						searchareaAnimate.setStartDelay(0);
						searchareaAnimate.setDuration(500);
						searchareaAnimate.translationY(-searchbarHeight);
						searchareaAnimate.start();
						UIUtil.hideKeyboard(MainActivity.this);
					}*/
					sbOnceMove = false;
				}
			}
		});
	// camera idle (diam) listener
	// di trigger saat pertama maps dijalankan dan saat selesai dari move (menggeser maps)
	map.setOnCameraIdleListener(new GoogleMap.OnCameraIdleListener(){
			@Override
			public void onCameraIdle() {
				// atur centerMarker ke solid (bukan samar lagi)
				centerMarker.setAlpha(1.0f);
				// animasi tampil pada searchbar
				//searchareaAnimate.setStartDelay(1500).setDuration(800).translationY(0).start();
				sbOnceMove = true;
			}
		});
	// saat menekan tombol GPS (my location)
	tariff.setOnMyLocationButtonClickListener(new GoogleMap.OnMyLocationButtonClickListener(){
			@Override
			public boolean onMyLocationButtonClick() {
				// cek apakah GPS aktif
				// jika tidak maka jalankan GPSrequest()
				final LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
				if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
					GPSrequest();
				} else {
					// jika GPS aktif, tampikan waiting indikator dan cari lokasi pengguna
					if(tprog.isShowing()){
						tprog.cancel();
						setTitle(""+System.currentTimeMillis());
						return false;
					}
					movetomylocation = true;
					gmaps.getMyLocation();
					tprog.show("Waiting for location...", Gravity.CENTER, (1000*60)*2);
					tprog.setOnTimedOutListener(new ToastProgress.onTimedOutListener(){
							@Override
							public void onTimedOut() {
								Toast.makeText(MainActivity.this, "Timed Out",0).show();
							}
						});
				}
				return false;
			}
		});
	// di trigger saat lokasi pengguna terdeteksi atau terjadi perubahan lokasi
	map.setOnMyLocationChangeListener(new GoogleMap.OnMyLocationChangeListener(){
			@Override
			public void onMyLocationChange(Location loc) {
				if (movetomylocation) {
					tprog.cancel();
					gmaps.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(loc.getLatitude(), loc.getLongitude()), 15f), 1500, null);
				}
				movetomylocation = false;
			}
		});
}
 
開發者ID:agusibrahim,項目名稱:go-jay,代碼行數:82,代碼來源:MainActivity.java

示例5: MapsManager

import com.google.android.gms.maps.GoogleMap; //導入方法依賴的package包/類
MapsManager(Activity context, GoogleMap map) {
    mContext = context;

    // 地圖
    mMaps.add(MAP_CODE_MAIN, map);
    mMapTiles.add(MAP_CODE_MAIN, null);

    mZoomNumber = (TextView) context.findViewById(R.id.zoom_number);

    // 顯示準心座標
    mCrossCoor = (TextView) context.findViewById(R.id.tvCoord);
    mCrossCoor.setOnClickListener((MapsActivity) mContext);

    // 加入比例尺
    RelativeLayout container = (RelativeLayout) context.findViewById(R.id.layout_container);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(800, 800);
    mScaleBar = new ScaleBar(mContext, getMap(MAP_CODE_MAIN));
    mScaleBar.setLayoutParams(params);
    container.addView(mScaleBar);

    // 註冊畫麵縮放的監聽
    map.setOnCameraMoveListener(this);

    // Set the Listener
    map.setOnMapClickListener(this);
    map.setOnMapLongClickListener(this);
    map.setOnInfoWindowClickListener(this);
    map.setOnMarkerDragListener(this);
    map.setOnCameraIdleListener(this);

    // 在Activity和Map物件註冊ClusterManager
    mClusterManagers.add(MAP_CODE_MAIN, new ClusterManager<CustomMarker>(mContext, map));
    // The Rule about Cluster Managing
    mClusterManagers.get(MAP_CODE_MAIN).setRenderer(
            new CustomRenderer(mContext, map, mClusterManagers.get(MAP_CODE_MAIN)));
    mClusterManagers.get(MAP_CODE_MAIN).setOnClusterClickListener(
            (CustomRenderer) mClusterManagers.get(MAP_CODE_MAIN).getRenderer());
    // Click on marker to open infoWindow
    map.setOnMarkerClickListener(mClusterManagers.get(MAP_CODE_MAIN));
    // POI in Google map
    map.setOnPoiClickListener(this);

    // Test for new info window
    map.setInfoWindowAdapter(new CustomAdapter(mContext));
}
 
開發者ID:typebrook,項目名稱:FiveMinsMore,代碼行數:46,代碼來源:MapsManager.java


注:本文中的com.google.android.gms.maps.GoogleMap.setOnCameraIdleListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。