Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import android.widget.Toast
import androidx.annotation.OptIn
import androidx.media3.common.text.Cue
import androidx.media3.common.util.UnstableApi
import com.fasterxml.jackson.annotation.JsonProperty
import com.google.android.gms.cast.TextTrackStyle.EDGE_TYPE_DEPRESSED
import com.google.android.gms.cast.TextTrackStyle.EDGE_TYPE_DROP_SHADOW
import com.google.android.gms.cast.TextTrackStyle.EDGE_TYPE_NONE
Expand All @@ -38,18 +37,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,
@SerialName("fontFamily") var fontFamily: String? = null,
@SerialName("fontGenericFamily") var fontGenericFamily: Int? = null,
@SerialName("backgroundColor") var backgroundColor: Int = 0x00FFFFFF, // transparent
@SerialName("edgeColor") var edgeColor: Int = Color.BLACK, // BLACK
@SerialName("edgeType") var edgeType: Int = EDGE_TYPE_OUTLINE,
@SerialName("foregroundColor") var foregroundColor: Int = Color.WHITE,
@SerialName("fontScale") var fontScale: Float = 1.05f,
@SerialName("windowColor") var windowColor: Int = Color.TRANSPARENT,
)

class ChromecastSubtitlesFragment : BaseFragment<ChromecastSubtitleSettingsBinding>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import androidx.media3.common.util.UnstableApi
import androidx.media3.ui.CaptionStyleCompat
import androidx.media3.ui.SubtitleView
import androidx.preference.PreferenceManager
import com.fasterxml.jackson.annotation.JsonProperty
import com.jaredrummler.android.colorpicker.ColorPickerDialog
import com.lagradost.cloudstream3.CloudStreamApp.Companion.getKey
import com.lagradost.cloudstream3.CloudStreamApp.Companion.setKey
Expand Down Expand Up @@ -54,40 +53,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,
@SerialName("foregroundColor") var foregroundColor: Int,
@SerialName("backgroundColor") var backgroundColor: Int,
@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,
@SerialName("edgeType") var edgeType: @CaptionStyleCompat.EdgeType Int,
@SerialName("edgeColor") var edgeColor: Int,
@FontRes @SerialName("typeface") var typeface: Int?,
@SerialName("typefaceFilePath") var typefaceFilePath: String?,
@SerialName("elevation") var elevation: Int, // in dp
@SerialName("fixedTextSize") var fixedTextSize: Float?, // in sp
@Px @SerialName("edgeSize") var edgeSize: Float? = null,
@SerialName("removeCaptions") var removeCaptions: Boolean = false,
@SerialName("removeBloat") var removeBloat: Boolean = true,
/** Apply caps lock to the text */
@SerialName("upperCase") var upperCase: Boolean = false,
/** Apply bold to the text */
@SerialName("bold") var bold: Boolean = false,
/** Apply italic to the text */
@SerialName("italic") var italic: Boolean = false,
/** in px, background radius, aka how round the background (backgroundColor) on each row is */
@SerialName("backgroundRadius") var backgroundRadius: Float? = null,
/** The SSA_ALIGNMENT */
@JsonProperty("alignment") var alignment: Int? = null,
@SerialName("alignment") var alignment: Int? = null,
)

const val DEF_SUBS_ELEVATION = 20
Expand Down