feat(ui): Hide Downloads & Settings Back button on TV (#1074)

This commit is contained in:
KingLucius 2024-05-04 14:17:52 +03:00 committed by GitHub
parent 83c473d9f8
commit 71bd48f493
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 33 additions and 16 deletions

View file

@ -11,6 +11,9 @@ import com.lagradost.cloudstream3.databinding.FragmentChildDownloadsBinding
import com.lagradost.cloudstream3.ui.download.DownloadButtonSetup.handleDownloadClick import com.lagradost.cloudstream3.ui.download.DownloadButtonSetup.handleDownloadClick
import com.lagradost.cloudstream3.ui.result.FOCUS_SELF import com.lagradost.cloudstream3.ui.result.FOCUS_SELF
import com.lagradost.cloudstream3.ui.result.setLinearListLayout import com.lagradost.cloudstream3.ui.result.setLinearListLayout
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
import com.lagradost.cloudstream3.utils.Coroutines.main import com.lagradost.cloudstream3.utils.Coroutines.main
import com.lagradost.cloudstream3.utils.DataStore.getKey import com.lagradost.cloudstream3.utils.DataStore.getKey
import com.lagradost.cloudstream3.utils.DataStore.getKeys import com.lagradost.cloudstream3.utils.DataStore.getKeys
@ -86,9 +89,11 @@ class DownloadChildFragment : Fragment() {
binding?.downloadChildToolbar?.apply { binding?.downloadChildToolbar?.apply {
title = name title = name
setNavigationIcon(R.drawable.ic_baseline_arrow_back_24) if (isLayout(PHONE or EMULATOR)) {
setNavigationOnClickListener { setNavigationIcon(R.drawable.ic_baseline_arrow_back_24)
activity?.onBackPressedDispatcher?.onBackPressed() setNavigationOnClickListener {
activity?.onBackPressedDispatcher?.onBackPressed()
}
} }
setAppBarNoScrollFlagsOnTV() setAppBarNoScrollFlagsOnTV()
} }

View file

@ -34,6 +34,9 @@ import com.lagradost.cloudstream3.ui.search.SearchAdapter
import com.lagradost.cloudstream3.ui.search.SearchClickCallback import com.lagradost.cloudstream3.ui.search.SearchClickCallback
import com.lagradost.cloudstream3.ui.search.SearchHelper import com.lagradost.cloudstream3.ui.search.SearchHelper
import com.lagradost.cloudstream3.ui.search.SearchViewModel import com.lagradost.cloudstream3.ui.search.SearchViewModel
import com.lagradost.cloudstream3.ui.settings.Globals
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
import com.lagradost.cloudstream3.ui.settings.Globals.TV import com.lagradost.cloudstream3.ui.settings.Globals.TV
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
import com.lagradost.cloudstream3.utils.AppUtils.ownShow import com.lagradost.cloudstream3.utils.AppUtils.ownShow
@ -274,8 +277,13 @@ class QuickSearchFragment : Fragment() {
// UIHelper.showInputMethod(view.findFocus()) // UIHelper.showInputMethod(view.findFocus())
// } // }
//} //}
binding?.quickSearchBack?.setOnClickListener { if (isLayout(PHONE or EMULATOR)) {
activity?.popCurrentPage() binding?.quickSearchBack?.apply {
isVisible = true
setOnClickListener {
activity?.popCurrentPage()
}
}
} }
if (isLayout(TV)) { if (isLayout(TV)) {

View file

@ -23,6 +23,7 @@ import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.account
import com.lagradost.cloudstream3.ui.home.HomeFragment import com.lagradost.cloudstream3.ui.home.HomeFragment
import com.lagradost.cloudstream3.ui.result.txt import com.lagradost.cloudstream3.ui.result.txt
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
import com.lagradost.cloudstream3.ui.settings.Globals.TV import com.lagradost.cloudstream3.ui.settings.Globals.TV
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
import com.lagradost.cloudstream3.utils.DataStoreHelper import com.lagradost.cloudstream3.utils.DataStoreHelper
@ -84,9 +85,11 @@ class SettingsFragment : Fragment() {
settingsToolbar.apply { settingsToolbar.apply {
setTitle(title) setTitle(title)
setNavigationIcon(R.drawable.ic_baseline_arrow_back_24) if (isLayout(PHONE or EMULATOR)) {
setNavigationOnClickListener { setNavigationIcon(R.drawable.ic_baseline_arrow_back_24)
activity?.onBackPressedDispatcher?.onBackPressed() setNavigationOnClickListener {
activity?.onBackPressedDispatcher?.onBackPressed()
}
} }
} }
UIHelper.fixPaddingStatusbar(settingsToolbar) UIHelper.fixPaddingStatusbar(settingsToolbar)
@ -98,10 +101,12 @@ class SettingsFragment : Fragment() {
settingsToolbar.apply { settingsToolbar.apply {
setTitle(title) setTitle(title)
setNavigationIcon(R.drawable.ic_baseline_arrow_back_24) if (isLayout(PHONE or EMULATOR)) {
children.firstOrNull { it is ImageView }?.tag = getString(R.string.tv_no_focus_tag) setNavigationIcon(R.drawable.ic_baseline_arrow_back_24)
setNavigationOnClickListener { children.firstOrNull { it is ImageView }?.tag = getString(R.string.tv_no_focus_tag)
activity?.onBackPressedDispatcher?.onBackPressed() setNavigationOnClickListener {
activity?.onBackPressedDispatcher?.onBackPressed()
}
} }
} }
UIHelper.fixPaddingStatusbar(settingsToolbar) UIHelper.fixPaddingStatusbar(settingsToolbar)

View file

@ -23,11 +23,10 @@
android:background="?android:attr/selectableItemBackgroundBorderless" android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_baseline_arrow_back_24" android:src="@drawable/ic_baseline_arrow_back_24"
app:tint="@android:color/white" app:tint="@android:color/white"
android:focusable="true" android:visibility="gone"
android:layout_width="25dp" android:layout_width="25dp"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
tools:visibility="visible">
<requestFocus />
</ImageView> </ImageView>
<FrameLayout <FrameLayout