|
|
|
|
@ -7,6 +7,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter; |
|
|
|
|
import com.chad.library.adapter.base.BaseViewHolder; |
|
|
|
|
import com.github.tvbox.osc.R; |
|
|
|
|
import com.github.tvbox.osc.bean.VodInfo; |
|
|
|
|
import com.owen.tvrecyclerview.widget.V7GridLayoutManager; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
|
|
@ -16,8 +17,10 @@ import java.util.ArrayList; |
|
|
|
|
* @description: |
|
|
|
|
*/ |
|
|
|
|
public class SeriesAdapter extends BaseQuickAdapter<VodInfo.VodSeries, BaseViewHolder> { |
|
|
|
|
public SeriesAdapter() { |
|
|
|
|
private V7GridLayoutManager mGridLayoutManager; |
|
|
|
|
public SeriesAdapter(V7GridLayoutManager gridLayoutManager) { |
|
|
|
|
super(R.layout.item_series, new ArrayList<>()); |
|
|
|
|
this.mGridLayoutManager = gridLayoutManager; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -33,5 +36,20 @@ public class SeriesAdapter extends BaseQuickAdapter<VodInfo.VodSeries, BaseViewH |
|
|
|
|
if (getData().size() == 1 && helper.getLayoutPosition() == 0) { |
|
|
|
|
helper.itemView.setNextFocusUpId(R.id.mGridViewFlag); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int spanCount = mGridLayoutManager.getSpanCount(); |
|
|
|
|
int position = helper.getLayoutPosition(); |
|
|
|
|
|
|
|
|
|
if (position < spanCount) { |
|
|
|
|
helper.itemView.setNextFocusUpId(R.id.mSeriesSortTv); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int totalCount = getData().size(); |
|
|
|
|
int remainder = totalCount % spanCount; |
|
|
|
|
int lastRowStart = remainder == 0 ? totalCount - spanCount : totalCount - remainder; |
|
|
|
|
|
|
|
|
|
if (position >= lastRowStart) { |
|
|
|
|
helper.itemView.setNextFocusDownId(R.id.tvPlay); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |