feat(subtitles): color picker. Clear data after this. (#547)
* feat(subtitle): custom color picker * can't have two of the same buttons smh * It was a misinput * Too much
This commit is contained in:
parent
01a64c25fd
commit
6f1bb10dec
5 changed files with 286 additions and 413 deletions
|
@ -327,36 +327,10 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
|||
}
|
||||
|
||||
private fun setupSubFormatting(playerView: PlayerView) {
|
||||
val primaryColor = when (PrefManager.getVal<Int>(PrefName.PrimaryColor)) {
|
||||
0 -> Color.BLACK
|
||||
1 -> Color.DKGRAY
|
||||
2 -> Color.GRAY
|
||||
3 -> Color.LTGRAY
|
||||
4 -> Color.WHITE
|
||||
5 -> Color.RED
|
||||
6 -> Color.YELLOW
|
||||
7 -> Color.GREEN
|
||||
8 -> Color.CYAN
|
||||
9 -> Color.BLUE
|
||||
10 -> Color.MAGENTA
|
||||
11 -> Color.TRANSPARENT
|
||||
else -> Color.WHITE
|
||||
}
|
||||
val secondaryColor = when (PrefManager.getVal<Int>(PrefName.SecondaryColor)) {
|
||||
0 -> Color.BLACK
|
||||
1 -> Color.DKGRAY
|
||||
2 -> Color.GRAY
|
||||
3 -> Color.LTGRAY
|
||||
4 -> Color.WHITE
|
||||
5 -> Color.RED
|
||||
6 -> Color.YELLOW
|
||||
7 -> Color.GREEN
|
||||
8 -> Color.CYAN
|
||||
9 -> Color.BLUE
|
||||
10 -> Color.MAGENTA
|
||||
11 -> Color.TRANSPARENT
|
||||
else -> Color.BLACK
|
||||
}
|
||||
val primaryColor = PrefManager.getVal<Int>(PrefName.PrimaryColor)
|
||||
|
||||
val secondaryColor = PrefManager.getVal<Int>(PrefName.SecondaryColor)
|
||||
|
||||
val outline = when (PrefManager.getVal<Int>(PrefName.Outline)) {
|
||||
0 -> EDGE_TYPE_OUTLINE // Normal
|
||||
1 -> EDGE_TYPE_DEPRESSED // Shine
|
||||
|
@ -364,36 +338,11 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
|||
3 -> EDGE_TYPE_NONE // No outline
|
||||
else -> EDGE_TYPE_OUTLINE // Normal
|
||||
}
|
||||
val subBackground = when (PrefManager.getVal<Int>(PrefName.SubBackground)) {
|
||||
0 -> Color.TRANSPARENT
|
||||
1 -> Color.BLACK
|
||||
2 -> Color.DKGRAY
|
||||
3 -> Color.GRAY
|
||||
4 -> Color.LTGRAY
|
||||
5 -> Color.WHITE
|
||||
6 -> Color.RED
|
||||
7 -> Color.YELLOW
|
||||
8 -> Color.GREEN
|
||||
9 -> Color.CYAN
|
||||
10 -> Color.BLUE
|
||||
11 -> Color.MAGENTA
|
||||
else -> Color.TRANSPARENT
|
||||
}
|
||||
val subWindow = when (PrefManager.getVal<Int>(PrefName.SubWindow)) {
|
||||
0 -> Color.TRANSPARENT
|
||||
1 -> Color.BLACK
|
||||
2 -> Color.DKGRAY
|
||||
3 -> Color.GRAY
|
||||
4 -> Color.LTGRAY
|
||||
5 -> Color.WHITE
|
||||
6 -> Color.RED
|
||||
7 -> Color.YELLOW
|
||||
8 -> Color.GREEN
|
||||
9 -> Color.CYAN
|
||||
10 -> Color.BLUE
|
||||
11 -> Color.MAGENTA
|
||||
else -> Color.TRANSPARENT
|
||||
}
|
||||
|
||||
val subBackground = PrefManager.getVal<Int>(PrefName.SubBackground)
|
||||
|
||||
val subWindow = PrefManager.getVal<Int>(PrefName.SubWindow)
|
||||
|
||||
val font = when (PrefManager.getVal<Int>(PrefName.Font)) {
|
||||
0 -> ResourcesCompat.getFont(this, R.font.poppins_semi_bold)
|
||||
1 -> ResourcesCompat.getFont(this, R.font.poppins_bold)
|
||||
|
@ -432,37 +381,15 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
|||
}
|
||||
|
||||
private fun applySubtitleStyles(textView: Xubtitle) {
|
||||
val primaryColor = when (PrefManager.getVal<Int>(PrefName.PrimaryColor)) {
|
||||
0 -> Color.BLACK
|
||||
1 -> Color.DKGRAY
|
||||
2 -> Color.GRAY
|
||||
3 -> Color.LTGRAY
|
||||
4 -> Color.WHITE
|
||||
5 -> Color.RED
|
||||
6 -> Color.YELLOW
|
||||
7 -> Color.GREEN
|
||||
8 -> Color.CYAN
|
||||
9 -> Color.BLUE
|
||||
10 -> Color.MAGENTA
|
||||
11 -> Color.TRANSPARENT
|
||||
else -> Color.WHITE
|
||||
}
|
||||
val primaryColor = PrefManager.getVal<Int>(PrefName.PrimaryColor)
|
||||
|
||||
val subBackground = when (PrefManager.getVal<Int>(PrefName.SubBackground)) {
|
||||
0 -> Color.TRANSPARENT
|
||||
1 -> Color.BLACK
|
||||
2 -> Color.DKGRAY
|
||||
3 -> Color.GRAY
|
||||
4 -> Color.LTGRAY
|
||||
5 -> Color.WHITE
|
||||
6 -> Color.RED
|
||||
7 -> Color.YELLOW
|
||||
8 -> Color.GREEN
|
||||
9 -> Color.CYAN
|
||||
10 -> Color.BLUE
|
||||
11 -> Color.MAGENTA
|
||||
else -> Color.TRANSPARENT
|
||||
}
|
||||
val subBackground = PrefManager.getVal<Int>(PrefName.SubBackground)
|
||||
|
||||
val secondaryColor = PrefManager.getVal<Int>(PrefName.SecondaryColor)
|
||||
|
||||
val subStroke = PrefManager.getVal<Float>(PrefName.SubStroke)
|
||||
|
||||
val fontSize = PrefManager.getVal<Int>(PrefName.FontSize).toFloat()
|
||||
|
||||
val font = when (PrefManager.getVal<Int>(PrefName.Font)) {
|
||||
0 -> ResourcesCompat.getFont(this, R.font.poppins_semi_bold)
|
||||
|
@ -475,31 +402,11 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
|||
else -> ResourcesCompat.getFont(this, R.font.poppins_semi_bold)
|
||||
}
|
||||
|
||||
val fontSize = PrefManager.getVal<Int>(PrefName.FontSize).toFloat()
|
||||
|
||||
textView.setBackgroundColor(subBackground)
|
||||
textView.setTextColor(primaryColor)
|
||||
textView.typeface = font
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize)
|
||||
|
||||
val secondaryColor = when (PrefManager.getVal<Int>(PrefName.SecondaryColor)) {
|
||||
0 -> Color.BLACK
|
||||
1 -> Color.DKGRAY
|
||||
2 -> Color.GRAY
|
||||
3 -> Color.LTGRAY
|
||||
4 -> Color.WHITE
|
||||
5 -> Color.RED
|
||||
6 -> Color.YELLOW
|
||||
7 -> Color.GREEN
|
||||
8 -> Color.CYAN
|
||||
9 -> Color.BLUE
|
||||
10 -> Color.MAGENTA
|
||||
11 -> Color.TRANSPARENT
|
||||
else -> Color.BLACK
|
||||
}
|
||||
|
||||
val subStroke = PrefManager.getVal<Float>(PrefName.SubStroke)
|
||||
|
||||
textView.apply {
|
||||
when (PrefManager.getVal<Int>(PrefName.Outline)) {
|
||||
0 -> applyOutline(secondaryColor, subStroke)
|
||||
|
@ -516,7 +423,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
|||
false -> 0f
|
||||
}
|
||||
|
||||
val textElevation = PrefManager.getVal<Float>(PrefName.SubBottomMargin) / 30 * resources.displayMetrics.heightPixels
|
||||
val textElevation = PrefManager.getVal<Float>(PrefName.SubBottomMargin) / 50 * resources.displayMetrics.heightPixels
|
||||
textView.translationY = -textElevation
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package ani.dantotsu.settings
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.app.Dialog
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.util.TypedValue
|
||||
|
@ -31,9 +28,19 @@ import ani.dantotsu.themes.ThemeManager
|
|||
import ani.dantotsu.toast
|
||||
import ani.dantotsu.util.customAlertDialog
|
||||
import com.google.android.material.slider.Slider.OnChangeListener
|
||||
import eltos.simpledialogfragment.SimpleDialog
|
||||
import eltos.simpledialogfragment.color.SimpleColorWheelDialog
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class PlayerSettingsActivity : AppCompatActivity() {
|
||||
class PlayerSettingsActivity :
|
||||
AppCompatActivity(),
|
||||
SimpleDialog.OnDialogResultListener {
|
||||
interface ColorPickerCallback {
|
||||
fun onColorSelected(color: Int)
|
||||
}
|
||||
|
||||
private var colorPickerCallback: ColorPickerCallback? = null
|
||||
|
||||
lateinit var binding: ActivityPlayerSettingsBinding
|
||||
private val player = "player_settings"
|
||||
|
||||
|
@ -41,9 +48,12 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
var subtitle: Subtitle? = null
|
||||
|
||||
private val Int.toSP
|
||||
get() = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_SP, this.toFloat(), Resources.getSystem().displayMetrics
|
||||
)
|
||||
get() =
|
||||
TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_SP,
|
||||
this.toFloat(),
|
||||
Resources.getSystem().displayMetrics,
|
||||
)
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -70,12 +80,11 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
bottomMargin = navBarHeight
|
||||
}
|
||||
|
||||
|
||||
binding.playerSettingsBack.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
}
|
||||
|
||||
//Video
|
||||
// Video
|
||||
|
||||
val speeds =
|
||||
arrayOf(
|
||||
|
@ -91,7 +100,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
1.5f,
|
||||
1.66f,
|
||||
1.75f,
|
||||
2f
|
||||
2f,
|
||||
)
|
||||
val cursedSpeeds = arrayOf(1f, 1.25f, 1.5f, 1.75f, 2f, 2.5f, 3f, 4f, 5f, 10f, 25f, 50f)
|
||||
var curSpeedArr = if (PrefManager.getVal(PrefName.CursedSpeeds)) cursedSpeeds else speeds
|
||||
|
@ -99,14 +108,14 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
binding.playerSettingsSpeed.text =
|
||||
getString(
|
||||
R.string.default_playback_speed,
|
||||
speedsName[PrefManager.getVal(PrefName.DefaultSpeed)]
|
||||
speedsName[PrefManager.getVal(PrefName.DefaultSpeed)],
|
||||
)
|
||||
binding.playerSettingsSpeed.setOnClickListener {
|
||||
customAlertDialog().apply {
|
||||
setTitle(getString(R.string.default_speed))
|
||||
singleChoiceItems(
|
||||
speedsName,
|
||||
PrefManager.getVal(PrefName.DefaultSpeed)
|
||||
PrefManager.getVal(PrefName.DefaultSpeed),
|
||||
) { i ->
|
||||
PrefManager.setVal(PrefName.DefaultSpeed, i)
|
||||
binding.playerSettingsSpeed.text =
|
||||
|
@ -126,11 +135,10 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
binding.playerSettingsSpeed.text =
|
||||
getString(
|
||||
R.string.default_playback_speed,
|
||||
speedsName[PrefManager.getVal(PrefName.DefaultSpeed)]
|
||||
speedsName[PrefManager.getVal(PrefName.DefaultSpeed)],
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
// Time Stamp
|
||||
binding.playerSettingsTimeStamps.isChecked = PrefManager.getVal(PrefName.TimeStampsEnabled)
|
||||
binding.playerSettingsTimeStamps.setOnCheckedChangeListener { _, isChecked ->
|
||||
|
@ -182,7 +190,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
PrefManager.setVal(PrefName.AutoSkipFiller, isChecked)
|
||||
}
|
||||
|
||||
//Update Progress
|
||||
// Update Progress
|
||||
binding.playerSettingsAskUpdateProgress.isChecked =
|
||||
PrefManager.getVal(PrefName.AskIndividualPlayer)
|
||||
binding.playerSettingsAskUpdateProgress.setOnCheckedChangeListener { _, isChecked ->
|
||||
|
@ -208,7 +216,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
PrefManager.setVal(PrefName.WatchPercentage, value / 100)
|
||||
}
|
||||
|
||||
//Behaviour
|
||||
// Behaviour
|
||||
binding.playerSettingsAlwaysContinue.isChecked = PrefManager.getVal(PrefName.AlwaysContinue)
|
||||
binding.playerSettingsAlwaysContinue.setOnCheckedChangeListener { _, isChecked ->
|
||||
PrefManager.setVal(PrefName.AlwaysContinue, isChecked)
|
||||
|
@ -245,13 +253,16 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
false
|
||||
}
|
||||
binding.exoSkipTime.addTextChangedListener {
|
||||
val time = binding.exoSkipTime.text.toString().toIntOrNull()
|
||||
val time =
|
||||
binding.exoSkipTime.text
|
||||
.toString()
|
||||
.toIntOrNull()
|
||||
if (time != null) {
|
||||
PrefManager.setVal(PrefName.SkipTime, time)
|
||||
}
|
||||
}
|
||||
|
||||
//Other
|
||||
// Other
|
||||
binding.playerSettingsPiP.apply {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
visibility = View.VISIBLE
|
||||
|
@ -259,7 +270,9 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
setOnCheckedChangeListener { _, isChecked ->
|
||||
PrefManager.setVal(PrefName.Pip, isChecked)
|
||||
}
|
||||
} else visibility = View.GONE
|
||||
} else {
|
||||
visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
binding.playerSettingsCast.isChecked = PrefManager.getVal(PrefName.Cast)
|
||||
|
@ -288,7 +301,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
setTitle(getString(R.string.default_resize_mode))
|
||||
singleChoiceItems(
|
||||
resizeModes,
|
||||
PrefManager.getVal<Int>(PrefName.Resize)
|
||||
PrefManager.getVal<Int>(PrefName.Resize),
|
||||
) { count ->
|
||||
PrefManager.setVal(PrefName.Resize, count)
|
||||
}
|
||||
|
@ -310,13 +323,14 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
binding.subtitleFontSizeText,
|
||||
binding.subtitleFontSize,
|
||||
binding.videoSubLanguage,
|
||||
binding.subTextSwitch
|
||||
binding.subTextSwitch,
|
||||
).forEach {
|
||||
it.isEnabled = isChecked
|
||||
it.alpha = when (isChecked) {
|
||||
true -> 1f
|
||||
false -> 0.5f
|
||||
}
|
||||
it.alpha =
|
||||
when (isChecked) {
|
||||
true -> 1f
|
||||
false -> 0.5f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -325,13 +339,14 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
binding.videoSubStrokeButton,
|
||||
binding.videoSubStroke,
|
||||
binding.videoSubBottomMarginButton,
|
||||
binding.videoSubBottomMargin
|
||||
binding.videoSubBottomMargin,
|
||||
).forEach {
|
||||
it.isEnabled = isChecked
|
||||
it.alpha = when (isChecked) {
|
||||
true -> 1f
|
||||
false -> 0.5f
|
||||
}
|
||||
it.alpha =
|
||||
when (isChecked) {
|
||||
true -> 1f
|
||||
false -> 0.5f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,122 +365,100 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
}
|
||||
toggleExpSubOptions(binding.subTextSwitch.isChecked)
|
||||
|
||||
val subLanguages = arrayOf(
|
||||
"Albanian",
|
||||
"Arabic",
|
||||
"Bosnian",
|
||||
"Bulgarian",
|
||||
"Chinese",
|
||||
"Croatian",
|
||||
"Czech",
|
||||
"Danish",
|
||||
"Dutch",
|
||||
"English",
|
||||
"Estonian",
|
||||
"Finnish",
|
||||
"French",
|
||||
"Georgian",
|
||||
"German",
|
||||
"Greek",
|
||||
"Hebrew",
|
||||
"Hindi",
|
||||
"Indonesian",
|
||||
"Irish",
|
||||
"Italian",
|
||||
"Japanese",
|
||||
"Korean",
|
||||
"Lithuanian",
|
||||
"Luxembourgish",
|
||||
"Macedonian",
|
||||
"Mongolian",
|
||||
"Norwegian",
|
||||
"Polish",
|
||||
"Portuguese",
|
||||
"Punjabi",
|
||||
"Romanian",
|
||||
"Russian",
|
||||
"Serbian",
|
||||
"Slovak",
|
||||
"Slovenian",
|
||||
"Spanish",
|
||||
"Turkish",
|
||||
"Ukrainian",
|
||||
"Urdu",
|
||||
"Vietnamese",
|
||||
)
|
||||
val subLanguages =
|
||||
arrayOf(
|
||||
"Albanian",
|
||||
"Arabic",
|
||||
"Bosnian",
|
||||
"Bulgarian",
|
||||
"Chinese",
|
||||
"Croatian",
|
||||
"Czech",
|
||||
"Danish",
|
||||
"Dutch",
|
||||
"English",
|
||||
"Estonian",
|
||||
"Finnish",
|
||||
"French",
|
||||
"Georgian",
|
||||
"German",
|
||||
"Greek",
|
||||
"Hebrew",
|
||||
"Hindi",
|
||||
"Indonesian",
|
||||
"Irish",
|
||||
"Italian",
|
||||
"Japanese",
|
||||
"Korean",
|
||||
"Lithuanian",
|
||||
"Luxembourgish",
|
||||
"Macedonian",
|
||||
"Mongolian",
|
||||
"Norwegian",
|
||||
"Polish",
|
||||
"Portuguese",
|
||||
"Punjabi",
|
||||
"Romanian",
|
||||
"Russian",
|
||||
"Serbian",
|
||||
"Slovak",
|
||||
"Slovenian",
|
||||
"Spanish",
|
||||
"Turkish",
|
||||
"Ukrainian",
|
||||
"Urdu",
|
||||
"Vietnamese",
|
||||
)
|
||||
binding.videoSubLanguage.setOnClickListener {
|
||||
customAlertDialog().apply {
|
||||
setTitle(getString(R.string.subtitle_langauge))
|
||||
singleChoiceItems(
|
||||
subLanguages,
|
||||
PrefManager.getVal(PrefName.SubLanguage)
|
||||
PrefManager.getVal(PrefName.SubLanguage),
|
||||
) { count ->
|
||||
PrefManager.setVal(PrefName.SubLanguage, count)
|
||||
PrefManager.setVal(PrefName.SubLanguage, count)
|
||||
}
|
||||
show()
|
||||
}
|
||||
}
|
||||
val colorsPrimary =
|
||||
arrayOf(
|
||||
"Black",
|
||||
"Dark Gray",
|
||||
"Gray",
|
||||
"Light Gray",
|
||||
"White",
|
||||
"Red",
|
||||
"Yellow",
|
||||
"Green",
|
||||
"Cyan",
|
||||
"Blue",
|
||||
"Magenta"
|
||||
)
|
||||
|
||||
binding.videoSubColorPrimary.setOnClickListener {
|
||||
customAlertDialog().apply {
|
||||
setTitle(getString(R.string.primary_sub_color))
|
||||
singleChoiceItems(
|
||||
colorsPrimary,
|
||||
PrefManager.getVal(PrefName.PrimaryColor)
|
||||
) { count ->
|
||||
PrefManager.setVal(PrefName.PrimaryColor, count)
|
||||
updateSubPreview()
|
||||
}
|
||||
show()
|
||||
}
|
||||
val color = PrefManager.getVal<Int>(PrefName.PrimaryColor)
|
||||
val title = getString(R.string.primary_sub_color)
|
||||
showColorPicker(
|
||||
color,
|
||||
title,
|
||||
object : ColorPickerCallback {
|
||||
override fun onColorSelected(color: Int) {
|
||||
PrefManager.setVal(PrefName.PrimaryColor, color)
|
||||
updateSubPreview()
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
val colorsSecondary = arrayOf(
|
||||
"Black",
|
||||
"Dark Gray",
|
||||
"Gray",
|
||||
"Light Gray",
|
||||
"White",
|
||||
"Red",
|
||||
"Yellow",
|
||||
"Green",
|
||||
"Cyan",
|
||||
"Blue",
|
||||
"Magenta",
|
||||
"Transparent"
|
||||
)
|
||||
|
||||
binding.videoSubColorSecondary.setOnClickListener {
|
||||
customAlertDialog().apply {
|
||||
setTitle(getString(R.string.outline_sub_color))
|
||||
singleChoiceItems(
|
||||
colorsSecondary,
|
||||
PrefManager.getVal(PrefName.SecondaryColor)
|
||||
) { count ->
|
||||
PrefManager.setVal(PrefName.SecondaryColor, count)
|
||||
updateSubPreview()
|
||||
}
|
||||
show()
|
||||
}
|
||||
val color = PrefManager.getVal<Int>(PrefName.SecondaryColor)
|
||||
val title = getString(R.string.outline_sub_color)
|
||||
showColorPicker(
|
||||
color,
|
||||
title,
|
||||
object : ColorPickerCallback {
|
||||
override fun onColorSelected(color: Int) {
|
||||
PrefManager.setVal(PrefName.SecondaryColor, color)
|
||||
updateSubPreview()
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
val typesOutline = arrayOf("Outline", "Shine", "Drop Shadow", "None")
|
||||
binding.videoSubOutline.setOnClickListener {
|
||||
customAlertDialog().apply {
|
||||
setTitle(getString(R.string.outline_type))
|
||||
singleChoiceItems(
|
||||
typesOutline,
|
||||
PrefManager.getVal(PrefName.Outline)
|
||||
PrefManager.getVal(PrefName.Outline),
|
||||
) { count ->
|
||||
PrefManager.setVal(PrefName.Outline, count)
|
||||
updateSubPreview()
|
||||
|
@ -473,101 +466,83 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
show()
|
||||
}
|
||||
}
|
||||
val colorsSubBackground = arrayOf(
|
||||
"Transparent",
|
||||
"Black",
|
||||
"Dark Gray",
|
||||
"Gray",
|
||||
"Light Gray",
|
||||
"White",
|
||||
"Red",
|
||||
"Yellow",
|
||||
"Green",
|
||||
"Cyan",
|
||||
"Blue",
|
||||
"Magenta"
|
||||
)
|
||||
|
||||
binding.videoSubColorBackground.setOnClickListener {
|
||||
customAlertDialog().apply {
|
||||
setTitle(getString(R.string.sub_background_color_select))
|
||||
singleChoiceItems(
|
||||
colorsSubBackground,
|
||||
PrefManager.getVal(PrefName.SubBackground)
|
||||
) { count ->
|
||||
PrefManager.setVal(PrefName.SubBackground, count)
|
||||
updateSubPreview()
|
||||
}
|
||||
show()
|
||||
}
|
||||
val color = PrefManager.getVal<Int>(PrefName.SubBackground)
|
||||
val title = getString(R.string.sub_background_color_select)
|
||||
showColorPicker(
|
||||
color,
|
||||
title,
|
||||
object : ColorPickerCallback {
|
||||
override fun onColorSelected(color: Int) {
|
||||
PrefManager.setVal(PrefName.SubBackground, color)
|
||||
updateSubPreview()
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
val colorsSubWindow = arrayOf(
|
||||
"Transparent",
|
||||
"Black",
|
||||
"Dark Gray",
|
||||
"Gray",
|
||||
"Light Gray",
|
||||
"White",
|
||||
"Red",
|
||||
"Yellow",
|
||||
"Green",
|
||||
"Cyan",
|
||||
"Blue",
|
||||
"Magenta"
|
||||
)
|
||||
binding.videoSubColorWindow.setOnClickListener {
|
||||
customAlertDialog().apply {
|
||||
setTitle(getString(R.string.sub_window_color_select))
|
||||
singleChoiceItems(
|
||||
colorsSubWindow,
|
||||
PrefManager.getVal(PrefName.SubWindow)
|
||||
) { count ->
|
||||
PrefManager.setVal(PrefName.SubWindow, count)
|
||||
updateSubPreview()
|
||||
}
|
||||
show()
|
||||
}
|
||||
val color = PrefManager.getVal<Int>(PrefName.SubWindow)
|
||||
val title = getString(R.string.sub_window_color_select)
|
||||
showColorPicker(
|
||||
color,
|
||||
title,
|
||||
object : ColorPickerCallback {
|
||||
override fun onColorSelected(color: Int) {
|
||||
PrefManager.setVal(PrefName.SubWindow, color)
|
||||
updateSubPreview()
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
binding.videoSubAlpha.value = PrefManager.getVal(PrefName.SubAlpha)
|
||||
binding.videoSubAlpha.addOnChangeListener(OnChangeListener { _, value, fromUser ->
|
||||
if (fromUser) {
|
||||
PrefManager.setVal(PrefName.SubAlpha, value)
|
||||
updateSubPreview()
|
||||
}
|
||||
})
|
||||
binding.videoSubAlpha.addOnChangeListener(
|
||||
OnChangeListener { _, value, fromUser ->
|
||||
if (fromUser) {
|
||||
PrefManager.setVal(PrefName.SubAlpha, value)
|
||||
updateSubPreview()
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
binding.videoSubStroke.value = PrefManager.getVal(PrefName.SubStroke)
|
||||
binding.videoSubStroke.addOnChangeListener(OnChangeListener { _, value, fromUser ->
|
||||
if (fromUser) {
|
||||
PrefManager.setVal(PrefName.SubStroke, value)
|
||||
updateSubPreview()
|
||||
}
|
||||
})
|
||||
binding.videoSubStroke.addOnChangeListener(
|
||||
OnChangeListener { _, value, fromUser ->
|
||||
if (fromUser) {
|
||||
PrefManager.setVal(PrefName.SubStroke, value)
|
||||
updateSubPreview()
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
binding.videoSubBottomMargin.value = PrefManager.getVal(PrefName.SubBottomMargin)
|
||||
binding.videoSubBottomMargin.addOnChangeListener(OnChangeListener { _, value, fromUser ->
|
||||
if (fromUser) {
|
||||
PrefManager.setVal(PrefName.SubBottomMargin, value)
|
||||
updateSubPreview()
|
||||
}
|
||||
})
|
||||
|
||||
val fonts = arrayOf(
|
||||
"Poppins Semi Bold",
|
||||
"Poppins Bold",
|
||||
"Poppins",
|
||||
"Poppins Thin",
|
||||
"Century Gothic",
|
||||
"Levenim MT Bold",
|
||||
"Blocky"
|
||||
binding.videoSubBottomMargin.addOnChangeListener(
|
||||
OnChangeListener { _, value, fromUser ->
|
||||
if (fromUser) {
|
||||
PrefManager.setVal(PrefName.SubBottomMargin, value)
|
||||
updateSubPreview()
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
val fonts =
|
||||
arrayOf(
|
||||
"Poppins Semi Bold",
|
||||
"Poppins Bold",
|
||||
"Poppins",
|
||||
"Poppins Thin",
|
||||
"Century Gothic",
|
||||
"Levenim MT Bold",
|
||||
"Blocky",
|
||||
)
|
||||
binding.videoSubFont.setOnClickListener {
|
||||
customAlertDialog().apply {
|
||||
setTitle(getString(R.string.subtitle_font))
|
||||
singleChoiceItems(
|
||||
fonts,
|
||||
PrefManager.getVal(PrefName.Font)
|
||||
PrefManager.getVal(PrefName.Font),
|
||||
) { count ->
|
||||
PrefManager.setVal(PrefName.Font, count)
|
||||
updateSubPreview()
|
||||
|
@ -583,89 +558,80 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
false
|
||||
}
|
||||
binding.subtitleFontSize.addTextChangedListener {
|
||||
val size = binding.subtitleFontSize.text.toString().toIntOrNull()
|
||||
val size =
|
||||
binding.subtitleFontSize.text
|
||||
.toString()
|
||||
.toIntOrNull()
|
||||
if (size != null) {
|
||||
PrefManager.setVal(PrefName.FontSize, size)
|
||||
updateSubPreview()
|
||||
}
|
||||
}
|
||||
binding.subtitleTest.addOnChangeListener(object : Xpandable.OnChangeListener {
|
||||
override fun onExpand() {
|
||||
updateSubPreview()
|
||||
}
|
||||
binding.subtitleTest.addOnChangeListener(
|
||||
object : Xpandable.OnChangeListener {
|
||||
override fun onExpand() {
|
||||
updateSubPreview()
|
||||
}
|
||||
|
||||
override fun onRetract() {}
|
||||
})
|
||||
override fun onRetract() {}
|
||||
},
|
||||
)
|
||||
updateSubPreview()
|
||||
}
|
||||
|
||||
private fun showColorPicker(
|
||||
originalColor: Int,
|
||||
title: String,
|
||||
callback: ColorPickerCallback,
|
||||
) {
|
||||
colorPickerCallback = callback
|
||||
|
||||
SimpleColorWheelDialog()
|
||||
.title(title)
|
||||
.color(originalColor)
|
||||
.alpha(true)
|
||||
.neg()
|
||||
.theme(R.style.MyPopup)
|
||||
.show(this, "colorPicker")
|
||||
}
|
||||
|
||||
override fun onResult(
|
||||
dialogTag: String,
|
||||
which: Int,
|
||||
extras: Bundle,
|
||||
): Boolean {
|
||||
if (dialogTag == "colorPicker" && which == SimpleDialog.OnDialogResultListener.BUTTON_POSITIVE) {
|
||||
val color = extras.getInt(SimpleColorWheelDialog.COLOR)
|
||||
colorPickerCallback?.onColorSelected(color)
|
||||
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun updateSubPreview() {
|
||||
binding.subtitleTestWindow.run {
|
||||
alpha = PrefManager.getVal(PrefName.SubAlpha)
|
||||
setBackgroundColor(
|
||||
when (PrefManager.getVal<Int>(PrefName.SubWindow)) {
|
||||
0 -> Color.TRANSPARENT
|
||||
1 -> Color.BLACK
|
||||
2 -> Color.DKGRAY
|
||||
3 -> Color.GRAY
|
||||
4 -> Color.LTGRAY
|
||||
5 -> Color.WHITE
|
||||
6 -> Color.RED
|
||||
7 -> Color.YELLOW
|
||||
8 -> Color.GREEN
|
||||
9 -> Color.CYAN
|
||||
10 -> Color.BLUE
|
||||
11 -> Color.MAGENTA
|
||||
else -> Color.TRANSPARENT
|
||||
}
|
||||
)
|
||||
setBackgroundColor(PrefManager.getVal(PrefName.SubWindow))
|
||||
}
|
||||
|
||||
binding.subtitleTestText.run {
|
||||
textSize = PrefManager.getVal<Int>(PrefName.FontSize).toSP
|
||||
typeface = when (PrefManager.getVal<Int>(PrefName.Font)) {
|
||||
0 -> ResourcesCompat.getFont(this.context, R.font.poppins_semi_bold)
|
||||
1 -> ResourcesCompat.getFont(this.context, R.font.poppins_bold)
|
||||
2 -> ResourcesCompat.getFont(this.context, R.font.poppins)
|
||||
3 -> ResourcesCompat.getFont(this.context, R.font.poppins_thin)
|
||||
4 -> ResourcesCompat.getFont(this.context, R.font.century_gothic_regular)
|
||||
5 -> ResourcesCompat.getFont(this.context, R.font.levenim_mt_bold)
|
||||
6 -> ResourcesCompat.getFont(this.context, R.font.blocky)
|
||||
else -> ResourcesCompat.getFont(this.context, R.font.poppins_semi_bold)
|
||||
}
|
||||
setTextColor(
|
||||
when (PrefManager.getVal<Int>(PrefName.PrimaryColor)) {
|
||||
0 -> Color.BLACK
|
||||
1 -> Color.DKGRAY
|
||||
2 -> Color.GRAY
|
||||
3 -> Color.LTGRAY
|
||||
4 -> Color.WHITE
|
||||
5 -> Color.RED
|
||||
6 -> Color.YELLOW
|
||||
7 -> Color.GREEN
|
||||
8 -> Color.CYAN
|
||||
9 -> Color.BLUE
|
||||
10 -> Color.MAGENTA
|
||||
11 -> Color.TRANSPARENT
|
||||
else -> Color.WHITE
|
||||
typeface =
|
||||
when (PrefManager.getVal<Int>(PrefName.Font)) {
|
||||
0 -> ResourcesCompat.getFont(this.context, R.font.poppins_semi_bold)
|
||||
1 -> ResourcesCompat.getFont(this.context, R.font.poppins_bold)
|
||||
2 -> ResourcesCompat.getFont(this.context, R.font.poppins)
|
||||
3 -> ResourcesCompat.getFont(this.context, R.font.poppins_thin)
|
||||
4 -> ResourcesCompat.getFont(this.context, R.font.century_gothic_regular)
|
||||
5 -> ResourcesCompat.getFont(this.context, R.font.levenim_mt_bold)
|
||||
6 -> ResourcesCompat.getFont(this.context, R.font.blocky)
|
||||
else -> ResourcesCompat.getFont(this.context, R.font.poppins_semi_bold)
|
||||
}
|
||||
)
|
||||
setBackgroundColor(
|
||||
when (PrefManager.getVal<Int>(PrefName.SubBackground)) {
|
||||
0 -> Color.TRANSPARENT
|
||||
1 -> Color.BLACK
|
||||
2 -> Color.DKGRAY
|
||||
3 -> Color.GRAY
|
||||
4 -> Color.LTGRAY
|
||||
5 -> Color.WHITE
|
||||
6 -> Color.RED
|
||||
7 -> Color.YELLOW
|
||||
8 -> Color.GREEN
|
||||
9 -> Color.CYAN
|
||||
10 -> Color.BLUE
|
||||
11 -> Color.MAGENTA
|
||||
else -> Color.TRANSPARENT
|
||||
}
|
||||
)
|
||||
|
||||
setTextColor(PrefManager.getVal<Int>(PrefName.PrimaryColor))
|
||||
|
||||
setBackgroundColor(PrefManager.getVal<Int>(PrefName.SubBackground))
|
||||
}
|
||||
}
|
||||
}
|
|
@ -96,14 +96,14 @@ enum class PrefName(val data: Pref) { //TODO: Split this into multiple files
|
|||
Subtitles(Pref(Location.Player, Boolean::class, true)),
|
||||
TextviewSubtitles(Pref(Location.Player, Boolean::class, false)),
|
||||
SubLanguage(Pref(Location.Player, Int::class, 9)),
|
||||
PrimaryColor(Pref(Location.Player, Int::class, 4)),
|
||||
SecondaryColor(Pref(Location.Player, Int::class, 0)),
|
||||
PrimaryColor(Pref(Location.Player, Int::class, Color.WHITE)),
|
||||
SecondaryColor(Pref(Location.Player, Int::class, Color.BLACK)),
|
||||
Outline(Pref(Location.Player, Int::class, 0)),
|
||||
SubBackground(Pref(Location.Player, Int::class, 0)),
|
||||
SubWindow(Pref(Location.Player, Int::class, 0)),
|
||||
SubBackground(Pref(Location.Player, Int::class, Color.TRANSPARENT)),
|
||||
SubWindow(Pref(Location.Player, Int::class, Color.TRANSPARENT)),
|
||||
SubAlpha(Pref(Location.Player, Float::class, 1f)),
|
||||
SubStroke(Pref(Location.Player, Float::class, 8f)),
|
||||
SubBottomMargin(Pref(Location.Player, Float::class, 4f)),
|
||||
SubBottomMargin(Pref(Location.Player, Float::class, 1f)),
|
||||
Font(Pref(Location.Player, Int::class, 0)),
|
||||
FontSize(Pref(Location.Player, Int::class, 20)),
|
||||
Locale(Pref(Location.Player, Int::class, 2)),
|
||||
|
|
|
@ -225,25 +225,6 @@
|
|||
app:showText="false"
|
||||
app:thumbTint="@color/button_switch_track" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/videoSubLanguage"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:insetTop="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:paddingHorizontal="32dp"
|
||||
android:text="@string/subtitle_langauge"
|
||||
android:textAlignment="viewStart"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/bg_opp"
|
||||
app:cornerRadius="0dp"
|
||||
app:icon="@drawable/ic_round_subtitles_24"
|
||||
app:iconPadding="16dp"
|
||||
app:iconSize="24dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/videoSubColorPrimary"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
|
@ -426,7 +407,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="32dp"
|
||||
android:valueFrom="1"
|
||||
android:valueFrom="0"
|
||||
android:stepSize="1.0"
|
||||
android:valueTo="30">
|
||||
|
||||
|
@ -457,9 +438,9 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="32dp"
|
||||
android:valueFrom="1"
|
||||
android:valueFrom="0"
|
||||
android:stepSize="1.0"
|
||||
android:valueTo="30">
|
||||
android:valueTo="50">
|
||||
|
||||
</com.google.android.material.slider.Slider>
|
||||
|
||||
|
@ -544,6 +525,25 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/videoSubLanguage"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:insetTop="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:paddingHorizontal="32dp"
|
||||
android:text="@string/subtitle_langauge"
|
||||
android:textAlignment="viewStart"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/bg_opp"
|
||||
app:cornerRadius="0dp"
|
||||
app:icon="@drawable/ic_round_subtitles_24"
|
||||
app:iconPadding="16dp"
|
||||
app:iconSize="24dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -1073,7 +1073,7 @@ Non quae tempore quo provident laudantium qui illo dolor vel quia dolor et exerc
|
|||
<string name="private_mode">Private</string>
|
||||
<string name="omega_cursed">you have been Ǫ̴̺̙͎̤̫͓̮̰̿͝M̴͇̤͗́̾̈́̑̍̿̈͌͝Ȅ̴̡̨̛͉̣̙̩̲̣̤̟̪̣̎͗̎̆̒̉͆̆̕ͅͅǴ̸̯̬̗̠̙͛͐̀̈͋̀̈̽́̎̿͘͘͝ͅĀ̶̧̲̀ͅ ̴̢̟͕̜̓̾̓C̶̬̜̰̘̝̱̫͓͙̭̈́͐͋̓̏̈̍̓̀̌̾̚Ư̸̛̤̱̈́͆̽͊͛̐̓́̑͘̕̕͝R̸̨̨͈̬̱̺͕̪̪̘͕͎̂͛́̅̆̓̀͝ͅS̴̨̨̛̩̭̗̹̰̭̥͉̮̝̠̓̔͆̂͊͆̀̈́̅̕͘̚͝È̴̢̛̝͈̳͉͈͒͒̒̄̏̈̈́D̸̢̡̨̜̞̩̼̫̹̗̮͛̀̈̋̾̇̕̕͜ͅ</string>
|
||||
<string name="omega_freed">you have been freed</string>
|
||||
<string name="subtitle_langauge">Subtitle Langauge</string>
|
||||
<string name="subtitle_langauge">Preferred Langauge</string>
|
||||
<string name="socks5">SOCKS5</string>
|
||||
<string name="host">Host</string>
|
||||
<string name="port">Port</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue