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);
}
}
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);
}
}
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();
}
}
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;
}
}
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);
}
Aggregations