Java Code Examples for android.view.View#getViewRootImpl()

The following examples show how to use android.view.View#getViewRootImpl() . 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: WebViewDelegate.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Detaches the draw GL functor.
 *
 * @param nativeDrawGLFunctor the pointer to the native functor that implements
 *        system/core/include/utils/Functor.h
 */
public void detachDrawGlFunctor(View containerView, long nativeDrawGLFunctor) {
    ViewRootImpl viewRootImpl = containerView.getViewRootImpl();
    if (nativeDrawGLFunctor != 0 && viewRootImpl != null) {
        viewRootImpl.detachFunctor(nativeDrawGLFunctor);
    }
}
 
Example 2
Source File: InputMethodManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Provides the default implementation of {@link InputConnection#sendKeyEvent(KeyEvent)}, which
 * is expected to dispatch an keyboard event sent from the IME to an appropriate event target
 * depending on the given {@link View} and the current focus state.
 *
 * <p>CAUTION: This method is provided only for the situation where
 * {@link InputConnection#sendKeyEvent(KeyEvent)} needs to be implemented without relying on
 * {@link BaseInputConnection}. Do not use this API for anything else.</p>
 *
 * @param targetView the default target view. If {@code null} is specified, then this method
 * tries to find a good event target based on the current focus state.
 * @param event the key event to be dispatched.
 */
public void dispatchKeyEventFromInputMethod(@Nullable View targetView,
        @NonNull KeyEvent event) {
    synchronized (mH) {
        ViewRootImpl viewRootImpl = targetView != null ? targetView.getViewRootImpl() : null;
        if (viewRootImpl == null) {
            if (mServedView != null) {
                viewRootImpl = mServedView.getViewRootImpl();
            }
        }
        if (viewRootImpl != null) {
            viewRootImpl.dispatchKeyFromIme(event);
        }
    }
}
 
Example 3
Source File: ActivityTransitionCoordinator.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void startInputWhenTransitionsComplete() {
    if (mViewsTransitionComplete && mSharedElementTransitionComplete) {
        final View decor = getDecor();
        if (decor != null) {
            final ViewRootImpl viewRoot = decor.getViewRootImpl();
            if (viewRoot != null) {
                viewRoot.setPausedForTransition(false);
            }
        }
        onTransitionsComplete();
    }
}
 
Example 4
Source File: ActivityTransitionCoordinator.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
protected void pauseInput() {
    final View decor = getDecor();
    final ViewRootImpl viewRoot = decor == null ? null : decor.getViewRootImpl();
    if (viewRoot != null) {
        viewRoot.setPausedForTransition(true);
    }
}
 
Example 5
Source File: InputMethodManager.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
static void scheduleCheckFocusLocked(View view) {
    ViewRootImpl viewRootImpl = view.getViewRootImpl();
    if (viewRootImpl != null) {
        viewRootImpl.dispatchCheckFocus();
    }
}