mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
Merge pull request #2711 from Isira-Seneviratne/ConfigurationCompat
Use ConfigurationCompat.getLocales().
This commit is contained in:
commit
b925c58119
@ -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
|
||||
@ -829,11 +830,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() {
|
||||
|
@ -45,7 +45,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…
Reference in New Issue
Block a user