setTitleNextFocus

pull/442/head
okjack 2 years ago
parent c944a8c80d
commit cfb4ab6ffa
  1. 10
      app/src/leanback/java/com/fongmi/android/tv/ui/fragment/HomeFragment.java

@ -2,6 +2,7 @@ package com.fongmi.android.tv.ui.fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
@ -118,6 +119,7 @@ public class HomeFragment extends BaseFragment implements VodPresenter.OnClickLi
mHistoryAdapter = new ArrayObjectAdapter(mPresenter = new HistoryPresenter(this));
homeUI = Setting.getHomeUI();
button = Setting.getHomeButtons(Button.getDefaultButtons());
if (funcRow != null) setTitleNextFocus(funcRow);
}
public void addVideo(Result result) {
@ -145,6 +147,13 @@ public class HomeFragment extends BaseFragment implements VodPresenter.OnClickLi
return new ListRow(adapter);
}
private void setTitleNextFocus(ListRow funcRow) {
if (funcRow == null) return;
Func func = (Func) funcRow.getAdapter().get(0);
int downId = getHomeActicity().mBinding.recycler.getVisibility() == View.VISIBLE ? -1 : func.getId();
getHomeActicity().mBinding.title.setNextFocusDownId(downId);
}
private void refreshFuncRow() {
if (homeUI == Setting.getHomeUI() && Setting.getHomeButtons(Button.getDefaultButtons()).equals(button)) return;
if (!TextUtils.isEmpty(button)) mAdapter.removeItems(0, 1);
@ -152,6 +161,7 @@ public class HomeFragment extends BaseFragment implements VodPresenter.OnClickLi
button = Setting.getHomeButtons(Button.getDefaultButtons());
ListRow funcRow = getFuncRow();
if (funcRow != null) mAdapter.add(0, funcRow);
if (funcRow != null) setTitleNextFocus(funcRow);
}
public void refreshRecommond() {

Loading…
Cancel
Save