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)
}
fun setUpDownloadButton(
private fun setUpDownloadButton(
setupCurrentBytes: Long?,
setupTotalBytes: Long?,
progressBar: ContentLoadingProgressBar,

View file

@ -797,8 +797,9 @@ class PlayerFragment : Fragment() {
//endregion
private fun onSubStyleChanged(style : SaveCaptionStyle) {
subView?.setStyle(fromSaveToStyle(subStyle))
subView?.translationY = -subStyle.elevation.toPx.toFloat()
subStyle = style
subView?.setStyle(fromSaveToStyle(style))
subView?.translationY = -style.elevation.toPx.toFloat()
}
@SuppressLint("SetTextI18n")
@ -1161,6 +1162,7 @@ class PlayerFragment : Fragment() {
subsSettings.setOnClickListener {
SubtitlesFragment.push(activity)
sourceDialog.dismiss()
}
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.SingleSelectionHelper.showBottomDialog
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
import com.lagradost.cloudstream3.utils.UIHelper.hideSystemUI
import com.lagradost.cloudstream3.utils.UIHelper.popCurrentPage
import kotlinx.android.synthetic.main.subtitle_settings.*
@ -106,6 +107,11 @@ class SubtitlesFragment : Fragment() {
private fun onColorSelected(stuff: Pair<Int, Int>) {
setColor(stuff.first, stuff.second)
activity?.hideSystemUI()
}
private fun onDialogDismissed(id: Int) {
activity?.hideSystemUI()
}
private fun setColor(id: Int, color: Int?) {
@ -122,7 +128,7 @@ class SubtitlesFragment : Fragment() {
updateState()
}
fun updateState() {
private fun updateState() {
subtitle_text?.setStyle(fromSaveToStyle(state))
}
@ -157,6 +163,7 @@ class SubtitlesFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
MainActivity.onColorSelectedEvent += ::onColorSelected
MainActivity.onDialogDismissedEvent += ::onDialogDismissed
context?.fixPaddingStatusbar(subs_root)
@ -202,6 +209,7 @@ class SubtitlesFragment : Fragment() {
) { index ->
state.elevation = elevationTypes.map { it.first }[index]
updateState()
activity?.hideSystemUI()
}
}
@ -229,6 +237,7 @@ class SubtitlesFragment : Fragment() {
) { index ->
state.edgeType = edgeTypes.map { it.first }[index]
updateState()
activity?.hideSystemUI()
}
}
@ -244,6 +253,7 @@ class SubtitlesFragment : Fragment() {
}
apply_btt.setOnClickListener {
it.context.saveStyle(state)
applyStyleEvent.invoke(state)
fromSaveToStyle(state)
activity?.popCurrentPage()