use of android.view.ViewTreeObserver in project android_frameworks_base by ParanoidAndroid.
the class Editor method onAttachedToWindow.
void onAttachedToWindow() {
if (mShowErrorAfterAttach) {
showError();
mShowErrorAfterAttach = false;
}
mTemporaryDetach = false;
final ViewTreeObserver observer = mTextView.getViewTreeObserver();
// The get method will add the listener on controller creation.
if (mInsertionPointCursorController != null) {
observer.addOnTouchModeChangeListener(mInsertionPointCursorController);
}
if (mSelectionModifierCursorController != null) {
mSelectionModifierCursorController.resetTouchOffsets();
observer.addOnTouchModeChangeListener(mSelectionModifierCursorController);
}
updateSpellCheckSpans(0, mTextView.getText().length(), true);
if (mTextView.hasTransientState() && mTextView.getSelectionStart() != mTextView.getSelectionEnd()) {
// Since transient state is reference counted make sure it stays matched
// with our own calls to it for managing selection.
// The action mode callback will set this back again when/if the action mode starts.
mTextView.setHasTransientState(false);
// We had an active selection from before, start the selection mode.
startSelectionActionMode();
}
}
use of android.view.ViewTreeObserver in project android_frameworks_base by ParanoidAndroid.
the class Editor method getInsertionController.
InsertionPointCursorController getInsertionController() {
if (!mInsertionControllerEnabled) {
return null;
}
if (mInsertionPointCursorController == null) {
mInsertionPointCursorController = new InsertionPointCursorController();
final ViewTreeObserver observer = mTextView.getViewTreeObserver();
observer.addOnTouchModeChangeListener(mInsertionPointCursorController);
}
return mInsertionPointCursorController;
}
use of android.view.ViewTreeObserver in project android_frameworks_base by ParanoidAndroid.
the class TabHost method onDetachedFromWindow.
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
final ViewTreeObserver treeObserver = getViewTreeObserver();
treeObserver.removeOnTouchModeChangeListener(this);
}
use of android.view.ViewTreeObserver in project android_frameworks_base by ParanoidAndroid.
the class TabHost method onAttachedToWindow.
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
final ViewTreeObserver treeObserver = getViewTreeObserver();
treeObserver.addOnTouchModeChangeListener(this);
}
use of android.view.ViewTreeObserver in project android_frameworks_base by ParanoidAndroid.
the class ActivityChooserView method dismissPopup.
/**
* Dismisses the popup window with activities.
*
* @return True if dismissed, false if already dismissed.
*/
public boolean dismissPopup() {
if (isShowingPopup()) {
getListPopupWindow().dismiss();
ViewTreeObserver viewTreeObserver = getViewTreeObserver();
if (viewTreeObserver.isAlive()) {
viewTreeObserver.removeOnGlobalLayoutListener(mOnGlobalLayoutListener);
}
}
return true;
}
Aggregations