use of android.view.ViewTreeObserver in project Klyph by jonathangerbaud.
the class AbsHListView method onDetachedFromWindow.
@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;
}
use of android.view.ViewTreeObserver in project Jota-Text-Editor-old by jiro-aqua.
the class TextView method onDetachedFromWindow.
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
final ViewTreeObserver observer = getViewTreeObserver();
if (observer != null) {
if (mPreDrawState != PREDRAW_NOT_REGISTERED) {
observer.removeOnPreDrawListener(this);
mPreDrawState = PREDRAW_NOT_REGISTERED;
}
if (mInsertionPointCursorController != null) {
observer.removeOnTouchModeChangeListener(mInsertionPointCursorController);
}
if (mSelectionModifierCursorController != null) {
observer.removeOnTouchModeChangeListener(mSelectionModifierCursorController);
}
}
if (mError != null) {
hideError();
}
if (mBlink != null) {
mBlink.cancel();
}
if (mInsertionPointCursorController != null) {
mInsertionPointCursorController.onDetached();
}
if (mSelectionModifierCursorController != null) {
mSelectionModifierCursorController.onDetached();
}
hideControllers();
}
use of android.view.ViewTreeObserver in project Jota-Text-Editor-old by jiro-aqua.
the class TextView method getSelectionController.
CursorController getSelectionController() {
if (!mSelectionControllerEnabled) {
return null;
}
if (mSelectionModifierCursorController == null) {
mSelectionModifierCursorController = new SelectionModifierCursorController();
final ViewTreeObserver observer = getViewTreeObserver();
if (observer != null) {
observer.addOnTouchModeChangeListener(mSelectionModifierCursorController);
}
}
return mSelectionModifierCursorController;
}
use of android.view.ViewTreeObserver in project Jota-Text-Editor-old by jiro-aqua.
the class TextView method onAttachedToWindow.
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
mTemporaryDetach = false;
if (mShowErrorAfterAttach) {
showError();
mShowErrorAfterAttach = false;
}
final ViewTreeObserver observer = getViewTreeObserver();
if (observer != null) {
if (mInsertionPointCursorController != null) {
observer.addOnTouchModeChangeListener(mInsertionPointCursorController);
}
if (mSelectionModifierCursorController != null) {
observer.addOnTouchModeChangeListener(mSelectionModifierCursorController);
}
}
}
use of android.view.ViewTreeObserver in project KJFrameForAndroid by kymjs.
the class CurtainViewController method prepareSlidingLayout.
/**
* 为控件做一些属性设置
*/
protected void prepareSlidingLayout() {
curtainLayoutParams = (FrameLayout.LayoutParams) curtainParent.getLayoutParams();
ViewTreeObserver vto = curtainParent.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
@SuppressLint("NewApi")
public void onGlobalLayout() {
hideCurtainLayout();
ViewTreeObserver obs = curtainParent.getViewTreeObserver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
obs.removeOnGlobalLayoutListener(this);
} else {
obs.removeGlobalOnLayoutListener(this);
}
}
});
curtainParent.setOnTouchListener(new OnContentTouchListener());
curtainParent.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && getSlidingStatus() == SlidingStatus.EXPANDED) {
collapse();
return true;
} else {
return false;
}
}
});
}
Aggregations