mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
subs settings not working :(
This commit is contained in:
parent
e59b26cb0e
commit
0ec5d166df
16 changed files with 665 additions and 200 deletions
|
@ -91,4 +91,7 @@ dependencies {
|
||||||
annotationProcessor "com.google.auto.service:auto-service:1.0"
|
annotationProcessor "com.google.auto.service:auto-service:1.0"
|
||||||
//or for kotlin sources (requires kapt gradle plugin):
|
//or for kotlin sources (requires kapt gradle plugin):
|
||||||
kapt "com.google.auto.service:auto-service:1.0"
|
kapt "com.google.auto.service:auto-service:1.0"
|
||||||
|
|
||||||
|
// subtitle color picker
|
||||||
|
implementation 'com.jaredrummler:colorpicker:1.1.0'
|
||||||
}
|
}
|
|
@ -13,6 +13,7 @@ import androidx.navigation.NavOptions
|
||||||
import androidx.navigation.findNavController
|
import androidx.navigation.findNavController
|
||||||
import androidx.navigation.fragment.NavHostFragment
|
import androidx.navigation.fragment.NavHostFragment
|
||||||
import com.google.android.gms.cast.framework.CastButtonFactory
|
import com.google.android.gms.cast.framework.CastButtonFactory
|
||||||
|
import com.jaredrummler.android.colorpicker.ColorPickerDialogListener
|
||||||
import com.lagradost.cloudstream3.APIHolder.apis
|
import com.lagradost.cloudstream3.APIHolder.apis
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.checkWrite
|
import com.lagradost.cloudstream3.utils.UIHelper.checkWrite
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.getResourceColor
|
import com.lagradost.cloudstream3.utils.UIHelper.getResourceColor
|
||||||
|
@ -46,21 +47,23 @@ const val VLC_EXTRA_POSITION_OUT = "extra_position"
|
||||||
const val VLC_EXTRA_DURATION_OUT = "extra_duration"
|
const val VLC_EXTRA_DURATION_OUT = "extra_duration"
|
||||||
const val VLC_LAST_ID_KEY = "vlc_last_open_id"
|
const val VLC_LAST_ID_KEY = "vlc_last_open_id"
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
/*, ViewModelStoreOwner {
|
override fun onColorSelected(dialogId: Int, color: Int) {
|
||||||
private val appViewModelStore: ViewModelStore by lazy {
|
onColorSelectedEvent.invoke(Pair(dialogId, color))
|
||||||
ViewModelStore()
|
}
|
||||||
}
|
|
||||||
|
override fun onDialogDismissed(dialogId: Int) {
|
||||||
|
onDialogDismissedEvent.invoke(dialogId)
|
||||||
|
}
|
||||||
|
|
||||||
override fun getViewModelStore(): ViewModelStore {
|
|
||||||
return appViewModelStore
|
|
||||||
}*/
|
|
||||||
companion object {
|
companion object {
|
||||||
var canEnterPipMode: Boolean = false
|
var canEnterPipMode: Boolean = false
|
||||||
var canShowPipMode: Boolean = false
|
var canShowPipMode: Boolean = false
|
||||||
var isInPIPMode: Boolean = false
|
var isInPIPMode: Boolean = false
|
||||||
|
|
||||||
val backEvent = Event<Boolean>()
|
val backEvent = Event<Boolean>()
|
||||||
|
val onColorSelectedEvent = Event<Pair<Int, Int>>()
|
||||||
|
val onDialogDismissedEvent = Event<Int>()
|
||||||
lateinit var navOptions: NavOptions
|
lateinit var navOptions: NavOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,4 +291,5 @@ class MainActivity : AppCompatActivity() {
|
||||||
}*/
|
}*/
|
||||||
handleAppIntent(intent)
|
handleAppIntent(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -65,6 +65,10 @@ import com.lagradost.cloudstream3.mvvm.observe
|
||||||
import com.lagradost.cloudstream3.mvvm.observeDirectly
|
import com.lagradost.cloudstream3.mvvm.observeDirectly
|
||||||
import com.lagradost.cloudstream3.ui.result.ResultEpisode
|
import com.lagradost.cloudstream3.ui.result.ResultEpisode
|
||||||
import com.lagradost.cloudstream3.ui.result.ResultViewModel
|
import com.lagradost.cloudstream3.ui.result.ResultViewModel
|
||||||
|
import com.lagradost.cloudstream3.ui.subtitles.SaveCaptionStyle
|
||||||
|
import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment
|
||||||
|
import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment.Companion.fromSaveToStyle
|
||||||
|
import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment.Companion.getCurrentSavedStyle
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.getFocusRequest
|
import com.lagradost.cloudstream3.utils.AppUtils.getFocusRequest
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.getVideoContentUri
|
import com.lagradost.cloudstream3.utils.AppUtils.getVideoContentUri
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.isCastApiAvailable
|
import com.lagradost.cloudstream3.utils.AppUtils.isCastApiAvailable
|
||||||
|
@ -75,6 +79,7 @@ import com.lagradost.cloudstream3.utils.DataStore.getKey
|
||||||
import com.lagradost.cloudstream3.utils.DataStore.setKey
|
import com.lagradost.cloudstream3.utils.DataStore.setKey
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.setViewPos
|
import com.lagradost.cloudstream3.utils.DataStoreHelper.setViewPos
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showDialog
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.getNavigationBarHeight
|
import com.lagradost.cloudstream3.utils.UIHelper.getNavigationBarHeight
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.getStatusBarHeight
|
import com.lagradost.cloudstream3.utils.UIHelper.getStatusBarHeight
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
|
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
|
||||||
|
@ -145,6 +150,9 @@ data class UriData(
|
||||||
|
|
||||||
// YE, I KNOW, THIS COULD BE HANDLED A LOT BETTER
|
// YE, I KNOW, THIS COULD BE HANDLED A LOT BETTER
|
||||||
class PlayerFragment : Fragment() {
|
class PlayerFragment : Fragment() {
|
||||||
|
private lateinit var subStyle: SaveCaptionStyle
|
||||||
|
private var subView: SubtitleView? = null
|
||||||
|
|
||||||
private var isCurrentlyPlaying: Boolean = false
|
private var isCurrentlyPlaying: Boolean = false
|
||||||
private val mapper = JsonMapper.builder().addModule(KotlinModule())
|
private val mapper = JsonMapper.builder().addModule(KotlinModule())
|
||||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).build()
|
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).build()
|
||||||
|
@ -788,18 +796,19 @@ class PlayerFragment : Fragment() {
|
||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
private fun onSubStyleChanged(style : SaveCaptionStyle) {
|
||||||
|
subView?.setStyle(fromSaveToStyle(subStyle))
|
||||||
|
subView?.translationY = -subStyle.elevation.toPx.toFloat()
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
val subs = player_view.findViewById<SubtitleView>(R.id.exo_subtitles)
|
subView = player_view.findViewById(R.id.exo_subtitles)
|
||||||
subs.setStyle(
|
subStyle = context?.getCurrentSavedStyle()!!
|
||||||
CaptionStyleCompat(
|
onSubStyleChanged(subStyle)
|
||||||
Color.WHITE, Color.TRANSPARENT, Color.TRANSPARENT, CaptionStyleCompat.EDGE_TYPE_OUTLINE, Color.BLACK,
|
SubtitlesFragment.applyStyleEvent += ::onSubStyleChanged
|
||||||
Typeface.SANS_SERIF
|
|
||||||
)
|
|
||||||
)
|
|
||||||
subs.translationY = -10.toPx.toFloat()
|
|
||||||
|
|
||||||
settingsManager = PreferenceManager.getDefaultSharedPreferences(activity)
|
settingsManager = PreferenceManager.getDefaultSharedPreferences(activity)
|
||||||
swipeEnabled = settingsManager.getBoolean("swipe_enabled", true)
|
swipeEnabled = settingsManager.getBoolean("swipe_enabled", true)
|
||||||
|
@ -1115,64 +1124,19 @@ class PlayerFragment : Fragment() {
|
||||||
|
|
||||||
playback_speed_btt.visibility = if (playBackSpeedEnabled) VISIBLE else GONE
|
playback_speed_btt.visibility = if (playBackSpeedEnabled) VISIBLE else GONE
|
||||||
playback_speed_btt.setOnClickListener {
|
playback_speed_btt.setOnClickListener {
|
||||||
lateinit var dialog: AlertDialog
|
|
||||||
// Lmao kind bad
|
|
||||||
val speedsText = listOf("0.5x", "0.75x", "1x", "1.25x", "1.5x", "1.75x", "2x")
|
val speedsText = listOf("0.5x", "0.75x", "1x", "1.25x", "1.5x", "1.75x", "2x")
|
||||||
val speedsNumbers = listOf(0.5f, 0.75f, 1f, 1.25f, 1.5f, 1.75f, 2f)
|
val speedsNumbers = listOf(0.5f, 0.75f, 1f, 1.25f, 1.5f, 1.75f, 2f)
|
||||||
val builder =
|
|
||||||
AlertDialog.Builder(requireContext(), R.style.AlertDialogCustom).setView(R.layout.player_select_speed)
|
|
||||||
|
|
||||||
val speedDialog = builder.create()
|
|
||||||
speedDialog.show()
|
|
||||||
|
|
||||||
val speedList = speedDialog.findViewById<ListView>(R.id.sort_speed)!!
|
|
||||||
// val applyButton = speedDialog.findViewById<MaterialButton>(R.id.pick_source_apply)!!
|
|
||||||
// val cancelButton = speedDialog.findViewById<MaterialButton>(R.id.pick_source_cancel)!!
|
|
||||||
|
|
||||||
val arrayAdapter = ArrayAdapter<String>(view.context, R.layout.sort_bottom_single_choice)
|
|
||||||
arrayAdapter.addAll(speedsText)
|
|
||||||
|
|
||||||
speedList.adapter = arrayAdapter
|
|
||||||
speedList.choiceMode = AbsListView.CHOICE_MODE_SINGLE
|
|
||||||
|
|
||||||
val speedIndex = speedsNumbers.indexOf(playbackSpeed)
|
val speedIndex = speedsNumbers.indexOf(playbackSpeed)
|
||||||
|
|
||||||
speedList.setSelection(speedIndex)
|
context?.showDialog(speedsText,speedIndex,"Player Speed", false) { index ->
|
||||||
speedList.setItemChecked(speedIndex, true)
|
playbackSpeed = speedsNumbers[index]
|
||||||
|
|
||||||
speedList.setOnItemClickListener { _, _, which, _ ->
|
|
||||||
playbackSpeed = speedsNumbers[which]
|
|
||||||
requireContext().setKey(PLAYBACK_SPEED_KEY, playbackSpeed)
|
requireContext().setKey(PLAYBACK_SPEED_KEY, playbackSpeed)
|
||||||
val param = PlaybackParameters(playbackSpeed)
|
val param = PlaybackParameters(playbackSpeed)
|
||||||
exoPlayer.playbackParameters = param
|
exoPlayer.playbackParameters = param
|
||||||
player_speed_text.text = "Speed (${playbackSpeed}x)".replace(".0x", "x")
|
player_speed_text.text = "Speed (${playbackSpeed}x)".replace(".0x", "x")
|
||||||
|
|
||||||
speedDialog.dismiss()
|
|
||||||
activity?.hideSystemUI()
|
activity?.hideSystemUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
builder.setTitle("Pick playback speed")
|
|
||||||
builder.setOnDismissListener {
|
|
||||||
activity?.hideSystemUI()
|
|
||||||
}
|
|
||||||
builder.setSingleChoiceItems(speedsText, speedsNumbers.indexOf(playbackSpeed)) { _, which ->
|
|
||||||
|
|
||||||
//val speed = speedsText[which]
|
|
||||||
//Toast.makeText(requireContext(), "$speed selected.", Toast.LENGTH_SHORT).show()
|
|
||||||
|
|
||||||
playbackSpeed = speedsNumbers[which]
|
|
||||||
requireContext().setKey(PLAYBACK_SPEED_KEY, playbackSpeed)
|
|
||||||
val param = PlaybackParameters(playbackSpeed)
|
|
||||||
exoPlayer.playbackParameters = param
|
|
||||||
player_speed_text.text = "Speed (${playbackSpeed}x)".replace(".0x", "x")
|
|
||||||
|
|
||||||
dialog.dismiss()
|
|
||||||
activity?.hideSystemUI()
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog = builder.create()
|
|
||||||
dialog.show()*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sources_btt.setOnClickListener {
|
sources_btt.setOnClickListener {
|
||||||
|
@ -1191,8 +1155,13 @@ class PlayerFragment : Fragment() {
|
||||||
// bottomSheetDialog.setContentView(R.layout.sort_bottom_sheet)
|
// bottomSheetDialog.setContentView(R.layout.sort_bottom_sheet)
|
||||||
val providerList = sourceDialog.findViewById<ListView>(R.id.sort_providers)!!
|
val providerList = sourceDialog.findViewById<ListView>(R.id.sort_providers)!!
|
||||||
val subtitleList = sourceDialog.findViewById<ListView>(R.id.sort_subtitles)!!
|
val subtitleList = sourceDialog.findViewById<ListView>(R.id.sort_subtitles)!!
|
||||||
val applyButton = sourceDialog.findViewById<MaterialButton>(R.id.pick_source_apply)!!
|
val applyButton = sourceDialog.findViewById<MaterialButton>(R.id.apply_btt)!!
|
||||||
val cancelButton = sourceDialog.findViewById<MaterialButton>(R.id.pick_source_cancel)!!
|
val cancelButton = sourceDialog.findViewById<MaterialButton>(R.id.cancel_btt)!!
|
||||||
|
val subsSettings = sourceDialog.findViewById<ImageView>(R.id.subs_settings)!!
|
||||||
|
|
||||||
|
subsSettings.setOnClickListener {
|
||||||
|
SubtitlesFragment.push(activity)
|
||||||
|
}
|
||||||
|
|
||||||
val startSource = sources.indexOf(getCurrentUrl())
|
val startSource = sources.indexOf(getCurrentUrl())
|
||||||
var sourceIndex = startSource
|
var sourceIndex = startSource
|
||||||
|
@ -1450,6 +1419,7 @@ class PlayerFragment : Fragment() {
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
savePos()
|
savePos()
|
||||||
|
SubtitlesFragment.applyStyleEvent -= ::onSubStyleChanged
|
||||||
|
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
canEnterPipMode = false
|
canEnterPipMode = false
|
||||||
|
|
|
@ -330,9 +330,7 @@ class ResultFragment : Fragment() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
val skipLoading = if (apiName != null) {
|
val skipLoading = getApiFromName(apiName).instantLinkLoading
|
||||||
getApiFromName(apiName).instantLinkLoading
|
|
||||||
} else false
|
|
||||||
|
|
||||||
var loadingDialog: AlertDialog? = null
|
var loadingDialog: AlertDialog? = null
|
||||||
val currentLoad = currentLoadingCount
|
val currentLoad = currentLoadingCount
|
||||||
|
|
|
@ -23,6 +23,7 @@ import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.getGridIsCompact
|
import com.lagradost.cloudstream3.utils.UIHelper.getGridIsCompact
|
||||||
import com.lagradost.cloudstream3.mvvm.Resource
|
import com.lagradost.cloudstream3.mvvm.Resource
|
||||||
import com.lagradost.cloudstream3.mvvm.observe
|
import com.lagradost.cloudstream3.mvvm.observe
|
||||||
|
import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
|
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
|
||||||
import kotlinx.android.synthetic.main.fragment_search.*
|
import kotlinx.android.synthetic.main.fragment_search.*
|
||||||
|
|
||||||
|
@ -171,8 +172,8 @@ class SearchFragment : Fragment() {
|
||||||
}, 200)
|
}, 200)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
main_search.onActionViewExpanded()
|
// main_search.onActionViewExpanded()
|
||||||
|
SubtitlesFragment.push(activity)
|
||||||
//searchViewModel.search("iron man")
|
//searchViewModel.search("iron man")
|
||||||
//(activity as AppCompatActivity).loadResult("https://shiro.is/overlord-dubbed", "overlord-dubbed", "Shiro")
|
//(activity as AppCompatActivity).loadResult("https://shiro.is/overlord-dubbed", "overlord-dubbed", "Shiro")
|
||||||
/*
|
/*
|
||||||
|
@ -184,4 +185,5 @@ class SearchFragment : Fragment() {
|
||||||
.add(R.id.homeRoot, PlayerFragment.newInstance(PlayerData(0, null,0)))
|
.add(R.id.homeRoot, PlayerFragment.newInstance(PlayerData(0, null,0)))
|
||||||
.commit()*/
|
.commit()*/
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,263 @@
|
||||||
|
package com.lagradost.cloudstream3.ui.subtitles
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.res.Resources
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.Typeface
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.DisplayMetrics
|
||||||
|
import android.util.TypedValue
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.TextView
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.FragmentActivity
|
||||||
|
import com.google.android.exoplayer2.text.Cue
|
||||||
|
import com.google.android.exoplayer2.ui.CaptionStyleCompat
|
||||||
|
import com.jaredrummler.android.colorpicker.ColorPickerDialog
|
||||||
|
import com.lagradost.cloudstream3.MainActivity
|
||||||
|
import com.lagradost.cloudstream3.R
|
||||||
|
import com.lagradost.cloudstream3.utils.DataStore.getKey
|
||||||
|
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.popCurrentPage
|
||||||
|
import kotlinx.android.synthetic.main.subtitle_settings.*
|
||||||
|
|
||||||
|
const val SUBTITLE_KEY = "subtitle_settings"
|
||||||
|
|
||||||
|
data class SaveCaptionStyle(
|
||||||
|
var foregroundColor: Int,
|
||||||
|
var backgroundColor: Int,
|
||||||
|
var windowColor: Int,
|
||||||
|
@CaptionStyleCompat.EdgeType
|
||||||
|
var edgeType: Int,
|
||||||
|
var edgeColor: Int,
|
||||||
|
var typeface: String?,
|
||||||
|
/**in dp**/
|
||||||
|
var elevation: Int,
|
||||||
|
)
|
||||||
|
|
||||||
|
class SubtitlesFragment : Fragment() {
|
||||||
|
companion object {
|
||||||
|
val applyStyleEvent = Event<SaveCaptionStyle>()
|
||||||
|
|
||||||
|
fun fromSaveToStyle(data: SaveCaptionStyle): CaptionStyleCompat {
|
||||||
|
return CaptionStyleCompat(
|
||||||
|
data.foregroundColor, data.backgroundColor, data.windowColor, data.edgeType, data.edgeColor,
|
||||||
|
Typeface.SANS_SERIF
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun push(activity: Activity?) {
|
||||||
|
(activity as FragmentActivity?)?.supportFragmentManager?.beginTransaction()
|
||||||
|
?.setCustomAnimations(
|
||||||
|
R.anim.enter_anim,
|
||||||
|
R.anim.exit_anim,
|
||||||
|
R.anim.pop_enter,
|
||||||
|
R.anim.pop_exit
|
||||||
|
)
|
||||||
|
?.add(
|
||||||
|
R.id.homeRoot,
|
||||||
|
SubtitlesFragment()
|
||||||
|
)
|
||||||
|
?.commit()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getDefColor(id: Int): Int {
|
||||||
|
return when (id) {
|
||||||
|
0 -> Color.WHITE
|
||||||
|
1 -> Color.BLACK
|
||||||
|
2 -> Color.TRANSPARENT
|
||||||
|
3 -> Color.TRANSPARENT
|
||||||
|
else -> Color.TRANSPARENT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Context.saveStyle(style: SaveCaptionStyle) {
|
||||||
|
this.setKey(SUBTITLE_KEY, style)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Context.getCurrentSavedStyle(): SaveCaptionStyle {
|
||||||
|
return this.getKey(SUBTITLE_KEY) ?: SaveCaptionStyle(
|
||||||
|
getDefColor(0),
|
||||||
|
getDefColor(2),
|
||||||
|
getDefColor(3),
|
||||||
|
CaptionStyleCompat.EDGE_TYPE_OUTLINE,
|
||||||
|
getDefColor(1),
|
||||||
|
null,
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Context.getCurrentStyle(): CaptionStyleCompat {
|
||||||
|
return fromSaveToStyle(getCurrentSavedStyle())
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getPixels(unit: Int, size: Float): Int {
|
||||||
|
val metrics: DisplayMetrics = Resources.getSystem().displayMetrics
|
||||||
|
return TypedValue.applyDimension(unit, size, metrics).toInt()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun onColorSelected(stuff: Pair<Int, Int>) {
|
||||||
|
setColor(stuff.first, stuff.second)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setColor(id: Int, color: Int?) {
|
||||||
|
val realColor = color ?: getDefColor(id)
|
||||||
|
when (id) {
|
||||||
|
0 -> state.foregroundColor = realColor
|
||||||
|
1 -> state.edgeColor = realColor
|
||||||
|
2 -> state.backgroundColor = realColor
|
||||||
|
3 -> state.windowColor = realColor
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateState()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateState() {
|
||||||
|
subtitle_text?.setStyle(fromSaveToStyle(state))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getColor(id: Int): Int {
|
||||||
|
val color = when (id) {
|
||||||
|
0 -> state.foregroundColor
|
||||||
|
1 -> state.edgeColor
|
||||||
|
2 -> state.backgroundColor
|
||||||
|
3 -> state.windowColor
|
||||||
|
|
||||||
|
else -> Color.TRANSPARENT
|
||||||
|
}
|
||||||
|
|
||||||
|
return if (color == Color.TRANSPARENT) Color.BLACK else color
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?,
|
||||||
|
): View? {
|
||||||
|
return inflater.inflate(R.layout.subtitle_settings, container, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
lateinit var state: SaveCaptionStyle
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
MainActivity.onColorSelectedEvent -= ::onColorSelected
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
MainActivity.onColorSelectedEvent += ::onColorSelected
|
||||||
|
|
||||||
|
context?.fixPaddingStatusbar(subs_root)
|
||||||
|
|
||||||
|
state = requireContext().getCurrentSavedStyle()
|
||||||
|
updateState()
|
||||||
|
|
||||||
|
fun View.setup(id: Int) {
|
||||||
|
this.setOnClickListener {
|
||||||
|
activity?.let {
|
||||||
|
ColorPickerDialog.newBuilder()
|
||||||
|
.setDialogId(id)
|
||||||
|
.setColor(getColor(id))
|
||||||
|
.show(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setOnLongClickListener {
|
||||||
|
setColor(id, null)
|
||||||
|
Toast.makeText(it.context, R.string.subs_default_reset_toast, Toast.LENGTH_SHORT).show()
|
||||||
|
return@setOnLongClickListener true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
subs_text_color.setup(0)
|
||||||
|
subs_outline_color.setup(1)
|
||||||
|
subs_background_color.setup(2)
|
||||||
|
subs_window_color.setup(3)
|
||||||
|
|
||||||
|
subs_subtitle_elevation.setOnClickListener { textView ->
|
||||||
|
val elevationTypes = listOf(
|
||||||
|
Pair(0, "None"),
|
||||||
|
Pair(10, "10"),
|
||||||
|
Pair(20, "20"),
|
||||||
|
Pair(30, "30"),
|
||||||
|
Pair(40, "40"),
|
||||||
|
)
|
||||||
|
|
||||||
|
textView.context.showBottomDialog(
|
||||||
|
elevationTypes.map { it.second },
|
||||||
|
elevationTypes.map { it.first }.indexOf(state.elevation),
|
||||||
|
(textView as TextView).text.toString(),
|
||||||
|
false
|
||||||
|
) { index ->
|
||||||
|
state.elevation = elevationTypes.map { it.first }[index]
|
||||||
|
updateState()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
subs_subtitle_elevation.setOnLongClickListener {
|
||||||
|
state.elevation = 0
|
||||||
|
updateState()
|
||||||
|
Toast.makeText(it.context, R.string.subs_default_reset_toast, Toast.LENGTH_SHORT).show()
|
||||||
|
return@setOnLongClickListener true
|
||||||
|
}
|
||||||
|
|
||||||
|
subs_edge_type.setOnClickListener { textView ->
|
||||||
|
val edgeTypes = listOf(
|
||||||
|
Pair(CaptionStyleCompat.EDGE_TYPE_NONE, "None"),
|
||||||
|
Pair(CaptionStyleCompat.EDGE_TYPE_OUTLINE, "Outline"),
|
||||||
|
Pair(CaptionStyleCompat.EDGE_TYPE_DEPRESSED, "Depressed"),
|
||||||
|
Pair(CaptionStyleCompat.EDGE_TYPE_DROP_SHADOW, "Shadow"),
|
||||||
|
Pair(CaptionStyleCompat.EDGE_TYPE_RAISED, "Raised"),
|
||||||
|
)
|
||||||
|
|
||||||
|
textView.context.showBottomDialog(
|
||||||
|
edgeTypes.map { it.second },
|
||||||
|
edgeTypes.map { it.first }.indexOf(state.edgeType),
|
||||||
|
(textView as TextView).text.toString(),
|
||||||
|
false
|
||||||
|
) { index ->
|
||||||
|
state.edgeType = edgeTypes.map { it.first }[index]
|
||||||
|
updateState()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
subs_edge_type.setOnLongClickListener {
|
||||||
|
state.edgeType = CaptionStyleCompat.EDGE_TYPE_OUTLINE
|
||||||
|
updateState()
|
||||||
|
Toast.makeText(it.context, R.string.subs_default_reset_toast, Toast.LENGTH_SHORT).show()
|
||||||
|
return@setOnLongClickListener true
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel_btt.setOnClickListener {
|
||||||
|
activity?.popCurrentPage()
|
||||||
|
}
|
||||||
|
|
||||||
|
apply_btt.setOnClickListener {
|
||||||
|
applyStyleEvent.invoke(state)
|
||||||
|
fromSaveToStyle(state)
|
||||||
|
activity?.popCurrentPage()
|
||||||
|
}
|
||||||
|
|
||||||
|
subtitle_text.setCues(
|
||||||
|
listOf(
|
||||||
|
Cue.Builder()
|
||||||
|
.setTextSize(
|
||||||
|
getPixels(TypedValue.COMPLEX_UNIT_SP, 25.0f).toFloat(),
|
||||||
|
Cue.TEXT_SIZE_TYPE_ABSOLUTE
|
||||||
|
)
|
||||||
|
.setText("The quick brown fox jumps over the lazy dog").build()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
package com.lagradost.cloudstream3.utils
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.*
|
||||||
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import androidx.core.view.marginLeft
|
||||||
|
import androidx.core.view.marginRight
|
||||||
|
import androidx.core.view.marginTop
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||||
|
import com.lagradost.cloudstream3.R
|
||||||
|
|
||||||
|
object SingleSelectionHelper {
|
||||||
|
fun Context.showDialog(
|
||||||
|
dialog: Dialog,
|
||||||
|
items: List<String>,
|
||||||
|
selectedIndex: Int,
|
||||||
|
name: String,
|
||||||
|
showApply: Boolean,
|
||||||
|
callback: (Int) -> Unit
|
||||||
|
) {
|
||||||
|
val listView = dialog.findViewById<ListView>(R.id.listview1)!!
|
||||||
|
val textView = dialog.findViewById<TextView>(R.id.text1)!!
|
||||||
|
val applyButton = dialog.findViewById<TextView>(R.id.apply_btt)!!
|
||||||
|
val cancelButton = dialog.findViewById<TextView>(R.id.cancel_btt)!!
|
||||||
|
val applyHolder = dialog.findViewById<LinearLayout>(R.id.apply_btt_holder)!!
|
||||||
|
|
||||||
|
applyHolder.visibility = if (showApply) View.VISIBLE else View.GONE
|
||||||
|
if (!showApply) {
|
||||||
|
val params = listView.layoutParams as LinearLayout.LayoutParams
|
||||||
|
params.setMargins(listView.marginLeft, listView.marginTop, listView.marginRight, 0)
|
||||||
|
listView.layoutParams = params
|
||||||
|
}
|
||||||
|
|
||||||
|
textView.text = name
|
||||||
|
|
||||||
|
val arrayAdapter = ArrayAdapter<String>(this, R.layout.sort_bottom_single_choice)
|
||||||
|
arrayAdapter.addAll(items)
|
||||||
|
|
||||||
|
listView.adapter = arrayAdapter
|
||||||
|
listView.choiceMode = AbsListView.CHOICE_MODE_SINGLE
|
||||||
|
|
||||||
|
listView.setSelection(selectedIndex)
|
||||||
|
listView.setItemChecked(selectedIndex, true)
|
||||||
|
|
||||||
|
var currentIndex = selectedIndex
|
||||||
|
|
||||||
|
listView.setOnItemClickListener { _, _, which, _ ->
|
||||||
|
if (showApply) {
|
||||||
|
currentIndex = which
|
||||||
|
listView.setItemChecked(which, true)
|
||||||
|
} else {
|
||||||
|
callback.invoke(which)
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (showApply) {
|
||||||
|
applyButton.setOnClickListener {
|
||||||
|
callback.invoke(currentIndex)
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
cancelButton.setOnClickListener {
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Context.showDialog(
|
||||||
|
items: List<String>,
|
||||||
|
selectedIndex: Int,
|
||||||
|
name: String,
|
||||||
|
showApply: Boolean,
|
||||||
|
callback: (Int) -> Unit
|
||||||
|
) {
|
||||||
|
val builder =
|
||||||
|
AlertDialog.Builder(this, R.style.AlertDialogCustom).setView(R.layout.bottom_selection_dialog)
|
||||||
|
|
||||||
|
val dialog = builder.create()
|
||||||
|
dialog.show()
|
||||||
|
showDialog(dialog, items, selectedIndex, name, showApply, callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Context.showBottomDialog(
|
||||||
|
items: List<String>,
|
||||||
|
selectedIndex: Int,
|
||||||
|
name: String,
|
||||||
|
showApply: Boolean,
|
||||||
|
callback: (Int) -> Unit
|
||||||
|
) {
|
||||||
|
val builder =
|
||||||
|
BottomSheetDialog(this)
|
||||||
|
builder.setContentView(R.layout.bottom_selection_dialog)
|
||||||
|
|
||||||
|
builder.show()
|
||||||
|
showDialog(builder, items, selectedIndex, name, showApply, callback)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<gradient
|
||||||
|
android:startColor="#FFF"
|
||||||
|
android:endColor="#000"
|
||||||
|
android:angle="0"/>
|
||||||
|
</shape>
|
|
@ -15,7 +15,7 @@
|
||||||
android:id="@+id/nav_view"
|
android:id="@+id/nav_view"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/darkBackground"
|
android:background="?attr/darkBackground"
|
||||||
app:itemRippleColor="@color/colorRipple"
|
app:itemRippleColor="@color/colorRipple"
|
||||||
app:labelVisibilityMode="labeled"
|
app:labelVisibilityMode="labeled"
|
||||||
|
|
||||||
|
|
58
app/src/main/res/layout/bottom_selection_dialog.xml
Normal file
58
app/src/main/res/layout/bottom_selection_dialog.xml
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:background="?attr/bitDarkerGrayBackground"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text1"
|
||||||
|
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||||
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textColor="?attr/textColor"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_rowWeight="1"
|
||||||
|
tools:text="Test"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
</TextView>
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listview1"
|
||||||
|
android:layout_marginTop="-10dp"
|
||||||
|
android:layout_marginBottom="60dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
tools:listitem="@layout/sort_bottom_single_choice"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_rowWeight="1"
|
||||||
|
/>
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/apply_btt_holder"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:gravity="bottom|end"
|
||||||
|
android:layout_marginTop="-60dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp">
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/WhiteButton"
|
||||||
|
android:layout_gravity="center_vertical|end"
|
||||||
|
android:text="@string/sort_apply"
|
||||||
|
android:id="@+id/apply_btt"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
/>
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/BlackButton"
|
||||||
|
android:layout_gravity="center_vertical|end"
|
||||||
|
android:text="@string/sort_cancel"
|
||||||
|
android:id="@+id/cancel_btt"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
|
@ -26,49 +26,22 @@
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_height="50dp"
|
style="@style/WhiteButton"
|
||||||
android:layout_margin="5dp"
|
|
||||||
|
|
||||||
android:visibility="visible"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:rippleColor="?attr/grayBackground"
|
|
||||||
android:textColor="?attr/grayBackground"
|
|
||||||
app:iconTint="?attr/grayBackground"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
app:iconGravity="textStart"
|
|
||||||
app:strokeColor="?attr/grayBackground"
|
|
||||||
app:backgroundTint="?attr/textColor"
|
|
||||||
|
|
||||||
app:icon="@drawable/ic_baseline_autorenew_24"
|
app:icon="@drawable/ic_baseline_autorenew_24"
|
||||||
app:iconSize="20dp"
|
|
||||||
android:text="@string/reload_error"
|
android:text="@string/reload_error"
|
||||||
android:id="@+id/home_reload_connectionerror"
|
android:id="@+id/home_reload_connectionerror"
|
||||||
android:textSize="15sp"
|
|
||||||
app:cornerRadius="5dp"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:minWidth="200dp"
|
android:minWidth="200dp"
|
||||||
>
|
>
|
||||||
</com.google.android.material.button.MaterialButton>
|
</com.google.android.material.button.MaterialButton>
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_height="50dp"
|
style="@style/BlackButton"
|
||||||
android:layout_margin="5dp"
|
|
||||||
|
|
||||||
app:iconGravity="textStart"
|
|
||||||
app:strokeColor="?attr/textColor"
|
|
||||||
android:backgroundTint="?attr/grayBackground"
|
|
||||||
app:rippleColor="?attr/textColor"
|
|
||||||
android:textColor="?attr/textColor"
|
|
||||||
app:iconTint="?attr/textColor"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
android:textStyle="bold"
|
|
||||||
|
|
||||||
app:icon="@drawable/ic_baseline_public_24"
|
app:icon="@drawable/ic_baseline_public_24"
|
||||||
app:iconSize="20dp"
|
|
||||||
android:text="@string/result_open_in_browser"
|
android:text="@string/result_open_in_browser"
|
||||||
android:id="@+id/home_reload_connection_open_in_browser"
|
android:id="@+id/home_reload_connection_open_in_browser"
|
||||||
android:textSize="15sp"
|
|
||||||
app:cornerRadius="5dp"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:minWidth="200dp"
|
android:minWidth="200dp"
|
||||||
>
|
>
|
||||||
|
@ -147,48 +120,26 @@
|
||||||
android:contentDescription="@string/home_next_random">
|
android:contentDescription="@string/home_next_random">
|
||||||
</ImageView>
|
</ImageView>
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:layout_margin="5dp"
|
style="@style/WhiteButton"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
app:cornerRadius="4dp"
|
|
||||||
android:id="@+id/home_main_play"
|
android:id="@+id/home_main_play"
|
||||||
android:text="@string/home_play"
|
android:text="@string/home_play"
|
||||||
android:textStyle="bold"
|
|
||||||
|
|
||||||
app:rippleColor="?attr/grayBackground"
|
|
||||||
android:textColor="?attr/grayBackground"
|
|
||||||
app:iconTint="?attr/grayBackground"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
app:iconGravity="textStart"
|
|
||||||
app:strokeColor="?attr/grayBackground"
|
|
||||||
app:backgroundTint="?attr/textColor"
|
|
||||||
app:icon="@drawable/ic_baseline_play_arrow_24"
|
app:icon="@drawable/ic_baseline_play_arrow_24"
|
||||||
android:layout_width="120dp"
|
android:layout_width="120dp">
|
||||||
android:layout_height="50dp">
|
|
||||||
</com.google.android.material.button.MaterialButton>
|
</com.google.android.material.button.MaterialButton>
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:layout_margin="5dp"
|
style="@style/BlackButton"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
app:cornerRadius="4dp"
|
|
||||||
android:text="@string/home_info"
|
android:text="@string/home_info"
|
||||||
app:icon="@drawable/ic_outline_info_24"
|
app:icon="@drawable/ic_outline_info_24"
|
||||||
android:textStyle="bold"
|
|
||||||
|
|
||||||
android:id="@+id/home_main_info"
|
android:id="@+id/home_main_info"
|
||||||
app:rippleColor="?attr/textColor"
|
|
||||||
android:textColor="?attr/textColor"
|
|
||||||
app:iconTint="?attr/textColor"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:backgroundTint="?attr/grayBackground"
|
android:layout_width="120dp">
|
||||||
app:iconGravity="textStart"
|
|
||||||
app:strokeColor="?attr/textColor"
|
|
||||||
android:layout_width="120dp"
|
|
||||||
android:layout_height="50dp">
|
|
||||||
</com.google.android.material.button.MaterialButton>
|
</com.google.android.material.button.MaterialButton>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
|
|
@ -306,46 +306,26 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/WhiteButton"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
app:cornerRadius="4dp"
|
|
||||||
android:id="@+id/result_play_movie"
|
android:id="@+id/result_play_movie"
|
||||||
android:text="@string/play_movie_button"
|
android:text="@string/play_movie_button"
|
||||||
android:textStyle="bold"
|
|
||||||
|
|
||||||
app:rippleColor="?attr/grayBackground"
|
|
||||||
android:textColor="?attr/grayBackground"
|
|
||||||
app:iconTint="?attr/grayBackground"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
app:iconGravity="textStart"
|
|
||||||
app:strokeColor="?attr/grayBackground"
|
|
||||||
app:backgroundTint="?attr/textColor"
|
|
||||||
app:icon="@drawable/ic_baseline_play_arrow_24"
|
app:icon="@drawable/ic_baseline_play_arrow_24"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent">
|
||||||
android:layout_height="50dp">
|
|
||||||
</com.google.android.material.button.MaterialButton>
|
</com.google.android.material.button.MaterialButton>
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/BlackButton"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
app:cornerRadius="4dp"
|
|
||||||
tools:text="Downloading"
|
tools:text="Downloading"
|
||||||
tools:icon="@drawable/netflix_download"
|
tools:icon="@drawable/netflix_download"
|
||||||
android:textStyle="bold"
|
|
||||||
|
|
||||||
android:id="@+id/result_download_movie"
|
android:id="@+id/result_download_movie"
|
||||||
app:rippleColor="?attr/textColor"
|
|
||||||
android:textColor="?attr/textColor"
|
|
||||||
app:iconTint="?attr/textColor"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:backgroundTint="?attr/grayBackground"
|
android:layout_width="match_parent">
|
||||||
app:iconGravity="textStart"
|
|
||||||
app:strokeColor="?attr/textColor"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="50dp">
|
|
||||||
</com.google.android.material.button.MaterialButton>
|
</com.google.android.material.button.MaterialButton>
|
||||||
|
|
||||||
<androidx.core.widget.ContentLoadingProgressBar
|
<androidx.core.widget.ContentLoadingProgressBar
|
||||||
|
|
|
@ -48,19 +48,38 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_weight="50">
|
android:layout_weight="50">
|
||||||
<TextView
|
<FrameLayout
|
||||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
android:orientation="horizontal"
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="@string/pick_subtitle"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:textColor="?attr/textColor"
|
|
||||||
android:layout_rowWeight="1"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
</TextView>
|
<TextView
|
||||||
|
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||||
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:text="@string/pick_subtitle"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textColor="?attr/textColor"
|
||||||
|
android:layout_rowWeight="1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
</TextView>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/subs_settings"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||||
|
|
||||||
|
android:src="@drawable/ic_outline_settings_24"
|
||||||
|
android:layout_width="25dp"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:contentDescription="@string/home_change_provider">
|
||||||
|
</ImageView>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:layout_marginTop="-10dp"
|
android:layout_marginTop="-10dp"
|
||||||
android:paddingTop="10dp"
|
android:paddingTop="10dp"
|
||||||
|
@ -83,49 +102,18 @@
|
||||||
android:layout_height="60dp">
|
android:layout_height="60dp">
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/WhiteButton"
|
||||||
android:layout_gravity="center_vertical|end"
|
android:layout_gravity="center_vertical|end"
|
||||||
android:layout_height="50dp"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
|
|
||||||
android:visibility="visible"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:rippleColor="?attr/grayBackground"
|
|
||||||
android:textColor="?attr/grayBackground"
|
|
||||||
app:iconTint="?attr/grayBackground"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
app:iconGravity="textStart"
|
|
||||||
app:strokeColor="?attr/grayBackground"
|
|
||||||
app:backgroundTint="?attr/textColor"
|
|
||||||
|
|
||||||
app:iconSize="20dp"
|
|
||||||
android:text="@string/sort_apply"
|
android:text="@string/sort_apply"
|
||||||
android:id="@+id/pick_source_apply"
|
android:id="@+id/apply_btt"
|
||||||
android:textSize="15sp"
|
|
||||||
app:cornerRadius="5dp"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
>
|
/>
|
||||||
</com.google.android.material.button.MaterialButton>
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/BlackButton"
|
||||||
android:layout_gravity="center_vertical|end"
|
android:layout_gravity="center_vertical|end"
|
||||||
android:layout_height="50dp"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
|
|
||||||
app:iconGravity="textStart"
|
|
||||||
app:strokeColor="?attr/textColor"
|
|
||||||
android:backgroundTint="?attr/grayBackground"
|
|
||||||
app:rippleColor="?attr/textColor"
|
|
||||||
android:textColor="?attr/textColor"
|
|
||||||
app:iconTint="?attr/textColor"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
android:textStyle="bold"
|
|
||||||
|
|
||||||
app:iconSize="20dp"
|
|
||||||
android:text="@string/sort_cancel"
|
android:text="@string/sort_cancel"
|
||||||
android:id="@+id/pick_source_cancel"
|
android:id="@+id/cancel_btt"
|
||||||
android:textSize="15sp"
|
|
||||||
app:cornerRadius="5dp"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
>
|
/>
|
||||||
</com.google.android.material.button.MaterialButton>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
92
app/src/main/res/layout/subtitle_settings.xml
Normal file
92
app/src/main/res/layout/subtitle_settings.xml
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/subs_root"
|
||||||
|
android:background="?attr/bitDarkerGrayBackground"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
>
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||||
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:text="@string/subtitles_settings"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textColor="?attr/textColor"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_rowWeight="1"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
</TextView>
|
||||||
|
|
||||||
|
<com.google.android.exoplayer2.ui.SubtitleView
|
||||||
|
android:id="@+id/subtitle_text"
|
||||||
|
android:background="@drawable/subtitles_background_gradient"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:foregroundGravity="center"
|
||||||
|
android:layout_height="75sp">
|
||||||
|
</com.google.android.exoplayer2.ui.SubtitleView>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/subs_text_color"
|
||||||
|
android:text="@string/subs_text_color"
|
||||||
|
style="@style/SettingsItem"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/subs_outline_color"
|
||||||
|
android:text="@string/subs_outline_color"
|
||||||
|
style="@style/SettingsItem"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/subs_background_color"
|
||||||
|
android:text="@string/subs_background_color"
|
||||||
|
style="@style/SettingsItem"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/subs_window_color"
|
||||||
|
android:text="@string/subs_window_color"
|
||||||
|
style="@style/SettingsItem"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/subs_edge_type"
|
||||||
|
android:text="@string/subs_edge_type"
|
||||||
|
style="@style/SettingsItem"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/subs_subtitle_elevation"
|
||||||
|
android:text="@string/subs_subtitle_elevation"
|
||||||
|
style="@style/SettingsItem"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:gravity="bottom|end"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp">
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/WhiteButton"
|
||||||
|
android:layout_gravity="center_vertical|end"
|
||||||
|
android:visibility="visible"
|
||||||
|
android:text="@string/sort_apply"
|
||||||
|
android:id="@+id/apply_btt"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
/>
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/BlackButton"
|
||||||
|
android:layout_gravity="center_vertical|end"
|
||||||
|
android:text="@string/sort_cancel"
|
||||||
|
android:id="@+id/cancel_btt"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
|
@ -70,4 +70,12 @@
|
||||||
<string name="sort_apply">Apply</string>
|
<string name="sort_apply">Apply</string>
|
||||||
<string name="sort_cancel">Cancel</string>
|
<string name="sort_cancel">Cancel</string>
|
||||||
<string name="player_speed">Player Speed</string>
|
<string name="player_speed">Player Speed</string>
|
||||||
|
<string name="subtitles_settings">Subtitle Settings</string>
|
||||||
|
<string name="subs_text_color">Text Color</string>
|
||||||
|
<string name="subs_outline_color">Outline Color</string>
|
||||||
|
<string name="subs_background_color">Background Color</string>
|
||||||
|
<string name="subs_window_color">Window Color</string>
|
||||||
|
<string name="subs_edge_type">Edge Type</string>
|
||||||
|
<string name="subs_subtitle_elevation">Subtitle Elevation</string>
|
||||||
|
<string name="subs_default_reset_toast">Reset to default value</string>
|
||||||
</resources>
|
</resources>
|
|
@ -5,7 +5,7 @@
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
<!-- <item name="android:windowBackground">@drawable/splash_background</item>-->
|
<!-- <item name="android:windowBackground">@drawable/splash_background</item>-->
|
||||||
|
|
||||||
<item name="android:navigationBarColor">@color/darkBackground</item>
|
<item name="android:navigationBarColor">@color/darkBackground</item>
|
||||||
<item name="android:statusBarColor">@color/grayBackground</item>
|
<item name="android:statusBarColor">@color/grayBackground</item>
|
||||||
|
@ -132,6 +132,48 @@
|
||||||
<item name="android:backgroundTint">?attr/bitDarkerGrayBackground</item>
|
<item name="android:backgroundTint">?attr/bitDarkerGrayBackground</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="SettingsItem">
|
||||||
|
<item name="android:layout_width">match_parent</item>
|
||||||
|
<item name="android:layout_height">50sp</item>
|
||||||
|
<item name="android:gravity">center_vertical</item>
|
||||||
|
<item name="android:paddingStart">20dp</item>
|
||||||
|
<item name="android:paddingEnd">20dp</item>
|
||||||
|
<item name="android:selectAllOnFocus">true</item>
|
||||||
|
<item name="android:background">@color/transparent</item>
|
||||||
|
<item name="android:textColor">?attr/textColor</item>
|
||||||
|
<item name="android:foreground">?attr/selectableItemBackgroundBorderless</item>
|
||||||
|
<item name="android:textAppearance">?android:attr/textAppearanceListItemSmall</item>
|
||||||
|
<item name="drawableEndCompat">@drawable/ic_baseline_keyboard_arrow_right_24</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="NiceButton">
|
||||||
|
<item name="android:layout_marginStart">5dp</item>
|
||||||
|
<item name="android:layout_marginEnd">5dp</item>
|
||||||
|
<item name="android:layout_height">50dp</item>
|
||||||
|
<item name="android:textStyle">bold</item>
|
||||||
|
<item name="android:textAllCaps">false</item>
|
||||||
|
<item name="iconGravity">textStart</item>
|
||||||
|
<item name="iconSize">20dp</item>
|
||||||
|
<item name="cornerRadius">4dp</item>
|
||||||
|
<item name="android:textSize">15sp</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="WhiteButton" parent="NiceButton">
|
||||||
|
<item name="strokeColor">?attr/grayBackground</item>
|
||||||
|
<item name="backgroundTint">?attr/textColor</item>
|
||||||
|
<item name="iconTint">?attr/grayBackground</item>
|
||||||
|
<item name="android:textColor">?attr/grayBackground</item>
|
||||||
|
<item name="rippleColor">?attr/grayBackground</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="BlackButton" parent="NiceButton">
|
||||||
|
<item name="strokeColor">?attr/textColor</item>
|
||||||
|
<item name="backgroundTint">?attr/grayBackground</item>
|
||||||
|
<item name="iconTint">?attr/textColor</item>
|
||||||
|
<item name="android:textColor">?attr/textColor</item>
|
||||||
|
<item name="rippleColor">?attr/textColor</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<!-- CHROMECAST -->
|
<!-- CHROMECAST -->
|
||||||
<style name="CustomCastExpandedController" parent="CastExpandedController">
|
<style name="CustomCastExpandedController" parent="CastExpandedController">
|
||||||
<item name="castControlButtons">
|
<item name="castControlButtons">
|
||||||
|
@ -139,7 +181,8 @@
|
||||||
</item>
|
</item>
|
||||||
<item name="castButtonColor">@null</item>
|
<item name="castButtonColor">@null</item>
|
||||||
<item name="castSeekBarProgressAndThumbColor">@color/white</item> <!--@color/white ?attr/colorPrimary-->
|
<item name="castSeekBarProgressAndThumbColor">@color/white</item> <!--@color/white ?attr/colorPrimary-->
|
||||||
<item name="castSeekBarSecondaryProgressColor">?attr/darkBackground</item> <!--CHECK ?attr/darkBackground ?attr/colorPrimary-->
|
<item name="castSeekBarSecondaryProgressColor">?attr/darkBackground
|
||||||
|
</item> <!--CHECK ?attr/darkBackground ?attr/colorPrimary-->
|
||||||
<item name="castBackground">?attr/colorPrimary</item>
|
<item name="castBackground">?attr/colorPrimary</item>
|
||||||
<item name="castProgressBarColor">?attr/colorPrimary</item>
|
<item name="castProgressBarColor">?attr/colorPrimary</item>
|
||||||
<item name="castPlayButtonDrawable">@drawable/ic_baseline_play_arrow_24</item>
|
<item name="castPlayButtonDrawable">@drawable/ic_baseline_play_arrow_24</item>
|
||||||
|
|
Loading…
Reference in a new issue