Skip to content

Commit ddcbe27

Browse files
authored
Fixed search not accepting key input after closing player overlay (#7607)
* Fixed search not accepting key input after closing player overlay * Made comments easier to understand * More comments
1 parent ee19ea6 commit ddcbe27

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2208,12 +2208,20 @@ private void moveFocusToMainFragment(final boolean toMain) {
22082208
mainFragment.setDescendantFocusability(afterDescendants);
22092209
toolbar.setDescendantFocusability(afterDescendants);
22102210
((ViewGroup) requireView()).setDescendantFocusability(blockDescendants);
2211-
mainFragment.requestFocus();
2211+
// Only focus the mainFragment if the mainFragment (e.g. search-results)
2212+
// or the toolbar (e.g. Textfield for search) don't have focus.
2213+
// This was done to fix problems with the keyboard input, see also #7490
2214+
if (!mainFragment.hasFocus() && !toolbar.hasFocus()) {
2215+
mainFragment.requestFocus();
2216+
}
22122217
} else {
22132218
mainFragment.setDescendantFocusability(blockDescendants);
22142219
toolbar.setDescendantFocusability(blockDescendants);
22152220
((ViewGroup) requireView()).setDescendantFocusability(afterDescendants);
2216-
binding.detailThumbnailRootLayout.requestFocus();
2221+
// Only focus the player if it not already has focus
2222+
if (!binding.getRoot().hasFocus()) {
2223+
binding.detailThumbnailRootLayout.requestFocus();
2224+
}
22172225
}
22182226
}
22192227

0 commit comments

Comments
 (0)