android.view.View#getViewRootImpl ( )源码实例Demo

下面列出了android.view.View#getViewRootImpl ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: android_9.0.0_r45   文件: WebViewDelegate.java
/**
 * 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);
    }
}
 
源代码2 项目: android_9.0.0_r45   文件: InputMethodManager.java
/**
 * 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);
        }
    }
}
 
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();
    }
}
 
protected void pauseInput() {
    final View decor = getDecor();
    final ViewRootImpl viewRoot = decor == null ? null : decor.getViewRootImpl();
    if (viewRoot != null) {
        viewRoot.setPausedForTransition(true);
    }
}
 
源代码5 项目: android_9.0.0_r45   文件: InputMethodManager.java
static void scheduleCheckFocusLocked(View view) {
    ViewRootImpl viewRootImpl = view.getViewRootImpl();
    if (viewRootImpl != null) {
        viewRootImpl.dispatchCheckFocus();
    }
}
 
 方法所在类
 同类方法