subs settings

This commit is contained in:
LagradOst 2021-08-06 23:57:52 +02:00
parent 0ec5d166df
commit 362b9f5a0a
3 changed files with 16 additions and 4 deletions

View file

@ -57,7 +57,7 @@ class EasyDownloadButton : IDisposable {
}, clickCallback) }, clickCallback)
} }
fun setUpDownloadButton( private fun setUpDownloadButton(
setupCurrentBytes: Long?, setupCurrentBytes: Long?,
setupTotalBytes: Long?, setupTotalBytes: Long?,
progressBar: ContentLoadingProgressBar, progressBar: ContentLoadingProgressBar,

View file

@ -797,8 +797,9 @@ class PlayerFragment : Fragment() {
//endregion //endregion
private fun onSubStyleChanged(style : SaveCaptionStyle) { private fun onSubStyleChanged(style : SaveCaptionStyle) {
subView?.setStyle(fromSaveToStyle(subStyle)) subStyle = style
subView?.translationY = -subStyle.elevation.toPx.toFloat() subView?.setStyle(fromSaveToStyle(style))
subView?.translationY = -style.elevation.toPx.toFloat()
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
@ -1161,6 +1162,7 @@ class PlayerFragment : Fragment() {
subsSettings.setOnClickListener { subsSettings.setOnClickListener {
SubtitlesFragment.push(activity) SubtitlesFragment.push(activity)
sourceDialog.dismiss()
} }
val startSource = sources.indexOf(getCurrentUrl()) val startSource = sources.indexOf(getCurrentUrl())

View file

@ -25,6 +25,7 @@ import com.lagradost.cloudstream3.utils.DataStore.setKey
import com.lagradost.cloudstream3.utils.Event import com.lagradost.cloudstream3.utils.Event
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
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.subtitle_settings.* import kotlinx.android.synthetic.main.subtitle_settings.*
@ -106,6 +107,11 @@ class SubtitlesFragment : Fragment() {
private fun onColorSelected(stuff: Pair<Int, Int>) { private fun onColorSelected(stuff: Pair<Int, Int>) {
setColor(stuff.first, stuff.second) setColor(stuff.first, stuff.second)
activity?.hideSystemUI()
}
private fun onDialogDismissed(id: Int) {
activity?.hideSystemUI()
} }
private fun setColor(id: Int, color: Int?) { private fun setColor(id: Int, color: Int?) {
@ -122,7 +128,7 @@ class SubtitlesFragment : Fragment() {
updateState() updateState()
} }
fun updateState() { private fun updateState() {
subtitle_text?.setStyle(fromSaveToStyle(state)) subtitle_text?.setStyle(fromSaveToStyle(state))
} }
@ -157,6 +163,7 @@ class SubtitlesFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
MainActivity.onColorSelectedEvent += ::onColorSelected MainActivity.onColorSelectedEvent += ::onColorSelected
MainActivity.onDialogDismissedEvent += ::onDialogDismissed
context?.fixPaddingStatusbar(subs_root) context?.fixPaddingStatusbar(subs_root)
@ -202,6 +209,7 @@ class SubtitlesFragment : Fragment() {
) { index -> ) { index ->
state.elevation = elevationTypes.map { it.first }[index] state.elevation = elevationTypes.map { it.first }[index]
updateState() updateState()
activity?.hideSystemUI()
} }
} }
@ -229,6 +237,7 @@ class SubtitlesFragment : Fragment() {
) { index -> ) { index ->
state.edgeType = edgeTypes.map { it.first }[index] state.edgeType = edgeTypes.map { it.first }[index]
updateState() updateState()
activity?.hideSystemUI()
} }
} }
@ -244,6 +253,7 @@ class SubtitlesFragment : Fragment() {
} }
apply_btt.setOnClickListener { apply_btt.setOnClickListener {
it.context.saveStyle(state)
applyStyleEvent.invoke(state) applyStyleEvent.invoke(state)
fromSaveToStyle(state) fromSaveToStyle(state)
activity?.popCurrentPage() activity?.popCurrentPage()