Panorama API - Inflate layout on top of panorama view

758 Views Asked by At

I'm using google play services panorama api fir displaying panorama image. Everything works fine but I want to add a layout on top of that view so the image will be used as an activity background.

Here's my code for showing the panoramic view:

@Override
protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   mClient = new GoogleApiClient.Builder(this, this, this)
       .addApi(Panorama.API)
       .build();
 }

 @Override
    public void onConnected(Bundle bundle) {
        Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.pano1);
        Panorama.PanoramaApi.loadPanoramaInfo(mClient, uri).setResultCallback(
                new ResultCallback<PanoramaApi.PanoramaResult>() {
                    @Override
                    public void onResult(PanoramaApi.PanoramaResult result) {
                        if (result.getStatus().isSuccess()) {
                            Intent viewerIntent = result.getViewerIntent();
                            Log.i(TAG, "found viewerIntent: " + viewerIntent);
                            if (viewerIntent != null) {
                                startActivity(viewerIntent);
                            }
                        } else {
                            Log.e(TAG, "error: " + result);
                        }
                    }
                });
    }

The workflow is that I start new activity with the ViewerIntent and I don't have layout control so it just showing the panoramic view.

I'm searching one of the following:

  • Getting control of the openning ViewerIntent activity
  • Passing a layout to the next activity through bundle
  • overriding the panoramic view activity, and populating my own layout

Google street view panorama activity example:

enter image description here

1

There are 1 best solutions below

1
adjuremods On

The Panorama API in the Google APIs doesn't seem to have that much feature that you're looking for. Based on the return description of the PanoramaResult (getViewerIntent),

If the image is a panorama this is not null and will launch a viewer when started. If the image is not a panorama this will be null.

You may have to search for a 3rd party library or create your own implementation on the requirements you need.