Search in sources :

Example 1 with SupportStreetViewPanoramaFragment

use of com.google.android.libraries.maps.SupportStreetViewPanoramaFragment in project android-samples by googlemaps.

the class StreetViewPanoramaBasicDemoActivity method onCreate.

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.street_view_panorama_basic_demo);
    SupportStreetViewPanoramaFragment streetViewPanoramaFragment = (SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama);
    streetViewPanoramaFragment.getStreetViewPanoramaAsync(new OnStreetViewPanoramaReadyCallback() {

        @Override
        public void onStreetViewPanoramaReady(StreetViewPanorama panorama) {
            // loaded which is when the savedInstanceState is null).
            if (savedInstanceState == null) {
                panorama.setPosition(SYDNEY);
            }
        }
    });
}
Also used : StreetViewPanorama(com.google.android.libraries.maps.StreetViewPanorama) OnStreetViewPanoramaReadyCallback(com.google.android.libraries.maps.OnStreetViewPanoramaReadyCallback) SupportStreetViewPanoramaFragment(com.google.android.libraries.maps.SupportStreetViewPanoramaFragment)

Example 2 with SupportStreetViewPanoramaFragment

use of com.google.android.libraries.maps.SupportStreetViewPanoramaFragment in project android-samples by googlemaps.

the class StreetViewPanoramaEventsDemoActivity method onCreate.

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.street_view_panorama_events_demo);
    panoChangeTimesTextView = findViewById(R.id.change_pano);
    panoCameraChangeTextView = findViewById(R.id.change_camera);
    panoClickTextView = findViewById(R.id.click_pano);
    panoLongClickTextView = findViewById(R.id.long_click_pano);
    SupportStreetViewPanoramaFragment streetViewPanoramaFragment = (SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama);
    streetViewPanoramaFragment.getStreetViewPanoramaAsync(panorama -> {
        streetViewPanorama = panorama;
        streetViewPanorama.setOnStreetViewPanoramaChangeListener(StreetViewPanoramaEventsDemoActivity.this);
        streetViewPanorama.setOnStreetViewPanoramaCameraChangeListener(StreetViewPanoramaEventsDemoActivity.this);
        streetViewPanorama.setOnStreetViewPanoramaClickListener(StreetViewPanoramaEventsDemoActivity.this);
        streetViewPanorama.setOnStreetViewPanoramaLongClickListener(StreetViewPanoramaEventsDemoActivity.this);
        // loaded which is when the savedInstanceState is null).
        if (savedInstanceState == null) {
            streetViewPanorama.setPosition(SYDNEY);
        }
    });
}
Also used : SupportStreetViewPanoramaFragment(com.google.android.libraries.maps.SupportStreetViewPanoramaFragment)

Example 3 with SupportStreetViewPanoramaFragment

use of com.google.android.libraries.maps.SupportStreetViewPanoramaFragment in project android-samples by googlemaps.

the class StreetViewPanoramaNavigationDemoActivity method onCreate.

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.street_view_panorama_navigation_demo);
    SupportStreetViewPanoramaFragment streetViewPanoramaFragment = (SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama);
    streetViewPanoramaFragment.getStreetViewPanoramaAsync(new OnStreetViewPanoramaReadyCallback() {

        @Override
        public void onStreetViewPanoramaReady(StreetViewPanorama panorama) {
            mStreetViewPanorama = panorama;
            // loaded which is when the savedInstanceState is null).
            if (savedInstanceState == null) {
                mStreetViewPanorama.setPosition(SYDNEY);
            }
        }
    });
    mCustomDurationBar = (SeekBar) findViewById(R.id.duration_bar);
}
Also used : StreetViewPanorama(com.google.android.libraries.maps.StreetViewPanorama) OnStreetViewPanoramaReadyCallback(com.google.android.libraries.maps.OnStreetViewPanoramaReadyCallback) SupportStreetViewPanoramaFragment(com.google.android.libraries.maps.SupportStreetViewPanoramaFragment)

Example 4 with SupportStreetViewPanoramaFragment

use of com.google.android.libraries.maps.SupportStreetViewPanoramaFragment in project android-samples by googlemaps.

