public void setDividerHeight(int height) { this.mVerticalDividerHeight = height; this.mHorizontalDividerHeight = height; if (isDefaultItemDecoration && null != mFamiliarDefaultItemDecoration) { mFamiliarDefaultItemDecoration.setVerticalDividerDrawableHeight(mVerticalDividerHeight); mFamiliarDefaultItemDecoration.setHorizontalDividerDrawableHeight(mHorizontalDividerHeight); if (null != mWrapFamiliarRecyclerViewAdapter) { mWrapFamiliarRecyclerViewAdapter.notifyDataSetChanged(); } } }
private void addDefaultItemDecoration() { if (null != mFamiliarDefaultItemDecoration) { removeItemDecoration(mFamiliarDefaultItemDecoration); mFamiliarDefaultItemDecoration = null; } mFamiliarDefaultItemDecoration = new FamiliarDefaultItemDecoration( this, mVerticalDivider, mHorizontalDivider, mVerticalDividerHeight, mHorizontalDividerHeight); mFamiliarDefaultItemDecoration.setItemViewBothSidesMargin(mItemViewBothSidesMargin); mFamiliarDefaultItemDecoration.setHeaderDividersEnabled(isHeaderDividersEnabled); mFamiliarDefaultItemDecoration.setFooterDividersEnabled(isFooterDividersEnabled); super.addItemDecoration(mFamiliarDefaultItemDecoration); }
public void setFooterDividersEnabled(boolean isFooterDividersEnabled) { this.isFooterDividersEnabled = isFooterDividersEnabled; if (isDefaultItemDecoration && null != mFamiliarDefaultItemDecoration) { mFamiliarDefaultItemDecoration.setFooterDividersEnabled(isFooterDividersEnabled); if (null != mWrapFamiliarRecyclerViewAdapter) { mWrapFamiliarRecyclerViewAdapter.notifyDataSetChanged(); } } }
public void setDivider(Drawable dividerVertical, Drawable dividerHorizontal) { if (!isDefaultItemDecoration || (mVerticalDividerHeight <= 0 && mHorizontalDividerHeight <= 0)) return; if (this.mVerticalDivider != dividerVertical) { this.mVerticalDivider = dividerVertical; } if (this.mHorizontalDivider != dividerHorizontal) { this.mHorizontalDivider = dividerHorizontal; } if (null == mFamiliarDefaultItemDecoration) { addDefaultItemDecoration(); } else { mFamiliarDefaultItemDecoration.setVerticalDividerDrawable(mVerticalDivider); mFamiliarDefaultItemDecoration.setHorizontalDividerDrawable(mHorizontalDivider); if (null != mWrapFamiliarRecyclerViewAdapter) { mWrapFamiliarRecyclerViewAdapter.notifyDataSetChanged(); } } }