List of usage examples for android.graphics Rect set
public void set(int left, int top, int right, int bottom)
From source file:me.lizheng.deckview.helpers.FakeShadowDrawable.java
@Override public boolean getPadding(@NonNull Rect padding) { int vOffset = (int) Math.ceil(calculateVerticalPadding(mRawMaxShadowSize, mCornerRadius, true)); int hOffset = (int) Math.ceil(calculateHorizontalPadding(mRawMaxShadowSize, mCornerRadius, true)); padding.set(hOffset, vOffset, hOffset, vOffset); return true;/*from ww w . j av a 2 s . c o m*/ }
From source file:com.marshalchen.common.uimodule.modifysys.PagerTabStrip.java
@Override void updateTextPositions(int position, float positionOffset, boolean force) { final Rect r = mTempRect; int bottom = getHeight(); int left = mCurrText.getLeft() - mTabPadding; int right = mCurrText.getRight() + mTabPadding; int top = bottom - mIndicatorHeight; r.set(left, top, right, bottom); super.updateTextPositions(position, positionOffset, force); mTabAlpha = (int) (Math.abs(positionOffset - 0.5f) * 2 * 0xFF); left = mCurrText.getLeft() - mTabPadding; right = mCurrText.getRight() + mTabPadding; r.union(left, top, right, bottom);//from ww w . j a v a 2 s.c om invalidate(r); }
From source file:com.ziv.recyclerview.gridview.vertical.DividerGridItemDecoration.java
/** * ??item???//from w w w. ja v a 2 s .c om * {@link RecyclerView.ItemDecoration#getItemOffsets(Rect, View, RecyclerView, RecyclerView.State)} * * @param outRect Rect to receive the output. * @param view The child view to decorate * @param parent RecyclerView this ItemDecoration is decorating * @param state The current state of RecyclerView. */ @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { // int spanCount = getSpanCount(parent); // int childCount = parent.getAdapter().getItemCount(); if (mOrientation == VERTICAL) { outRect.set(0, 0, 0, mDivider.getIntrinsicHeight()); } else { outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0); } }
From source file:com.hippo.recyclerview.addons.LinearDividerItemDecoration.java
@Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { if (parent.getAdapter() == null) { // Can't get view position, return empty rect outRect.set(0, 0, 0, 0); return;/*from w w w . jav a 2 s. c o m*/ } if (overlap) { // Overlap, return empty rect outRect.set(0, 0, 0, 0); return; } final int position = parent.getChildLayoutPosition(view); final int itemCount = parent.getAdapter().getItemCount(); outRect.set(0, 0, 0, 0); if (showDividerHelper != null) { if (orientation == VERTICAL) { if (position == 0 && showDividerHelper.showDivider(0)) { outRect.top = thickness; } if (showDividerHelper.showDivider(position + 1)) { outRect.bottom = thickness; } } else { if (position == 0 && showDividerHelper.showDivider(0)) { outRect.left = thickness; } if (showDividerHelper.showDivider(position + 1)) { outRect.right = thickness; } } } else { if (orientation == VERTICAL) { if (position == 0 && showFirstDivider) { outRect.top = thickness; } if ((position != itemCount - 1) || showLastDivider) { outRect.bottom = thickness; } } else { if (position == 0 && showFirstDivider) { outRect.left = thickness; } if ((position != itemCount - 1) || showLastDivider) { outRect.right = thickness; } } } }
From source file:de.vanita5.twittnuker.adapter.decorator.DividerItemDecoration.java
@Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, State state) { final int childPos = parent.getChildPosition(view); final int start = getDecorationStart(), end = getDecorationEnd(parent); if (start >= 0 && end >= 0 && childPos < start && childPos > end) { outRect.setEmpty();//from w ww .j a v a2s . com return; } if (mOrientation == VERTICAL_LIST) { outRect.set(0, 0, 0, mDivider.getIntrinsicHeight()); } else { outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0); } }
From source file:org.getlantern.firetweet.adapter.decorator.DividerItemDecoration.java
@Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, State state) { final int childPos = parent.getChildAdapterPosition(view); final int start = getDecorationStart(), end = getDecorationEnd(parent); if (start >= 0 && childPos < start || end >= 0 && childPos > end) { outRect.setEmpty();/*from ww w.ja v a 2 s .co m*/ return; } if (mOrientation == VERTICAL_LIST) { outRect.set(0, 0, 0, mDivider.getIntrinsicHeight()); } else { outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0); } }
From source file:com.github.jdsjlzx.ItemDecoration.StickyHeaderDecoration.java
/** * {@inheritDoc}/*from w ww .j a va 2 s .c o m*/ */ @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { int position = parent.getChildAdapterPosition(view); int headerHeight = 0; if (position != RecyclerView.NO_POSITION && hasHeader(position)) { View header = getHeader(parent, position).itemView; headerHeight = getHeaderHeightForLayout(header); } outRect.set(0, headerHeight, 0, 0); }
From source file:cn.bingoogolapple.androidcommon.adapter.BGADivider.java
public void getVerticalItemOffsets(Rect outRect) { outRect.set(0, mSize, 0, 0); }
From source file:com.chartiq.chartiqsample.ui.StickyHeaderDecoration.java
/** * {@inheritDoc}//from w w w . j a va 2 s.c o m */ @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { int position = parent.getChildAdapterPosition(view); int headerHeight = 0; if (position != RecyclerView.NO_POSITION && hasHeader(position) && showHeaderAboveItem(position)) { View header = getHeader(parent, position).itemView; headerHeight = header.getHeight(); } outRect.set(0, headerHeight, 0, 0); }
From source file:com.facebook.litho.LithoView.java
private void maybePerformIncrementalMountOnView() { if (!mIncrementalMountOnOffsetOrTranslationChange && !ComponentsConfiguration.isIncrementalMountOnOffsetOrTranslationChangeEnabled) { return;//from w ww.j a v a 2 s. c o m } if (!isIncrementalMountEnabled() || !(getParent() instanceof View)) { return; } int parentWidth = ((View) getParent()).getWidth(); int parentHeight = ((View) getParent()).getHeight(); final int translationX = (int) getTranslationX(); final int translationY = (int) getTranslationY(); final int top = getTop() + translationY; final int bottom = getBottom() + translationY; final int left = getLeft() + translationX; final int right = getRight() + translationX; if (left >= 0 && top >= 0 && right <= parentWidth && bottom <= parentHeight && mPreviousMountBounds.width() == getWidth() && mPreviousMountBounds.height() == getHeight()) { // View is fully visible, and has already been completely mounted. return; } final Rect rect = ComponentsPools.acquireRect(); rect.set(Math.max(0, -left), Math.max(0, -top), Math.min(right, parentWidth) - left, Math.min(bottom, parentHeight) - top); if (rect.isEmpty()) { // View is not visible at all, nothing to do. ComponentsPools.release(rect); return; } performIncrementalMount(rect); ComponentsPools.release(rect); }