Java Code Examples for com.google.android.gms.maps.SupportStreetViewPanoramaFragment#getStreetViewPanoramaAsync()

The following examples show how to use com.google.android.gms.maps.SupportStreetViewPanoramaFragment#getStreetViewPanoramaAsync() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From journaldev with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    SupportStreetViewPanoramaFragment streetViewFragment =
            (SupportStreetViewPanoramaFragment) getSupportFragmentManager()
                    .findFragmentById(R.id.googleMapStreetView);
    streetViewFragment.getStreetViewPanoramaAsync(this);

    FloatingActionButton fab = findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            secondLocation = !secondLocation;
            onStreetViewPanoramaReady(mStreetViewPanorama);
        }
    });

}
 
Example 2
Source File: StreetViewPanoramaBasicDemoActivity.java    From android-samples with Apache License 2.0 6 votes vote down vote up
@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) {
                    // 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);
                    }
                }
            });
}
 
Example 3
Source File: StreetViewPanoramaNavigationDemoActivity.java    From android-samples with Apache License 2.0 6 votes vote down vote up
@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;
                    // Only set the panorama to SYDNEY on startup (when no panoramas have been
                    // loaded which is when the savedInstanceState is null).
                    if (savedInstanceState == null) {
                        mStreetViewPanorama.setPosition(SYDNEY);
                    }
                }
            });
    mCustomDurationBar = (SeekBar) findViewById(R.id.duration_bar);
}
 
Example 4
Source File: StreetViewNavigationActivity.java    From Complete-Google-Map-API-Tutorial with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_street_view_navigation);

	SupportStreetViewPanoramaFragment fragment = (SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.street_view);
	fragment.getStreetViewPanoramaAsync(this);

	initialize();
}
 
Example 5
Source File: StreetViewSettingsActivity.java    From Complete-Google-Map-API-Tutorial with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_street_view_settings);

	SupportStreetViewPanoramaFragment fragment = (SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.street_view);
	fragment.getStreetViewPanoramaAsync(this);
}
 
Example 6
Source File: StreetViewAndMapActivity.java    From Complete-Google-Map-API-Tutorial with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_street_view_and_map);

	SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
	mapFragment.getMapAsync(this);

	SupportStreetViewPanoramaFragment fragment = (SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.street_view);
	fragment.getStreetViewPanoramaAsync(this);
}
 
Example 7
Source File: StreetViewEventsActivity.java    From Complete-Google-Map-API-Tutorial with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_street_view_events);

	SupportStreetViewPanoramaFragment fragment = (SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.street_view);
	fragment.getStreetViewPanoramaAsync(this);
}
 
Example 8
Source File: StreetViewBasicActivity.java    From Complete-Google-Map-API-Tutorial with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_street_view_basic);

	SupportStreetViewPanoramaFragment streetViewPanoramaFragment = (SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.street_view);
	streetViewPanoramaFragment.getStreetViewPanoramaAsync(this);
}
 
Example 9
Source File: StreetViewPanoramaEventsDemoActivity.java    From android-samples with Apache License 2.0 5 votes vote down vote up
@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);

                // Only set the panorama to SYDNEY on startup (when no panoramas have been
                // loaded which is when the savedInstanceState is null).
                if (savedInstanceState == null) {
                    streetViewPanorama.setPosition(SYDNEY);
                }
            });
}
 
Example 10
Source File: StreetViewPanoramaOptionsDemoActivity.java    From android-samples with Apache License 2.0 5 votes vote down vote up
@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());

                // Only set the panorama to SAN_FRAN on startup (when no panoramas have been
                // loaded which is when the savedInstanceState is null).
                if (savedInstanceState == null) {
                    setPosition();
                }
            });
}