Search in sources :

Example 1 with ViewParent

use of android.view.ViewParent in project Launcher3 by chislon.

the class PagedView method focusableViewAvailable.

/**
     * If one of our descendant views decides that it could be focused now, only
     * pass that along if it's on the current page.
     *
     * This happens when live folders requery, and if they're off page, they
     * end up calling requestFocus, which pulls it on page.
     */
@Override
public void focusableViewAvailable(View focused) {
    View current = getPageAt(mCurrentPage);
    View v = focused;
    while (true) {
        if (v == current) {
            super.focusableViewAvailable(focused);
            return;
        }
        if (v == this) {
            return;
        }
        ViewParent parent = v.getParent();
        if (parent instanceof View) {
            v = (View) v.getParent();
        } else {
            return;
        }
    }
}
Also used : ViewParent(android.view.ViewParent) View(android.view.View)

Example 2 with ViewParent

use of android.view.ViewParent in project Launcher3 by chislon.

the class PagedView method getPageForView.

public int getPageForView(View v) {
    int result = -1;
    if (v != null) {
        ViewParent vp = v.getParent();
        int count = getChildCount();
        for (int i = 0; i < count; i++) {
            if (vp == getPageAt(i)) {
                return i;
            }
        }
    }
    return result;
}
Also used : ViewParent(android.view.ViewParent)

Example 3 with ViewParent

use of android.view.ViewParent in project cw-omnibus by commonsguy.

the class IcsListPopupWindow method dismiss.

public void dismiss() {
    mPopup.dismiss();
    if (mPromptView != null) {
        final ViewParent parent = mPromptView.getParent();
        if (parent instanceof ViewGroup) {
            final ViewGroup group = (ViewGroup) parent;
            group.removeView(mPromptView);
        }
    }
    mPopup.setContentView(null);
    mDropDownList = null;
    mHandler.removeCallbacks(mResizePopupRunnable);
}
Also used : ViewParent(android.view.ViewParent) ViewGroup(android.view.ViewGroup)

Example 4 with ViewParent

use of android.view.ViewParent in project Android-PullToRefresh by chrisbanes.

the class PullToRefreshAdapterViewBase method setEmptyView.

/**
	 * Sets the Empty View to be used by the Adapter View.
	 * <p/>
	 * We need it handle it ourselves so that we can Pull-to-Refresh when the
	 * Empty View is shown.
	 * <p/>
	 * Please note, you do <strong>not</strong> usually need to call this method
	 * yourself. Calling setEmptyView on the AdapterView will automatically call
	 * this method and set everything up. This includes when the Android
	 * Framework automatically sets the Empty View based on it's ID.
	 * 
	 * @param newEmptyView - Empty View to be used
	 */
public final void setEmptyView(View newEmptyView) {
    FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();
    if (null != newEmptyView) {
        // New view needs to be clickable so that Android recognizes it as a
        // target for Touch Events
        newEmptyView.setClickable(true);
        ViewParent newEmptyViewParent = newEmptyView.getParent();
        if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
            ((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
        }
        // We need to convert any LayoutParams so that it works in our
        // FrameLayout
        FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
        if (null != lp) {
            refreshableViewWrapper.addView(newEmptyView, lp);
        } else {
            refreshableViewWrapper.addView(newEmptyView);
        }
    }
    if (mRefreshableView instanceof EmptyViewMethodAccessor) {
        ((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
    } else {
        mRefreshableView.setEmptyView(newEmptyView);
    }
    mEmptyView = newEmptyView;
}
Also used : ViewParent(android.view.ViewParent) ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) EmptyViewMethodAccessor(com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor)

Example 5 with ViewParent

use of android.view.ViewParent in project PhotoView by chrisbanes.

the class PhotoViewAttacher method onTouch.

@Override
public boolean onTouch(View v, MotionEvent ev) {
    boolean handled = false;
    if (mZoomEnabled && Util.hasDrawable((ImageView) v)) {
        switch(ev.getAction()) {
            case MotionEvent.ACTION_DOWN:
                ViewParent parent = v.getParent();
                // event
                if (parent != null) {
                    parent.requestDisallowInterceptTouchEvent(true);
                }
                // If we're flinging, and the user presses down, cancel
                // fling
                cancelFling();
                break;
            case MotionEvent.ACTION_CANCEL:
            case MotionEvent.ACTION_UP:
                // to min scale
                if (getScale() < mMinScale) {
                    RectF rect = getDisplayRect();
                    if (rect != null) {
                        v.post(new AnimatedZoomRunnable(getScale(), mMinScale, rect.centerX(), rect.centerY()));
                        handled = true;
                    }
                }
                break;
        }
        // Try the Scale/Drag detector
        if (mScaleDragDetector != null) {
            boolean wasScaling = mScaleDragDetector.isScaling();
            boolean wasDragging = mScaleDragDetector.isDragging();
            handled = mScaleDragDetector.onTouchEvent(ev);
            boolean didntScale = !wasScaling && !mScaleDragDetector.isScaling();
            boolean didntDrag = !wasDragging && !mScaleDragDetector.isDragging();
            mBlockParentIntercept = didntScale && didntDrag;
        }
        // Check to see if the user double tapped
        if (mGestureDetector != null && mGestureDetector.onTouchEvent(ev)) {
            handled = true;
        }
    }
    return handled;
}
Also used : RectF(android.graphics.RectF) ViewParent(android.view.ViewParent) ImageView(android.widget.ImageView)

Aggregations

ViewParent (android.view.ViewParent)401 ViewGroup (android.view.ViewGroup)184 View (android.view.View)153 ImageView (android.widget.ImageView)36 Rect (android.graphics.Rect)32 VelocityTracker (android.view.VelocityTracker)32 TextView (android.widget.TextView)23 SuppressLint (android.annotation.SuppressLint)15 Paint (android.graphics.Paint)15 FrameLayout (android.widget.FrameLayout)15 AdapterView (android.widget.AdapterView)14 AccessibilityEvent (android.view.accessibility.AccessibilityEvent)13 ViewTreeObserver (android.view.ViewTreeObserver)12 LayoutParams (android.view.WindowManager.LayoutParams)11 Description (org.hamcrest.Description)11 ExpandableNotificationRow (com.android.systemui.statusbar.ExpandableNotificationRow)10 SignalClusterView (com.android.systemui.statusbar.SignalClusterView)10 TypeSafeMatcher (org.hamcrest.TypeSafeMatcher)10 EditText (android.widget.EditText)9 Context (android.content.Context)8