mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Fix settings top bar on TV (#738)
This commit is contained in:
parent
8b73c35e43
commit
6ce9f29331
7 changed files with 22 additions and 1 deletions
|
@ -30,6 +30,7 @@ import com.lagradost.cloudstream3.syncproviders.OAuth2API
|
|||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.getPref
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setPaddingBottom
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setToolBarScrollFlags
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar
|
||||
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
||||
|
@ -248,6 +249,7 @@ class SettingsAccount : PreferenceFragmentCompat() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpToolbar(R.string.category_account)
|
||||
setPaddingBottom()
|
||||
setToolBarScrollFlags()
|
||||
}
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
|
|
|
@ -12,10 +12,12 @@ import android.widget.ImageView
|
|||
import androidx.annotation.StringRes
|
||||
import androidx.core.view.children
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import com.google.android.material.appbar.MaterialToolbar
|
||||
import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.databinding.MainSettingsBinding
|
||||
|
@ -54,7 +56,15 @@ class SettingsFragment : Fragment() {
|
|||
listView?.setPadding(0, 0, 0, 100.toPx)
|
||||
}
|
||||
}
|
||||
fun PreferenceFragmentCompat.setToolBarScrollFlags() {
|
||||
if (isTvSettings()) {
|
||||
val settingsAppbar = view?.findViewById<MaterialToolbar>(R.id.settings_toolbar)
|
||||
|
||||
settingsAppbar?.updateLayoutParams<AppBarLayout.LayoutParams> {
|
||||
scrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_NO_SCROLL
|
||||
}
|
||||
}
|
||||
}
|
||||
fun Fragment?.setUpToolbar(title: String) {
|
||||
if (this == null) return
|
||||
val settingsToolbar = view?.findViewById<MaterialToolbar>(R.id.settings_toolbar) ?: return
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.lagradost.cloudstream3.network.initClient
|
|||
import com.lagradost.cloudstream3.ui.EasterEggMonke
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.getPref
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setPaddingBottom
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setToolBarScrollFlags
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar
|
||||
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
|
||||
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showDialog
|
||||
|
@ -115,6 +116,7 @@ class SettingsGeneral : PreferenceFragmentCompat() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpToolbar(R.string.category_general)
|
||||
setPaddingBottom()
|
||||
setToolBarScrollFlags()
|
||||
}
|
||||
|
||||
data class CustomSite(
|
||||
|
@ -192,7 +194,6 @@ class SettingsGeneral : PreferenceFragmentCompat() {
|
|||
return@setOnPreferenceClickListener true
|
||||
}
|
||||
|
||||
|
||||
fun showAdd() {
|
||||
val providers = synchronized(allProviders) { allProviders.distinctBy { it.javaClass }.sortedBy { it.name } }
|
||||
activity?.showDialog(
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.lagradost.cloudstream3.mvvm.logError
|
|||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.getFolderSize
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.getPref
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setPaddingBottom
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setToolBarScrollFlags
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar
|
||||
import com.lagradost.cloudstream3.ui.subtitles.ChromecastSubtitlesFragment
|
||||
import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment
|
||||
|
@ -23,6 +24,7 @@ class SettingsPlayer : PreferenceFragmentCompat() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpToolbar(R.string.category_player)
|
||||
setPaddingBottom()
|
||||
setToolBarScrollFlags()
|
||||
}
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
hideKeyboard()
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.lagradost.cloudstream3.AcraApplication.Companion.removeKey
|
|||
import com.lagradost.cloudstream3.ui.APIRepository
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.getPref
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setPaddingBottom
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setToolBarScrollFlags
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar
|
||||
import com.lagradost.cloudstream3.utils.DataStoreHelper
|
||||
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showMultiDialog
|
||||
|
@ -25,6 +26,7 @@ class SettingsProviders : PreferenceFragmentCompat() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpToolbar(R.string.category_providers)
|
||||
setPaddingBottom()
|
||||
setToolBarScrollFlags()
|
||||
}
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.lagradost.cloudstream3.mvvm.logError
|
|||
import com.lagradost.cloudstream3.ui.search.SearchResultBuilder
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.getPref
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setPaddingBottom
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setToolBarScrollFlags
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.updateTv
|
||||
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
|
||||
|
@ -23,6 +24,7 @@ class SettingsUI : PreferenceFragmentCompat() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpToolbar(R.string.category_ui)
|
||||
setPaddingBottom()
|
||||
setToolBarScrollFlags()
|
||||
}
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.lagradost.cloudstream3.network.initClient
|
|||
import com.lagradost.cloudstream3.services.BackupWorkManager
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.getPref
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setPaddingBottom
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setToolBarScrollFlags
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar
|
||||
import com.lagradost.cloudstream3.utils.BackupUtils
|
||||
import com.lagradost.cloudstream3.utils.BackupUtils.restorePrompt
|
||||
|
@ -42,6 +43,7 @@ class SettingsUpdates : PreferenceFragmentCompat() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
setUpToolbar(R.string.category_updates)
|
||||
setPaddingBottom()
|
||||
setToolBarScrollFlags()
|
||||
}
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
|
|
Loading…
Reference in a new issue