|
|
|
|
@ -15,6 +15,7 @@ import androidx.leanback.widget.ListRow; |
|
|
|
|
import androidx.lifecycle.ViewModelProvider; |
|
|
|
|
import androidx.viewbinding.ViewBinding; |
|
|
|
|
|
|
|
|
|
import com.fongmi.android.tv.Product; |
|
|
|
|
import com.fongmi.android.tv.R; |
|
|
|
|
import com.fongmi.android.tv.bean.Filter; |
|
|
|
|
import com.fongmi.android.tv.bean.Vod; |
|
|
|
|
@ -28,7 +29,6 @@ import com.fongmi.android.tv.ui.custom.CustomScroller; |
|
|
|
|
import com.fongmi.android.tv.ui.custom.CustomSelector; |
|
|
|
|
import com.fongmi.android.tv.ui.presenter.FilterPresenter; |
|
|
|
|
import com.fongmi.android.tv.ui.presenter.VodPresenter; |
|
|
|
|
import com.fongmi.android.tv.utils.Prefers; |
|
|
|
|
import com.fongmi.android.tv.utils.ResUtil; |
|
|
|
|
import com.google.common.collect.Lists; |
|
|
|
|
|
|
|
|
|
@ -142,7 +142,7 @@ public class VodFragment extends BaseFragment implements CustomScroller.Callback |
|
|
|
|
|
|
|
|
|
private boolean checkLastSize(List<Vod> items) { |
|
|
|
|
if (mLast == null || items.size() == 0) return false; |
|
|
|
|
int size = Prefers.getColumn() - mLast.size(); |
|
|
|
|
int size = Product.getColumn() - mLast.size(); |
|
|
|
|
if (size == 0) return false; |
|
|
|
|
size = Math.min(size, items.size()); |
|
|
|
|
mLast.addAll(mLast.size(), new ArrayList<>(items.subList(0, size))); |
|
|
|
|
@ -153,7 +153,7 @@ public class VodFragment extends BaseFragment implements CustomScroller.Callback |
|
|
|
|
private void addVideo(List<Vod> items) { |
|
|
|
|
if (checkLastSize(items)) return; |
|
|
|
|
List<ListRow> rows = new ArrayList<>(); |
|
|
|
|
for (List<Vod> part : Lists.partition(items, Prefers.getColumn())) { |
|
|
|
|
for (List<Vod> part : Lists.partition(items, Product.getColumn())) { |
|
|
|
|
mLast = new ArrayObjectAdapter(new VodPresenter(this)); |
|
|
|
|
mLast.setItems(part, null); |
|
|
|
|
rows.add(new ListRow(mLast)); |
|
|
|
|
@ -192,10 +192,12 @@ public class VodFragment extends BaseFragment implements CustomScroller.Callback |
|
|
|
|
getVideo(typeId, "1"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public boolean canBack() { |
|
|
|
|
if (mTypeIds.size() == 0) return true; |
|
|
|
|
public boolean canGoBack() { |
|
|
|
|
return mTypeIds.size() > 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void goBack() { |
|
|
|
|
refresh(2); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|