mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
GeneratorPlayer -> viewbinding, AbstractPlayerFragment -> findViewById,
parity between player_custom_layout_tv, player_custom_layout and fragment_player, fragment_player_tv
This commit is contained in:
parent
f30506a394
commit
4f28aef8f2
7 changed files with 441 additions and 149 deletions
|
@ -9,13 +9,15 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
import androidx.viewbinding.ViewBinding
|
import androidx.viewbinding.ViewBinding
|
||||||
import com.lagradost.cloudstream3.databinding.FragmentHomeBinding
|
import com.lagradost.cloudstream3.databinding.FragmentHomeBinding
|
||||||
import com.lagradost.cloudstream3.databinding.FragmentHomeTvBinding
|
import com.lagradost.cloudstream3.databinding.FragmentHomeTvBinding
|
||||||
|
import com.lagradost.cloudstream3.databinding.FragmentPlayerBinding
|
||||||
|
import com.lagradost.cloudstream3.databinding.FragmentPlayerTvBinding
|
||||||
import com.lagradost.cloudstream3.databinding.FragmentSearchBinding
|
import com.lagradost.cloudstream3.databinding.FragmentSearchBinding
|
||||||
import com.lagradost.cloudstream3.databinding.FragmentSearchTvBinding
|
import com.lagradost.cloudstream3.databinding.FragmentSearchTvBinding
|
||||||
import com.lagradost.cloudstream3.databinding.HomeResultGridBinding
|
import com.lagradost.cloudstream3.databinding.HomeResultGridBinding
|
||||||
import com.lagradost.cloudstream3.databinding.HomeScrollViewBinding
|
|
||||||
import com.lagradost.cloudstream3.databinding.HomeScrollViewTvBinding
|
|
||||||
import com.lagradost.cloudstream3.databinding.HomepageParentBinding
|
import com.lagradost.cloudstream3.databinding.HomepageParentBinding
|
||||||
import com.lagradost.cloudstream3.databinding.HomepageParentTvBinding
|
import com.lagradost.cloudstream3.databinding.HomepageParentTvBinding
|
||||||
|
import com.lagradost.cloudstream3.databinding.PlayerCustomLayoutBinding
|
||||||
|
import com.lagradost.cloudstream3.databinding.PlayerCustomLayoutTvBinding
|
||||||
import com.lagradost.cloudstream3.databinding.RepositoryItemBinding
|
import com.lagradost.cloudstream3.databinding.RepositoryItemBinding
|
||||||
import com.lagradost.cloudstream3.databinding.RepositoryItemTvBinding
|
import com.lagradost.cloudstream3.databinding.RepositoryItemTvBinding
|
||||||
import com.lagradost.cloudstream3.databinding.SearchResultGridBinding
|
import com.lagradost.cloudstream3.databinding.SearchResultGridBinding
|
||||||
|
@ -80,6 +82,15 @@ class ExampleInstrumentedTest {
|
||||||
// testAllLayouts<ActivityMainBinding>(activity,R.layout.activity_main, R.layout.activity_main_tv)
|
// testAllLayouts<ActivityMainBinding>(activity,R.layout.activity_main, R.layout.activity_main_tv)
|
||||||
//testAllLayouts<ActivityMainBinding>(activity, R.layout.activity_main_tv)
|
//testAllLayouts<ActivityMainBinding>(activity, R.layout.activity_main_tv)
|
||||||
|
|
||||||
|
testAllLayouts<FragmentPlayerBinding>(activity, R.layout.fragment_player,R.layout.fragment_player_tv)
|
||||||
|
testAllLayouts<FragmentPlayerTvBinding>(activity, R.layout.fragment_player,R.layout.fragment_player_tv)
|
||||||
|
|
||||||
|
testAllLayouts<PlayerCustomLayoutBinding>(activity, R.layout.player_custom_layout,R.layout.player_custom_layout_tv)
|
||||||
|
testAllLayouts<PlayerCustomLayoutTvBinding>(activity, R.layout.player_custom_layout,R.layout.player_custom_layout_tv)
|
||||||
|
|
||||||
|
testAllLayouts<RepositoryItemBinding>(activity, R.layout.repository_item_tv, R.layout.repository_item)
|
||||||
|
testAllLayouts<RepositoryItemTvBinding>(activity, R.layout.repository_item_tv, R.layout.repository_item)
|
||||||
|
|
||||||
testAllLayouts<RepositoryItemBinding>(activity, R.layout.repository_item_tv, R.layout.repository_item)
|
testAllLayouts<RepositoryItemBinding>(activity, R.layout.repository_item_tv, R.layout.repository_item)
|
||||||
testAllLayouts<RepositoryItemTvBinding>(activity, R.layout.repository_item_tv, R.layout.repository_item)
|
testAllLayouts<RepositoryItemTvBinding>(activity, R.layout.repository_item_tv, R.layout.repository_item)
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,9 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
|
import android.widget.FrameLayout
|
||||||
|
import android.widget.ImageView
|
||||||
|
import android.widget.ProgressBar
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.annotation.LayoutRes
|
import androidx.annotation.LayoutRes
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
|
@ -24,6 +27,7 @@ import com.google.android.exoplayer2.ExoPlayer
|
||||||
import com.google.android.exoplayer2.PlaybackException
|
import com.google.android.exoplayer2.PlaybackException
|
||||||
import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector
|
import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector
|
||||||
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout
|
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout
|
||||||
|
import com.google.android.exoplayer2.ui.PlayerView
|
||||||
import com.google.android.exoplayer2.ui.SubtitleView
|
import com.google.android.exoplayer2.ui.SubtitleView
|
||||||
import com.lagradost.cloudstream3.AcraApplication.Companion.getKey
|
import com.lagradost.cloudstream3.AcraApplication.Companion.getKey
|
||||||
import com.lagradost.cloudstream3.AcraApplication.Companion.setKey
|
import com.lagradost.cloudstream3.AcraApplication.Companion.setKey
|
||||||
|
@ -42,8 +46,6 @@ import com.lagradost.cloudstream3.utils.EpisodeSkip
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper
|
import com.lagradost.cloudstream3.utils.UIHelper
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.hideSystemUI
|
import com.lagradost.cloudstream3.utils.UIHelper.hideSystemUI
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.popCurrentPage
|
import com.lagradost.cloudstream3.utils.UIHelper.popCurrentPage
|
||||||
import kotlinx.android.synthetic.main.fragment_player.*
|
|
||||||
import kotlinx.android.synthetic.main.player_custom_layout.*
|
|
||||||
|
|
||||||
enum class PlayerResize(@StringRes val nameRes: Int) {
|
enum class PlayerResize(@StringRes val nameRes: Int) {
|
||||||
Fit(R.string.resize_fit),
|
Fit(R.string.resize_fit),
|
||||||
|
@ -72,6 +74,12 @@ abstract class AbstractPlayerFragment(
|
||||||
var isBuffering = true
|
var isBuffering = true
|
||||||
protected open var hasPipModeSupport = true
|
protected open var hasPipModeSupport = true
|
||||||
|
|
||||||
|
lateinit var playerPausePlayHolderHolder : FrameLayout
|
||||||
|
lateinit var playerPausePlay : ImageView
|
||||||
|
lateinit var playerBuffering : ProgressBar
|
||||||
|
var playerView : PlayerView? = null
|
||||||
|
var piphide : FrameLayout? = null
|
||||||
|
var subtitleHolder : FrameLayout? = null
|
||||||
|
|
||||||
@LayoutRes
|
@LayoutRes
|
||||||
protected var layout: Int = R.layout.fragment_player
|
protected var layout: Int = R.layout.fragment_player
|
||||||
|
@ -133,15 +141,15 @@ abstract class AbstractPlayerFragment(
|
||||||
|
|
||||||
isBuffering = CSPlayerLoading.IsBuffering == isPlaying
|
isBuffering = CSPlayerLoading.IsBuffering == isPlaying
|
||||||
if (isBuffering) {
|
if (isBuffering) {
|
||||||
player_pause_play_holder_holder?.isVisible = false
|
playerPausePlayHolderHolder.isVisible = false
|
||||||
player_buffering?.isVisible = true
|
playerBuffering.isVisible = true
|
||||||
} else {
|
} else {
|
||||||
player_pause_play_holder_holder?.isVisible = true
|
playerPausePlayHolderHolder.isVisible = true
|
||||||
player_buffering?.isVisible = false
|
playerBuffering.isVisible = false
|
||||||
|
|
||||||
if (wasPlaying != isPlaying) {
|
if (wasPlaying != isPlaying) {
|
||||||
player_pause_play?.setImageResource(if (isPlayingRightNow) R.drawable.play_to_pause else R.drawable.pause_to_play)
|
playerPausePlay.setImageResource(if (isPlayingRightNow) R.drawable.play_to_pause else R.drawable.pause_to_play)
|
||||||
val drawable = player_pause_play?.drawable
|
val drawable = playerPausePlay.drawable
|
||||||
|
|
||||||
var startedAnimation = false
|
var startedAnimation = false
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
|
||||||
|
@ -163,10 +171,10 @@ abstract class AbstractPlayerFragment(
|
||||||
|
|
||||||
// somehow the phone is wacked
|
// somehow the phone is wacked
|
||||||
if (!startedAnimation) {
|
if (!startedAnimation) {
|
||||||
player_pause_play?.setImageResource(if (isPlayingRightNow) R.drawable.netflix_pause else R.drawable.netflix_play)
|
playerPausePlay.setImageResource(if (isPlayingRightNow) R.drawable.netflix_pause else R.drawable.netflix_play)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player_pause_play?.setImageResource(if (isPlayingRightNow) R.drawable.netflix_pause else R.drawable.netflix_play)
|
playerPausePlay.setImageResource(if (isPlayingRightNow) R.drawable.netflix_pause else R.drawable.netflix_play)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,9 +334,9 @@ abstract class AbstractPlayerFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Necessary for multiple combined videos
|
// Necessary for multiple combined videos
|
||||||
player_view?.setShowMultiWindowTimeBar(true)
|
playerView?.setShowMultiWindowTimeBar(true)
|
||||||
player_view?.player = player
|
playerView?.player = player
|
||||||
player_view?.performClick()
|
playerView?.performClick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,9 +394,9 @@ abstract class AbstractPlayerFragment(
|
||||||
)
|
)
|
||||||
|
|
||||||
if (player is CS3IPlayer) {
|
if (player is CS3IPlayer) {
|
||||||
subView = player_view?.findViewById(R.id.exo_subtitles)
|
subView = playerView?.findViewById(R.id.exo_subtitles)
|
||||||
subStyle = SubtitlesFragment.getCurrentSavedStyle()
|
subStyle = SubtitlesFragment.getCurrentSavedStyle()
|
||||||
player.initSubtitles(subView, subtitle_holder, subStyle)
|
player.initSubtitles(subView, subtitleHolder, subStyle)
|
||||||
|
|
||||||
SubtitlesFragment.applyStyleEvent += ::onSubStyleChanged
|
SubtitlesFragment.applyStyleEvent += ::onSubStyleChanged
|
||||||
|
|
||||||
|
@ -456,7 +464,7 @@ abstract class AbstractPlayerFragment(
|
||||||
PlayerResize.Fit -> AspectRatioFrameLayout.RESIZE_MODE_FIT
|
PlayerResize.Fit -> AspectRatioFrameLayout.RESIZE_MODE_FIT
|
||||||
PlayerResize.Zoom -> AspectRatioFrameLayout.RESIZE_MODE_ZOOM
|
PlayerResize.Zoom -> AspectRatioFrameLayout.RESIZE_MODE_ZOOM
|
||||||
}
|
}
|
||||||
player_view?.resizeMode = type
|
playerView?.resizeMode = type
|
||||||
|
|
||||||
if (showToast)
|
if (showToast)
|
||||||
showToast(resize.nameRes, Toast.LENGTH_SHORT)
|
showToast(resize.nameRes, Toast.LENGTH_SHORT)
|
||||||
|
@ -480,6 +488,13 @@ abstract class AbstractPlayerFragment(
|
||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
return inflater.inflate(layout, container, false)
|
val root = inflater.inflate(layout, container, false)
|
||||||
|
playerPausePlayHolderHolder = root.findViewById(R.id.player_pause_play_holder_holder)
|
||||||
|
playerPausePlay = root.findViewById(R.id.player_pause_play)
|
||||||
|
playerBuffering = root.findViewById(R.id.player_buffering)
|
||||||
|
playerView = root.findViewById(R.id.player_view)
|
||||||
|
piphide = root.findViewById(R.id.piphide)
|
||||||
|
subtitleHolder = root.findViewById(R.id.subtitle_holder)
|
||||||
|
return root
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -63,7 +63,6 @@ import kotlinx.android.synthetic.main.player_custom_layout.player_center_menu
|
||||||
import kotlinx.android.synthetic.main.player_custom_layout.player_ffwd_holder
|
import kotlinx.android.synthetic.main.player_custom_layout.player_ffwd_holder
|
||||||
import kotlinx.android.synthetic.main.player_custom_layout.player_holder
|
import kotlinx.android.synthetic.main.player_custom_layout.player_holder
|
||||||
import kotlinx.android.synthetic.main.player_custom_layout.player_pause_play
|
import kotlinx.android.synthetic.main.player_custom_layout.player_pause_play
|
||||||
import kotlinx.android.synthetic.main.player_custom_layout.player_pause_play_holder
|
|
||||||
import kotlinx.android.synthetic.main.player_custom_layout.player_progressbar_left
|
import kotlinx.android.synthetic.main.player_custom_layout.player_progressbar_left
|
||||||
import kotlinx.android.synthetic.main.player_custom_layout.player_progressbar_left_holder
|
import kotlinx.android.synthetic.main.player_custom_layout.player_progressbar_left_holder
|
||||||
import kotlinx.android.synthetic.main.player_custom_layout.player_progressbar_left_icon
|
import kotlinx.android.synthetic.main.player_custom_layout.player_progressbar_left_icon
|
||||||
|
@ -605,7 +604,7 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
}
|
}
|
||||||
player_lock_holder?.isGone = isGone
|
player_lock_holder?.isGone = isGone
|
||||||
player_video_bar?.isGone = isGone
|
player_video_bar?.isGone = isGone
|
||||||
player_pause_play_holder?.isGone = isGone
|
|
||||||
player_pause_play?.isGone = isGone
|
player_pause_play?.isGone = isGone
|
||||||
//player_buffering?.isGone = isGone
|
//player_buffering?.isGone = isGone
|
||||||
player_top_holder?.isGone = isGone
|
player_top_holder?.isGone = isGone
|
||||||
|
|
|
@ -25,6 +25,11 @@ import com.hippo.unifile.UniFile
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.APIHolder.getApiFromNameNull
|
import com.lagradost.cloudstream3.APIHolder.getApiFromNameNull
|
||||||
import com.lagradost.cloudstream3.CommonActivity.showToast
|
import com.lagradost.cloudstream3.CommonActivity.showToast
|
||||||
|
import com.lagradost.cloudstream3.databinding.DialogOnlineSubtitlesBinding
|
||||||
|
import com.lagradost.cloudstream3.databinding.FragmentPlayerBinding
|
||||||
|
import com.lagradost.cloudstream3.databinding.PlayerCustomLayoutBinding
|
||||||
|
import com.lagradost.cloudstream3.databinding.PlayerSelectSourceAndSubsBinding
|
||||||
|
import com.lagradost.cloudstream3.databinding.PlayerSelectTracksBinding
|
||||||
import com.lagradost.cloudstream3.mvvm.*
|
import com.lagradost.cloudstream3.mvvm.*
|
||||||
import com.lagradost.cloudstream3.subtitles.AbstractSubtitleEntities
|
import com.lagradost.cloudstream3.subtitles.AbstractSubtitleEntities
|
||||||
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.subtitleProviders
|
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.subtitleProviders
|
||||||
|
@ -33,8 +38,6 @@ import com.lagradost.cloudstream3.ui.player.CustomDecoder.Companion.updateForced
|
||||||
import com.lagradost.cloudstream3.ui.player.PlayerSubtitleHelper.Companion.toSubtitleMimeType
|
import com.lagradost.cloudstream3.ui.player.PlayerSubtitleHelper.Companion.toSubtitleMimeType
|
||||||
import com.lagradost.cloudstream3.ui.player.source_priority.QualityDataHelper
|
import com.lagradost.cloudstream3.ui.player.source_priority.QualityDataHelper
|
||||||
import com.lagradost.cloudstream3.ui.player.source_priority.QualityProfileDialog
|
import com.lagradost.cloudstream3.ui.player.source_priority.QualityProfileDialog
|
||||||
import com.lagradost.cloudstream3.ui.player.source_priority.SourcePriority
|
|
||||||
import com.lagradost.cloudstream3.ui.player.source_priority.SourcePriorityDialog
|
|
||||||
import com.lagradost.cloudstream3.ui.result.*
|
import com.lagradost.cloudstream3.ui.result.*
|
||||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings
|
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings
|
||||||
import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment.Companion.getAutoSelectLanguageISO639_1
|
import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment.Companion.getAutoSelectLanguageISO639_1
|
||||||
|
@ -49,18 +52,8 @@ import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.hideSystemUI
|
import com.lagradost.cloudstream3.utils.UIHelper.hideSystemUI
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.popCurrentPage
|
import com.lagradost.cloudstream3.utils.UIHelper.popCurrentPage
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.toPx
|
import com.lagradost.cloudstream3.utils.UIHelper.toPx
|
||||||
import kotlinx.android.synthetic.main.dialog_online_subtitles.*
|
|
||||||
import kotlinx.android.synthetic.main.dialog_online_subtitles.apply_btt
|
|
||||||
import kotlinx.android.synthetic.main.dialog_online_subtitles.cancel_btt
|
|
||||||
import kotlinx.android.synthetic.main.fragment_player.*
|
|
||||||
import kotlinx.android.synthetic.main.player_custom_layout.*
|
|
||||||
import kotlinx.android.synthetic.main.player_select_source_and_subs.*
|
|
||||||
import kotlinx.android.synthetic.main.player_select_source_and_subs.subtitles_click_settings
|
|
||||||
import kotlinx.android.synthetic.main.player_select_tracks.*
|
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
|
||||||
import kotlin.collections.HashMap
|
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
class GeneratorPlayer : FullScreenPlayer() {
|
class GeneratorPlayer : FullScreenPlayer() {
|
||||||
|
@ -98,12 +91,15 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
|
|
||||||
private var preferredAutoSelectSubtitles: String? = null // null means do nothing, "" means none
|
private var preferredAutoSelectSubtitles: String? = null // null means do nothing, "" means none
|
||||||
|
|
||||||
|
private var binding: FragmentPlayerBinding? = null
|
||||||
|
private var playerBinding: PlayerCustomLayoutBinding? = null
|
||||||
|
|
||||||
private fun startLoading() {
|
private fun startLoading() {
|
||||||
player.release()
|
player.release()
|
||||||
currentSelectedSubtitles = null
|
currentSelectedSubtitles = null
|
||||||
isActive = false
|
isActive = false
|
||||||
overlay_loading_skip_button?.isVisible = false
|
binding?.overlayLoadingSkipButton?.isVisible = false
|
||||||
player_loading_overlay?.isVisible = true
|
binding?.playerLoadingOverlay?.isVisible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setSubtitles(sub: SubtitleData?): Boolean {
|
private fun setSubtitles(sub: SubtitleData?): Boolean {
|
||||||
|
@ -118,7 +114,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
|
|
||||||
override fun onTracksInfoChanged() {
|
override fun onTracksInfoChanged() {
|
||||||
val tracks = player.getVideoTracks()
|
val tracks = player.getVideoTracks()
|
||||||
player_tracks_btt?.isVisible =
|
playerBinding?.playerTracksBtt?.isVisible =
|
||||||
tracks.allVideoTracks.size > 1 || tracks.allAudioTracks.size > 1
|
tracks.allVideoTracks.size > 1 || tracks.allAudioTracks.size > 1
|
||||||
// Only set the preferred language if it is available.
|
// Only set the preferred language if it is available.
|
||||||
// Otherwise it may give some users audio track init failed!
|
// Otherwise it may give some users audio track init failed!
|
||||||
|
@ -158,12 +154,12 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
if (link == null) return
|
if (link == null) return
|
||||||
|
|
||||||
// manage UI
|
// manage UI
|
||||||
player_loading_overlay?.isVisible = false
|
binding?.playerLoadingOverlay?.isVisible = false
|
||||||
uiReset()
|
uiReset()
|
||||||
currentSelectedLink = link
|
currentSelectedLink = link
|
||||||
currentMeta = viewModel.getMeta()
|
currentMeta = viewModel.getMeta()
|
||||||
nextMeta = viewModel.getNextMeta()
|
nextMeta = viewModel.getNextMeta()
|
||||||
// setEpisodes(viewModel.getAllMeta() ?: emptyList())
|
// setEpisodes(viewModel.getAllMeta() ?: emptyList())
|
||||||
isActive = true
|
isActive = true
|
||||||
setPlayerDimen(null)
|
setPlayerDimen(null)
|
||||||
setTitle()
|
setTitle()
|
||||||
|
@ -257,7 +253,9 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
val isSingleProvider = subsProviders.size == 1
|
val isSingleProvider = subsProviders.size == 1
|
||||||
|
|
||||||
val dialog = Dialog(context, R.style.AlertDialogCustomBlack)
|
val dialog = Dialog(context, R.style.AlertDialogCustomBlack)
|
||||||
dialog.setContentView(R.layout.dialog_online_subtitles)
|
val binding =
|
||||||
|
DialogOnlineSubtitlesBinding.inflate(LayoutInflater.from(context), null, false)
|
||||||
|
dialog.setContentView(binding.root)
|
||||||
|
|
||||||
var currentSubtitles: List<AbstractSubtitleEntities.SubtitleEntity> = emptyList()
|
var currentSubtitles: List<AbstractSubtitleEntities.SubtitleEntity> = emptyList()
|
||||||
var currentSubtitle: AbstractSubtitleEntities.SubtitleEntity? = null
|
var currentSubtitle: AbstractSubtitleEntities.SubtitleEntity? = null
|
||||||
|
@ -295,6 +293,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
imageViewEnd.setImageDrawable(drawableEnd)
|
imageViewEnd.setImageDrawable(drawableEnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
|
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
|
||||||
val view = convertView ?: LayoutInflater.from(context).inflate(layout, null)
|
val view = convertView ?: LayoutInflater.from(context).inflate(layout, null)
|
||||||
|
|
||||||
|
@ -318,16 +317,16 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.show()
|
dialog.show()
|
||||||
dialog.cancel_btt.setOnClickListener {
|
binding.cancelBtt.setOnClickListener {
|
||||||
dialog.dismissSafe()
|
dialog.dismissSafe()
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.subtitle_adapter.choiceMode = AbsListView.CHOICE_MODE_SINGLE
|
binding.subtitleAdapter.choiceMode = AbsListView.CHOICE_MODE_SINGLE
|
||||||
dialog.subtitle_adapter.adapter = arrayAdapter
|
binding.subtitleAdapter.adapter = arrayAdapter
|
||||||
val adapter =
|
val adapter =
|
||||||
dialog.subtitle_adapter.adapter as? ArrayAdapter<AbstractSubtitleEntities.SubtitleEntity>
|
binding.subtitleAdapter.adapter as? ArrayAdapter<AbstractSubtitleEntities.SubtitleEntity>
|
||||||
|
|
||||||
dialog.subtitle_adapter.setOnItemClickListener { _, _, position, _ ->
|
binding.subtitleAdapter.setOnItemClickListener { _, _, position, _ ->
|
||||||
currentSubtitle = currentSubtitles.getOrNull(position) ?: return@setOnItemClickListener
|
currentSubtitle = currentSubtitles.getOrNull(position) ?: return@setOnItemClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,16 +342,16 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
val currentTempMeta = getMetaData()
|
val currentTempMeta = getMetaData()
|
||||||
// bruh idk why it is not correct
|
// bruh idk why it is not correct
|
||||||
val color = ColorStateList.valueOf(context.colorFromAttribute(R.attr.colorAccent))
|
val color = ColorStateList.valueOf(context.colorFromAttribute(R.attr.colorAccent))
|
||||||
dialog.search_loading_bar.progressTintList = color
|
binding.searchLoadingBar.progressTintList = color
|
||||||
dialog.search_loading_bar.indeterminateTintList = color
|
binding.searchLoadingBar.indeterminateTintList = color
|
||||||
|
|
||||||
observeNullable(viewModel.currentSubtitleYear) {
|
observeNullable(viewModel.currentSubtitleYear) {
|
||||||
// When year is changed search again
|
// When year is changed search again
|
||||||
dialog.subtitles_search.setQuery(dialog.subtitles_search.query, true)
|
binding.subtitlesSearch.setQuery(binding.subtitlesSearch.query, true)
|
||||||
dialog.year_btt.text = it?.toString() ?: txt(R.string.none).asString(context)
|
binding.yearBtt.text = it?.toString() ?: txt(R.string.none).asString(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.year_btt?.setOnClickListener {
|
binding.yearBtt.setOnClickListener {
|
||||||
val none = txt(R.string.none).asString(context)
|
val none = txt(R.string.none).asString(context)
|
||||||
val currentYear = Calendar.getInstance().get(Calendar.YEAR)
|
val currentYear = Calendar.getInstance().get(Calendar.YEAR)
|
||||||
val earliestYear = 1900
|
val earliestYear = 1900
|
||||||
|
@ -380,10 +379,10 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.subtitles_search.setOnQueryTextListener(object :
|
binding.subtitlesSearch.setOnQueryTextListener(object :
|
||||||
androidx.appcompat.widget.SearchView.OnQueryTextListener {
|
androidx.appcompat.widget.SearchView.OnQueryTextListener {
|
||||||
override fun onQueryTextSubmit(query: String?): Boolean {
|
override fun onQueryTextSubmit(query: String?): Boolean {
|
||||||
dialog.search_loading_bar?.show()
|
binding.searchLoadingBar.show()
|
||||||
ioSafe {
|
ioSafe {
|
||||||
val search =
|
val search =
|
||||||
AbstractSubtitleEntities.SubtitleSearch(
|
AbstractSubtitleEntities.SubtitleSearch(
|
||||||
|
@ -415,7 +414,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
// ugly ik
|
// ugly ik
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
setSubtitlesList(items)
|
setSubtitlesList(items)
|
||||||
dialog.search_loading_bar?.hide()
|
binding.searchLoadingBar.hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,7 +426,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
dialog.search_filter.setOnClickListener { view ->
|
binding.searchFilter.setOnClickListener { view ->
|
||||||
val lang639_1 = languages.map { it.ISO_639_1 }
|
val lang639_1 = languages.map { it.ISO_639_1 }
|
||||||
activity?.showDialog(languages.map { it.languageName },
|
activity?.showDialog(languages.map { it.languageName },
|
||||||
lang639_1.indexOf(currentLanguageTwoLetters),
|
lang639_1.indexOf(currentLanguageTwoLetters),
|
||||||
|
@ -436,11 +435,11 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
true,
|
true,
|
||||||
{ }) { index ->
|
{ }) { index ->
|
||||||
currentLanguageTwoLetters = lang639_1[index]
|
currentLanguageTwoLetters = lang639_1[index]
|
||||||
dialog.subtitles_search.setQuery(dialog.subtitles_search.query, true)
|
binding.subtitlesSearch.setQuery(binding.subtitlesSearch.query, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.apply_btt.setOnClickListener {
|
binding.applyBtt.setOnClickListener {
|
||||||
currentSubtitle?.let { currentSubtitle ->
|
currentSubtitle?.let { currentSubtitle ->
|
||||||
providers.firstOrNull { it.idPrefix == currentSubtitle.idPrefix }?.let { api ->
|
providers.firstOrNull { it.idPrefix == currentSubtitle.idPrefix }?.let { api ->
|
||||||
ioSafe {
|
ioSafe {
|
||||||
|
@ -466,7 +465,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.show()
|
dialog.show()
|
||||||
dialog.subtitles_search.setQuery(currentTempMeta.name, true)
|
binding.subtitlesSearch.setQuery(currentTempMeta.name, true)
|
||||||
//TODO: Set year text from currently loaded movie on Player
|
//TODO: Set year text from currently loaded movie on Player
|
||||||
//dialog.subtitles_search_year?.setText(currentTempMeta.year)
|
//dialog.subtitles_search_year?.setText(currentTempMeta.year)
|
||||||
}
|
}
|
||||||
|
@ -557,13 +556,15 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
val currentSubtitles = sortSubs(currentSubs)
|
val currentSubtitles = sortSubs(currentSubs)
|
||||||
|
|
||||||
val sourceDialog = Dialog(ctx, R.style.AlertDialogCustomBlack)
|
val sourceDialog = Dialog(ctx, R.style.AlertDialogCustomBlack)
|
||||||
sourceDialog.setContentView(R.layout.player_select_source_and_subs)
|
val binding =
|
||||||
|
PlayerSelectSourceAndSubsBinding.inflate(LayoutInflater.from(ctx), null, false)
|
||||||
|
sourceDialog.setContentView(binding.root)
|
||||||
|
|
||||||
selectSourceDialog = sourceDialog
|
selectSourceDialog = sourceDialog
|
||||||
|
|
||||||
sourceDialog.show()
|
sourceDialog.show()
|
||||||
val providerList = sourceDialog.sort_providers
|
val providerList = binding.sortProviders
|
||||||
val subtitleList = sourceDialog.sort_subtitles
|
val subtitleList = binding.sortSubtitles
|
||||||
|
|
||||||
val loadFromFileFooter: TextView =
|
val loadFromFileFooter: TextView =
|
||||||
layoutInflater.inflate(R.layout.sort_bottom_footer_add_choice, null) as TextView
|
layoutInflater.inflate(R.layout.sort_bottom_footer_add_choice, null) as TextView
|
||||||
|
@ -671,12 +672,12 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceDialog.cancel_btt?.setOnClickListener {
|
binding.cancelBtt.setOnClickListener {
|
||||||
sourceDialog.dismissSafe(activity)
|
sourceDialog.dismissSafe(activity)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setProfileName(profile: Int) {
|
fun setProfileName(profile: Int) {
|
||||||
sourceDialog.source_settings_btt.setText(
|
binding.sourceSettingsBtt.setText(
|
||||||
QualityDataHelper.getProfileName(
|
QualityDataHelper.getProfileName(
|
||||||
profile
|
profile
|
||||||
)
|
)
|
||||||
|
@ -684,7 +685,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
}
|
}
|
||||||
setProfileName(currentQualityProfile)
|
setProfileName(currentQualityProfile)
|
||||||
|
|
||||||
sourceDialog.profiles_click_settings.setOnClickListener {
|
binding.profilesClickSettings.setOnClickListener {
|
||||||
val activity = activity ?: return@setOnClickListener
|
val activity = activity ?: return@setOnClickListener
|
||||||
QualityProfileDialog(
|
QualityProfileDialog(
|
||||||
activity,
|
activity,
|
||||||
|
@ -698,7 +699,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
}.show()
|
}.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceDialog.subtitles_encoding_format?.apply {
|
binding.subtitlesEncodingFormat.apply {
|
||||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(ctx)
|
val settingsManager = PreferenceManager.getDefaultSharedPreferences(ctx)
|
||||||
|
|
||||||
val prefNames = ctx.resources.getStringArray(R.array.subtitles_encoding_list)
|
val prefNames = ctx.resources.getStringArray(R.array.subtitles_encoding_list)
|
||||||
|
@ -711,7 +712,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
text = prefNames[if (index == -1) 0 else index]
|
text = prefNames[if (index == -1) 0 else index]
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceDialog.subtitles_click_settings?.setOnClickListener {
|
binding.subtitlesClickSettings.setOnClickListener {
|
||||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(ctx)
|
val settingsManager = PreferenceManager.getDefaultSharedPreferences(ctx)
|
||||||
|
|
||||||
val prefNames = ctx.resources.getStringArray(R.array.subtitles_encoding_list)
|
val prefNames = ctx.resources.getStringArray(R.array.subtitles_encoding_list)
|
||||||
|
@ -740,7 +741,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceDialog.apply_btt?.setOnClickListener {
|
binding.applyBtt.setOnClickListener {
|
||||||
var init = false
|
var init = false
|
||||||
if (sourceIndex != startSource) {
|
if (sourceIndex != startSource) {
|
||||||
init = true
|
init = true
|
||||||
|
@ -780,18 +781,19 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
it.height?.times(-1)
|
it.height?.times(-1)
|
||||||
}
|
}
|
||||||
val currentAudioTracks = tracks.allAudioTracks
|
val currentAudioTracks = tracks.allAudioTracks
|
||||||
|
val binding: PlayerSelectTracksBinding =
|
||||||
|
PlayerSelectTracksBinding.inflate(LayoutInflater.from(ctx), null, false)
|
||||||
val trackDialog = Dialog(ctx, R.style.AlertDialogCustomBlack)
|
val trackDialog = Dialog(ctx, R.style.AlertDialogCustomBlack)
|
||||||
trackDialog.setContentView(R.layout.player_select_tracks)
|
trackDialog.setContentView(binding.root)
|
||||||
trackDialog.show()
|
trackDialog.show()
|
||||||
|
|
||||||
// selectTracksDialog = tracksDialog
|
// selectTracksDialog = tracksDialog
|
||||||
|
|
||||||
val videosList = trackDialog.video_tracks_list
|
val videosList = binding.videoTracksList
|
||||||
val audioList = trackDialog.auto_tracks_list
|
val audioList = binding.autoTracksList
|
||||||
|
|
||||||
trackDialog.video_tracks_holder.isVisible = currentVideoTracks.size > 1
|
binding.videoTracksHolder.isVisible = currentVideoTracks.size > 1
|
||||||
trackDialog.audio_tracks_holder.isVisible = currentAudioTracks.size > 1
|
binding.audioTracksHolder.isVisible = currentAudioTracks.size > 1
|
||||||
|
|
||||||
fun dismiss() {
|
fun dismiss() {
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
|
@ -856,11 +858,11 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
audioList.setItemChecked(which, true)
|
audioList.setItemChecked(which, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
trackDialog.cancel_btt?.setOnClickListener {
|
binding.cancelBtt.setOnClickListener {
|
||||||
trackDialog.dismissSafe(activity)
|
trackDialog.dismissSafe(activity)
|
||||||
}
|
}
|
||||||
|
|
||||||
trackDialog.apply_btt?.setOnClickListener {
|
binding.applyBtt.setOnClickListener {
|
||||||
val currentTrack = currentAudioTracks.getOrNull(audioIndexStart)
|
val currentTrack = currentAudioTracks.getOrNull(audioIndexStart)
|
||||||
player.setPreferredAudioTrack(
|
player.setPreferredAudioTrack(
|
||||||
currentTrack?.language, currentTrack?.id
|
currentTrack?.language, currentTrack?.id
|
||||||
|
@ -1029,8 +1031,10 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
if (meta.tvType.isAnimeOp()) isOpVisible = percentage < SKIP_OP_VIDEO_PERCENTAGE
|
if (meta.tvType.isAnimeOp()) isOpVisible = percentage < SKIP_OP_VIDEO_PERCENTAGE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player_skip_op?.isVisible = isOpVisible
|
|
||||||
player_skip_episode?.isVisible = !isOpVisible && viewModel.hasNextEpisode() == true
|
playerBinding?.playerSkipOp?.isVisible = isOpVisible
|
||||||
|
playerBinding?.playerSkipEpisode?.isVisible =
|
||||||
|
!isOpVisible && viewModel.hasNextEpisode() == true
|
||||||
|
|
||||||
if (percentage >= PRELOAD_NEXT_EPISODE_PERCENTAGE) {
|
if (percentage >= PRELOAD_NEXT_EPISODE_PERCENTAGE) {
|
||||||
viewModel.preLoadNextLinks()
|
viewModel.preLoadNextLinks()
|
||||||
|
@ -1167,7 +1171,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
|
|
||||||
//Hide title, if set in setting
|
//Hide title, if set in setting
|
||||||
if (limitTitle < 0) {
|
if (limitTitle < 0) {
|
||||||
player_video_title?.visibility = View.GONE
|
playerBinding?.playerVideoTitle?.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
//Truncate video title if it exceeds limit
|
//Truncate video title if it exceeds limit
|
||||||
val differenceInLength = playerVideoTitle.length - limitTitle
|
val differenceInLength = playerVideoTitle.length - limitTitle
|
||||||
|
@ -1178,8 +1182,8 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
}
|
}
|
||||||
val isFiller: Boolean? = (currentMeta as? ResultEpisode)?.isFiller
|
val isFiller: Boolean? = (currentMeta as? ResultEpisode)?.isFiller
|
||||||
|
|
||||||
player_episode_filler_holder?.isVisible = isFiller ?: false
|
playerBinding?.playerEpisodeFillerHolder?.isVisible = isFiller ?: false
|
||||||
player_video_title?.text = playerVideoTitle
|
playerBinding?.playerVideoTitle?.text = playerVideoTitle
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
|
@ -1200,8 +1204,10 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
3 -> "$source - $extra"
|
3 -> "$source - $extra"
|
||||||
else -> ""
|
else -> ""
|
||||||
}
|
}
|
||||||
player_video_title_rez?.text = title
|
playerBinding?.playerVideoTitleRez?.apply {
|
||||||
player_video_title_rez?.isVisible = title.isNotBlank()
|
text = title
|
||||||
|
isVisible = title.isNotBlank()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun playerDimensionsLoaded(widthHeight: Pair<Int, Int>) {
|
override fun playerDimensionsLoaded(widthHeight: Pair<Int, Int>) {
|
||||||
|
@ -1229,7 +1235,18 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
unwrapBundle(savedInstanceState)
|
unwrapBundle(savedInstanceState)
|
||||||
unwrapBundle(arguments)
|
unwrapBundle(arguments)
|
||||||
|
|
||||||
return super.onCreateView(inflater, container, savedInstanceState)
|
val root = super.onCreateView(inflater, container, savedInstanceState) ?: return null
|
||||||
|
binding = FragmentPlayerBinding.bind(root).also { b ->
|
||||||
|
playerBinding = PlayerCustomLayoutBinding.bind(b.playerView.findViewById(R.id.player_holder))
|
||||||
|
}
|
||||||
|
|
||||||
|
return root
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
playerBinding = null
|
||||||
|
binding = null
|
||||||
|
super.onDestroyView()
|
||||||
}
|
}
|
||||||
|
|
||||||
var timestampShowState = false
|
var timestampShowState = false
|
||||||
|
@ -1242,7 +1259,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
skipIndex++
|
skipIndex++
|
||||||
println("displayTimeStamp = $show")
|
println("displayTimeStamp = $show")
|
||||||
timestampShowState = show
|
timestampShowState = show
|
||||||
skip_chapter_button?.apply {
|
playerBinding?.skipChapterButton?.apply {
|
||||||
val showWidth = 170.toPx
|
val showWidth = 170.toPx
|
||||||
val noShowWidth = 10.toPx
|
val noShowWidth = 10.toPx
|
||||||
//if((show && width == showWidth) || (!show && width == noShowWidth)) {
|
//if((show && width == showWidth) || (!show && width == noShowWidth)) {
|
||||||
|
@ -1262,7 +1279,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
from, to
|
from, to
|
||||||
).apply {
|
).apply {
|
||||||
addListener(onEnd = {
|
addListener(onEnd = {
|
||||||
if (!show) skip_chapter_button?.isVisible = false
|
if (!show) playerBinding?.skipChapterButton?.isVisible = false
|
||||||
})
|
})
|
||||||
addUpdateListener { valueAnimator ->
|
addUpdateListener { valueAnimator ->
|
||||||
val value = valueAnimator.animatedValue as Int
|
val value = valueAnimator.animatedValue as Int
|
||||||
|
@ -1282,10 +1299,10 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
|
|
||||||
override fun onTimestamp(timestamp: EpisodeSkip.SkipStamp?) {
|
override fun onTimestamp(timestamp: EpisodeSkip.SkipStamp?) {
|
||||||
if (timestamp != null) {
|
if (timestamp != null) {
|
||||||
skip_chapter_button.setText(timestamp.uiText)
|
playerBinding?.skipChapterButton?.setText(timestamp.uiText)
|
||||||
displayTimeStamp(true)
|
displayTimeStamp(true)
|
||||||
val currentIndex = skipIndex
|
val currentIndex = skipIndex
|
||||||
skip_chapter_button?.handler?.postDelayed({
|
playerBinding?.skipChapterButton?.handler?.postDelayed({
|
||||||
if (skipIndex == currentIndex)
|
if (skipIndex == currentIndex)
|
||||||
displayTimeStamp(false)
|
displayTimeStamp(false)
|
||||||
}, 6000)
|
}, 6000)
|
||||||
|
@ -1328,11 +1345,11 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
viewModel.loadLinks()
|
viewModel.loadLinks()
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay_loading_skip_button?.setOnClickListener {
|
binding?.overlayLoadingSkipButton?.setOnClickListener {
|
||||||
startPlayer()
|
startPlayer()
|
||||||
}
|
}
|
||||||
|
|
||||||
player_loading_go_back?.setOnClickListener {
|
binding?.playerLoadingGoBack?.setOnClickListener {
|
||||||
player.release()
|
player.release()
|
||||||
activity?.popCurrentPage()
|
activity?.popCurrentPage()
|
||||||
}
|
}
|
||||||
|
@ -1365,8 +1382,8 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
observe(viewModel.currentLinks) {
|
observe(viewModel.currentLinks) {
|
||||||
currentLinks = it
|
currentLinks = it
|
||||||
val turnVisible = it.isNotEmpty()
|
val turnVisible = it.isNotEmpty()
|
||||||
val wasGone = overlay_loading_skip_button?.isGone == true
|
val wasGone = binding?.overlayLoadingSkipButton?.isGone == true
|
||||||
overlay_loading_skip_button?.isVisible = turnVisible
|
binding?.overlayLoadingSkipButton?.isVisible = turnVisible
|
||||||
|
|
||||||
normalSafeApiCall {
|
normalSafeApiCall {
|
||||||
if (currentLinks.any { link ->
|
if (currentLinks.any { link ->
|
||||||
|
@ -1379,7 +1396,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (turnVisible && wasGone) {
|
if (turnVisible && wasGone) {
|
||||||
overlay_loading_skip_button?.requestFocus()
|
binding?.overlayLoadingSkipButton?.requestFocus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@
|
||||||
android:background="@color/black_overlay" />
|
android:background="@color/black_overlay" />
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/player_time_menu"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="200dp"
|
android:layout_height="200dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
|
@ -199,29 +198,22 @@
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<FrameLayout
|
<ImageView
|
||||||
android:id="@+id/player_pause_play_holder"
|
android:id="@+id/player_pause_play"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="70dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="70dp"
|
||||||
tools:ignore="uselessParent">
|
android:layout_gravity="center"
|
||||||
|
android:background="@drawable/video_tap_button"
|
||||||
|
android:nextFocusLeft="@id/exo_rew"
|
||||||
|
|
||||||
<ImageView
|
android:nextFocusRight="@id/exo_ffwd"
|
||||||
android:id="@+id/player_pause_play"
|
|
||||||
android:layout_width="70dp"
|
|
||||||
android:layout_height="70dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="@drawable/video_tap_button"
|
|
||||||
android:nextFocusLeft="@id/exo_rew"
|
|
||||||
|
|
||||||
android:nextFocusRight="@id/exo_ffwd"
|
android:nextFocusUp="@id/player_go_back"
|
||||||
|
android:nextFocusDown="@id/player_lock"
|
||||||
|
|
||||||
android:nextFocusUp="@id/player_go_back"
|
android:src="@drawable/netflix_pause"
|
||||||
android:nextFocusDown="@id/player_lock"
|
app:tint="@color/white"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
android:src="@drawable/netflix_pause"
|
|
||||||
app:tint="@color/white"
|
|
||||||
tools:ignore="ContentDescription" />
|
|
||||||
</FrameLayout>
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|
|
@ -54,6 +54,118 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
-->
|
-->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layoutDirection="ltr"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/player_progressbar_left_holder"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:gravity="start"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toLeftOf="@+id/centerMenuView"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:alpha="1"
|
||||||
|
tools:visibility="visible">
|
||||||
|
<!--VERY hacky layout -->
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/player_progressbar_left_icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginBottom="220dp"
|
||||||
|
android:src="@drawable/ic_baseline_volume_up_24"
|
||||||
|
app:tint="@android:color/white"
|
||||||
|
tools:ignore="ContentDescription">
|
||||||
|
|
||||||
|
</ImageView>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/player_progressbar_left"
|
||||||
|
style="@android:style/Widget.Material.ProgressBar.Horizontal"
|
||||||
|
android:layout_width="5dp"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_gravity="end|center_vertical"
|
||||||
|
android:layout_marginStart="40dp"
|
||||||
|
android:indeterminate="false"
|
||||||
|
android:max="100"
|
||||||
|
android:progress="100"
|
||||||
|
android:progressDrawable="@drawable/progress_drawable_vertical"
|
||||||
|
tools:progress="30" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/player_progressbar_right_holder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:gravity="right"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toRightOf="@+id/centerMenuView"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:alpha="1"
|
||||||
|
tools:ignore="RtlHardcoded"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/player_progressbar_right_icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginBottom="220dp"
|
||||||
|
android:src="@drawable/ic_baseline_brightness_7_24"
|
||||||
|
app:tint="@android:color/white"
|
||||||
|
tools:ignore="ContentDescription">
|
||||||
|
|
||||||
|
</ImageView>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/player_progressbar_right"
|
||||||
|
style="@android:style/Widget.Material.ProgressBar.Horizontal"
|
||||||
|
android:layout_width="5dp"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_gravity="end|center_vertical"
|
||||||
|
android:layout_marginEnd="40dp"
|
||||||
|
android:indeterminate="false"
|
||||||
|
android:max="100"
|
||||||
|
android:progress="100"
|
||||||
|
android:progressDrawable="@drawable/progress_drawable_vertical" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/player_time_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:shadowColor="@android:color/black"
|
||||||
|
android:shadowRadius="10.0"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="30sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:text="+100"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/player_pause_play_holder_holder"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/player_video_holder"
|
android:id="@+id/player_video_holder"
|
||||||
|
@ -61,35 +173,70 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="16dp">
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/skip_chapter_button"
|
||||||
|
style="@style/NiceButton"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginEnd="100dp"
|
||||||
|
android:backgroundTint="@color/skipOpTransparent"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:cornerRadius="@dimen/rounded_button_radius"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/bottom_player_bar"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:strokeColor="@color/white"
|
||||||
|
app:strokeWidth="1dp"
|
||||||
|
tools:text="Skip Opening"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/player_top_holder"
|
android:id="@+id/player_top_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/player_video_title"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="80dp"
|
android:layout_marginStart="80dp"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_marginEnd="32dp"
|
android:layout_marginEnd="32dp"
|
||||||
android:gravity="end"
|
android:orientation="vertical">
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
tools:text="Hello world" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/player_video_title_rez"
|
android:id="@+id/player_video_title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="80dp"
|
android:gravity="end"
|
||||||
android:layout_marginTop="40dp"
|
android:textColor="@color/white"
|
||||||
android:layout_marginEnd="32dp"
|
android:textSize="16sp"
|
||||||
android:gravity="end"
|
android:textStyle="bold"
|
||||||
android:textColor="@color/white"
|
tools:text="Hello world" />
|
||||||
android:textSize="16sp"
|
|
||||||
tools:text="1920x1080" />
|
<TextView
|
||||||
|
android:id="@+id/player_video_title_rez"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="end"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp"
|
||||||
|
tools:text="1920x1080" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/player_episode_filler_holder"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:layout_marginTop="2dp">
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/player_episode_filler"
|
||||||
|
style="@style/SmallBlackButton"
|
||||||
|
android:text="@string/filler" />
|
||||||
|
</FrameLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- Removed as it has no use anymore-->
|
<!-- Removed as it has no use anymore-->
|
||||||
<!--<androidx.mediarouter.app.MediaRouteButton
|
<!--<androidx.mediarouter.app.MediaRouteButton
|
||||||
|
@ -131,6 +278,108 @@
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/player_center_menu"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layoutDirection="ltr"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:visibility="gone"
|
||||||
|
android:id="@+id/player_rew_holder"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical|start"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toLeftOf="@id/player_ffwd_holder"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintWidth_percent="0.5">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/exo_rew_text"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="19sp"
|
||||||
|
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:text="10" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@id/exo_rew"
|
||||||
|
android:layout_width="70dp"
|
||||||
|
android:layout_height="70dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
|
||||||
|
android:background="@drawable/video_tap_button_skip"
|
||||||
|
android:nextFocusLeft="@id/exo_rew"
|
||||||
|
android:nextFocusUp="@id/player_go_back"
|
||||||
|
android:nextFocusDown="@id/player_lock"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:scaleX="-1"
|
||||||
|
android:src="@drawable/netflix_skip_forward"
|
||||||
|
android:tintMode="src_in"
|
||||||
|
app:tint="@color/white"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:visibility="gone"
|
||||||
|
android:id="@+id/player_ffwd_holder"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical|end"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toRightOf="@id/player_rew_holder"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintWidth_percent="0.5">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/exo_ffwd_text"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="19sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:text="10" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@id/exo_ffwd"
|
||||||
|
android:layout_width="70dp"
|
||||||
|
android:layout_height="70dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
|
||||||
|
android:background="@drawable/video_tap_button_skip"
|
||||||
|
android:nextFocusRight="@id/exo_rew"
|
||||||
|
android:nextFocusUp="@id/player_go_back"
|
||||||
|
android:nextFocusDown="@id/player_lock"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@drawable/netflix_skip_forward"
|
||||||
|
android:tintMode="src_in"
|
||||||
|
app:tint="@color/white"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
</FrameLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<!--use for thinner app:trackThickness="3dp" com.google.android.material.progressindicator.CircularProgressIndicator-->
|
<!--use for thinner app:trackThickness="3dp" com.google.android.material.progressindicator.CircularProgressIndicator-->
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/player_buffering"
|
android:id="@+id/player_buffering"
|
||||||
|
@ -304,6 +553,22 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp">
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/player_lock"
|
||||||
|
style="@style/VideoButtonTV"
|
||||||
|
android:nextFocusLeft="@id/player_skip_episode"
|
||||||
|
|
||||||
|
android:nextFocusRight="@id/player_resize_btt"
|
||||||
|
android:nextFocusUp="@id/player_pause_play"
|
||||||
|
android:text="@string/video_lock"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:icon="@drawable/video_locked" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/player_resize_btt"
|
android:id="@+id/player_resize_btt"
|
||||||
style="@style/VideoButtonTV"
|
style="@style/VideoButtonTV"
|
||||||
|
|
|
@ -109,29 +109,22 @@
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<FrameLayout
|
<ImageView
|
||||||
android:id="@+id/player_pause_play_holder"
|
android:id="@+id/player_pause_play"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="70dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="70dp"
|
||||||
tools:ignore="uselessParent">
|
android:layout_gravity="center"
|
||||||
|
android:background="@drawable/video_tap_button"
|
||||||
|
android:nextFocusLeft="@id/exo_rew"
|
||||||
|
|
||||||
<ImageView
|
android:nextFocusRight="@id/exo_ffwd"
|
||||||
android:id="@+id/player_pause_play"
|
|
||||||
android:layout_width="70dp"
|
|
||||||
android:layout_height="70dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="@drawable/video_tap_button"
|
|
||||||
android:nextFocusLeft="@id/exo_rew"
|
|
||||||
|
|
||||||
android:nextFocusRight="@id/exo_ffwd"
|
android:nextFocusUp="@id/player_go_back"
|
||||||
|
android:nextFocusDown="@id/player_lock"
|
||||||
|
|
||||||
android:nextFocusUp="@id/player_go_back"
|
android:src="@drawable/netflix_pause"
|
||||||
android:nextFocusDown="@id/player_lock"
|
app:tint="@color/white"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
android:src="@drawable/netflix_pause"
|
|
||||||
app:tint="@color/white"
|
|
||||||
tools:ignore="ContentDescription" />
|
|
||||||
</FrameLayout>
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|
Loading…
Reference in a new issue