Example usage for android.view ViewTreeObserver removeOnTouchModeChangeListener

List of usage examples for android.view ViewTreeObserver removeOnTouchModeChangeListener

Introduction

In this page you can find the example usage for android.view ViewTreeObserver removeOnTouchModeChangeListener.

Prototype

public void removeOnTouchModeChangeListener(OnTouchModeChangeListener victim) 

Source Link

Document

Remove a previously installed touch mode change callback

Usage

From source file:com.example.libwidgettv.bak.AbsListView.java

@Override
protected void onDetachedFromWindow() {
    super.onDetachedFromWindow();

    // Dismiss the popup in case onSaveInstanceState() was not invoked
    dismissPopup();/*from w w w.  jav  a2  s . c o m*/

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

    final ViewTreeObserver treeObserver = getViewTreeObserver();
    treeObserver.removeOnTouchModeChangeListener(this);
    if (mTextFilterEnabled && mPopup != null) {
        treeObserver.removeGlobalOnLayoutListener(this);
        mGlobalLayoutListenerAddedFilter = false;
    }

    if (mAdapter != 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;
}

From source file:com.common.widget.hzlib.AbsHorizontalListView.java

@Override
protected void onDetachedFromWindow() {
    super.onDetachedFromWindow();

    // Dismiss the popup in case onSaveInstanceState() was not invoked
    dismissPopup();/*from w  w  w  .  j  av a 2 s  .c om*/

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

    final ViewTreeObserver treeObserver = getViewTreeObserver();
    treeObserver.removeOnTouchModeChangeListener(this);
    if (mTextFilterEnabled && mPopup != null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            treeObserver.removeOnGlobalLayoutListener(this);
        } else {
            treeObserver.removeGlobalOnLayoutListener(this);
        }
        mGlobalLayoutListenerAddedFilter = false;
    }

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

    // TODO we removed strict span in backport (j.m.)
    //if (mScrollStrictSpan != null) {
    //    mScrollStrictSpan.finish();
    //    mScrollStrictSpan = null;
    //}

    //if (mFlingStrictSpan != null) {
    //    mFlingStrictSpan.finish();
    //    mFlingStrictSpan = 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.run();
    }
}

From source file:com.appunite.list.AbsHorizontalListView.java

@Override
protected void onDetachedFromWindow() {
    super.onDetachedFromWindow();

    // Dismiss the popup in case onSaveInstanceState() was not invoked
    dismissPopup();//from   w w w .  j a  v a 2  s  .c o m

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

    final ViewTreeObserver treeObserver = getViewTreeObserver();
    treeObserver.removeOnTouchModeChangeListener(this);
    if (mTextFilterEnabled && mPopup != null) {
        Compat.removeOnGlobalLayoutListener(treeObserver, this);
        mGlobalLayoutListenerAddedFilter = false;
    }

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

    // TODO we removed strict span in backport (j.m.)
    //if (mScrollStrictSpan != null) {
    //    mScrollStrictSpan.finish();
    //    mScrollStrictSpan = null;
    //}

    //if (mFlingStrictSpan != null) {
    //    mFlingStrictSpan.finish();
    //    mFlingStrictSpan = 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.run();
    }
}

From source file:com.aliasapps.seq.scroller.TwoWayView.java

@Override
protected void onDetachedFromWindow() {
    super.onDetachedFromWindow();

    // Detach any view left in the scrap heap
    mRecycler.clear();/* ww w  .  jav  a  2 s .  c  o  m*/

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

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

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

    if (mTouchModeReset != null) {
        removeCallbacks(mTouchModeReset);
        mTouchModeReset.run();
    }

    mIsAttached = false;
}

From source file:com.vreal.libs.TwoWayView.java

@Override
protected void onDetachedFromWindow() {
    super.onDetachedFromWindow();

    // Detach any view left in the scrap heap
    mRecycler.clear();/*from  w  w  w. j  a v a 2s. c o m*/

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

    if (mAdapter != null) {
        try {
            mAdapter.unregisterDataSetObserver(mDataSetObserver);
        } catch (Exception e) {
            // TODO: handle exception
        }

        mDataSetObserver = null;
    }

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

    if (mTouchModeReset != null) {
        removeCallbacks(mTouchModeReset);
        mTouchModeReset.run();
    }

    mIsAttached = false;
}

From source file:com.artifex.mupdflib.TwoWayView.java

@Override
protected void onDetachedFromWindow() {
    super.onDetachedFromWindow();

    // Detach any view left in the scrap heap
    mRecycler.clear();/*from  w w  w .  java  2  s. co m*/

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

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

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

    if (mTouchModeReset != null) {
        removeCallbacks(mTouchModeReset);
        mTouchModeReset.run();
    }

    finishSmoothScrolling();

    mIsAttached = false;
}