Java Code Examples for android.view.ViewGroup#getBottom()

The following examples show how to use android.view.ViewGroup#getBottom() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwipeLayout.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public boolean onDoubleTap(MotionEvent e) {
    if (mDoubleClickListener != null) {
        View target;
        ViewGroup bottom = getBottomView();
        ViewGroup surface = getSurfaceView();
        if (e.getX() > bottom.getLeft() && e.getX() < bottom.getRight()
                && e.getY() > bottom.getTop()
                && e.getY() < bottom.getBottom()) {
            target = bottom;
        } else {
            target = surface;
        }
        mDoubleClickListener.onDoubleClick(SwipeLayout.this,
                target == surface);
    }
    return true;
}
 
Example 2
Source File: SwipeLayoutConv.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public boolean onDoubleTap(MotionEvent e) {
    if (mDoubleClickListener != null) {
        View target;
        ViewGroup bottom = getBottomView();
        ViewGroup surface = getSurfaceView();
        if (e.getX() > bottom.getLeft() && e.getX() < bottom.getRight()
                && e.getY() > bottom.getTop()
                && e.getY() < bottom.getBottom()) {
            target = bottom;
        } else {
            target = surface;
        }
        mDoubleClickListener.onDoubleClick(SwipeLayoutConv.this,
                target == surface);
    }
    return true;
}
 
Example 3
Source File: ShareMessageFragment.java    From TestChat with Apache License 2.0 6 votes vote down vote up
@Override
public void onCommentItemClick(View view, String id, int shareMessagePosition, int position, String replyUser) {
        LogUtil.e("位置" + shareMessagePosition);
        currentPosition = shareMessagePosition;
        currentCommentPosition = position;
        ViewParent viewParent = view.getParent();
        if (viewParent != null) {
                ViewGroup parent = (ViewGroup) viewParent;
                commentItemOffset += parent.getHeight() - view.getBottom();
                if (parent.getParent() != null) {
                        ViewGroup rootParent = (ViewGroup) parent.getParent();
                        commentItemOffset += rootParent.getHeight() + parent.getBottom();
                }
        }
        this.replyUid = replyUser;
        dealBottomView(true);
}
 
Example 4
Source File: UserDetailActivity.java    From TestChat with Apache License 2.0 6 votes vote down vote up
@Override
public void onCommentItemClick(View view, String id, int shareMessagePosition, int commentPosition, String replyUid) {
        LogUtil.e("位置" + shareMessagePosition);
        currentPosition = shareMessagePosition;
        currentCommentPosition = commentPosition;
        ViewParent viewParent = view.getParent();
        if (viewParent != null) {
                ViewGroup parent = (ViewGroup) viewParent;
                commentItemOffset += parent.getHeight() - view.getBottom();
                if (parent.getParent() != null) {
                        ViewGroup rootParent = (ViewGroup) parent.getParent();
                        commentItemOffset += rootParent.getHeight() + parent.getBottom();
                }
        }
        this.replyUid = replyUid;
        dealBottomView(true);
}
 
Example 5
Source File: HintCaseView.java    From hintcase with Apache License 2.0 6 votes vote down vote up
private void calculateHintBlockPosition(ViewGroup parent, Shape shape) {
    if (targetView == NO_TARGETVIEW) {
        hintBlockPosition = HintCase.HINT_BLOCK_POSITION_CENTER;
    } else {
        int[] areas = new int[4];
        areas[HintCase.HINT_BLOCK_POSITION_LEFT] = shape.getLeft() - parent.getLeft();
        areas[HintCase.HINT_BLOCK_POSITION_TOP] = shape.getTop() - parent.getTop();
        areas[HintCase.HINT_BLOCK_POSITION_RIGHT] = parent.getRight() - shape.getRight();
        areas[HintCase.HINT_BLOCK_POSITION_BOTTOM] = parent.getBottom() - shape.getBottom();
        hintBlockPosition = HintCase.HINT_BLOCK_POSITION_LEFT;
        for(int i = 1; i < areas.length; i++) {
            if(areas[i] >= areas[hintBlockPosition]) {
                hintBlockPosition = i;
            }
        }
    }
}
 
Example 6
Source File: SwipeLayout.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onDoubleTap(MotionEvent e) {
    if(mDoubleClickListener != null){
        View target;
        ViewGroup bottom = getBottomView();
        ViewGroup surface = getSurfaceView();
        if(e.getX() > bottom.getLeft() && e.getX() < bottom.getRight()
                && e.getY() > bottom.getTop() && e.getY() < bottom.getBottom()){
            target = bottom;
        }else{
            target = surface;
        }
        mDoubleClickListener.onDoubleClick(SwipeLayout.this, target == surface);
    }
    return true;
}
 
Example 7
Source File: FocusAnimator.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/** Scroll the layout so that the focused child is on screen. */
private void requestChildFocus() {
    ViewGroup parent = (ViewGroup) mLayout.getParent();
    if (mLayout.getParent() == null) return;

    // Scroll the parent to make the focused child visible.
    if (mFocusedChild != null) parent.requestChildFocus(mLayout, mFocusedChild);

    // {@link View#requestChildFocus} fails to account for children changing their height, so
    // the scroll value may be past the actual maximum.
    int viewportHeight = parent.getBottom() - parent.getTop();
    int scrollMax = Math.max(0, mLayout.getMeasuredHeight() - viewportHeight);
    if (parent.getScrollY() > scrollMax) parent.setScrollY(scrollMax);
}
 
Example 8
Source File: DragSortListView.java    From Field-Book with GNU General Public License v2.0 5 votes vote down vote up
private void drawDivider(int expPosition, Canvas canvas) {
    final Drawable divider = getDivider();
    final int dividerHeight = getDividerHeight();

    if (divider != null && dividerHeight != 0) {
        final ViewGroup expItem = (ViewGroup) getChildAt(expPosition
                - getFirstVisiblePosition());
        if (expItem != null) {
            final int left = getPaddingLeft();
            final int right = getWidth() - getPaddingRight();
            final int top;
            final int bottom;

            final int childHeight = expItem.getChildAt(0).getHeight();

            if (expPosition > mSrcPos) {
                top = expItem.getTop() + childHeight;
                bottom = top + dividerHeight;
            } else {
                bottom = expItem.getBottom() - childHeight;
                top = bottom - dividerHeight;
            }

            // Have to clip to support ColorDrawable on <= Gingerbread
            canvas.save();
            canvas.clipRect(left, top, right, bottom);
            divider.setBounds(left, top, right, bottom);
            divider.draw(canvas);
            canvas.restore();
        }
    }
}
 
Example 9
Source File: DragSortListView.java    From simpletask-android with GNU General Public License v3.0 5 votes vote down vote up
private void drawDivider(int expPosition, @NonNull Canvas canvas) {

        final Drawable divider = getDivider();
        final int dividerHeight = getDividerHeight();
        // Log.d(tag, "div="+divider+" divH="+dividerHeight);

        if (divider != null && dividerHeight != 0) {
            final ViewGroup expItem = (ViewGroup) getChildAt(expPosition
                    - getFirstVisiblePosition());
            if (expItem != null) {
                final int l = getPaddingLeft();
                final int r = getWidth() - getPaddingRight();
                final int t;
                final int b;

                final int childHeight = expItem.getChildAt(0).getHeight();

                if (expPosition > mSrcPos) {
                    t = expItem.getTop() + childHeight;
                    b = t + dividerHeight;
                } else {
                    b = expItem.getBottom() - childHeight;
                    t = b - dividerHeight;
                }
                // Log.d(tag, "l="+l+" t="+t+" r="+r+" b="+b);

                // Have to clip to support ColorDrawable on <= Gingerbread
                canvas.save();
                canvas.clipRect(l, t, r, b);
                divider.setBounds(l, t, r, b);
                divider.draw(canvas);
                canvas.restore();
            }
        }
    }
 
Example 10
Source File: DragSortListView.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private void drawDivider(int expPosition, Canvas canvas) {

        final Drawable divider = getDivider();
        final int dividerHeight = getDividerHeight();
        // Log.d("mobeta", "div="+divider+" divH="+dividerHeight);

        if (divider != null && dividerHeight != 0) {
            final ViewGroup expItem = (ViewGroup) getChildAt(expPosition
                    - getFirstVisiblePosition());
            if (expItem != null) {
                final int l = getPaddingLeft();
                final int r = getWidth() - getPaddingRight();
                final int t;
                final int b;

                final int childHeight = expItem.getChildAt(0).getHeight();

                if (expPosition > mSrcPos) {
                    t = expItem.getTop() + childHeight;
                    b = t + dividerHeight;
                } else {
                    b = expItem.getBottom() - childHeight;
                    t = b - dividerHeight;
                }
                // Log.d("mobeta", "l="+l+" t="+t+" r="+r+" b="+b);

                // Have to clip to support ColorDrawable on <= Gingerbread
                canvas.save();
                canvas.clipRect(l, t, r, b);
                divider.setBounds(l, t, r, b);
                divider.draw(canvas);
                canvas.restore();
            }
        }
    }
 
Example 11
Source File: DragSortListView.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private void drawDivider(int expPosition, Canvas canvas) {

        final Drawable divider = getDivider();
        final int dividerHeight = getDividerHeight();
        // Log.d("mobeta", "div="+divider+" divH="+dividerHeight);

        if (divider != null && dividerHeight != 0) {
            final ViewGroup expItem = (ViewGroup) getChildAt(expPosition
                    - getFirstVisiblePosition());
            if (expItem != null) {
                final int l = getPaddingLeft();
                final int r = getWidth() - getPaddingRight();
                final int t;
                final int b;

                final int childHeight = expItem.getChildAt(0).getHeight();

                if (expPosition > mSrcPos) {
                    t = expItem.getTop() + childHeight;
                    b = t + dividerHeight;
                } else {
                    b = expItem.getBottom() - childHeight;
                    t = b - dividerHeight;
                }
                // Log.d("mobeta", "l="+l+" t="+t+" r="+r+" b="+b);

                // Have to clip to support ColorDrawable on <= Gingerbread
                canvas.save();
                canvas.clipRect(l, t, r, b);
                divider.setBounds(l, t, r, b);
                divider.draw(canvas);
                canvas.restore();
            }
        }
    }
 
Example 12
Source File: DragSortListView.java    From google-authenticator-android with Apache License 2.0 5 votes vote down vote up
private void drawDivider(int expPosition, Canvas canvas) {

        final Drawable divider = getDivider();
        final int dividerHeight = getDividerHeight();
        // Log.d("mobeta", "div="+divider+" divH="+dividerHeight);

        if (divider != null && dividerHeight != 0) {
            final ViewGroup expItem = (ViewGroup) getChildAt(expPosition
                    - getFirstVisiblePosition());
            if (expItem != null) {
                final int l = getPaddingLeft();
                final int r = getWidth() - getPaddingRight();
                final int t;
                final int b;

                final int childHeight = expItem.getChildAt(0).getHeight();

                if (expPosition > mSrcPos) {
                    t = expItem.getTop() + childHeight;
                    b = t + dividerHeight;
                } else {
                    b = expItem.getBottom() - childHeight;
                    t = b - dividerHeight;
                }
                // Log.d("mobeta", "l="+l+" t="+t+" r="+r+" b="+b);

                // Have to clip to support ColorDrawable on <= Gingerbread
                canvas.save();
                canvas.clipRect(l, t, r, b);
                divider.setBounds(l, t, r, b);
                divider.draw(canvas);
                canvas.restore();
            }
        }
    }
 
Example 13
Source File: DragSortListView.java    From chromadoze with GNU General Public License v3.0 5 votes vote down vote up
private void drawDivider(int expPosition, Canvas canvas) {

        final Drawable divider = getDivider();
        final int dividerHeight = getDividerHeight();
        // Log.d("mobeta", "div="+divider+" divH="+dividerHeight);

        if (divider != null && dividerHeight != 0) {
            final ViewGroup expItem = (ViewGroup) getChildAt(expPosition
                    - getFirstVisiblePosition());
            if (expItem != null) {
                final int l = getPaddingLeft();
                final int r = getWidth() - getPaddingRight();
                final int t;
                final int b;

                final int childHeight = expItem.getChildAt(0).getHeight();

                if (expPosition > mSrcPos) {
                    t = expItem.getTop() + childHeight;
                    b = t + dividerHeight;
                } else {
                    b = expItem.getBottom() - childHeight;
                    t = b - dividerHeight;
                }
                // Log.d("mobeta", "l="+l+" t="+t+" r="+r+" b="+b);

                // Have to clip to support ColorDrawable on <= Gingerbread
                canvas.save();
                canvas.clipRect(l, t, r, b);
                divider.setBounds(l, t, r, b);
                divider.draw(canvas);
                canvas.restore();
            }
        }
    }
 
Example 14
Source File: DragSortListView.java    From Overchan-Android with GNU General Public License v3.0 5 votes vote down vote up
private void drawDivider(int expPosition, Canvas canvas) {

        final Drawable divider = getDivider();
        final int dividerHeight = getDividerHeight();
        // Log.d("mobeta", "div="+divider+" divH="+dividerHeight);

        if (divider != null && dividerHeight != 0) {
            final ViewGroup expItem = (ViewGroup) getChildAt(expPosition
                    - getFirstVisiblePosition());
            if (expItem != null) {
                final int l = getPaddingLeft();
                final int r = getWidth() - getPaddingRight();
                final int t;
                final int b;

                final int childHeight = expItem.getChildAt(0).getHeight();

                if (expPosition > mSrcPos) {
                    t = expItem.getTop() + childHeight;
                    b = t + dividerHeight;
                } else {
                    b = expItem.getBottom() - childHeight;
                    t = b - dividerHeight;
                }
                // Log.d("mobeta", "l="+l+" t="+t+" r="+r+" b="+b);

                // Have to clip to support ColorDrawable on <= Gingerbread
                canvas.save();
                canvas.clipRect(l, t, r, b);
                divider.setBounds(l, t, r, b);
                divider.draw(canvas);
                canvas.restore();
            }
        }
    }
 
Example 15
Source File: DragSortListView.java    From android-kernel-tweaker with GNU General Public License v3.0 5 votes vote down vote up
private void drawDivider(int expPosition, Canvas canvas) {

        final Drawable divider = getDivider();
        final int dividerHeight = getDividerHeight();
        // Log.d("mobeta", "div="+divider+" divH="+dividerHeight);

        if (divider != null && dividerHeight != 0) {
            final ViewGroup expItem = (ViewGroup) getChildAt(expPosition
                    - getFirstVisiblePosition());
            if (expItem != null) {
                final int l = getPaddingLeft();
                final int r = getWidth() - getPaddingRight();
                final int t;
                final int b;

                final int childHeight = expItem.getChildAt(0).getHeight();

                if (expPosition > mSrcPos) {
                    t = expItem.getTop() + childHeight;
                    b = t + dividerHeight;
                } else {
                    b = expItem.getBottom() - childHeight;
                    t = b - dividerHeight;
                }
                // Log.d("mobeta", "l="+l+" t="+t+" r="+r+" b="+b);

                // Have to clip to support ColorDrawable on <= Gingerbread
                canvas.save();
                canvas.clipRect(l, t, r, b);
                divider.setBounds(l, t, r, b);
                divider.draw(canvas);
                canvas.restore();
            }
        }
    }
 
Example 16
Source File: DragSortListView.java    From DongWeather with Apache License 2.0 5 votes vote down vote up
private void drawDivider(int expPosition, Canvas canvas) {

        final Drawable divider = getDivider();
        final int dividerHeight = getDividerHeight();
        // Log.d("mobeta", "div="+divider+" divH="+dividerHeight);

        if (divider != null && dividerHeight != 0) {
            final ViewGroup expItem = (ViewGroup) getChildAt(expPosition
                    - getFirstVisiblePosition());
            if (expItem != null) {
                final int l = getPaddingLeft();
                final int r = getWidth() - getPaddingRight();
                final int t;
                final int b;

                final int childHeight = expItem.getChildAt(0).getHeight();

                if (expPosition > mSrcPos) {
                    t = expItem.getTop() + childHeight;
                    b = t + dividerHeight;
                } else {
                    b = expItem.getBottom() - childHeight;
                    t = b - dividerHeight;
                }
                // Log.d("mobeta", "l="+l+" t="+t+" r="+r+" b="+b);

                // Have to clip to support ColorDrawable on <= Gingerbread
                canvas.save();
                canvas.clipRect(l, t, r, b);
                divider.setBounds(l, t, r, b);
                divider.draw(canvas);
                canvas.restore();
            }
        }
    }
 
Example 17
Source File: DragSortListView.java    From mobile-manager-tool with MIT License 5 votes vote down vote up
private void drawDivider(int expPosition, Canvas canvas) {

        final Drawable divider = getDivider();
        final int dividerHeight = getDividerHeight();
        // Log.d("mobeta", "div="+divider+" divH="+dividerHeight);

        if (divider != null && dividerHeight != 0) {
            final ViewGroup expItem = (ViewGroup) getChildAt(expPosition
                    - getFirstVisiblePosition());
            if (expItem != null) {
                final int l = getPaddingLeft();
                final int r = getWidth() - getPaddingRight();
                final int t;
                final int b;

                final int childHeight = expItem.getChildAt(0).getHeight();

                if (expPosition > mSrcPos) {
                    t = expItem.getTop() + childHeight;
                    b = t + dividerHeight;
                } else {
                    b = expItem.getBottom() - childHeight;
                    t = b - dividerHeight;
                }
                // Log.d("mobeta", "l="+l+" t="+t+" r="+r+" b="+b);

                // Have to clip to support ColorDrawable on <= Gingerbread
                canvas.save();
                canvas.clipRect(l, t, r, b);
                divider.setBounds(l, t, r, b);
                divider.draw(canvas);
                canvas.restore();
            }
        }
    }
 
Example 18
Source File: FocusAnimator.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/** Scroll the layout so that the focused child is on screen. */
private void requestChildFocus() {
    ViewGroup parent = (ViewGroup) mLayout.getParent();
    if (mLayout.getParent() == null) return;

    // Scroll the parent to make the focused child visible.
    if (mFocusedChild != null) parent.requestChildFocus(mLayout, mFocusedChild);

    // {@link View#requestChildFocus} fails to account for children changing their height, so
    // the scroll value may be past the actual maximum.
    int viewportHeight = parent.getBottom() - parent.getTop();
    int scrollMax = Math.max(0, mLayout.getMeasuredHeight() - viewportHeight);
    if (parent.getScrollY() > scrollMax) parent.setScrollY(scrollMax);
}
 
Example 19
Source File: FocusAnimator.java    From delion with Apache License 2.0 5 votes vote down vote up
/** Scroll the layout so that the focused child is on screen. */
private void requestChildFocus() {
    ViewGroup parent = (ViewGroup) mLayout.getParent();
    if (mLayout.getParent() == null) return;

    // Scroll the parent to make the focused child visible.
    if (mFocusedChild != null) parent.requestChildFocus(mLayout, mFocusedChild);

    // {@link View#requestChildFocus} fails to account for children changing their height, so
    // the scroll value may be past the actual maximum.
    int viewportHeight = parent.getBottom() - parent.getTop();
    int scrollMax = Math.max(0, mLayout.getMeasuredHeight() - viewportHeight);
    if (parent.getScrollY() > scrollMax) parent.setScrollY(scrollMax);
}
 
Example 20
Source File: DragSortListView.java    From onpc with GNU General Public License v3.0 4 votes vote down vote up
private void drawDivider(int expPosition, Canvas canvas)
{

    final Drawable divider = getDivider();
    final int dividerHeight = getDividerHeight();
    // Log.d("mobeta", "div="+divider+" divH="+dividerHeight);

    if (divider != null && dividerHeight != 0)
    {
        final ViewGroup expItem = (ViewGroup) getChildAt(expPosition
                - getFirstVisiblePosition());
        if (expItem != null)
        {
            final int l = getPaddingLeft();
            final int r = getWidth() - getPaddingRight();
            final int t;
            final int b;

            final int childHeight = expItem.getChildAt(0).getHeight();

            if (expPosition > mSrcPos)
            {
                t = expItem.getTop() + childHeight;
                b = t + dividerHeight;
            }
            else
            {
                b = expItem.getBottom() - childHeight;
                t = b - dividerHeight;
            }
            // Log.d("mobeta", "l="+l+" t="+t+" r="+r+" b="+b);

            // Have to clip to support ColorDrawable on <= Gingerbread
            canvas.save();
            canvas.clipRect(l, t, r, b);
            divider.setBounds(l, t, r, b);
            divider.draw(canvas);
            canvas.restore();
        }
    }
}