android.view.Choreographer.FrameCallback Java Examples
The following examples show how to use
android.view.Choreographer.FrameCallback.
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: VrShellDelegate.java From 365browser with Apache License 2.0 | 6 votes |
private VrShellDelegate(ChromeActivity activity, VrClassesWrapper wrapper) { mActivity = activity; mVrClassesWrapper = wrapper; // If an activity isn't resumed at the point, it must have been paused. mPaused = ApplicationStatus.getStateForActivity(activity) != ActivityState.RESUMED; updateVrSupportLevel(); mNativeVrShellDelegate = nativeInit(); mFeedbackFrequency = VrFeedbackStatus.getFeedbackFrequency(); mEnterVrHandler = new Handler(); Choreographer.getInstance().postFrameCallback(new FrameCallback() { @Override public void doFrame(long frameTimeNanos) { if (mNativeVrShellDelegate == 0) return; Display display = ((WindowManager) mActivity.getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay(); nativeUpdateVSyncInterval( mNativeVrShellDelegate, frameTimeNanos, 1.0d / display.getRefreshRate()); } }); ApplicationStatus.registerStateListenerForAllActivities(this); }