|
|
|
|
@ -43,6 +43,8 @@ import com.fongmi.android.tv.ui.custom.dialog.SiteDialog; |
|
|
|
|
import com.fongmi.android.tv.utils.ResUtil; |
|
|
|
|
import com.fongmi.android.tv.utils.Utils; |
|
|
|
|
import com.github.catvod.net.OkHttp; |
|
|
|
|
import com.google.android.flexbox.FlexDirection; |
|
|
|
|
import com.google.android.flexbox.FlexboxLayoutManager; |
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
@ -127,8 +129,10 @@ public class CollectActivity extends BaseActivity implements CustomScroller.Call |
|
|
|
|
mBinding.recycler.setAdapter(mSearchAdapter = new SearchAdapter(this)); |
|
|
|
|
mBinding.wordRecycler.setHasFixedSize(true); |
|
|
|
|
mBinding.wordRecycler.setAdapter(mWordAdapter = new WordAdapter(this)); |
|
|
|
|
mBinding.wordRecycler.setLayoutManager(new FlexboxLayoutManager(this, FlexDirection.ROW)); |
|
|
|
|
mBinding.recordRecycler.setHasFixedSize(true); |
|
|
|
|
mBinding.recordRecycler.setAdapter(mRecordAdapter = new RecordAdapter(this)); |
|
|
|
|
mBinding.recordRecycler.setLayoutManager(new FlexboxLayoutManager(this, FlexDirection.ROW)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setViewType() { |
|
|
|
|
@ -136,9 +140,10 @@ public class CollectActivity extends BaseActivity implements CustomScroller.Call |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setViewType(int viewType) { |
|
|
|
|
int count = Product.isPad() ? 5 : 2; |
|
|
|
|
mSearchAdapter.setViewType(viewType); |
|
|
|
|
mSearchAdapter.setSize(Product.getSpec(this, ResUtil.dp2px(64), 3)); |
|
|
|
|
((GridLayoutManager) mBinding.recycler.getLayoutManager()).setSpanCount(mSearchAdapter.isGrid() ? 2 : 1); |
|
|
|
|
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); |
|
|
|
|
|