Skip to content

Commit

Permalink
Optimize TV mode focus switching
Browse files Browse the repository at this point in the history
  • Loading branch information
xfangfang committed Jul 8, 2024
1 parent c470df3 commit b5502a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions resources/xml/activity/search_activity_tv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
width="400">
<brls:Box
focusable="true"
focusDown="tv/search/search"
alignItems="center"
marginLeft="10"
width="310">
Expand Down
4 changes: 4 additions & 0 deletions wiliwili/source/activity/search_activity_tv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ void TVSearchActivity::onContentAvailable() {
this->updateInputLabel();
},
"wiliwili/search/tv/hint"_i18n, "", 32, getCurrentSearch(), 0);
inputLabel->getParent()->setCustomNavigationRoute(brls::FocusDirection::DOWN, searchLabel);
return true;
});
inputLabel->getParent()->addGestureRecognizer(new brls::TapGestureRecognizer(this->inputLabel->getParent()));
Expand All @@ -183,6 +184,7 @@ void TVSearchActivity::onContentAvailable() {
clearLabel->registerClickAction([this](...) {
this->currentSearch.clear();
this->updateInputLabel();
inputLabel->getParent()->setCustomNavigationRoute(brls::FocusDirection::DOWN, clearLabel);
return true;
});
clearLabel->addGestureRecognizer(new brls::TapGestureRecognizer(clearLabel));
Expand All @@ -193,12 +195,14 @@ void TVSearchActivity::onContentAvailable() {
}
currentSearch.erase(currentSearch.size() - 1, 1);
this->updateInputLabel();
inputLabel->getParent()->setCustomNavigationRoute(brls::FocusDirection::DOWN, deleteLabel);
return true;
});
deleteLabel->addGestureRecognizer(new brls::TapGestureRecognizer(deleteLabel));

searchLabel->registerClickAction([this](...) {
this->search(getCurrentSearch());
inputLabel->getParent()->setCustomNavigationRoute(brls::FocusDirection::DOWN, searchLabel);
return true;
});
searchLabel->addGestureRecognizer(new brls::TapGestureRecognizer(searchLabel));
Expand Down

0 comments on commit b5502a8

Please sign in to comment.