@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 initMapFragment() { mMapFragment = SupportStreetViewPanoramaFragment.newInstance(); mMapFragment.getStreetViewPanoramaAsync(new OnStreetViewPanoramaReadyCallback() { @Override public void onStreetViewPanoramaReady(StreetViewPanorama streetViewPanorama) { setUpStreetViewPanoramaIfNeeded(mDetail.getPosition()); } }); }
/** * 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 SupportStreetViewPanoramaFragment fragment) { checkNotNull(fragment, "fragment == null"); return Observable.create( new StreetViewPanoramaSupportFragmentPanoramaReadyOnSubscribe(fragment)); }
private void setUpStreetViewPanoramaIfNeeded(Bundle savedInstanceState) { if (svp == null) { svp = ((SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama)) .getStreetViewPanorama(); if (svp != null) { if (savedInstanceState == null) { svp.setPosition(SYDNEY); } svp.setOnStreetViewPanoramaChangeListener(this); } } }
private void setUpStreetViewPanoramaIfNeeded(Bundle savedInstanceState) { if (svp == null) { svp = ((SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama)) .getStreetViewPanorama(); if (svp != null) { if (savedInstanceState == null) { svp.setPosition(SYDNEY); } svp.setOnStreetViewPanoramaChangeListener(this); svp.setOnStreetViewPanoramaCameraChangeListener(this); svp.setOnStreetViewPanoramaClickListener(this); } } }
private void setUpStreetViewPanoramaIfNeeded(Bundle savedInstanceState) { if (svp == null) { svp = ((SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama)) .getStreetViewPanorama(); if (svp != null) { if (savedInstanceState == null) { svp.setPosition(SAN_FRAN); } } } }
private void setUpStreetViewPanoramaIfNeeded(Bundle savedInstanceState) { if (svp == null) { svp = ((SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama)) .getStreetViewPanorama(); if (svp != null) { if (savedInstanceState == null) { svp.setPosition(SYDNEY); } } } }
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); } }); }
StreetViewPanoramaSupportFragmentPanoramaReadyOnSubscribe( SupportStreetViewPanoramaFragment fragment) { this.fragment = fragment; }
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_maps); // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); SupportStreetViewPanoramaFragment streetViewPanoramaFragment = (SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama); streetViewPanoramaFragment.getStreetViewPanoramaAsync(this); mAct = this; mRequestingLocationUpdates = true; final ActionButton ab = (ActionButton) findViewById(R.id.action_button); ab.setImageResource(R.drawable.ic_qr); ab.setShowAnimation(ActionButton.Animations.JUMP_FROM_DOWN); ab.setHideAnimation(ActionButton.Animations.JUMP_TO_DOWN); ab.setButtonColor(getResources().getColor(R.color.fab_material_amber_500)); ab.setButtonColorPressed(getResources().getColor(R.color.fab_material_amber_900)); ab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ab.hide(); new IntentIntegrator(mAct).initiateScan(); new Handler().postDelayed(new Runnable() { @Override public void run() { ab.show(); } }, 1000); } }); mLocationReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { mPreviousLocation = mCurrentLocation; mCurrentLocation = intent.getParcelableExtra(LocationUpdaterService.COPA_MESSAGE); updateMap(); mLocationsList.add(mCurrentLocation); if (BuildConfig.DEBUG) { Log.d(TAG, "LocationList size: " + mLocationsList.size()); } } }; mRequestLocationIntent = new Intent(this, LocationUpdaterService.class); startService(mRequestLocationIntent); // Update values using data stored in the Bundle. updateValuesFromBundle(savedInstanceState); }