diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/subtitles/ChromecastSubtitlesFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/subtitles/ChromecastSubtitlesFragment.kt index f9b1cb1fe88..95ef264f879 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/subtitles/ChromecastSubtitlesFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/subtitles/ChromecastSubtitlesFragment.kt @@ -38,18 +38,21 @@ import com.lagradost.cloudstream3.utils.UIHelper.fixSystemBarsPadding import com.lagradost.cloudstream3.utils.UIHelper.hideSystemUI import com.lagradost.cloudstream3.utils.UIHelper.navigate import com.lagradost.cloudstream3.utils.UIHelper.popCurrentPage +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable const val CHROME_SUBTITLE_KEY = "chome_subtitle_settings" +@Serializable data class SaveChromeCaptionStyle( - @JsonProperty("fontFamily") var fontFamily: String? = null, - @JsonProperty("fontGenericFamily") var fontGenericFamily: Int? = null, - @JsonProperty("backgroundColor") var backgroundColor: Int = 0x00FFFFFF, // transparent - @JsonProperty("edgeColor") var edgeColor: Int = Color.BLACK, // BLACK - @JsonProperty("edgeType") var edgeType: Int = EDGE_TYPE_OUTLINE, - @JsonProperty("foregroundColor") var foregroundColor: Int = Color.WHITE, - @JsonProperty("fontScale") var fontScale: Float = 1.05f, - @JsonProperty("windowColor") var windowColor: Int = Color.TRANSPARENT, + @JsonProperty("fontFamily") @SerialName("fontFamily") var fontFamily: String? = null, + @JsonProperty("fontGenericFamily") @SerialName("fontGenericFamily") var fontGenericFamily: Int? = null, + @JsonProperty("backgroundColor") @SerialName("backgroundColor") var backgroundColor: Int = 0x00FFFFFF, // transparent + @JsonProperty("edgeColor") @SerialName("edgeColor") var edgeColor: Int = Color.BLACK, // BLACK + @JsonProperty("edgeType") @SerialName("edgeType") var edgeType: Int = EDGE_TYPE_OUTLINE, + @JsonProperty("foregroundColor") @SerialName("foregroundColor") var foregroundColor: Int = Color.WHITE, + @JsonProperty("fontScale") @SerialName("fontScale") var fontScale: Float = 1.05f, + @JsonProperty("windowColor") @SerialName("windowColor") var windowColor: Int = Color.TRANSPARENT, ) class ChromecastSubtitlesFragment : BaseFragment( diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/subtitles/SubtitlesFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/subtitles/SubtitlesFragment.kt index 5f716cca3f1..860cb4fcbe0 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/subtitles/SubtitlesFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/subtitles/SubtitlesFragment.kt @@ -54,40 +54,39 @@ import com.lagradost.cloudstream3.utils.UIHelper.hideSystemUI import com.lagradost.cloudstream3.utils.UIHelper.navigate import com.lagradost.cloudstream3.utils.UIHelper.popCurrentPage import com.lagradost.cloudstream3.utils.UIHelper.toPx +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable import java.io.File const val SUBTITLE_KEY = "subtitle_settings" const val SUBTITLE_AUTO_SELECT_KEY = "subs_auto_select" const val SUBTITLE_DOWNLOAD_KEY = "subs_auto_download" +@Serializable data class SaveCaptionStyle( - @JsonProperty("foregroundColor") var foregroundColor: Int, - @JsonProperty("backgroundColor") var backgroundColor: Int, - @JsonProperty("windowColor") var windowColor: Int, + @JsonProperty("foregroundColor") @SerialName("foregroundColor") var foregroundColor: Int, + @JsonProperty("backgroundColor") @SerialName("backgroundColor") var backgroundColor: Int, + @JsonProperty("windowColor") @SerialName("windowColor") var windowColor: Int, @OptIn(UnstableApi::class) - @JsonProperty("edgeType") var edgeType: @CaptionStyleCompat.EdgeType Int, - @JsonProperty("edgeColor") var edgeColor: Int, - @FontRes - @JsonProperty("typeface") var typeface: Int?, - @JsonProperty("typefaceFilePath") var typefaceFilePath: String?, - /**in dp**/ - @JsonProperty("elevation") var elevation: Int, - /**in sp**/ - @JsonProperty("fixedTextSize") var fixedTextSize: Float?, - @Px - @JsonProperty("edgeSize") var edgeSize: Float? = null, - @JsonProperty("removeCaptions") var removeCaptions: Boolean = false, - @JsonProperty("removeBloat") var removeBloat: Boolean = true, - /** Apply caps lock to the text **/ - @JsonProperty("upperCase") var upperCase: Boolean = false, - /** Apply bold to the text **/ - @JsonProperty("bold") var bold: Boolean = false, - /** Apply italic to the text **/ - @JsonProperty("italic") var italic: Boolean = false, - /** in px, background radius, aka how round the background (backgroundColor) on each row is **/ - @JsonProperty("backgroundRadius") var backgroundRadius: Float? = null, + @JsonProperty("edgeType") @SerialName("edgeType") var edgeType: @CaptionStyleCompat.EdgeType Int, + @JsonProperty("edgeColor") @SerialName("edgeColor") var edgeColor: Int, + @FontRes @JsonProperty("typeface") @SerialName("typeface") var typeface: Int?, + @JsonProperty("typefaceFilePath") @SerialName("typefaceFilePath") var typefaceFilePath: String?, + @JsonProperty("elevation") @SerialName("elevation") var elevation: Int, // in dp + @JsonProperty("fixedTextSize") @SerialName("fixedTextSize") var fixedTextSize: Float?, // in sp + @Px @JsonProperty("edgeSize") @SerialName("edgeSize") var edgeSize: Float? = null, + @JsonProperty("removeCaptions") @SerialName("removeCaptions") var removeCaptions: Boolean = false, + @JsonProperty("removeBloat") @SerialName("removeBloat") var removeBloat: Boolean = true, + /** Apply caps lock to the text */ + @JsonProperty("upperCase") @SerialName("upperCase") var upperCase: Boolean = false, + /** Apply bold to the text */ + @JsonProperty("bold") @SerialName("bold") var bold: Boolean = false, + /** Apply italic to the text */ + @JsonProperty("italic") @SerialName("italic") var italic: Boolean = false, + /** in px, background radius, aka how round the background (backgroundColor) on each row is */ + @JsonProperty("backgroundRadius") @SerialName("backgroundRadius") var backgroundRadius: Float? = null, /** The SSA_ALIGNMENT */ - @JsonProperty("alignment") var alignment: Int? = null, + @JsonProperty("alignment") @SerialName("alignment") var alignment: Int? = null, ) const val DEF_SUBS_ELEVATION = 20