mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 06:40:30 +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.annotation.RequiresApi
|
||||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
|
import androidx.core.os.ConfigurationCompat
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
@ -829,11 +830,8 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun localizedDate(date: String?): String? {
|
private fun localizedDate(date: String?): String? {
|
||||||
return if (SDK_INT >= Build.VERSION_CODES.N) {
|
val locale = ConfigurationCompat.getLocales(resources.configuration)[0]!!
|
||||||
TextUtils.localizeDate(date, resources.configuration.locales[0])
|
return TextUtils.localizeDate(date, locale)
|
||||||
} else {
|
|
||||||
TextUtils.localizeDate(date)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleLiveVideo() {
|
private fun handleLiveVideo() {
|
||||||
|
@ -45,7 +45,7 @@ object TextUtils {
|
|||||||
* @param locale The locale to use, otherwise uses system default
|
* @param locale The locale to use, otherwise uses system default
|
||||||
* return Localized date string
|
* return Localized date string
|
||||||
*/
|
*/
|
||||||
fun localizeDate(date: String?, locale: Locale? = null): String? {
|
fun localizeDate(date: String?, locale: Locale): String? {
|
||||||
date ?: return null
|
date ?: return null
|
||||||
|
|
||||||
// relative time span
|
// relative time span
|
||||||
|
Loading…
Reference in New Issue
Block a user