@Test public void testSetGutterStart() { setUpPagedListView(ITEMS_PER_PAGE * 10); mPagedListView.setGutter(PagedListView.Gutter.START); Resources res = InstrumentationRegistry.getContext().getResources(); int gutterSize = res.getDimensionPixelSize(R.dimen.car_margin); assertThat(mRecyclerViewLayoutParams.getMarginStart(), is(equalTo(gutterSize))); assertThat(mRecyclerViewLayoutParams.getMarginEnd(), is(equalTo(0))); }
public void setGutter(@Gutter int gutter) { mGutter = gutter; int startMargin = 0; int endMargin = 0; if ((mGutter & Gutter.START) != 0) { startMargin = mGutterSize; } if ((mGutter & Gutter.END) != 0) { endMargin = mGutterSize; } MarginLayoutParams layoutParams = (MarginLayoutParams) mRecyclerView.getLayoutParams(); layoutParams.setMarginStart(startMargin); layoutParams.setMarginEnd(endMargin); mRecyclerView.setLayoutParams(layoutParams); mRecyclerView.setClipToPadding(startMargin == 0 && endMargin == 0); }
PagedListView extends FrameLayout { public void setGutter(@Gutter int gutter) { mGutter = gutter; int startMargin = 0; int endMargin = 0; if ((mGutter & Gutter.START) != 0) { startMargin = mGutterSize; } if ((mGutter & Gutter.END) != 0) { endMargin = mGutterSize; } MarginLayoutParams layoutParams = (MarginLayoutParams) mRecyclerView.getLayoutParams(); layoutParams.setMarginStart(startMargin); layoutParams.setMarginEnd(endMargin); mRecyclerView.setLayoutParams(layoutParams); mRecyclerView.setClipToPadding(startMargin == 0 && endMargin == 0); } }
PagedListView extends FrameLayout { public void setGutter(@Gutter int gutter) { mGutter = gutter; int startMargin = 0; int endMargin = 0; if ((mGutter & Gutter.START) != 0) { startMargin = mGutterSize; } if ((mGutter & Gutter.END) != 0) { endMargin = mGutterSize; } MarginLayoutParams layoutParams = (MarginLayoutParams) mRecyclerView.getLayoutParams(); layoutParams.setMarginStart(startMargin); layoutParams.setMarginEnd(endMargin); mRecyclerView.setLayoutParams(layoutParams); mRecyclerView.setClipToPadding(startMargin == 0 && endMargin == 0); } PagedListView(Context context);  PagedListView(Context context, AttributeSet attrs);  PagedListView(Context context, AttributeSet attrs, int defStyleAttrs);  PagedListView(Context context, AttributeSet attrs, int defStyleAttrs, int defStyleRes); }
PagedListView extends FrameLayout { public void setGutter(@Gutter int gutter) { mGutter = gutter; int startMargin = 0; int endMargin = 0; if ((mGutter & Gutter.START) != 0) { startMargin = mGutterSize; } if ((mGutter & Gutter.END) != 0) { endMargin = mGutterSize; } MarginLayoutParams layoutParams = (MarginLayoutParams) mRecyclerView.getLayoutParams(); layoutParams.setMarginStart(startMargin); layoutParams.setMarginEnd(endMargin); mRecyclerView.setLayoutParams(layoutParams); mRecyclerView.setClipToPadding(startMargin == 0 && endMargin == 0); } PagedListView(Context context);  PagedListView(Context context, AttributeSet attrs);  PagedListView(Context context, AttributeSet attrs, int defStyleAttrs);  PagedListView(Context context, AttributeSet attrs, int defStyleAttrs, int defStyleRes); int positionOf(@Nullable View v); void setGutter(@Gutter int gutter); void setGutterSize(int gutterSize); void setScrollBarContainerWidth(int width); void setScrollBarTopMargin(int topMargin); void setListContentTopOffset(int offset); @NonNull RecyclerView getRecyclerView(); void scrollToPosition(int position); void snapToPosition(int position); void setUpButtonIcon(Drawable icon); void setDownButtonIcon(Drawable icon); void setAdapter(
            @NonNull RecyclerView.Adapter<? extends RecyclerView.ViewHolder> adapter); void setDividerVisibilityManager(DividerVisibilityManager dvm); @Nullable @SuppressWarnings("unchecked") RecyclerView.Adapter<? extends RecyclerView.ViewHolder> getAdapter(); void setMaxPages(int maxPages); int getMaxPages(); int getRowsPerPage(); void resetMaxPages(); void addItemDecoration(@NonNull RecyclerView.ItemDecoration decor); void removeItemDecoration(@NonNull RecyclerView.ItemDecoration decor); void setItemSpacing(int itemSpacing); void setScrollbarColor(@ColorRes int color); void resetScrollbarColor(); void addOnItemTouchListener(@NonNull RecyclerView.OnItemTouchListener touchListener); void removeOnItemTouchListener(@NonNull RecyclerView.OnItemTouchListener touchListener); void setDayNightStyle(@DayNightStyle int dayNightStyle); void setOnScrollListener(OnScrollListener listener); int getPage(int position); void pageUp(); void pageDown(); void setDefaultMaxPages(int newDefault); @Override void onLayout(boolean changed, int left, int top, int right, int bottom); boolean isAtStart(); boolean isAtEnd(); @Override Parcelable onSaveInstanceState(); @Override void onRestoreInstanceState(Parcelable state); }
PagedListView extends FrameLayout { public void setGutter(@Gutter int gutter) { mGutter = gutter; int startMargin = 0; int endMargin = 0; if ((mGutter & Gutter.START) != 0) { startMargin = mGutterSize; } if ((mGutter & Gutter.END) != 0) { endMargin = mGutterSize; } MarginLayoutParams layoutParams = (MarginLayoutParams) mRecyclerView.getLayoutParams(); layoutParams.setMarginStart(startMargin); layoutParams.setMarginEnd(endMargin); mRecyclerView.setLayoutParams(layoutParams); mRecyclerView.setClipToPadding(startMargin == 0 && endMargin == 0); } PagedListView(Context context);  PagedListView(Context context, AttributeSet attrs);  PagedListView(Context context, AttributeSet attrs, int defStyleAttrs);  PagedListView(Context context, AttributeSet attrs, int defStyleAttrs, int defStyleRes); int positionOf(@Nullable View v); void setGutter(@Gutter int gutter); void setGutterSize(int gutterSize); void setScrollBarContainerWidth(int width); void setScrollBarTopMargin(int topMargin); void setListContentTopOffset(int offset); @NonNull RecyclerView getRecyclerView(); void scrollToPosition(int position); void snapToPosition(int position); void setUpButtonIcon(Drawable icon); void setDownButtonIcon(Drawable icon); void setAdapter(
            @NonNull RecyclerView.Adapter<? extends RecyclerView.ViewHolder> adapter); void setDividerVisibilityManager(DividerVisibilityManager dvm); @Nullable @SuppressWarnings("unchecked") RecyclerView.Adapter<? extends RecyclerView.ViewHolder> getAdapter(); void setMaxPages(int maxPages); int getMaxPages(); int getRowsPerPage(); void resetMaxPages(); void addItemDecoration(@NonNull RecyclerView.ItemDecoration decor); void removeItemDecoration(@NonNull RecyclerView.ItemDecoration decor); void setItemSpacing(int itemSpacing); void setScrollbarColor(@ColorRes int color); void resetScrollbarColor(); void addOnItemTouchListener(@NonNull RecyclerView.OnItemTouchListener touchListener); void removeOnItemTouchListener(@NonNull RecyclerView.OnItemTouchListener touchListener); void setDayNightStyle(@DayNightStyle int dayNightStyle); void setOnScrollListener(OnScrollListener listener); int getPage(int position); void pageUp(); void pageDown(); void setDefaultMaxPages(int newDefault); @Override void onLayout(boolean changed, int left, int top, int right, int bottom); boolean isAtStart(); boolean isAtEnd(); @Override Parcelable onSaveInstanceState(); @Override void onRestoreInstanceState(Parcelable state); static final int DEFAULT_MAX_CLICKS; static final int UNLIMITED_PAGES; }