private void initStreetView( ) { StreetViewPanoramaFragment fragment = ( (StreetViewPanoramaFragment) getFragmentManager().findFragmentById( R.id.street_view_panorama_fragment ) ); if( mPanorama == null ) { if( fragment != null ) { mPanorama = fragment.getStreetViewPanorama(); if( mPanorama != null && mCurrentLocation != null ) { StreetViewPanoramaCamera.Builder builder = new StreetViewPanoramaCamera.Builder( mPanorama.getPanoramaCamera() ); if( mBearing != builder.bearing ) builder.bearing = mBearing; if( mTilt != builder.tilt ) builder.tilt = mTilt; if( mZoom != builder.zoom ) builder.zoom = mZoom; mPanorama.animateTo(builder.build(), 0); mPanorama.setPosition( mCurrentLocation, 300 ); mPanorama.setStreetNamesEnabled( true ); } } } }
StreetViewPanoramaFragmentPanoramaReadyOnSubscribe(StreetViewPanoramaFragment fragment) { this.fragment = fragment; }
/** * Create an observable which emits when {@link StreetViewPanorama} is ready to use. * <p> * <em>Warning:</em> The created observable keeps a strong reference to {@code fragment}. * Unsubscribe to free this reference. * </p> */ @CheckResult @NonNull public static Observable<StreetViewPanorama> streetViewPanoramaReady( @NonNull StreetViewPanoramaFragment fragment) { checkNotNull(fragment, "fragment == null"); return Observable.create(new StreetViewPanoramaFragmentPanoramaReadyOnSubscribe(fragment)); }