mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
fixed small tv issues
This commit is contained in:
parent
661dfc0927
commit
04ef6043b0
5 changed files with 72 additions and 41 deletions
|
@ -1,6 +1,5 @@
|
||||||
package com.lagradost.cloudstream3
|
package com.lagradost.cloudstream3
|
||||||
|
|
||||||
import android.animation.ObjectAnimator
|
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
@ -12,7 +11,12 @@ import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.*
|
import android.view.KeyEvent
|
||||||
|
import android.view.Menu
|
||||||
|
import android.view.MenuItem
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.view.WindowManager
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.activity.result.ActivityResultLauncher
|
import androidx.activity.result.ActivityResultLauncher
|
||||||
import androidx.annotation.IdRes
|
import androidx.annotation.IdRes
|
||||||
|
@ -20,8 +24,7 @@ import androidx.annotation.MainThread
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.core.animation.addListener
|
import androidx.core.view.children
|
||||||
import androidx.core.view.ViewCompat
|
|
||||||
import androidx.core.view.isGone
|
import androidx.core.view.isGone
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
|
@ -37,7 +40,10 @@ import androidx.preference.PreferenceManager
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature
|
import com.fasterxml.jackson.databind.DeserializationFeature
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper
|
import com.fasterxml.jackson.databind.ObjectMapper
|
||||||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||||
import com.google.android.gms.cast.framework.*
|
import com.google.android.gms.cast.framework.CastContext
|
||||||
|
import com.google.android.gms.cast.framework.Session
|
||||||
|
import com.google.android.gms.cast.framework.SessionManager
|
||||||
|
import com.google.android.gms.cast.framework.SessionManagerListener
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||||
import com.google.android.material.navigationrail.NavigationRailView
|
import com.google.android.material.navigationrail.NavigationRailView
|
||||||
|
@ -59,7 +65,11 @@ import com.lagradost.cloudstream3.CommonActivity.updateLocale
|
||||||
import com.lagradost.cloudstream3.databinding.ActivityMainBinding
|
import com.lagradost.cloudstream3.databinding.ActivityMainBinding
|
||||||
import com.lagradost.cloudstream3.databinding.ActivityMainTvBinding
|
import com.lagradost.cloudstream3.databinding.ActivityMainTvBinding
|
||||||
import com.lagradost.cloudstream3.databinding.BottomResultviewPreviewBinding
|
import com.lagradost.cloudstream3.databinding.BottomResultviewPreviewBinding
|
||||||
import com.lagradost.cloudstream3.mvvm.*
|
import com.lagradost.cloudstream3.mvvm.Resource
|
||||||
|
import com.lagradost.cloudstream3.mvvm.debugAssert
|
||||||
|
import com.lagradost.cloudstream3.mvvm.logError
|
||||||
|
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
|
||||||
|
import com.lagradost.cloudstream3.mvvm.observeNullable
|
||||||
import com.lagradost.cloudstream3.network.initClient
|
import com.lagradost.cloudstream3.network.initClient
|
||||||
import com.lagradost.cloudstream3.plugins.PluginManager
|
import com.lagradost.cloudstream3.plugins.PluginManager
|
||||||
import com.lagradost.cloudstream3.plugins.PluginManager.loadAllOnlinePlugins
|
import com.lagradost.cloudstream3.plugins.PluginManager.loadAllOnlinePlugins
|
||||||
|
@ -94,7 +104,7 @@ import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.updateT
|
||||||
import com.lagradost.cloudstream3.ui.settings.SettingsGeneral
|
import com.lagradost.cloudstream3.ui.settings.SettingsGeneral
|
||||||
import com.lagradost.cloudstream3.ui.setup.HAS_DONE_SETUP_KEY
|
import com.lagradost.cloudstream3.ui.setup.HAS_DONE_SETUP_KEY
|
||||||
import com.lagradost.cloudstream3.ui.setup.SetupFragmentExtensions
|
import com.lagradost.cloudstream3.ui.setup.SetupFragmentExtensions
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.ApkInstaller
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.html
|
import com.lagradost.cloudstream3.utils.AppUtils.html
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.isCastApiAvailable
|
import com.lagradost.cloudstream3.utils.AppUtils.isCastApiAvailable
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.isLtr
|
import com.lagradost.cloudstream3.utils.AppUtils.isLtr
|
||||||
|
@ -111,6 +121,8 @@ 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.setKey
|
import com.lagradost.cloudstream3.utils.DataStore.setKey
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.migrateResumeWatching
|
import com.lagradost.cloudstream3.utils.DataStoreHelper.migrateResumeWatching
|
||||||
|
import com.lagradost.cloudstream3.utils.Event
|
||||||
|
import com.lagradost.cloudstream3.utils.IOnBackPressed
|
||||||
import com.lagradost.cloudstream3.utils.InAppUpdater.Companion.runAutoUpdate
|
import com.lagradost.cloudstream3.utils.InAppUpdater.Companion.runAutoUpdate
|
||||||
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
|
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.changeStatusBarState
|
import com.lagradost.cloudstream3.utils.UIHelper.changeStatusBarState
|
||||||
|
@ -122,6 +134,8 @@ import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.navigate
|
import com.lagradost.cloudstream3.utils.UIHelper.navigate
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.requestRW
|
import com.lagradost.cloudstream3.utils.UIHelper.requestRW
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.toPx
|
import com.lagradost.cloudstream3.utils.UIHelper.toPx
|
||||||
|
import com.lagradost.cloudstream3.utils.USER_PROVIDER_API
|
||||||
|
import com.lagradost.cloudstream3.utils.USER_SELECTED_HOMEPAGE_API
|
||||||
import com.lagradost.nicehttp.Requests
|
import com.lagradost.nicehttp.Requests
|
||||||
import com.lagradost.nicehttp.ResponseParser
|
import com.lagradost.nicehttp.ResponseParser
|
||||||
import kotlinx.coroutines.sync.Mutex
|
import kotlinx.coroutines.sync.Mutex
|
||||||
|
@ -1216,6 +1230,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
|
|
||||||
navController.addOnDestinationChangedListener { _: NavController, navDestination: NavDestination, bundle: Bundle? ->
|
navController.addOnDestinationChangedListener { _: NavController, navDestination: NavDestination, bundle: Bundle? ->
|
||||||
// Intercept search and add a query
|
// Intercept search and add a query
|
||||||
|
updateNavBar(navDestination)
|
||||||
if (navDestination.matchDestination(R.id.navigation_search) && !nextSearchQuery.isNullOrBlank()) {
|
if (navDestination.matchDestination(R.id.navigation_search) && !nextSearchQuery.isNullOrBlank()) {
|
||||||
bundle?.apply {
|
bundle?.apply {
|
||||||
this.putString(SearchFragment.SEARCH_QUERY, nextSearchQuery)
|
this.putString(SearchFragment.SEARCH_QUERY, nextSearchQuery)
|
||||||
|
@ -1234,29 +1249,47 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
.setPopExitAnim(R.anim.nav_pop_exit)
|
.setPopExitAnim(R.anim.nav_pop_exit)
|
||||||
.setPopUpTo(navController.graph.startDestination, false)
|
.setPopUpTo(navController.graph.startDestination, false)
|
||||||
.build()*/
|
.build()*/
|
||||||
binding?.navView?.setupWithNavController(navController)
|
|
||||||
val navRail = findViewById<NavigationRailView?>(R.id.nav_rail_view)
|
|
||||||
navRail?.setupWithNavController(navController)
|
|
||||||
if (isTvSettings()) {
|
|
||||||
navRail?.background?.alpha = 200
|
|
||||||
} else {
|
|
||||||
navRail?.background?.alpha = 255
|
|
||||||
|
|
||||||
|
val rippleColor = ColorStateList.valueOf(getResourceColor(R.attr.colorPrimary, 0.1f))
|
||||||
|
|
||||||
|
binding?.navView?.apply {
|
||||||
|
itemRippleColor = rippleColor
|
||||||
|
itemActiveIndicatorColor = rippleColor
|
||||||
|
setupWithNavController(navController)
|
||||||
|
setOnItemSelectedListener { item ->
|
||||||
|
onNavDestinationSelected(
|
||||||
|
item,
|
||||||
|
navController
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
navRail?.setOnItemSelectedListener { item ->
|
|
||||||
onNavDestinationSelected(
|
binding?.navRailView?.apply {
|
||||||
item,
|
itemRippleColor = rippleColor
|
||||||
navController
|
itemActiveIndicatorColor = rippleColor
|
||||||
)
|
setupWithNavController(navController)
|
||||||
}
|
if (isTvSettings()) {
|
||||||
binding?.navView?.setOnItemSelectedListener { item ->
|
background?.alpha = 200
|
||||||
onNavDestinationSelected(
|
} else {
|
||||||
item,
|
background?.alpha = 255
|
||||||
navController
|
}
|
||||||
)
|
|
||||||
}
|
setOnItemSelectedListener { item ->
|
||||||
navController.addOnDestinationChangedListener { _, destination, _ ->
|
onNavDestinationSelected(
|
||||||
updateNavBar(destination)
|
item,
|
||||||
|
navController
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun noFocus(view: View) {
|
||||||
|
view.tag = view.context.getString(R.string.tv_no_focus_tag)
|
||||||
|
(view as? ViewGroup)?.let {
|
||||||
|
for (child in it.children) {
|
||||||
|
noFocus(child)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
noFocus(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
loadCache()
|
loadCache()
|
||||||
|
@ -1279,11 +1312,6 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
true
|
true
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
val rippleColor = ColorStateList.valueOf(getResourceColor(R.attr.colorPrimary, 0.1f))
|
|
||||||
binding?.navView?.itemRippleColor = rippleColor
|
|
||||||
navRail?.itemRippleColor = rippleColor
|
|
||||||
navRail?.itemActiveIndicatorColor = rippleColor
|
|
||||||
binding?.navView?.itemActiveIndicatorColor = rippleColor
|
|
||||||
|
|
||||||
if (!checkWrite()) {
|
if (!checkWrite()) {
|
||||||
requestRW()
|
requestRW()
|
||||||
|
|
|
@ -301,8 +301,8 @@ class ResultFragmentTv : Fragment() {
|
||||||
resultEpisodes
|
resultEpisodes
|
||||||
)
|
)
|
||||||
for (requestView in views) {
|
for (requestView in views) {
|
||||||
if (!requestView.isVisible) continue
|
if (!requestView.isShown) continue
|
||||||
if (requestView.requestFocus()) break
|
if (requestView.requestFocus()) break // View.FOCUS_RIGHT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -566,6 +566,7 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:descendantFocusability="afterDescendants"
|
||||||
android:id="@+id/result_season_selection"
|
android:id="@+id/result_season_selection"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -579,6 +580,7 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
tools:listitem="@layout/result_selection" />
|
tools:listitem="@layout/result_selection" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:descendantFocusability="afterDescendants"
|
||||||
android:id="@+id/result_range_selection"
|
android:id="@+id/result_range_selection"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -593,6 +595,7 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:descendantFocusability="afterDescendants"
|
||||||
android:id="@+id/result_dub_selection"
|
android:id="@+id/result_dub_selection"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -615,6 +618,7 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
android:layout_height="50dp" />-->
|
android:layout_height="50dp" />-->
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:descendantFocusability="afterDescendants"
|
||||||
android:id="@+id/result_episodes"
|
android:id="@+id/result_episodes"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -27,8 +27,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_rowWeight="1"
|
android:layout_rowWeight="1"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:background="@drawable/outline_drawable_less"
|
android:foreground="@drawable/outline_drawable_forced"
|
||||||
android:foreground="?attr/selectableItemBackgroundBorderless"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
@ -66,7 +65,7 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_rowWeight="1"
|
android:layout_rowWeight="1"
|
||||||
android:background="?attr/primaryBlackBackground"
|
android:background="?attr/primaryBlackBackground"
|
||||||
android:listSelector="@drawable/outline_drawable_less"
|
android:listSelector="@drawable/outline_drawable_forced"
|
||||||
android:nextFocusLeft="@id/sort_subtitles"
|
android:nextFocusLeft="@id/sort_subtitles"
|
||||||
android:nextFocusRight="@id/apply_btt"
|
android:nextFocusRight="@id/apply_btt"
|
||||||
android:requiresFadingEdge="vertical"
|
android:requiresFadingEdge="vertical"
|
||||||
|
@ -95,8 +94,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_rowWeight="1"
|
android:layout_rowWeight="1"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:background="@drawable/outline_drawable_less"
|
android:foreground="@drawable/outline_drawable_forced"
|
||||||
android:foreground="?attr/selectableItemBackgroundBorderless"
|
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingTop="10dp"
|
android:paddingTop="10dp"
|
||||||
android:paddingBottom="10dp">
|
android:paddingBottom="10dp">
|
||||||
|
@ -140,7 +138,7 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_rowWeight="1"
|
android:layout_rowWeight="1"
|
||||||
android:background="?attr/primaryBlackBackground"
|
android:background="?attr/primaryBlackBackground"
|
||||||
android:listSelector="@drawable/outline_drawable_less"
|
android:listSelector="@drawable/outline_drawable_forced"
|
||||||
android:nextFocusLeft="@id/sort_providers"
|
android:nextFocusLeft="@id/sort_providers"
|
||||||
android:nextFocusRight="@id/cancel_btt"
|
android:nextFocusRight="@id/cancel_btt"
|
||||||
android:requiresFadingEdge="vertical"
|
android:requiresFadingEdge="vertical"
|
||||||
|
|
|
@ -4,5 +4,6 @@
|
||||||
style="@style/CheckLabel"
|
style="@style/CheckLabel"
|
||||||
android:id="@android:id/text1"
|
android:id="@android:id/text1"
|
||||||
tools:text="hello"
|
tools:text="hello"
|
||||||
|
android:foreground="@drawable/outline_drawable_forced"
|
||||||
app:drawableStartCompat="@drawable/ic_baseline_add_24"
|
app:drawableStartCompat="@drawable/ic_baseline_add_24"
|
||||||
app:drawableTint="?attr/textColor" />
|
app:drawableTint="?attr/textColor" />
|
Loading…
Add table
Add a link
Reference in a new issue