mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 07:50:31 +05:30
Use ConfigurationCompat.getLocales().
This commit is contained in:
parent
e01a3d8465
commit
8122788349
@ -27,6 +27,7 @@ import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||
import androidx.core.net.toUri
|
||||
import androidx.core.os.ConfigurationCompat
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.activityViewModels
|
||||
@ -842,11 +843,8 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
||||
}
|
||||
|
||||
private fun localizedDate(date: String?): String? {
|
||||
return if (SDK_INT >= Build.VERSION_CODES.N) {
|
||||
TextUtils.localizeDate(date, resources.configuration.locales[0])
|
||||
} else {
|
||||
TextUtils.localizeDate(date)
|
||||
}
|
||||
val locale = ConfigurationCompat.getLocales(resources.configuration)[0]!!
|
||||
return TextUtils.localizeDate(date, locale)
|
||||
}
|
||||
|
||||
private fun handleLiveVideo() {
|
||||
|
@ -40,7 +40,7 @@ object TextUtils {
|
||||
* @param locale The locale to use, otherwise uses system default
|
||||
* return Localized date string
|
||||
*/
|
||||
fun localizeDate(date: String?, locale: Locale? = null): String? {
|
||||
fun localizeDate(date: String?, locale: Locale): String? {
|
||||
date ?: return null
|
||||
|
||||
// relative time span
|
||||
|
Loading…
x
Reference in New Issue
Block a user