Search in sources :

Example 91 with ViewParent

use of android.view.ViewParent in project UltimateAndroid by cymcsg.

the class SwipeLayout method performAdapterViewItemClick.

private void performAdapterViewItemClick(MotionEvent e) {
    ViewParent t = getParent();
    while (t != null) {
        if (t instanceof AdapterView) {
            AdapterView view = (AdapterView) t;
            int p = view.getPositionForView(SwipeLayout.this);
            if (p != AdapterView.INVALID_POSITION && view.performItemClick(view.getChildAt(p), p, view.getAdapter().getItemId(p)))
                return;
        } else {
            if (t instanceof View && ((View) t).performClick())
                return;
        }
        t = t.getParent();
    }
}
Also used : ViewParent(android.view.ViewParent) AdapterView(android.widget.AdapterView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 92 with ViewParent

use of android.view.ViewParent in project MaterialNavigationDrawer by neokree.

the class MaterialNavigationDrawer method addSection.

public void addSection(MaterialSection section) {
    //        section.setPosition(sectionList.size());
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (48 * density));
    section.setTypeface(fontManager.getRobotoMedium());
    sectionList.add(section);
    ViewParent parent = section.getView().getParent();
    sections.addView(section.getView(), params);
    // add the element to the list
    elementsList.add(new Element(Element.TYPE_SECTION, section));
}
Also used : ViewParent(android.view.ViewParent) Element(it.neokree.materialnavigationdrawer.elements.Element) LinearLayout(android.widget.LinearLayout)

Example 93 with ViewParent

use of android.view.ViewParent in project android-support-v4-googlemaps by petedoyle.

the class PagerTitleStrip method onAttachedToWindow.

@Override
protected void onAttachedToWindow() {
    super.onAttachedToWindow();
    final ViewParent parent = getParent();
    if (!(parent instanceof ViewPager)) {
        throw new IllegalStateException("PagerTitleStrip must be a direct child of a ViewPager.");
    }
    final ViewPager pager = (ViewPager) parent;
    final PagerAdapter adapter = pager.getAdapter();
    pager.setInternalPageChangeListener(mPageListener);
    pager.setOnAdapterChangeListener(mPageListener);
    mPager = pager;
    updateAdapter(mWatchingAdapter != null ? mWatchingAdapter.get() : null, adapter);
}
Also used : ViewParent(android.view.ViewParent)

Example 94 with ViewParent

use of android.view.ViewParent in project android-support-v4-googlemaps by petedoyle.

the class ViewPager method getChildRectInPagerCoordinates.

private Rect getChildRectInPagerCoordinates(Rect outRect, View child) {
    if (outRect == null) {
        outRect = new Rect();
    }
    if (child == null) {
        outRect.set(0, 0, 0, 0);
        return outRect;
    }
    outRect.left = child.getLeft();
    outRect.right = child.getRight();
    outRect.top = child.getTop();
    outRect.bottom = child.getBottom();
    ViewParent parent = child.getParent();
    while (parent instanceof ViewGroup && parent != this) {
        final ViewGroup group = (ViewGroup) parent;
        outRect.left += group.getLeft();
        outRect.right += group.getRight();
        outRect.top += group.getTop();
        outRect.bottom += group.getBottom();
        parent = group.getParent();
    }
    return outRect;
}
Also used : Rect(android.graphics.Rect) ViewParent(android.view.ViewParent) ViewGroup(android.view.ViewGroup)

Example 95 with ViewParent

use of android.view.ViewParent in project GalleryFinal by pengjianbo.

the class PhotoViewAttacher method onTouch.

@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View v, MotionEvent ev) {
    boolean handled = false;
    if (mZoomEnabled && hasDrawable((ImageView) v)) {
        ViewParent parent = v.getParent();
        switch(ev.getAction()) {
            case ACTION_DOWN:
                // event
                if (null != parent) {
                    parent.requestDisallowInterceptTouchEvent(true);
                }
                // If we're flinging, and the user presses down, cancel
                // fling
                cancelFling();
                break;
            case ACTION_CANCEL:
            case ACTION_UP:
                // to min scale
                if (getScale() < mMinScale) {
                    RectF rect = getDisplayRect();
                    if (null != rect) {
                        v.post(new AnimatedZoomRunnable(getScale(), mMinScale, rect.centerX(), rect.centerY()));
                        handled = true;
                    }
                }
                break;
        }
        // Try the Scale/Drag detector
        if (null != mScaleDragDetector) {
            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 (null != mGestureDetector && mGestureDetector.onTouchEvent(ev)) {
            handled = true;
        }
    }
    return handled;
}
Also used : RectF(android.graphics.RectF) ViewParent(android.view.ViewParent) ImageView(android.widget.ImageView) SuppressLint(android.annotation.SuppressLint)

Aggregations

ViewParent (android.view.ViewParent)409 ViewGroup (android.view.ViewGroup)185 View (android.view.View)156 ImageView (android.widget.ImageView)36 Rect (android.graphics.Rect)32 VelocityTracker (android.view.VelocityTracker)32 TextView (android.widget.TextView)24 FrameLayout (android.widget.FrameLayout)17 SuppressLint (android.annotation.SuppressLint)16 Paint (android.graphics.Paint)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 MotionEvent (android.view.MotionEvent)9 EditText (android.widget.EditText)9