@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_street_view); SupportStreetViewPanoramaFragment streetViewPanoramaFragment = (SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama); streetViewPanoramaFragment.getStreetViewPanoramaAsync( new OnStreetViewPanoramaReadyCallback() { @Override public void onStreetViewPanoramaReady(StreetViewPanorama panorama) { // Only set the panorama to SYDNEY on startup (when no panoramas have been // loaded which is when the savedInstanceState is null). if (savedInstanceState == null) { panorama.setPosition(SYDNEY); } } }); }
private void setUpStreetViewPanoramaIfNeeded(final LatLng location) { mMapFragment.getStreetViewPanoramaAsync(new OnStreetViewPanoramaReadyCallback() { @Override public void onStreetViewPanoramaReady(StreetViewPanorama streetViewPanorama) { if (streetViewPanorama != null) { streetViewPanorama.setPosition(location); streetViewPanorama.setUserNavigationEnabled(true); streetViewPanorama.setPanningGesturesEnabled(true); streetViewPanorama.setZoomGesturesEnabled(true); StreetViewPanoramaCamera galleryOrientation = StreetViewPanoramaCamera. builder(streetViewPanorama.getPanoramaCamera()) .bearing(mDetail.getBearing()) .tilt(mDetail.getTilt()) .build(); streetViewPanorama.animateTo(galleryOrientation, TimeUnit.SECONDS.toMillis(1)); } } }); }
private void initMapFragment() { mMapFragment = SupportStreetViewPanoramaFragment.newInstance(); mMapFragment.getStreetViewPanoramaAsync(new OnStreetViewPanoramaReadyCallback() { @Override public void onStreetViewPanoramaReady(StreetViewPanorama streetViewPanorama) { setUpStreetViewPanoramaIfNeeded(mDetail.getPosition()); } }); }
@Override public void call(final Subscriber<? super StreetViewPanorama> subscriber) { OnStreetViewPanoramaReadyCallback callback = new OnStreetViewPanoramaReadyCallback() { @Override public void onStreetViewPanoramaReady(StreetViewPanorama streetViewPanorama) { if (!subscriber.isUnsubscribed()) { subscriber.onNext(streetViewPanorama); } } }; fragment.getStreetViewPanoramaAsync(callback); }
@Override public void call(final Subscriber<? super StreetViewPanorama> subscriber) { OnStreetViewPanoramaReadyCallback callback = new OnStreetViewPanoramaReadyCallback() { @Override public void onStreetViewPanoramaReady(StreetViewPanorama streetViewPanorama) { if (!subscriber.isUnsubscribed()) { subscriber.onNext(streetViewPanorama); } } }; view.getStreetViewPanoramaAsync(callback); }
private void initSVFragment(final Bundle savedInstanceState) { mSvpFragment = ((SupportStreetViewPanoramaFragment) getSupportFragmentManager() .findFragmentById(R.id.streetviewpanorama)); mSvpFragment.getStreetViewPanoramaAsync(new OnStreetViewPanoramaReadyCallback() { @Override public void onStreetViewPanoramaReady(StreetViewPanorama streetViewPanorama) { setUpStreetViewPanoramaIfNeeded(savedInstanceState, coordenadas); } }); }
/** * StreetView * * @param savedInstanceState */ private void setUpStreetViewPanoramaIfNeeded(final Bundle savedInstanceState, final LatLng coordenadas) { mSvpFragment.getStreetViewPanoramaAsync(new OnStreetViewPanoramaReadyCallback() { @Override public void onStreetViewPanoramaReady(StreetViewPanorama streetViewPanorama) { if (streetViewPanorama != null && savedInstanceState == null) { streetViewPanorama.setPosition(coordenadas); streetViewPanorama.setUserNavigationEnabled(true); streetViewPanorama.setPanningGesturesEnabled(true); streetViewPanorama.setZoomGesturesEnabled(true); Log.d("STREETVIEW", "coordenadas 2: " + coordenadas.latitude + " - " + coordenadas.longitude); } } }); }