mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Add homepage search on TV (#618)
* Add search button on homepage for TV
This commit is contained in:
parent
527a6388a9
commit
d4fff7cee6
6 changed files with 67 additions and 4 deletions
|
@ -497,6 +497,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
R.id.navigation_results_phone,
|
||||
R.id.navigation_results_tv,
|
||||
R.id.navigation_player,
|
||||
R.id.navigation_quick_search,
|
||||
).contains(destination.id)
|
||||
|
||||
binding?.navHostFragment?.apply {
|
||||
|
|
|
@ -461,6 +461,11 @@ class HomeParentItemAdapterPreview(
|
|||
}
|
||||
}
|
||||
|
||||
homePreviewSearchButton.setOnClickListener { _ ->
|
||||
// Open blank screen.
|
||||
viewModel.queryTextSubmit("")
|
||||
}
|
||||
|
||||
// This makes the hidden next buttons only available when on the info button
|
||||
// Otherwise you might be able to go to the next item without being at the info button
|
||||
homePreviewInfoBtt.setOnFocusChangeListener { _, hasFocus ->
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.lagradost.cloudstream3.ui.search.SearchAdapter
|
|||
import com.lagradost.cloudstream3.ui.search.SearchClickCallback
|
||||
import com.lagradost.cloudstream3.ui.search.SearchHelper
|
||||
import com.lagradost.cloudstream3.ui.search.SearchViewModel
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueTvSettings
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.ownShow
|
||||
import com.lagradost.cloudstream3.utils.UIHelper
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
|
||||
|
@ -269,6 +270,10 @@ class QuickSearchFragment : Fragment() {
|
|||
activity?.popCurrentPage()
|
||||
}
|
||||
|
||||
if (isTrueTvSettings()) {
|
||||
binding?.quickSearch?.requestFocus()
|
||||
}
|
||||
|
||||
arguments?.getString(AUTOSEARCH_KEY)?.let {
|
||||
binding?.quickSearch?.setQuery(it, true)
|
||||
arguments?.remove(AUTOSEARCH_KEY)
|
||||
|
|
|
@ -114,6 +114,22 @@
|
|||
android:nextFocusRight="@id/home_switch_account"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/home_preview_search_button"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:background="@drawable/player_button_tv_attr_no_bg"
|
||||
android:contentDescription="@string/search"
|
||||
android:nextFocusLeft="@id/home_change_api"
|
||||
android:nextFocusRight="@id/home_preview_switch_account"
|
||||
android:nextFocusDown="@id/home_preview_info_btt"
|
||||
android:padding="10dp"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/search_icon"
|
||||
android:tag="@string/tv_no_focus_tag"
|
||||
app:tint="@color/player_on_button_tv_attr" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/home_switch_account"
|
||||
|
||||
|
|
|
@ -45,9 +45,24 @@
|
|||
android:background="@drawable/player_button_tv_attr_no_bg"
|
||||
android:gravity="center_vertical"
|
||||
android:nextFocusLeft="@id/nav_rail_view"
|
||||
android:nextFocusRight="@id/home_preview_switch_account"
|
||||
android:nextFocusRight="@id/home_preview_search_button"
|
||||
android:nextFocusDown="@id/home_preview_play_btt" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/home_preview_search_button"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:background="@drawable/player_button_tv_attr_no_bg"
|
||||
android:contentDescription="@string/search"
|
||||
android:nextFocusLeft="@id/home_preview_change_api"
|
||||
android:nextFocusRight="@id/home_preview_switch_account"
|
||||
android:nextFocusDown="@id/home_preview_info_btt"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/search_icon"
|
||||
android:tag="@string/tv_no_focus_tag"
|
||||
app:tint="@color/player_on_button_tv_attr" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/home_preview_switch_account"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -55,7 +70,8 @@
|
|||
android:layout_gravity="end"
|
||||
android:background="@drawable/player_button_tv_attr_no_bg"
|
||||
android:contentDescription="@string/account"
|
||||
android:nextFocusLeft="@id/home_preview_change_api"
|
||||
android:nextFocusLeft="@id/home_preview_search_button"
|
||||
android:nextFocusRight="@id/home_preview_switch_account"
|
||||
android:nextFocusDown="@id/home_preview_info_btt"
|
||||
|
||||
android:padding="10dp"
|
||||
|
|
|
@ -113,7 +113,25 @@
|
|||
android:background="@drawable/player_button_tv_attr_no_bg"
|
||||
android:gravity="center_vertical"
|
||||
android:nextFocusLeft="@id/nav_rail_view"
|
||||
android:nextFocusRight="@id/home_switch_account" />
|
||||
android:nextFocusRight="@id/home_preview_search_button"
|
||||
android:nextFocusDown="@id/home_preview_play_btt" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/home_preview_search_button"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:background="@drawable/player_button_tv_attr_no_bg"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/search"
|
||||
android:focusable="true"
|
||||
android:nextFocusLeft="@id/home_change_api"
|
||||
android:nextFocusRight="@id/home_switch_account"
|
||||
android:nextFocusDown="@id/home_preview_info_btt"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/search_icon"
|
||||
android:tag="@string/tv_no_focus_tag"
|
||||
app:tint="@color/player_on_button_tv_attr" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/home_switch_account"
|
||||
|
@ -122,7 +140,9 @@
|
|||
android:layout_gravity="end"
|
||||
android:background="@drawable/player_button_tv_attr_no_bg"
|
||||
android:contentDescription="@string/account"
|
||||
android:nextFocusLeft="@id/home_change_api"
|
||||
android:nextFocusLeft="@id/home_preview_search_button"
|
||||
android:nextFocusRight="@id/home_switch_account"
|
||||
android:nextFocusDown="@id/home_change_api"
|
||||
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_outline_account_circle_24"
|
||||
|
|
Loading…
Reference in a new issue