From cfb4ab6ffa8da248f420870afe90c2938316796e Mon Sep 17 00:00:00 2001 From: okjack Date: Fri, 17 May 2024 09:37:21 +0800 Subject: [PATCH] setTitleNextFocus --- .../fongmi/android/tv/ui/fragment/HomeFragment.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/leanback/java/com/fongmi/android/tv/ui/fragment/HomeFragment.java b/app/src/leanback/java/com/fongmi/android/tv/ui/fragment/HomeFragment.java index 325c0e6fc..20c78db37 100644 --- a/app/src/leanback/java/com/fongmi/android/tv/ui/fragment/HomeFragment.java +++ b/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() {