mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
more views
This commit is contained in:
parent
647e91bc4b
commit
273a947f8e
7 changed files with 491 additions and 454 deletions
|
@ -11,9 +11,9 @@ import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.lagradost.cloudstream3.LoadResponse
|
import com.lagradost.cloudstream3.LoadResponse
|
||||||
import com.lagradost.cloudstream3.R
|
import com.lagradost.cloudstream3.R
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.setImage
|
import com.lagradost.cloudstream3.utils.UIHelper.setImage
|
||||||
import kotlinx.android.synthetic.main.fragment_home_head_tv.*
|
import kotlinx.android.synthetic.main.home_scroll_view.view.home_scroll_preview
|
||||||
import kotlinx.android.synthetic.main.fragment_home_head_tv.view.*
|
import kotlinx.android.synthetic.main.home_scroll_view.view.home_scroll_preview_tags
|
||||||
import kotlinx.android.synthetic.main.home_scroll_view.view.*
|
import kotlinx.android.synthetic.main.home_scroll_view.view.home_scroll_preview_title
|
||||||
|
|
||||||
|
|
||||||
class HomeScrollAdapter(
|
class HomeScrollAdapter(
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
package com.lagradost.cloudstream3.ui.player.source_priority
|
package com.lagradost.cloudstream3.ui.player.source_priority
|
||||||
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.lagradost.cloudstream3.R
|
import com.lagradost.cloudstream3.databinding.PlayerPrioritizeItemBinding
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils
|
import com.lagradost.cloudstream3.utils.AppUtils
|
||||||
import kotlinx.android.synthetic.main.player_prioritize_item.view.*
|
|
||||||
|
|
||||||
data class SourcePriority<T>(
|
data class SourcePriority<T>(
|
||||||
val data: T,
|
val data: T,
|
||||||
|
@ -20,7 +16,8 @@ class PriorityAdapter<T>(override val items: MutableList<SourcePriority<T>>) :
|
||||||
AppUtils.DiffAdapter<SourcePriority<T>>(items) {
|
AppUtils.DiffAdapter<SourcePriority<T>>(items) {
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||||
return PriorityViewHolder(
|
return PriorityViewHolder(
|
||||||
LayoutInflater.from(parent.context).inflate(R.layout.player_prioritize_item, parent, false)
|
PlayerPrioritizeItemBinding.inflate(LayoutInflater.from(parent.context),parent,false),
|
||||||
|
//LayoutInflater.from(parent.context).inflate(R.layout.player_prioritize_item, parent, false)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,27 +28,27 @@ class PriorityAdapter<T>(override val items: MutableList<SourcePriority<T>>) :
|
||||||
}
|
}
|
||||||
|
|
||||||
class PriorityViewHolder(
|
class PriorityViewHolder(
|
||||||
itemView: View,
|
val binding: PlayerPrioritizeItemBinding,
|
||||||
) : RecyclerView.ViewHolder(itemView) {
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
fun <T> bind(item: SourcePriority<T>) {
|
fun <T> bind(item: SourcePriority<T>) {
|
||||||
val plusButton: ImageView = itemView.add_button
|
/* val plusButton: ImageView = itemView.add_button
|
||||||
val subtractButton: ImageView = itemView.subtract_button
|
val subtractButton: ImageView = itemView.subtract_button
|
||||||
val priorityText: TextView = itemView.priority_text
|
val priorityText: TextView = itemView.priority_text
|
||||||
val priorityNumber: TextView = itemView.priority_number
|
val priorityNumber: TextView = itemView.priority_number*/
|
||||||
priorityText.text = item.name
|
binding.priorityText.text = item.name
|
||||||
|
|
||||||
fun updatePriority() {
|
fun updatePriority() {
|
||||||
priorityNumber.text = item.priority.toString()
|
binding.priorityNumber.text = item.priority.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePriority()
|
updatePriority()
|
||||||
plusButton.setOnClickListener {
|
binding.addButton.setOnClickListener {
|
||||||
// If someone clicks til the integer limit then they deserve to crash.
|
// If someone clicks til the integer limit then they deserve to crash.
|
||||||
item.priority++
|
item.priority++
|
||||||
updatePriority()
|
updatePriority()
|
||||||
}
|
}
|
||||||
|
|
||||||
subtractButton.setOnClickListener {
|
binding.subtractButton.setOnClickListener {
|
||||||
item.priority--
|
item.priority--
|
||||||
updatePriority()
|
updatePriority()
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,19 +8,13 @@ import android.view.ViewGroup
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.content.res.ResourcesCompat
|
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.lagradost.cloudstream3.R
|
import com.lagradost.cloudstream3.R
|
||||||
|
import com.lagradost.cloudstream3.databinding.PlayerQualityProfileItemBinding
|
||||||
import com.lagradost.cloudstream3.ui.result.UiImage
|
import com.lagradost.cloudstream3.ui.result.UiImage
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils
|
import com.lagradost.cloudstream3.utils.AppUtils
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.setImage
|
import com.lagradost.cloudstream3.utils.UIHelper.setImage
|
||||||
import kotlinx.android.synthetic.main.player_quality_profile_item.view.card_view
|
|
||||||
import kotlinx.android.synthetic.main.player_quality_profile_item.view.outline
|
|
||||||
import kotlinx.android.synthetic.main.player_quality_profile_item.view.profile_image_background
|
|
||||||
import kotlinx.android.synthetic.main.player_quality_profile_item.view.profile_text
|
|
||||||
import kotlinx.android.synthetic.main.player_quality_profile_item.view.text_is_mobile_data
|
|
||||||
import kotlinx.android.synthetic.main.player_quality_profile_item.view.text_is_wifi
|
|
||||||
|
|
||||||
class ProfilesAdapter(
|
class ProfilesAdapter(
|
||||||
override val items: MutableList<QualityDataHelper.QualityProfile>,
|
override val items: MutableList<QualityDataHelper.QualityProfile>,
|
||||||
|
@ -34,8 +28,9 @@ class ProfilesAdapter(
|
||||||
}) {
|
}) {
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||||
return ProfilesViewHolder(
|
return ProfilesViewHolder(
|
||||||
LayoutInflater.from(parent.context)
|
PlayerQualityProfileItemBinding.inflate(LayoutInflater.from(parent.context),parent,false)
|
||||||
.inflate(R.layout.player_quality_profile_item, parent, false)
|
//LayoutInflater.from(parent.context)
|
||||||
|
// .inflate(R.layout.player_quality_profile_item, parent, false)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,8 +47,8 @@ class ProfilesAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class ProfilesViewHolder(
|
inner class ProfilesViewHolder(
|
||||||
itemView: View,
|
val binding: PlayerQualityProfileItemBinding,
|
||||||
) : RecyclerView.ViewHolder(itemView) {
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
private val art = listOf(
|
private val art = listOf(
|
||||||
R.drawable.profile_bg_teal,
|
R.drawable.profile_bg_teal,
|
||||||
R.drawable.profile_bg_blue,
|
R.drawable.profile_bg_blue,
|
||||||
|
@ -65,12 +60,12 @@ class ProfilesAdapter(
|
||||||
)
|
)
|
||||||
|
|
||||||
fun bind(item: QualityDataHelper.QualityProfile, index: Int) {
|
fun bind(item: QualityDataHelper.QualityProfile, index: Int) {
|
||||||
val priorityText: TextView = itemView.profile_text
|
val priorityText: TextView = binding.profileText
|
||||||
val profileBg: ImageView = itemView.profile_image_background
|
val profileBg: ImageView = binding.profileImageBackground
|
||||||
val wifiText: TextView = itemView.text_is_wifi
|
val wifiText: TextView = binding.textIsWifi
|
||||||
val dataText: TextView = itemView.text_is_mobile_data
|
val dataText: TextView = binding.textIsMobileData
|
||||||
val outline: View = itemView.outline
|
val outline: View = binding.outline
|
||||||
val cardView: View = itemView.card_view
|
val cardView: View = binding.cardView
|
||||||
|
|
||||||
priorityText.text = item.name.asString(itemView.context)
|
priorityText.text = item.name.asString(itemView.context)
|
||||||
dataText.isVisible = item.type == QualityDataHelper.QualityProfileType.Data
|
dataText.isVisible = item.type == QualityDataHelper.QualityProfileType.Data
|
||||||
|
|
|
@ -1,20 +1,16 @@
|
||||||
package com.lagradost.cloudstream3.ui.player.source_priority
|
package com.lagradost.cloudstream3.ui.player.source_priority
|
||||||
|
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.view.View
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.annotation.StyleRes
|
import androidx.annotation.StyleRes
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.lagradost.cloudstream3.R
|
import com.lagradost.cloudstream3.R
|
||||||
|
import com.lagradost.cloudstream3.databinding.PlayerQualityProfileDialogBinding
|
||||||
import com.lagradost.cloudstream3.ui.player.source_priority.QualityDataHelper.getProfileName
|
import com.lagradost.cloudstream3.ui.player.source_priority.QualityDataHelper.getProfileName
|
||||||
import com.lagradost.cloudstream3.ui.player.source_priority.QualityDataHelper.getProfiles
|
import com.lagradost.cloudstream3.ui.player.source_priority.QualityDataHelper.getProfiles
|
||||||
import com.lagradost.cloudstream3.ui.result.txt
|
import com.lagradost.cloudstream3.ui.result.txt
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
|
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
||||||
import kotlinx.android.synthetic.main.player_quality_profile_dialog.*
|
|
||||||
|
|
||||||
class QualityProfileDialog(
|
class QualityProfileDialog(
|
||||||
val activity: FragmentActivity,
|
val activity: FragmentActivity,
|
||||||
|
@ -24,32 +20,35 @@ class QualityProfileDialog(
|
||||||
private val profileSelectionCallback: (QualityDataHelper.QualityProfile) -> Unit
|
private val profileSelectionCallback: (QualityDataHelper.QualityProfile) -> Unit
|
||||||
) : Dialog(activity, themeRes) {
|
) : Dialog(activity, themeRes) {
|
||||||
override fun show() {
|
override fun show() {
|
||||||
setContentView(R.layout.player_quality_profile_dialog)
|
|
||||||
val profilesRecyclerView: RecyclerView = profiles_recyclerview
|
val binding = PlayerQualityProfileDialogBinding.inflate(this.layoutInflater, null, false)
|
||||||
|
|
||||||
|
setContentView(binding.root)//R.layout.player_quality_profile_dialog)
|
||||||
|
/*val profilesRecyclerView: RecyclerView = profiles_recyclerview
|
||||||
val useBtt: View = use_btt
|
val useBtt: View = use_btt
|
||||||
val editBtt: View = edit_btt
|
val editBtt: View = edit_btt
|
||||||
val cancelBtt: View = cancel_btt
|
val cancelBtt: View = cancel_btt
|
||||||
val defaultBtt: View = set_default_btt
|
val defaultBtt: View = set_default_btt
|
||||||
val currentProfileText: TextView = currently_selected_profile_text
|
val currentProfileText: TextView = currently_selected_profile_text
|
||||||
val selectedItemActionsHolder: View = selected_item_holder
|
val selectedItemActionsHolder: View = selected_item_holder*/
|
||||||
|
binding.apply {
|
||||||
fun getCurrentProfile(): QualityDataHelper.QualityProfile? {
|
fun getCurrentProfile(): QualityDataHelper.QualityProfile? {
|
||||||
return (profilesRecyclerView.adapter as? ProfilesAdapter)?.getCurrentProfile()
|
return (profilesRecyclerview.adapter as? ProfilesAdapter)?.getCurrentProfile()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun refreshProfiles() {
|
fun refreshProfiles() {
|
||||||
currentProfileText.text = getProfileName(usedProfile).asString(context)
|
currentlySelectedProfileText.text = getProfileName(usedProfile).asString(context)
|
||||||
(profilesRecyclerView.adapter as? ProfilesAdapter)?.updateList(getProfiles())
|
(profilesRecyclerview.adapter as? ProfilesAdapter)?.updateList(getProfiles())
|
||||||
}
|
}
|
||||||
|
|
||||||
profilesRecyclerView.adapter = ProfilesAdapter(
|
profilesRecyclerview.adapter = ProfilesAdapter(
|
||||||
mutableListOf(),
|
mutableListOf(),
|
||||||
usedProfile,
|
usedProfile,
|
||||||
) { oldIndex: Int?, newIndex: Int ->
|
) { oldIndex: Int?, newIndex: Int ->
|
||||||
profilesRecyclerView.adapter?.notifyItemChanged(newIndex)
|
profilesRecyclerview.adapter?.notifyItemChanged(newIndex)
|
||||||
selectedItemActionsHolder.alpha = 1f
|
selectedItemHolder.alpha = 1f
|
||||||
if (oldIndex != null) {
|
if (oldIndex != null) {
|
||||||
profilesRecyclerView.adapter?.notifyItemChanged(oldIndex)
|
profilesRecyclerview.adapter?.notifyItemChanged(oldIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ class QualityProfileDialog(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
defaultBtt.setOnClickListener {
|
setDefaultBtt.setOnClickListener {
|
||||||
val currentProfile = getCurrentProfile() ?: return@setOnClickListener
|
val currentProfile = getCurrentProfile() ?: return@setOnClickListener
|
||||||
val choices = QualityDataHelper.QualityProfileType.values()
|
val choices = QualityDataHelper.QualityProfileType.values()
|
||||||
.filter { it != QualityDataHelper.QualityProfileType.None }
|
.filter { it != QualityDataHelper.QualityProfileType.None }
|
||||||
|
@ -91,16 +90,16 @@ class QualityProfileDialog(
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelBtt.setOnClickListener {
|
cancelBtt.setOnClickListener {
|
||||||
this.dismissSafe()
|
this@QualityProfileDialog.dismissSafe()
|
||||||
}
|
}
|
||||||
|
|
||||||
useBtt.setOnClickListener {
|
useBtt.setOnClickListener {
|
||||||
getCurrentProfile()?.let {
|
getCurrentProfile()?.let {
|
||||||
profileSelectionCallback.invoke(it)
|
profileSelectionCallback.invoke(it)
|
||||||
this.dismissSafe()
|
this@QualityProfileDialog.dismissSafe()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.show()
|
super.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,30 +2,29 @@ package com.lagradost.cloudstream3.ui.settings.extensions
|
||||||
|
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
import android.text.format.Formatter.formatFileSize
|
||||||
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.lagradost.cloudstream3.R
|
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.setImage
|
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.toPx
|
|
||||||
import kotlinx.android.synthetic.main.fragment_plugin_details.*
|
|
||||||
import android.text.format.Formatter.formatFileSize
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||||
|
import com.lagradost.cloudstream3.AcraApplication.Companion.openBrowser
|
||||||
|
import com.lagradost.cloudstream3.R
|
||||||
|
import com.lagradost.cloudstream3.databinding.FragmentPluginDetailsBinding
|
||||||
|
import com.lagradost.cloudstream3.plugins.PluginManager
|
||||||
import com.lagradost.cloudstream3.plugins.VotingApi
|
import com.lagradost.cloudstream3.plugins.VotingApi
|
||||||
|
import com.lagradost.cloudstream3.plugins.VotingApi.canVote
|
||||||
import com.lagradost.cloudstream3.plugins.VotingApi.getVoteType
|
import com.lagradost.cloudstream3.plugins.VotingApi.getVoteType
|
||||||
import com.lagradost.cloudstream3.plugins.VotingApi.getVotes
|
import com.lagradost.cloudstream3.plugins.VotingApi.getVotes
|
||||||
import com.lagradost.cloudstream3.plugins.VotingApi.vote
|
import com.lagradost.cloudstream3.plugins.VotingApi.vote
|
||||||
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
|
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
|
||||||
import com.lagradost.cloudstream3.utils.Coroutines.main
|
import com.lagradost.cloudstream3.utils.Coroutines.main
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
|
|
||||||
import com.lagradost.cloudstream3.AcraApplication.Companion.openBrowser
|
|
||||||
import com.lagradost.cloudstream3.plugins.PluginManager
|
|
||||||
import com.lagradost.cloudstream3.plugins.VotingApi.canVote
|
|
||||||
import com.lagradost.cloudstream3.utils.SubtitleHelper.fromTwoLettersToLanguage
|
import com.lagradost.cloudstream3.utils.SubtitleHelper.fromTwoLettersToLanguage
|
||||||
import com.lagradost.cloudstream3.utils.SubtitleHelper.getFlagFromIso
|
import com.lagradost.cloudstream3.utils.SubtitleHelper.getFlagFromIso
|
||||||
import kotlinx.android.synthetic.main.repository_item.view.*
|
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
|
||||||
|
import com.lagradost.cloudstream3.utils.UIHelper.setImage
|
||||||
|
import com.lagradost.cloudstream3.utils.UIHelper.toPx
|
||||||
|
|
||||||
|
|
||||||
class PluginDetailsFragment(val data: PluginViewData) : BottomSheetDialogFragment() {
|
class PluginDetailsFragment(val data: PluginViewData) : BottomSheetDialogFragment() {
|
||||||
|
@ -43,18 +42,27 @@ class PluginDetailsFragment(val data: PluginViewData) : BottomSheetDialogFragmen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
binding = null
|
||||||
|
super.onDestroyView()
|
||||||
|
}
|
||||||
|
|
||||||
|
var binding: FragmentPluginDetailsBinding? = null
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View {
|
||||||
return inflater.inflate(R.layout.fragment_plugin_details, container, false)
|
val localBinding = FragmentPluginDetailsBinding.inflate(inflater, container, false)
|
||||||
|
binding = localBinding
|
||||||
|
return localBinding.root
|
||||||
|
//return inflater.inflate(R.layout.fragment_plugin_details, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
val metadata = data.plugin.second
|
val metadata = data.plugin.second
|
||||||
if (plugin_icon?.setImage(//plugin_icon?.height ?:
|
binding?.apply {
|
||||||
|
if (!pluginIcon.setImage(//plugin_icon?.height ?:
|
||||||
metadata.iconUrl?.replace(
|
metadata.iconUrl?.replace(
|
||||||
"%size%",
|
"%size%",
|
||||||
"$iconSize"
|
"$iconSize"
|
||||||
|
@ -64,23 +72,33 @@ class PluginDetailsFragment(val data: PluginViewData) : BottomSheetDialogFragmen
|
||||||
),
|
),
|
||||||
null,
|
null,
|
||||||
errorImageDrawable = R.drawable.ic_baseline_extension_24
|
errorImageDrawable = R.drawable.ic_baseline_extension_24
|
||||||
) != true
|
)
|
||||||
) {
|
) {
|
||||||
plugin_icon?.setImageResource(R.drawable.ic_baseline_extension_24)
|
pluginIcon.setImageResource(R.drawable.ic_baseline_extension_24)
|
||||||
}
|
}
|
||||||
plugin_name?.text = metadata.name.removeSuffix("Provider")
|
pluginName.text = metadata.name.removeSuffix("Provider")
|
||||||
plugin_version?.text = metadata.version.toString()
|
pluginVersion.text = metadata.version.toString()
|
||||||
plugin_description?.text = metadata.description ?: getString(R.string.no_data)
|
pluginDescription.text = metadata.description ?: getString(R.string.no_data)
|
||||||
plugin_size?.text = if (metadata.fileSize == null) getString(R.string.no_data) else formatFileSize(context, metadata.fileSize)
|
pluginSize.text =
|
||||||
plugin_author?.text = if (metadata.authors.isEmpty()) getString(R.string.no_data) else metadata.authors.joinToString(", ")
|
if (metadata.fileSize == null) getString(R.string.no_data) else formatFileSize(
|
||||||
plugin_status?.text = resources.getStringArray(R.array.extension_statuses)[metadata.status]
|
context,
|
||||||
plugin_types?.text = if ((metadata.tvTypes == null) || metadata.tvTypes.isEmpty()) getString(R.string.no_data) else metadata.tvTypes.joinToString(", ")
|
metadata.fileSize
|
||||||
plugin_lang?.text = if (metadata.language == null)
|
)
|
||||||
|
pluginAuthor.text =
|
||||||
|
if (metadata.authors.isEmpty()) getString(R.string.no_data) else metadata.authors.joinToString(
|
||||||
|
", "
|
||||||
|
)
|
||||||
|
pluginStatus.text = resources.getStringArray(R.array.extension_statuses)[metadata.status]
|
||||||
|
pluginTypes.text =
|
||||||
|
if (metadata.tvTypes.isNullOrEmpty()) getString(R.string.no_data) else metadata.tvTypes.joinToString(
|
||||||
|
", "
|
||||||
|
)
|
||||||
|
pluginLang.text = if (metadata.language == null)
|
||||||
getString(R.string.no_data)
|
getString(R.string.no_data)
|
||||||
else
|
else
|
||||||
"${getFlagFromIso(metadata.language)} ${fromTwoLettersToLanguage(metadata.language)}"
|
"${getFlagFromIso(metadata.language)} ${fromTwoLettersToLanguage(metadata.language)}"
|
||||||
|
|
||||||
github_btn.setOnClickListener {
|
githubBtn.setOnClickListener {
|
||||||
if (metadata.repositoryUrl != null) {
|
if (metadata.repositoryUrl != null) {
|
||||||
openBrowser(metadata.repositoryUrl)
|
openBrowser(metadata.repositoryUrl)
|
||||||
}
|
}
|
||||||
|
@ -93,10 +111,11 @@ class PluginDetailsFragment(val data: PluginViewData) : BottomSheetDialogFragmen
|
||||||
|
|
||||||
if (data.isDownloaded) {
|
if (data.isDownloaded) {
|
||||||
// On local plugins page the filepath is provided instead of url.
|
// On local plugins page the filepath is provided instead of url.
|
||||||
val plugin = PluginManager.urlPlugins[metadata.url] ?: PluginManager.plugins[metadata.url]
|
val plugin =
|
||||||
|
PluginManager.urlPlugins[metadata.url] ?: PluginManager.plugins[metadata.url]
|
||||||
if (plugin?.openSettings != null && context != null) {
|
if (plugin?.openSettings != null && context != null) {
|
||||||
action_settings?.isVisible = true
|
actionSettings.isVisible = true
|
||||||
action_settings.setOnClickListener {
|
actionSettings.setOnClickListener {
|
||||||
try {
|
try {
|
||||||
plugin.openSettings!!.invoke(requireContext())
|
plugin.openSettings!!.invoke(requireContext())
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
|
@ -109,10 +128,10 @@ class PluginDetailsFragment(val data: PluginViewData) : BottomSheetDialogFragmen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
action_settings?.isVisible = false
|
actionSettings.isVisible = false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
action_settings?.isVisible = false
|
actionSettings.isVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
upvote.setOnClickListener {
|
upvote.setOnClickListener {
|
||||||
|
@ -137,22 +156,39 @@ class PluginDetailsFragment(val data: PluginViewData) : BottomSheetDialogFragmen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun updateVoting(value: Int) {
|
private fun updateVoting(value: Int) {
|
||||||
val metadata = data.plugin.second
|
val metadata = data.plugin.second
|
||||||
plugin_votes.text = value.toString()
|
binding?.apply {
|
||||||
|
pluginVotes.text = value.toString()
|
||||||
when (metadata.getVoteType()) {
|
when (metadata.getVoteType()) {
|
||||||
VotingApi.VoteType.UPVOTE -> {
|
VotingApi.VoteType.UPVOTE -> {
|
||||||
upvote.imageTintList = ColorStateList.valueOf(context?.colorFromAttribute(R.attr.colorPrimary) ?: R.color.colorPrimary)
|
upvote.imageTintList = ColorStateList.valueOf(
|
||||||
downvote.imageTintList = ColorStateList.valueOf(context?.colorFromAttribute(R.attr.white) ?: R.color.white)
|
context?.colorFromAttribute(R.attr.colorPrimary) ?: R.color.colorPrimary
|
||||||
|
)
|
||||||
|
downvote.imageTintList = ColorStateList.valueOf(
|
||||||
|
context?.colorFromAttribute(R.attr.white) ?: R.color.white
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
VotingApi.VoteType.DOWNVOTE -> {
|
VotingApi.VoteType.DOWNVOTE -> {
|
||||||
downvote.imageTintList = ColorStateList.valueOf(context?.colorFromAttribute(R.attr.colorPrimary) ?: R.color.colorPrimary)
|
downvote.imageTintList = ColorStateList.valueOf(
|
||||||
upvote.imageTintList = ColorStateList.valueOf(context?.colorFromAttribute(R.attr.white) ?: R.color.white)
|
context?.colorFromAttribute(R.attr.colorPrimary) ?: R.color.colorPrimary
|
||||||
|
)
|
||||||
|
upvote.imageTintList = ColorStateList.valueOf(
|
||||||
|
context?.colorFromAttribute(R.attr.white) ?: R.color.white
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
VotingApi.VoteType.NONE -> {
|
VotingApi.VoteType.NONE -> {
|
||||||
upvote.imageTintList = ColorStateList.valueOf(context?.colorFromAttribute(R.attr.white) ?: R.color.white)
|
upvote.imageTintList = ColorStateList.valueOf(
|
||||||
downvote.imageTintList = ColorStateList.valueOf(context?.colorFromAttribute(R.attr.white) ?: R.color.white)
|
context?.colorFromAttribute(R.attr.white) ?: R.color.white
|
||||||
|
)
|
||||||
|
downvote.imageTintList = ColorStateList.valueOf(
|
||||||
|
context?.colorFromAttribute(R.attr.white) ?: R.color.white
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,19 +10,20 @@ import androidx.core.content.ContextCompat
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.lagradost.cloudstream3.MainAPI
|
import com.lagradost.cloudstream3.MainAPI
|
||||||
import com.lagradost.cloudstream3.R
|
import com.lagradost.cloudstream3.R
|
||||||
|
import com.lagradost.cloudstream3.databinding.ProviderTestItemBinding
|
||||||
import com.lagradost.cloudstream3.mvvm.getAllMessages
|
import com.lagradost.cloudstream3.mvvm.getAllMessages
|
||||||
import com.lagradost.cloudstream3.mvvm.getStackTracePretty
|
import com.lagradost.cloudstream3.mvvm.getStackTracePretty
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils
|
import com.lagradost.cloudstream3.utils.AppUtils
|
||||||
import com.lagradost.cloudstream3.utils.SubtitleHelper.getFlagFromIso
|
import com.lagradost.cloudstream3.utils.SubtitleHelper.getFlagFromIso
|
||||||
import com.lagradost.cloudstream3.utils.TestingUtils
|
import com.lagradost.cloudstream3.utils.TestingUtils
|
||||||
import kotlinx.android.synthetic.main.provider_test_item.view.*
|
|
||||||
|
|
||||||
class TestResultAdapter(override val items: MutableList<Pair<MainAPI, TestingUtils.TestResultProvider>>) :
|
class TestResultAdapter(override val items: MutableList<Pair<MainAPI, TestingUtils.TestResultProvider>>) :
|
||||||
AppUtils.DiffAdapter<Pair<MainAPI, TestingUtils.TestResultProvider>>(items) {
|
AppUtils.DiffAdapter<Pair<MainAPI, TestingUtils.TestResultProvider>>(items) {
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||||
return ProviderTestViewHolder(
|
return ProviderTestViewHolder(
|
||||||
LayoutInflater.from(parent.context)
|
ProviderTestItemBinding.inflate(LayoutInflater.from(parent.context), parent,false)
|
||||||
.inflate(R.layout.provider_test_item, parent, false),
|
//LayoutInflater.from(parent.context)
|
||||||
|
// .inflate(R.layout.provider_test_item, parent, false),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,12 +36,12 @@ class TestResultAdapter(override val items: MutableList<Pair<MainAPI, TestingUti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class ProviderTestViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
inner class ProviderTestViewHolder(binding: ProviderTestItemBinding) : RecyclerView.ViewHolder(binding.root) {
|
||||||
private val languageText: TextView = itemView.lang_icon
|
private val languageText: TextView = binding.langIcon
|
||||||
private val providerTitle: TextView = itemView.main_text
|
private val providerTitle: TextView = binding.mainText
|
||||||
private val statusText: TextView = itemView.passed_failed_marker
|
private val statusText: TextView = binding.passedFailedMarker
|
||||||
private val failDescription: TextView = itemView.fail_description
|
private val failDescription: TextView = binding.failDescription
|
||||||
private val logButton: ImageView = itemView.action_button
|
private val logButton: ImageView = binding.actionButton
|
||||||
|
|
||||||
private fun String.lastLine(): String? {
|
private fun String.lastLine(): String? {
|
||||||
return this.lines().lastOrNull { it.isNotBlank() }
|
return this.lines().lastOrNull { it.isNotBlank() }
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.lagradost.cloudstream3.CommonActivity.onColorSelectedEvent
|
||||||
import com.lagradost.cloudstream3.CommonActivity.onDialogDismissedEvent
|
import com.lagradost.cloudstream3.CommonActivity.onDialogDismissedEvent
|
||||||
import com.lagradost.cloudstream3.CommonActivity.showToast
|
import com.lagradost.cloudstream3.CommonActivity.showToast
|
||||||
import com.lagradost.cloudstream3.R
|
import com.lagradost.cloudstream3.R
|
||||||
|
import com.lagradost.cloudstream3.databinding.SubtitleSettingsBinding
|
||||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueTvSettings
|
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueTvSettings
|
||||||
import com.lagradost.cloudstream3.utils.DataStore.setKey
|
import com.lagradost.cloudstream3.utils.DataStore.setKey
|
||||||
import com.lagradost.cloudstream3.utils.Event
|
import com.lagradost.cloudstream3.utils.Event
|
||||||
|
@ -37,8 +38,6 @@ import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.hideSystemUI
|
import com.lagradost.cloudstream3.utils.UIHelper.hideSystemUI
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.navigate
|
import com.lagradost.cloudstream3.utils.UIHelper.navigate
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.popCurrentPage
|
import com.lagradost.cloudstream3.utils.UIHelper.popCurrentPage
|
||||||
import kotlinx.android.synthetic.main.subtitle_settings.*
|
|
||||||
import kotlinx.android.synthetic.main.toast.view.*
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
const val SUBTITLE_KEY = "subtitle_settings"
|
const val SUBTITLE_KEY = "subtitle_settings"
|
||||||
|
@ -184,10 +183,10 @@ class SubtitlesFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Context.updateState() {
|
private fun Context.updateState() {
|
||||||
subtitle_text?.setStyle(fromSaveToStyle(state))
|
binding?.subtitleText?.setStyle(fromSaveToStyle(state))
|
||||||
val text = subtitle_text.context.getString(R.string.subtitles_example_text)
|
val text = getString(R.string.subtitles_example_text)
|
||||||
val fixedText = if (state.upperCase) text.uppercase() else text
|
val fixedText = if (state.upperCase) text.uppercase() else text
|
||||||
subtitle_text?.setCues(
|
binding?.subtitleText?.setCues(
|
||||||
listOf(
|
listOf(
|
||||||
Cue.Builder()
|
Cue.Builder()
|
||||||
.setTextSize(
|
.setTextSize(
|
||||||
|
@ -213,12 +212,21 @@ class SubtitlesFragment : Fragment() {
|
||||||
return if (color == Color.TRANSPARENT) Color.BLACK else color
|
return if (color == Color.TRANSPARENT) Color.BLACK else color
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
binding = null
|
||||||
|
super.onDestroyView()
|
||||||
|
}
|
||||||
|
|
||||||
|
var binding: SubtitleSettingsBinding? = null
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater,
|
||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?,
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View {
|
||||||
return inflater.inflate(R.layout.subtitle_settings, container, false)
|
val localBinding = SubtitleSettingsBinding.inflate(inflater, container, false)
|
||||||
|
binding = localBinding
|
||||||
|
return localBinding.root
|
||||||
|
//return inflater.inflate(R.layout.subtitle_settings, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var state: SaveCaptionStyle
|
private lateinit var state: SaveCaptionStyle
|
||||||
|
@ -234,11 +242,11 @@ class SubtitlesFragment : Fragment() {
|
||||||
hide = arguments?.getBoolean("hide") ?: true
|
hide = arguments?.getBoolean("hide") ?: true
|
||||||
onColorSelectedEvent += ::onColorSelected
|
onColorSelectedEvent += ::onColorSelected
|
||||||
onDialogDismissedEvent += ::onDialogDismissed
|
onDialogDismissedEvent += ::onDialogDismissed
|
||||||
subs_import_text?.text = getString(R.string.subs_import_text).format(
|
binding?.subsImportText?.text = getString(R.string.subs_import_text).format(
|
||||||
context?.getExternalFilesDir(null)?.absolutePath.toString() + "/Fonts"
|
context?.getExternalFilesDir(null)?.absolutePath.toString() + "/Fonts"
|
||||||
)
|
)
|
||||||
|
|
||||||
fixPaddingStatusbar(subs_root)
|
fixPaddingStatusbar(binding?.subsRoot)
|
||||||
|
|
||||||
state = getCurrentSavedStyle()
|
state = getCurrentSavedStyle()
|
||||||
context?.updateState()
|
context?.updateState()
|
||||||
|
@ -268,19 +276,19 @@ class SubtitlesFragment : Fragment() {
|
||||||
return@setOnLongClickListener true
|
return@setOnLongClickListener true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
binding?.apply {
|
||||||
subs_text_color.setup(0)
|
subsTextColor.setup(0)
|
||||||
subs_outline_color.setup(1)
|
subsOutlineColor.setup(1)
|
||||||
subs_background_color.setup(2)
|
subsBackgroundColor.setup(2)
|
||||||
subs_window_color.setup(3)
|
subsWindowColor.setup(3)
|
||||||
|
|
||||||
val dismissCallback = {
|
val dismissCallback = {
|
||||||
if (hide)
|
if (hide)
|
||||||
activity?.hideSystemUI()
|
activity?.hideSystemUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
subs_subtitle_elevation.setFocusableInTv()
|
subsSubtitleElevation.setFocusableInTv()
|
||||||
subs_subtitle_elevation.setOnClickListener { textView ->
|
subsSubtitleElevation.setOnClickListener { textView ->
|
||||||
val suffix = "dp"
|
val suffix = "dp"
|
||||||
val elevationTypes = listOf(
|
val elevationTypes = listOf(
|
||||||
Pair(0, textView.context.getString(R.string.none)),
|
Pair(0, textView.context.getString(R.string.none)),
|
||||||
|
@ -311,15 +319,15 @@ class SubtitlesFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subs_subtitle_elevation.setOnLongClickListener {
|
subsSubtitleElevation.setOnLongClickListener {
|
||||||
state.elevation = DEF_SUBS_ELEVATION
|
state.elevation = DEF_SUBS_ELEVATION
|
||||||
it.context.updateState()
|
it.context.updateState()
|
||||||
showToast(activity, R.string.subs_default_reset_toast, Toast.LENGTH_SHORT)
|
showToast(activity, R.string.subs_default_reset_toast, Toast.LENGTH_SHORT)
|
||||||
return@setOnLongClickListener true
|
return@setOnLongClickListener true
|
||||||
}
|
}
|
||||||
|
|
||||||
subs_edge_type.setFocusableInTv()
|
subsEdgeType.setFocusableInTv()
|
||||||
subs_edge_type.setOnClickListener { textView ->
|
subsEdgeType.setOnClickListener { textView ->
|
||||||
val edgeTypes = listOf(
|
val edgeTypes = listOf(
|
||||||
Pair(
|
Pair(
|
||||||
CaptionStyleCompat.EDGE_TYPE_NONE,
|
CaptionStyleCompat.EDGE_TYPE_NONE,
|
||||||
|
@ -356,15 +364,15 @@ class SubtitlesFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subs_edge_type.setOnLongClickListener {
|
subsEdgeType.setOnLongClickListener {
|
||||||
state.edgeType = CaptionStyleCompat.EDGE_TYPE_OUTLINE
|
state.edgeType = CaptionStyleCompat.EDGE_TYPE_OUTLINE
|
||||||
it.context.updateState()
|
it.context.updateState()
|
||||||
showToast(activity, R.string.subs_default_reset_toast, Toast.LENGTH_SHORT)
|
showToast(activity, R.string.subs_default_reset_toast, Toast.LENGTH_SHORT)
|
||||||
return@setOnLongClickListener true
|
return@setOnLongClickListener true
|
||||||
}
|
}
|
||||||
|
|
||||||
subs_font_size.setFocusableInTv()
|
subsFontSize.setFocusableInTv()
|
||||||
subs_font_size.setOnClickListener { textView ->
|
subsFontSize.setOnClickListener { textView ->
|
||||||
val suffix = "sp"
|
val suffix = "sp"
|
||||||
val fontSizes = listOf(
|
val fontSizes = listOf(
|
||||||
Pair(null, textView.context.getString(R.string.normal)),
|
Pair(null, textView.context.getString(R.string.normal)),
|
||||||
|
@ -415,22 +423,22 @@ class SubtitlesFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subtitles_remove_bloat?.isChecked = state.removeBloat
|
subtitlesRemoveBloat.isChecked = state.removeBloat
|
||||||
subtitles_remove_bloat?.setOnCheckedChangeListener { _, b ->
|
subtitlesRemoveBloat.setOnCheckedChangeListener { _, b ->
|
||||||
state.removeBloat = b
|
state.removeBloat = b
|
||||||
}
|
}
|
||||||
subtitles_uppercase?.isChecked = state.upperCase
|
subtitlesUppercase.isChecked = state.upperCase
|
||||||
subtitles_uppercase?.setOnCheckedChangeListener { _, b ->
|
subtitlesUppercase.setOnCheckedChangeListener { _, b ->
|
||||||
state.upperCase = b
|
state.upperCase = b
|
||||||
context?.updateState()
|
context?.updateState()
|
||||||
}
|
}
|
||||||
|
|
||||||
subtitles_remove_captions?.isChecked = state.removeCaptions
|
subtitlesRemoveCaptions.isChecked = state.removeCaptions
|
||||||
subtitles_remove_captions?.setOnCheckedChangeListener { _, b ->
|
subtitlesRemoveCaptions.setOnCheckedChangeListener { _, b ->
|
||||||
state.removeCaptions = b
|
state.removeCaptions = b
|
||||||
}
|
}
|
||||||
|
|
||||||
subs_font_size.setOnLongClickListener { _ ->
|
subsFontSize.setOnLongClickListener { _ ->
|
||||||
state.fixedTextSize = null
|
state.fixedTextSize = null
|
||||||
//textView.context.updateState() // font size not changed
|
//textView.context.updateState() // font size not changed
|
||||||
showToast(activity, R.string.subs_default_reset_toast, Toast.LENGTH_SHORT)
|
showToast(activity, R.string.subs_default_reset_toast, Toast.LENGTH_SHORT)
|
||||||
|
@ -439,12 +447,12 @@ class SubtitlesFragment : Fragment() {
|
||||||
|
|
||||||
//Fetch current value from preference
|
//Fetch current value from preference
|
||||||
context?.let { ctx ->
|
context?.let { ctx ->
|
||||||
subtitles_filter_sub_lang?.isChecked =
|
subtitlesFilterSubLang.isChecked =
|
||||||
PreferenceManager.getDefaultSharedPreferences(ctx)
|
PreferenceManager.getDefaultSharedPreferences(ctx)
|
||||||
.getBoolean(getString(R.string.filter_sub_lang_key), false)
|
.getBoolean(getString(R.string.filter_sub_lang_key), false)
|
||||||
}
|
}
|
||||||
|
|
||||||
subtitles_filter_sub_lang?.setOnCheckedChangeListener { _, b ->
|
subtitlesFilterSubLang.setOnCheckedChangeListener { _, b ->
|
||||||
context?.let { ctx ->
|
context?.let { ctx ->
|
||||||
PreferenceManager.getDefaultSharedPreferences(ctx)
|
PreferenceManager.getDefaultSharedPreferences(ctx)
|
||||||
.edit()
|
.edit()
|
||||||
|
@ -453,8 +461,8 @@ class SubtitlesFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subs_font.setFocusableInTv()
|
subsFont.setFocusableInTv()
|
||||||
subs_font.setOnClickListener { textView ->
|
subsFont.setOnClickListener { textView ->
|
||||||
val fontTypes = listOf(
|
val fontTypes = listOf(
|
||||||
Pair(null, textView.context.getString(R.string.normal)),
|
Pair(null, textView.context.getString(R.string.normal)),
|
||||||
Pair(R.font.trebuchet_ms, "Trebuchet MS"),
|
Pair(R.font.trebuchet_ms, "Trebuchet MS"),
|
||||||
|
@ -501,7 +509,7 @@ class SubtitlesFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subs_font.setOnLongClickListener { textView ->
|
subsFont.setOnLongClickListener { textView ->
|
||||||
state.typeface = null
|
state.typeface = null
|
||||||
state.typefaceFilePath = null
|
state.typefaceFilePath = null
|
||||||
textView.context.updateState()
|
textView.context.updateState()
|
||||||
|
@ -509,8 +517,8 @@ class SubtitlesFragment : Fragment() {
|
||||||
return@setOnLongClickListener true
|
return@setOnLongClickListener true
|
||||||
}
|
}
|
||||||
|
|
||||||
subs_auto_select_language.setFocusableInTv()
|
subsAutoSelectLanguage.setFocusableInTv()
|
||||||
subs_auto_select_language.setOnClickListener { textView ->
|
subsAutoSelectLanguage.setOnClickListener { textView ->
|
||||||
val langMap = arrayListOf(
|
val langMap = arrayListOf(
|
||||||
SubtitleHelper.Language639(
|
SubtitleHelper.Language639(
|
||||||
textView.context.getString(R.string.none),
|
textView.context.getString(R.string.none),
|
||||||
|
@ -536,14 +544,14 @@ class SubtitlesFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subs_auto_select_language.setOnLongClickListener {
|
subsAutoSelectLanguage.setOnLongClickListener {
|
||||||
setKey(SUBTITLE_AUTO_SELECT_KEY, "en")
|
setKey(SUBTITLE_AUTO_SELECT_KEY, "en")
|
||||||
showToast(activity, R.string.subs_default_reset_toast, Toast.LENGTH_SHORT)
|
showToast(activity, R.string.subs_default_reset_toast, Toast.LENGTH_SHORT)
|
||||||
return@setOnLongClickListener true
|
return@setOnLongClickListener true
|
||||||
}
|
}
|
||||||
|
|
||||||
subs_download_languages.setFocusableInTv()
|
subsDownloadLanguages.setFocusableInTv()
|
||||||
subs_download_languages.setOnClickListener { textView ->
|
subsDownloadLanguages.setOnClickListener { textView ->
|
||||||
val langMap = SubtitleHelper.languages
|
val langMap = SubtitleHelper.languages
|
||||||
val lang639_1 = langMap.map { it.ISO_639_1 }
|
val lang639_1 = langMap.map { it.ISO_639_1 }
|
||||||
val keys = getDownloadSubsLanguageISO639_1()
|
val keys = getDownloadSubsLanguageISO639_1()
|
||||||
|
@ -559,22 +567,23 @@ class SubtitlesFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subs_download_languages.setOnLongClickListener {
|
subsDownloadLanguages.setOnLongClickListener {
|
||||||
setKey(SUBTITLE_DOWNLOAD_KEY, listOf("en"))
|
setKey(SUBTITLE_DOWNLOAD_KEY, listOf("en"))
|
||||||
|
|
||||||
showToast(activity, R.string.subs_default_reset_toast, Toast.LENGTH_SHORT)
|
showToast(activity, R.string.subs_default_reset_toast, Toast.LENGTH_SHORT)
|
||||||
return@setOnLongClickListener true
|
return@setOnLongClickListener true
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel_btt.setOnClickListener {
|
cancelBtt.setOnClickListener {
|
||||||
activity?.popCurrentPage()
|
activity?.popCurrentPage()
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_btt.setOnClickListener {
|
applyBtt.setOnClickListener {
|
||||||
it.context.saveStyle(state)
|
it.context.saveStyle(state)
|
||||||
applyStyleEvent.invoke(state)
|
applyStyleEvent.invoke(state)
|
||||||
it.context.fromSaveToStyle(state)
|
it.context.fromSaveToStyle(state)
|
||||||
activity?.popCurrentPage()
|
activity?.popCurrentPage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue