Search in sources :

Example 56 with LEFT

use of android.support.v7.widget.helper.ItemTouchHelper.LEFT in project LearnApp by YouCii.

the class RecyclerItemDecoration method drawHorizontal.

public void drawHorizontal(Canvas c, RecyclerView parent) {
    final int top = parent.getPaddingTop();
    final int bottom = parent.getHeight() - parent.getPaddingBottom();
    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
        final int left = child.getRight() + params.rightMargin;
        final int right = left + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 57 with LEFT

use of android.support.v7.widget.helper.ItemTouchHelper.LEFT in project LearnApp by YouCii.

the class RecyclerItemDecoration method drawVertical.

public void drawVertical(Canvas c, RecyclerView parent) {
    final int left = parent.getPaddingLeft();
    final int right = parent.getWidth() - parent.getPaddingRight();
    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        android.support.v7.widget.RecyclerView v = new android.support.v7.widget.RecyclerView(parent.getContext());
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
        final int top = child.getBottom() + params.bottomMargin;
        final int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 58 with LEFT

use of android.support.v7.widget.helper.ItemTouchHelper.LEFT in project android_packages_apps_DU-Tweaks by DirtyUnicorns.

the class BottomNavigationMenuCustom method onLayout.

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    final int count = getChildCount();
    final int width = right - left;
    final int height = bottom - top;
    int used = 0;
    for (int i = 0; i < count; i++) {
        final View child = getChildAt(i);
        if (child.getVisibility() == GONE) {
            continue;
        }
        if (ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_RTL) {
            child.layout(width - used - child.getMeasuredWidth(), 0, width - used, height);
        } else {
            child.layout(used, 0, child.getMeasuredWidth() + used, height);
        }
        used += child.getMeasuredWidth();
    }
}
Also used : MenuView(android.support.v7.view.menu.MenuView) View(android.view.View)

Example 59 with LEFT

use of android.support.v7.widget.helper.ItemTouchHelper.LEFT in project vlc-android by GeoffreyMetais.

the class VideoPlayerActivity method surfaceFrameAddLayoutListener.

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void surfaceFrameAddLayoutListener(boolean add) {
    if (mSurfaceFrame == null || add == (mOnLayoutChangeListener != null))
        return;
    if (add) {
        mOnLayoutChangeListener = new View.OnLayoutChangeListener() {

            private final Runnable mRunnable = new Runnable() {

                @Override
                public void run() {
                    changeSurfaceLayout();
                }
            };

            @Override
            public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
                if (left != oldLeft || top != oldTop || right != oldRight || bottom != oldBottom) {
                    /* changeSurfaceLayout need to be called after the layout changed */
                    mHandler.removeCallbacks(mRunnable);
                    mHandler.post(mRunnable);
                }
            }
        };
        mSurfaceFrame.addOnLayoutChangeListener(mOnLayoutChangeListener);
        changeSurfaceLayout();
    } else {
        mSurfaceFrame.removeOnLayoutChangeListener(mOnLayoutChangeListener);
        mOnLayoutChangeListener = null;
    }
}
Also used : ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) SurfaceView(android.view.SurfaceView) View(android.view.View) TextView(android.widget.TextView) OnLayoutChangeListener(android.view.View.OnLayoutChangeListener) SuppressLint(android.annotation.SuppressLint) TargetApi(android.annotation.TargetApi)

Example 60 with LEFT

use of android.support.v7.widget.helper.ItemTouchHelper.LEFT in project android-advancedrecyclerview by h6ah4i.

the class ItemSlidingAnimator method slideToOutsideOfWindowInternal.

private boolean slideToOutsideOfWindowInternal(RecyclerView.ViewHolder holder, int dir, boolean shouldAnimate, long duration, SwipeFinishInfo swipeFinish) {
    if (!(holder instanceof SwipeableItemViewHolder)) {
        return false;
    }
    final View containerView = SwipeableViewHolderUtils.getSwipeableContainerView(holder);
    final ViewGroup parent = (ViewGroup) containerView.getParent();
    if (parent == null) {
        return false;
    }
    final int left = containerView.getLeft();
    final int right = containerView.getRight();
    final int top = containerView.getTop();
    final int bottom = containerView.getBottom();
    final int width = right - left;
    final int height = bottom - top;
    parent.getWindowVisibleDisplayFrame(mTmpRect);
    final int windowWidth = mTmpRect.width();
    final int windowHeight = mTmpRect.height();
    int translateX = 0;
    int translateY = 0;
    if ((width == 0) || (height == 0)) {
        // not measured yet or not shown
        switch(dir) {
            case DIR_LEFT:
                translateX = -windowWidth;
                break;
            case DIR_UP:
                translateY = -windowHeight;
                break;
            case DIR_RIGHT:
                translateX = windowWidth;
                break;
            case DIR_DOWN:
                translateY = windowHeight;
                break;
            default:
                break;
        }
        shouldAnimate = false;
    } else {
        parent.getLocationInWindow(mTmpLocation);
        final int x = mTmpLocation[0];
        final int y = mTmpLocation[1];
        switch(dir) {
            case DIR_LEFT:
                translateX = -(x + width);
                break;
            case DIR_UP:
                translateY = -(y + height);
                break;
            case DIR_RIGHT:
                translateX = windowWidth - (x - left);
                break;
            case DIR_DOWN:
                translateY = windowHeight - (y - top);
                break;
            default:
                break;
        }
    }
    if (shouldAnimate) {
        shouldAnimate = ViewCompat.isAttachedToWindow(containerView) && (containerView.getVisibility() == View.VISIBLE);
    }
    duration = (shouldAnimate) ? duration : 0;
    boolean horizontal = (dir == DIR_LEFT || dir == DIR_RIGHT);
    return animateSlideInternalCompat(holder, horizontal, translateX, translateY, duration, mSlideToOutsideOfWindowAnimationInterpolator, swipeFinish);
}
Also used : ViewGroup(android.view.ViewGroup) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Aggregations

View (android.view.View)291 RecyclerView (android.support.v7.widget.RecyclerView)276 Paint (android.graphics.Paint)43 TextView (android.widget.TextView)36 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)22 ImageView (android.widget.ImageView)20 Rect (android.graphics.Rect)11 Intent (android.content.Intent)9 SuppressLint (android.annotation.SuppressLint)8 OnLayoutChangeListener (android.view.View.OnLayoutChangeListener)8 OrientationHelperEx (com.alibaba.android.vlayout.OrientationHelperEx)8 ArrayList (java.util.ArrayList)8 AlertDialog (android.support.v7.app.AlertDialog)7 Toolbar (android.support.v7.widget.Toolbar)7 ViewGroup (android.view.ViewGroup)7 GridLayoutManager (android.support.v7.widget.GridLayoutManager)6 Button (android.widget.Button)6 Animator (android.animation.Animator)5 TargetApi (android.annotation.TargetApi)5 Activity (android.app.Activity)5