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;
}
use of android.view.ViewTreeObserver in project android_frameworks_base by ParanoidAndroid.
the class AbsListView method onAttachedToWindow.
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
final ViewTreeObserver treeObserver = getViewTreeObserver();
treeObserver.addOnTouchModeChangeListener(this);
if (mTextFilterEnabled && mPopup != null && !mGlobalLayoutListenerAddedFilter) {
treeObserver.addOnGlobalLayoutListener(this);
}
if (mAdapter != null && mDataSetObserver == null) {
mDataSetObserver = new AdapterDataSetObserver();
mAdapter.registerDataSetObserver(mDataSetObserver);
// Data may have changed while we were detached. Refresh.
mDataChanged = true;
mOldItemCount = mItemCount;
mItemCount = mAdapter.getCount();
}
mIsAttached = true;
}
use of android.view.ViewTreeObserver in project android_frameworks_base by ParanoidAndroid.
the class PopupWindow method registerForScrollChanged.
private void registerForScrollChanged(View anchor, int xoff, int yoff) {
unregisterForScrollChanged();
mAnchor = new WeakReference<View>(anchor);
ViewTreeObserver vto = anchor.getViewTreeObserver();
if (vto != null) {
vto.addOnScrollChangedListener(mOnScrollChangedListener);
}
mAnchorXoff = xoff;
mAnchorYoff = yoff;
}
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;
}
Aggregations