List of usage examples for android.graphics Rect set
public void set(int left, int top, int right, int bottom)
From source file:com.xcyo.live.helper.DividerItemDecoration.java
@Override public void getItemOffsets(Rect outRect, int itemPosition, RecyclerView parent) { if (mOrientation == VERTICAL_LIST) { if (mDividerHeight > 0) { outRect.set(0, 0, 0, mDividerHeight - mDivider.getIntrinsicHeight()); return; }/*from w ww . j a v a2 s . co m*/ outRect.set(0, 0, 0, mDivider.getIntrinsicHeight()); } else { if (mDividerHeight > 0) { outRect.set(0, 0, mDividerHeight - mDivider.getIntrinsicWidth(), 0); return; } outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0); } }
From source file:android.support.design.widget.CircularBorderDrawable.java
@Override public boolean getPadding(Rect padding) { final int borderWidth = Math.round(mBorderWidth); padding.set(borderWidth, borderWidth, borderWidth, borderWidth); return true;// w w w .j a v a 2s . co m }
From source file:android.support.v7.widget.DividerItemDecoration.java
@Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { if (mOrientation == VERTICAL) { outRect.set(0, 0, 0, mDivider.getIntrinsicHeight()); } else {//from w ww . j av a 2 s . c o m outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0); } }
From source file:com.bobomee.android.tab_navigator.recyclerview.HorizontalDividerItemDecoration.java
@Override protected void setItemOffsets(Rect outRect, int position, RecyclerView parent) { if (mPositionInsideItem) { outRect.set(0, 0, 0, 0); return;//from www. ja v a2s. com } if (isReverseLayout(parent)) { outRect.set(0, getDividerSize(position, parent), 0, 0); } else { outRect.set(0, 0, 0, getDividerSize(position, parent)); } }
From source file:com.freshdigitable.udonroad.TimelineDecoration.java
@Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { int position = ((RecyclerView.LayoutParams) view.getLayoutParams()).getViewLayoutPosition(); int top = position == 0 ? dividerHeight : 0; outRect.set(0, top, 0, 0); }
From source file:com.camnter.easyrecyclerview.widget.decorator.EasyDividerItemDecoration.java
/** * Retrieve any offsets for the given item. Each field of <code>outRect</code> specifies * the number of pixels that the item view should be inset by, similar to padding or margin. * The default implementation sets the bounds of outRect to 0 and returns. * If this ItemDecoration does not affect the positioning of item views, it should set * all four fields of <code>outRect</code> (left, top, right, bottom) to zero * before returning./*from w ww. j av a 2 s. c o m*/ * If you need to access Adapter for additional data, you can call * RecyclerView#getChildAdapterPosition(View)} to get the adapter position of the * View. * * @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) { if (this.mOrientation == VERTICAL_LIST) { outRect.set(0, 0, 0, this.mDivider.getIntrinsicHeight()); } else { outRect.set(0, 0, this.mDivider.getIntrinsicWidth(), 0); } }
From source file:io.github.hidroh.materialistic.BaseListFragment.java
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mRecyclerView.setLayoutManager(new SnappyLinearLayoutManager(getActivity(), false)); final int verticalMargin = getResources().getDimensionPixelSize(R.dimen.cardview_vertical_margin); final int horizontalMargin = getResources().getDimensionPixelSize(R.dimen.cardview_horizontal_margin); final int divider = getResources().getDimensionPixelSize(R.dimen.divider); mRecyclerView.addItemDecoration(new RecyclerView.ItemDecoration() { @Override/*from ww w . ja v a 2 s.c om*/ public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { if (getAdapter().isCardViewEnabled()) { outRect.set(horizontalMargin, verticalMargin, horizontalMargin, 0); } else { outRect.set(0, 0, 0, divider); } } }); }
From source file:me.lizheng.deckview.helpers.DeckViewConfig.java
/** * Returns the task stack bounds in the current orientation. These bounds do not account for * the system insets.//from w ww.ja v a2s .c o m */ public void getTaskStackBounds(int windowWidth, int windowHeight, int topInset, int rightInset, Rect taskStackBounds) { taskStackBounds.set(0, 0, windowWidth, windowHeight); }
From source file:com.ahamed.multiviewadapter.util.SimpleDividerDecoration.java
@Override public void getItemOffsets(Rect outRect, int position, @PositionType int positionType) { if (positionType == POSITION_LAST_ITEM) { return;//from ww w. j a va 2 s . com } if (mOrientation == VERTICAL) { outRect.set(0, 0, 0, mDivider.getIntrinsicHeight()); } else { outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0); } }
From source file:au.com.roadhouse.licensehelper.library.VerticalDividerItemDecorator.java
@Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { RecyclerView.Adapter adapter = parent.getAdapter(); if (parent.getChildAdapterPosition(view) != 0 && parent.getChildAdapterPosition(view) < adapter.getItemCount()) { outRect.set(0, 0, 0, mDividerHeight); } else {/* ww w . ja v a 2 s . c om*/ outRect.setEmpty(); } }