com.google.vr.ndk.base.AndroidCompat Java Examples
The following examples show how to use
com.google.vr.ndk.base.AndroidCompat.
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: VrShellImpl.java From AndroidChromium with Apache License 2.0 | 6 votes |
@UsedByReflection("VrShellDelegate.java") public VrShellImpl(Activity activity) { super(activity); mActivity = activity; mContentViewCoreContainer = new FrameLayout(getContext()) { @Override public boolean dispatchTouchEvent(MotionEvent event) { return true; } }; addView(mContentViewCoreContainer, 0, new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mGlSurfaceView = new GLSurfaceView(getContext()); mGlSurfaceView.setEGLContextClientVersion(2); mGlSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 0, 0); mGlSurfaceView.setPreserveEGLContextOnPause(true); mGlSurfaceView.setRenderer(this); setPresentationView(mGlSurfaceView); if (setAsyncReprojectionEnabled(true)) { AndroidCompat.setSustainedPerformanceMode(mActivity, true); } }
Example #2
Source File: MainActivity.java From PanoramaGL with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setImmersiveSticky(); getWindow() .getDecorView() .setOnSystemUiVisibilityChangeListener( new View.OnSystemUiVisibilityChangeListener() { @Override public void onSystemUiVisibilityChange(int visibility) { if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) { setImmersiveSticky(); } } }); // Enable VR mode, if the device supports it. AndroidCompat.setVrModeEnabled(this, true); // Get the GvrLayout. gvrLayout = new GvrLayout(this); // Enable scan line racing, if possible. if (gvrLayout.setAsyncReprojectionEnabled(true)) { Log.d(TAG, "Successfully enabled scanline racing."); // Scanline racing decouples the app framerate from the display framerate, // allowing immersive interaction even at the throttled clockrates set by // sustained performance mode. AndroidCompat.setSustainedPerformanceMode(this, true); } else { Log.w(TAG, "Failed to enable scanline racing."); } // Configure the GLSurfaceView. surfaceView = new GLSurfaceView(this); surfaceView.setEGLContextClientVersion(2); surfaceView.setEGLConfigChooser(8, 8, 8, 0, 0, 0); surfaceView.setPreserveEGLContextOnPause(true); surfaceView.setRenderer(renderer); // Set the GLSurfaceView as the GvrLayout's presentation view. gvrLayout.setPresentationView(surfaceView); // Enable and configure the back button in the UI layout. gvrLayout .getUiLayout() .setBackButtonListener( new Runnable() { @Override public void run() { onBackPressed(); } }); // Add the GvrLayout to the View hierarchy. setContentView(gvrLayout); assetManager = getResources().getAssets(); nativeOnCreate(assetManager, gvrLayout.getGvrApi().getNativeGvrContext()); // Prevent screen from dimming/locking. getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); }
Example #3
Source File: VrDaydreamApiImpl.java From AndroidChromium with Apache License 2.0 | 4 votes |
@Override public void setVrModeEnabled(boolean enabled) { AndroidCompat.setVrModeEnabled(mActivity, enabled); }
Example #4
Source File: VrClassesWrapperImpl.java From 365browser with Apache License 2.0 | 4 votes |
@Override public void setVrModeEnabled(Activity activity, boolean enabled) { AndroidCompat.setVrModeEnabled(activity, enabled); }