Search in sources :

Example 86 with ViewTreeObserver

use of android.view.ViewTreeObserver in project android_frameworks_base by crdroidandroid.

the class PopupWindow method attachToAnchor.

private void attachToAnchor(View anchor, int xoff, int yoff, int gravity) {
    detachFromAnchor();
    final ViewTreeObserver vto = anchor.getViewTreeObserver();
    if (vto != null) {
        vto.addOnScrollChangedListener(mOnScrollChangedListener);
    }
    final View anchorRoot = anchor.getRootView();
    anchorRoot.addOnAttachStateChangeListener(mOnAnchorRootDetachedListener);
    mAnchor = new WeakReference<>(anchor);
    mAnchorRoot = new WeakReference<>(anchorRoot);
    mIsAnchorRootAttached = anchorRoot.isAttachedToWindow();
    mAnchorXoff = xoff;
    mAnchorYoff = yoff;
    mAnchoredGravity = gravity;
}
Also used : ViewTreeObserver(android.view.ViewTreeObserver) View(android.view.View)

Example 87 with ViewTreeObserver

use of android.view.ViewTreeObserver in project android_frameworks_base by crdroidandroid.

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();
    }
}
Also used : ViewTreeObserver(android.view.ViewTreeObserver)

Example 88 with ViewTreeObserver

use of android.view.ViewTreeObserver in project android_frameworks_base by crdroidandroid.

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;
}
Also used : ViewTreeObserver(android.view.ViewTreeObserver)

Example 89 with ViewTreeObserver

use of android.view.ViewTreeObserver in project android_frameworks_base by crdroidandroid.

the class Editor method onAttachedToWindow.

void onAttachedToWindow() {
    if (mShowErrorAfterAttach) {
        showError();
        mShowErrorAfterAttach = 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.hasSelection()) {
        refreshTextActionMode();
    }
    getPositionListener().addSubscriber(mCursorAnchorInfoNotifier, true);
    resumeBlink();
}
Also used : ViewTreeObserver(android.view.ViewTreeObserver)

Example 90 with ViewTreeObserver

use of android.view.ViewTreeObserver in project android_frameworks_base by crdroidandroid.

the class Editor method getSelectionController.

SelectionModifierCursorController getSelectionController() {
    if (!mSelectionControllerEnabled) {
        return null;
    }
    if (mSelectionModifierCursorController == null) {
        mSelectionModifierCursorController = new SelectionModifierCursorController();
        final ViewTreeObserver observer = mTextView.getViewTreeObserver();
        observer.addOnTouchModeChangeListener(mSelectionModifierCursorController);
    }
    return mSelectionModifierCursorController;
}
Also used : ViewTreeObserver(android.view.ViewTreeObserver)

Aggregations

ViewTreeObserver (android.view.ViewTreeObserver)222 View (android.view.View)56 OnGlobalLayoutListener (android.view.ViewTreeObserver.OnGlobalLayoutListener)25 ImageView (android.widget.ImageView)25 TextView (android.widget.TextView)15 ViewGroup (android.view.ViewGroup)14 SuppressLint (android.annotation.SuppressLint)13 AdapterView (android.widget.AdapterView)12 TypedArray (android.content.res.TypedArray)7 Test (org.junit.Test)7 RectF (android.graphics.RectF)6 DisplayMetrics (android.util.DisplayMetrics)6 ViewParent (android.view.ViewParent)6 LinearLayout (android.widget.LinearLayout)6 ListView (android.widget.ListView)6 Resources (android.content.res.Resources)5 ValueAnimator (android.animation.ValueAnimator)4 TargetApi (android.annotation.TargetApi)4 Activity (android.app.Activity)4 Paint (android.graphics.Paint)4