|
|
|
|
@ -140,10 +140,10 @@ public class CollectActivity extends BaseActivity implements CustomScroller.Call |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setViewType(int viewType) { |
|
|
|
|
int count = Product.getColumn(); |
|
|
|
|
mSearchAdapter.setViewType(viewType); |
|
|
|
|
mSearchAdapter.setSize(Product.getSpec(this, ResUtil.dp2px((count + 1) * 16), count)); |
|
|
|
|
((GridLayoutManager) mBinding.recycler.getLayoutManager()).setSpanCount(mSearchAdapter.isGrid() ? count - 1 : 1); |
|
|
|
|
int count = Product.getColumn() - 1; |
|
|
|
|
mSearchAdapter.setViewType(viewType, count); |
|
|
|
|
mSearchAdapter.setSize(Product.getSpec(this, ResUtil.dp2px((count + 2) * 16), count + 1)); |
|
|
|
|
((GridLayoutManager) mBinding.recycler.getLayoutManager()).setSpanCount(mSearchAdapter.isGrid() ? count : 1); |
|
|
|
|
mBinding.view.setImageResource(mSearchAdapter.isGrid() ? R.drawable.ic_action_list : R.drawable.ic_action_grid); |
|
|
|
|
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mBinding.collect.getLayoutParams(); |
|
|
|
|
params.width = mSearchAdapter.getWidth() + ResUtil.dp2px(24); |
|
|
|
|
|