mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
New way to except non-center buttons
This commit is contained in:
parent
3c7a14c82b
commit
3aaaa576d4
1 changed files with 18 additions and 4 deletions
|
@ -61,7 +61,6 @@ import com.lagradost.cloudstream3.APIHolder.apis
|
|||
import com.lagradost.cloudstream3.APIHolder.getApiDubstatusSettings
|
||||
import com.lagradost.cloudstream3.APIHolder.initAll
|
||||
import com.lagradost.cloudstream3.APIHolder.updateHasTrailers
|
||||
import com.lagradost.cloudstream3.AcraApplication.Companion.context
|
||||
import com.lagradost.cloudstream3.AcraApplication.Companion.getKey
|
||||
import com.lagradost.cloudstream3.AcraApplication.Companion.removeKey
|
||||
import com.lagradost.cloudstream3.AcraApplication.Companion.setKey
|
||||
|
@ -1185,14 +1184,29 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
}
|
||||
|
||||
if(isTrueTvSettings()) {
|
||||
// Put here any button you don't want focusing it to center the view
|
||||
val exceptionButtons = listOf(
|
||||
R.id.home_preview_play_btt,
|
||||
R.id.home_preview_info_btt,
|
||||
R.id.home_preview_hidden_next_focus,
|
||||
R.id.home_preview_hidden_prev_focus,
|
||||
R.id.result_play_movie_button,
|
||||
R.id.result_play_series_button,
|
||||
R.id.result_resume_series_button,
|
||||
R.id.result_play_trailer_button,
|
||||
R.id.result_bookmark_Button,
|
||||
R.id.result_favorite_Button,
|
||||
R.id.result_subscribe_Button,
|
||||
R.id.result_search_Button,
|
||||
R.id.result_episodes_show_button,
|
||||
)
|
||||
|
||||
newLocalBinding.root.viewTreeObserver.addOnGlobalFocusChangeListener { _, newFocus ->
|
||||
if (newFocus?.tag == context?.getString(R.string.tv_no_focus_tag)) return@addOnGlobalFocusChangeListener
|
||||
if (exceptionButtons.contains(newFocus?.id)) return@addOnGlobalFocusChangeListener
|
||||
centerView(newFocus)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ActivityMainBinding.bind(newLocalBinding.root) // this may crash
|
||||
} else {
|
||||
val newLocalBinding = ActivityMainBinding.inflate(layoutInflater, null, false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue