Merge remote-tracking branch 'origin/master'

This commit is contained in:
LagradOst 2022-06-09 15:51:46 +02:00
commit f7a5b24742
4 changed files with 25 additions and 5 deletions

View file

@ -282,6 +282,10 @@ object CommonActivity {
KeyEvent.KEYCODE_S, KeyEvent.KEYCODE_NUMPAD_9 -> { KeyEvent.KEYCODE_S, KeyEvent.KEYCODE_NUMPAD_9 -> {
PlayerEventType.ShowMirrors PlayerEventType.ShowMirrors
} }
// OpenSubtitles shortcut
KeyEvent.KEYCODE_O, KeyEvent.KEYCODE_NUMPAD_8 -> {
PlayerEventType.SearchSubtitlesOnline
}
KeyEvent.KEYCODE_E, KeyEvent.KEYCODE_NUMPAD_3 -> { KeyEvent.KEYCODE_E, KeyEvent.KEYCODE_NUMPAD_3 -> {
PlayerEventType.ShowSpeed PlayerEventType.ShowSpeed
} }

View file

@ -38,6 +38,7 @@ import com.lagradost.cloudstream3.CommonActivity.keyEventListener
import com.lagradost.cloudstream3.CommonActivity.playerEventListener import com.lagradost.cloudstream3.CommonActivity.playerEventListener
import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.R
import com.lagradost.cloudstream3.mvvm.logError import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.ui.player.GeneratorPlayer.Companion.subsProvidersIsActive
import com.lagradost.cloudstream3.utils.Qualities import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showDialog import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showDialog
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
@ -138,6 +139,14 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
throw NotImplementedError() throw NotImplementedError()
} }
open fun openOnlineSubPicker(
context: Context,
imdbId: Long?,
dismissCallback: (() -> Unit)
) {
throw NotImplementedError()
}
/** Returns false if the touch is on the status bar or navigation bar*/ /** Returns false if the touch is on the status bar or navigation bar*/
private fun isValidTouch(rawX: Float, rawY: Float): Boolean { private fun isValidTouch(rawX: Float, rawY: Float): Boolean {
val statusHeight = statusBarHeight ?: 0 val statusHeight = statusBarHeight ?: 0
@ -1070,6 +1079,11 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
PlayerEventType.ShowMirrors -> { PlayerEventType.ShowMirrors -> {
showMirrorsDialogue() showMirrorsDialogue()
} }
PlayerEventType.SearchSubtitlesOnline -> {
if (subsProvidersIsActive) {
openOnlineSubPicker(view.context, null) {}
}
}
} }
} }

View file

@ -65,12 +65,13 @@ class GeneratorPlayer : FullScreenPlayer() {
putSerializable("syncData", syncData) putSerializable("syncData", syncData)
} }
} }
val subsProviders
get() = subtitleProviders.filter { !it.requiresLogin || it.loginInfo() != null }
val subsProvidersIsActive
get() = subsProviders.isNotEmpty()
} }
private val subsProviders
get() = subtitleProviders.filter { !it.requiresLogin || it.loginInfo() != null }
private val subsProvidersIsActive
get() = subsProviders.isNotEmpty()
private var titleRez = 3 private var titleRez = 3
private var limitTitle = 0 private var limitTitle = 0
@ -209,7 +210,7 @@ class GeneratorPlayer : FullScreenPlayer() {
return meta return meta
} }
private fun openOnlineSubPicker( override fun openOnlineSubPicker(
context: Context, context: Context,
imdbId: Long?, imdbId: Long?,
dismissCallback: (() -> Unit) dismissCallback: (() -> Unit)

View file

@ -22,6 +22,7 @@ enum class PlayerEventType(val value: Int) {
ShowSpeed(11), ShowSpeed(11),
ShowMirrors(12), ShowMirrors(12),
Resize(13), Resize(13),
SearchSubtitlesOnline(14),
} }
enum class CSPlayerEvent(val value: Int) { enum class CSPlayerEvent(val value: Int) {