Java Code Examples for android.view.ViewTreeObserver#removeOnGlobalFocusChangeListener()

The following examples show how to use android.view.ViewTreeObserver#removeOnGlobalFocusChangeListener() . 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: BorderView.java    From AndroidTvDemo with Apache License 2.0 6 votes vote down vote up
public void detachFrom(ViewGroup viewGroup)
{
    try
    {
        if (viewGroup == mViewGroup)
        {
            ViewTreeObserver viewTreeObserver = mViewGroup.getViewTreeObserver();
            viewTreeObserver.removeOnGlobalFocusChangeListener(this);
            viewTreeObserver.removeOnScrollChangedListener(this);
            viewTreeObserver.removeOnGlobalLayoutListener(this);
            viewTreeObserver.removeOnTouchModeChangeListener(this);
            borderEffect.OnDetach(mView, viewGroup);
        }
    }
    catch (Exception ex)
    {
        ex.printStackTrace();
    }
}
 
Example 2
Source File: MetroViewBorderImpl.java    From LivePlayback with Apache License 2.0 5 votes vote down vote up
public void detachFrom(ViewGroup viewGroup) {
    try {
        if (viewGroup == mViewGroup) {
            ViewTreeObserver viewTreeObserver = mViewGroup.getViewTreeObserver();//获取view树的观察者
            viewTreeObserver.removeOnGlobalFocusChangeListener(this);//通知全局性移除相应的listener
            viewTreeObserver.removeOnScrollChangedListener(this);
            viewTreeObserver.removeOnGlobalLayoutListener(this);
            viewTreeObserver.removeOnTouchModeChangeListener(this);
            mMetroViewBorder.OnDetach(mView, viewGroup);
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
Example 3
Source File: BorderView.java    From TvWidget with Apache License 2.0 5 votes vote down vote up
public void detachFrom(ViewGroup viewGroup) {
    try {
        if (viewGroup == mViewGroup) {
            ViewTreeObserver viewTreeObserver = mViewGroup.getViewTreeObserver();
            viewTreeObserver.removeOnGlobalFocusChangeListener(this);
            viewTreeObserver.removeOnScrollChangedListener(this);
            viewTreeObserver.removeOnGlobalLayoutListener(this);
            viewTreeObserver.removeOnTouchModeChangeListener(this);
            borderEffect.OnDetach(mView, viewGroup);
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
Example 4
Source File: MetroViewBorderImpl.java    From TVSample with Apache License 2.0 5 votes vote down vote up
public void detachFrom(ViewGroup viewGroup) {
    try {
        if (viewGroup == mViewGroup) {
            ViewTreeObserver viewTreeObserver = mViewGroup.getViewTreeObserver();//获取view树的观察者
            viewTreeObserver.removeOnGlobalFocusChangeListener(this);//通知全局性移除相应的listener
            viewTreeObserver.removeOnScrollChangedListener(this);
            viewTreeObserver.removeOnGlobalLayoutListener(this);
            viewTreeObserver.removeOnTouchModeChangeListener(this);
            mMetroViewBorder.OnDetach(mView, viewGroup);
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
Example 5
Source File: MetroViewBorderImpl.java    From TVSample with Apache License 2.0 5 votes vote down vote up
public void detachFrom(ViewGroup viewGroup) {
    try {
        if (viewGroup == mViewGroup) {
            ViewTreeObserver viewTreeObserver = mViewGroup.getViewTreeObserver();
            viewTreeObserver.removeOnGlobalFocusChangeListener(this);
            viewTreeObserver.removeOnScrollChangedListener(this);
            viewTreeObserver.removeOnGlobalLayoutListener(this);
            viewTreeObserver.removeOnTouchModeChangeListener(this);
            mMetroViewBorder.OnDetach(mView, viewGroup);
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
Example 6
Source File: AppActivityLifecycleCallbacks.java    From sa-sdk-android with Apache License 2.0 5 votes vote down vote up
/**
 * 取消注册 ViewTreeObserver
 */
private void unRegisterViewTreeObserver(Activity activity) {
    ViewTreeObserver viewTreeObserver = activity.getWindow().getDecorView().getViewTreeObserver();
    viewTreeObserver.removeOnGlobalFocusChangeListener(AppViewTreeObserver.getInstance());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        viewTreeObserver.removeOnGlobalLayoutListener(AppViewTreeObserver.getInstance());
    }
    viewTreeObserver.removeOnScrollChangedListener(AppViewTreeObserver.getInstance());
}
 
Example 7
Source File: DpadAwareRecyclerView.java    From dpad-aware-recycler-view with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDetachedFromWindow() {
    super.onDetachedFromWindow();

    ViewTreeObserver obs = getViewTreeObserver();
    obs.removeOnGlobalFocusChangeListener(this);
}