Search in sources :

Example 76 with ViewTreeObserver

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

Example 77 with ViewTreeObserver

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

Example 78 with ViewTreeObserver

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

Example 79 with ViewTreeObserver

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

Example 80 with ViewTreeObserver

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;
}
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