the class SplitStreetViewPanoramaAndMapDemoActivity method onCreate.

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.split_street_view_panorama_and_map_demo);
    final LatLng markerPosition;
    if (savedInstanceState == null) {
        markerPosition = SYDNEY;
    } else {
        markerPosition = savedInstanceState.getParcelable(MARKER_POSITION_KEY);
    }
    SupportStreetViewPanoramaFragment streetViewPanoramaFragment = (SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama);
    streetViewPanoramaFragment.getStreetViewPanoramaAsync(new OnStreetViewPanoramaReadyCallback() {

        @Override
        public void onStreetViewPanoramaReady(StreetViewPanorama panorama) {
            streetViewPanorama = panorama;
            streetViewPanorama.setOnStreetViewPanoramaChangeListener(SplitStreetViewPanoramaAndMapDemoActivity.this);
            // its state.
            if (savedInstanceState == null) {
                streetViewPanorama.setPosition(SYDNEY);
            }
        }
    });
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(new OnMapReadyCallback() {

        @Override
        public void onMapReady(GoogleMap map) {
            map.setOnMarkerDragListener(SplitStreetViewPanoramaAndMapDemoActivity.this);
            // Creates a draggable marker. Long press to drag.
            marker = map.addMarker(new MarkerOptions().position(markerPosition).icon(BitmapDescriptorFactory.fromResource(R.drawable.pegman)).draggable(true));
        }
    });
}
Also used : SupportMapFragment(com.google.android.libraries.maps.SupportMapFragment) StreetViewPanorama(com.google.android.libraries.maps.StreetViewPanorama) MarkerOptions(com.google.android.libraries.maps.model.MarkerOptions) OnStreetViewPanoramaReadyCallback(com.google.android.libraries.maps.OnStreetViewPanoramaReadyCallback) GoogleMap(com.google.android.libraries.maps.GoogleMap) OnMapReadyCallback(com.google.android.libraries.maps.OnMapReadyCallback) LatLng(com.google.android.libraries.maps.model.LatLng) SupportStreetViewPanoramaFragment(com.google.android.libraries.maps.SupportStreetViewPanoramaFragment)

Example 5 with SupportStreetViewPanoramaFragment

use of com.google.android.libraries.maps.SupportStreetViewPanoramaFragment in project android-samples by googlemaps.

the class StreetViewPanoramaOptionsDemoActivity method onCreate.

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.street_view_panorama_options_demo);
    streetNameCheckbox = findViewById(R.id.streetnames);
    navigationCheckbox = findViewById(R.id.navigation);
    zoomCheckbox = findViewById(R.id.zoom);
    panningCheckbox = findViewById(R.id.panning);
    outdoorCheckbox = findViewById(R.id.outdoor);
    SupportStreetViewPanoramaFragment streetViewPanoramaFragment = (SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama);
    streetViewPanoramaFragment.getStreetViewPanoramaAsync(panorama -> {
        streetViewPanorama = panorama;
        panorama.setStreetNamesEnabled(streetNameCheckbox.isChecked());
        panorama.setUserNavigationEnabled(navigationCheckbox.isChecked());
        panorama.setZoomGesturesEnabled(zoomCheckbox.isChecked());
        panorama.setPanningGesturesEnabled(panningCheckbox.isChecked());
        // loaded which is when the savedInstanceState is null).
        if (savedInstanceState == null) {
            setPosition();
        }
    });
}
Also used : SupportStreetViewPanoramaFragment(com.google.android.libraries.maps.SupportStreetViewPanoramaFragment)

Aggregations

SupportStreetViewPanoramaFragment (com.google.android.libraries.maps.SupportStreetViewPanoramaFragment)5 OnStreetViewPanoramaReadyCallback (com.google.android.libraries.maps.OnStreetViewPanoramaReadyCallback)3 StreetViewPanorama (com.google.android.libraries.maps.StreetViewPanorama)3 GoogleMap (com.google.android.libraries.maps.GoogleMap)1 OnMapReadyCallback (com.google.android.libraries.maps.OnMapReadyCallback)1 SupportMapFragment (com.google.android.libraries.maps.SupportMapFragment)1 LatLng (com.google.android.libraries.maps.model.LatLng)1 MarkerOptions (com.google.android.libraries.maps.model.MarkerOptions)1