mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
upgrade locale deprecation & few unstable opt ins
This commit is contained in:
parent
f5a3db8ba1
commit
b041cefcdf
3 changed files with 7 additions and 2 deletions
|
@ -3,10 +3,12 @@ package com.lagradost.cloudstream3.ui.settings
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
|
@ -41,12 +43,13 @@ import com.lagradost.cloudstream3.utils.VideoDownloadManager
|
|||
import com.lagradost.cloudstream3.utils.VideoDownloadManager.getBasePath
|
||||
import com.lagradost.safefile.SafeFile
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun getCurrentLocale(context: Context): String {
|
||||
val res = context.resources
|
||||
// Change locale settings in the app.
|
||||
// val dm = res.displayMetrics
|
||||
val conf = res.configuration
|
||||
return conf?.locale?.toString() ?: "en"
|
||||
return conf?.locales?.toString() ?: "en"
|
||||
}
|
||||
|
||||
// idk, if you find a way of automating this it would be great
|
||||
|
@ -160,6 +163,7 @@ class SettingsGeneral : PreferenceFragmentCompat() {
|
|||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
hideKeyboard()
|
||||
setPreferencesFromResource(R.xml.settings_general, rootKey)
|
||||
|
|
|
@ -45,7 +45,7 @@ data class SaveChromeCaptionStyle(
|
|||
@JsonProperty("fontScale") var fontScale: Float = 1.05f,
|
||||
@JsonProperty("windowColor") var windowColor: Int = Color.TRANSPARENT,
|
||||
)
|
||||
|
||||
@androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class)
|
||||
class ChromecastSubtitlesFragment : Fragment() {
|
||||
companion object {
|
||||
val applyStyleEvent = Event<SaveChromeCaptionStyle>()
|
||||
|
|
|
@ -65,6 +65,7 @@ data class SaveCaptionStyle(
|
|||
|
||||
const val DEF_SUBS_ELEVATION = 20
|
||||
|
||||
@androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class)
|
||||
class SubtitlesFragment : Fragment() {
|
||||
companion object {
|
||||
val applyStyleEvent = Event<SaveCaptionStyle>()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue