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

The following examples show how to use android.view.ViewTreeObserver#removeOnTouchModeChangeListener() . 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: TwoWayAbsListView.java    From recent-images with MIT License 6 votes vote down vote up
@Override
protected void onDetachedFromWindow() {
	super.onDetachedFromWindow();

	// Dismiss the popup in case onSaveInstanceState() was not invoked
	//dismissPopup();

	// Detach any view left in the scrap heap
	mRecycler.clear();

	final ViewTreeObserver treeObserver = getViewTreeObserver();
	if (treeObserver != null) {
		treeObserver.removeOnTouchModeChangeListener(this);
		/*
           if (mTextFilterEnabled && mPopup != null) {
               treeObserver.removeGlobalOnLayoutListener(this);
               mGlobalLayoutListenerAddedFilter = false;
           }*/
	}
}
 
Example 3
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 4
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 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();//获取view树的观察者
            viewTreeObserver.removeOnGlobalFocusChangeListener(this);//通知全局性移除相应的listener
            viewTreeObserver.removeOnScrollChangedListener(this);
            viewTreeObserver.removeOnGlobalLayoutListener(this);
            viewTreeObserver.removeOnTouchModeChangeListener(this);
            mMetroViewBorder.OnDetach(mView, viewGroup);
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
Example 6
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 7
Source File: PLAAbsListView.java    From SimplifyReader with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDetachedFromWindow() {
    super.onDetachedFromWindow();

    // Detach any view left in the scrap heap
    mRecycler.clear();

    final ViewTreeObserver treeObserver = getViewTreeObserver();
    if (treeObserver != null) {
        treeObserver.removeOnTouchModeChangeListener(this);
    }
}
 
Example 8
Source File: PLAAbsListView.java    From Lay-s with MIT License 5 votes vote down vote up
@Override
protected void onDetachedFromWindow() {
    super.onDetachedFromWindow();

    // Detach any view left in the scrap heap
    mRecycler.clear();

    final ViewTreeObserver treeObserver = getViewTreeObserver();
    if (treeObserver != null) {
        treeObserver.removeOnTouchModeChangeListener(this);
    }
}
 
Example 9
Source File: AbsHListView.java    From Klyph with MIT License 5 votes vote down vote up
@Override
protected void onDetachedFromWindow() {
	super.onDetachedFromWindow();

	// Dismiss the popup in case onSaveInstanceState() was not invoked

	// Detach any view left in the scrap heap
	mRecycler.clear();

	final ViewTreeObserver treeObserver = getViewTreeObserver();
	treeObserver.removeOnTouchModeChangeListener( this );

	if ( mAdapter != null && mDataSetObserver != null ) {
		mAdapter.unregisterDataSetObserver( mDataSetObserver );
		mDataSetObserver = null;
	}

	if ( mFlingRunnable != null ) {
		removeCallbacks( mFlingRunnable );
	}

	if ( mPositionScroller != null ) {
		mPositionScroller.stop();
	}

	if ( mClearScrollingCache != null ) {
		removeCallbacks( mClearScrollingCache );
	}

	if ( mPerformClick != null ) {
		removeCallbacks( mPerformClick );
	}

	if ( mTouchModeReset != null ) {
		removeCallbacks( mTouchModeReset );
		mTouchModeReset = null;
	}
	mIsAttached = false;
}
 
Example 10
Source File: PLA_AbsListView.java    From EverMemo with MIT License 5 votes vote down vote up
@Override
protected void onDetachedFromWindow() {
	super.onDetachedFromWindow();

	// Detach any view left in the scrap heap
	mRecycler.clear();

	final ViewTreeObserver treeObserver = getViewTreeObserver();
	if (treeObserver != null) {
		treeObserver.removeOnTouchModeChangeListener(this);
	}
}