private void WebPageCloseOnClick ( GVRViewSceneObject gvrWebViewSceneObject , GVRSceneObject gvrSceneObjectAnchor , String url ) { final String urlFinal = url ; webPagePlusUISceneObject = new GVRSceneObject ( gvrContext ) ; webPagePlusUISceneObject . getTransform ( ) . setPosition ( webPagePlusUIPosition [ 0 ] , webPagePlusUIPosition [ 1 ] , webPagePlusUIPosition [ 2 ] ) ; GVRScene mainScene = gvrContext . getMainScene ( ) ; Sensor webPageSensor = new Sensor ( urlFinal , Sensor . Type . TOUCH , gvrWebViewSceneObject , true ) ; final GVRSceneObject gvrSceneObjectAnchorFinal = gvrSceneObjectAnchor ; final GVRSceneObject gvrWebViewSceneObjectFinal = gvrWebViewSceneObject ; final GVRSceneObject webPagePlusUISceneObjectFinal = webPagePlusUISceneObject ; webPagePlusUISceneObjectFinal . addChildObject ( gvrWebViewSceneObjectFinal ) ; gvrSceneObjectAnchorFinal . addChildObject ( webPagePlusUISceneObjectFinal ) ; webPageSensor . addISensorEvents ( new ISensorEvents ( ) { boolean uiObjectIsActive = false ; boolean clickDown = true ; @ Override public void onSensorEvent ( SensorEvent event ) { if ( event . isActive ( ) ) { clickDown = ! clickDown ; if ( clickDown ) { // Delete the WebView page gvrSceneObjectAnchorFinal . removeChildObject ( webPagePlusUISceneObjectFinal ) ; webPageActive = false ; webPagePlusUISceneObject = null ; webPageClosed = true ; // Make sure click up doesn't open web page behind it } } } } ) ; }
Display web page but no user interface - close