mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Make player preferences account specific (#646)
This commit is contained in:
parent
cc00e73e16
commit
b5d4c3bd27
3 changed files with 9 additions and 6 deletions
|
@ -48,6 +48,7 @@ import com.lagradost.cloudstream3.ui.subtitles.SaveCaptionStyle
|
||||||
import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment
|
import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils
|
import com.lagradost.cloudstream3.utils.AppUtils
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.requestLocalAudioFocus
|
import com.lagradost.cloudstream3.utils.AppUtils.requestLocalAudioFocus
|
||||||
|
import com.lagradost.cloudstream3.utils.DataStoreHelper.currentAccount
|
||||||
import com.lagradost.cloudstream3.utils.EpisodeSkip
|
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
|
||||||
|
@ -442,7 +443,7 @@ abstract class AbstractPlayerFragment(
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n", "UnsafeOptInUsageError")
|
@SuppressLint("SetTextI18n", "UnsafeOptInUsageError")
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
resizeMode = getKey(RESIZE_MODE_KEY) ?: 0
|
resizeMode = getKey("$currentAccount/$RESIZE_MODE_KEY") ?: 0
|
||||||
resize(resizeMode, false)
|
resize(resizeMode, false)
|
||||||
|
|
||||||
player.releaseCallbacks()
|
player.releaseCallbacks()
|
||||||
|
@ -573,7 +574,7 @@ abstract class AbstractPlayerFragment(
|
||||||
|
|
||||||
@SuppressLint("UnsafeOptInUsageError")
|
@SuppressLint("UnsafeOptInUsageError")
|
||||||
fun resize(resize: PlayerResize, showToast: Boolean) {
|
fun resize(resize: PlayerResize, showToast: Boolean) {
|
||||||
setKey(RESIZE_MODE_KEY, resize.ordinal)
|
setKey("$currentAccount/$RESIZE_MODE_KEY", resize.ordinal)
|
||||||
val type = when (resize) {
|
val type = when (resize) {
|
||||||
PlayerResize.Fill -> AspectRatioFrameLayout.RESIZE_MODE_FILL
|
PlayerResize.Fill -> AspectRatioFrameLayout.RESIZE_MODE_FILL
|
||||||
PlayerResize.Fit -> AspectRatioFrameLayout.RESIZE_MODE_FIT
|
PlayerResize.Fit -> AspectRatioFrameLayout.RESIZE_MODE_FIT
|
||||||
|
|
|
@ -57,6 +57,7 @@ import com.lagradost.cloudstream3.mvvm.logError
|
||||||
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
|
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
|
||||||
import com.lagradost.cloudstream3.ui.subtitles.SaveCaptionStyle
|
import com.lagradost.cloudstream3.ui.subtitles.SaveCaptionStyle
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.isUsingMobileData
|
import com.lagradost.cloudstream3.utils.AppUtils.isUsingMobileData
|
||||||
|
import com.lagradost.cloudstream3.utils.DataStoreHelper.currentAccount
|
||||||
import com.lagradost.cloudstream3.utils.DrmExtractorLink
|
import com.lagradost.cloudstream3.utils.DrmExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.EpisodeSkip
|
import com.lagradost.cloudstream3.utils.EpisodeSkip
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
@ -536,12 +537,12 @@ class CS3IPlayer : IPlayer {
|
||||||
**/
|
**/
|
||||||
var preferredAudioTrackLanguage: String? = null
|
var preferredAudioTrackLanguage: String? = null
|
||||||
get() {
|
get() {
|
||||||
return field ?: getKey(PREFERRED_AUDIO_LANGUAGE_KEY, field)?.also {
|
return field ?: getKey("$currentAccount/$PREFERRED_AUDIO_LANGUAGE_KEY", field)?.also {
|
||||||
field = it
|
field = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set(value) {
|
set(value) {
|
||||||
setKey(PREFERRED_AUDIO_LANGUAGE_KEY, value)
|
setKey("$currentAccount/$PREFERRED_AUDIO_LANGUAGE_KEY", value)
|
||||||
field = value
|
field = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ import com.lagradost.cloudstream3.ui.player.source_priority.QualityDataHelper
|
||||||
import com.lagradost.cloudstream3.ui.result.setText
|
import com.lagradost.cloudstream3.ui.result.setText
|
||||||
import com.lagradost.cloudstream3.ui.result.txt
|
import com.lagradost.cloudstream3.ui.result.txt
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.isUsingMobileData
|
import com.lagradost.cloudstream3.utils.AppUtils.isUsingMobileData
|
||||||
|
import com.lagradost.cloudstream3.utils.DataStoreHelper.currentAccount
|
||||||
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
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
||||||
|
@ -356,7 +357,7 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
|
|
||||||
private fun setPlayBackSpeed(speed: Float) {
|
private fun setPlayBackSpeed(speed: Float) {
|
||||||
try {
|
try {
|
||||||
setKey(PLAYBACK_SPEED_KEY, speed)
|
setKey("$currentAccount/$PLAYBACK_SPEED_KEY", speed)
|
||||||
playerBinding?.playerSpeedBtt?.text =
|
playerBinding?.playerSpeedBtt?.text =
|
||||||
getString(R.string.player_speed_text_format).format(speed)
|
getString(R.string.player_speed_text_format).format(speed)
|
||||||
.replace(".0x", "x")
|
.replace(".0x", "x")
|
||||||
|
@ -1194,7 +1195,7 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
// init variables
|
// init variables
|
||||||
setPlayBackSpeed(getKey(PLAYBACK_SPEED_KEY) ?: 1.0f)
|
setPlayBackSpeed(getKey("$currentAccount/$PLAYBACK_SPEED_KEY") ?: 1.0f)
|
||||||
savedInstanceState?.getLong(SUBTITLE_DELAY_BUNDLE_KEY)?.let {
|
savedInstanceState?.getLong(SUBTITLE_DELAY_BUNDLE_KEY)?.let {
|
||||||
subtitleDelay = it
|
subtitleDelay = it
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue