[Android] Use user's locale time format for TV
Nicolas Pomepuy
git at videolan.org
Mon Jul 29 16:37:11 CEST 2019
vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Jul 29 07:22:59 2019 +0200| [06198b5f45fb870d9611199e5741af0fdbfc8aa5] | committer: Geoffrey Métais
Use user's locale time format for TV
(cherry picked from commit ea8df450fd84fe91d13dc5d67b40393fa9e7a03c)
> https://code.videolan.org/videolan/vlc-android/commit/06198b5f45fb870d9611199e5741af0fdbfc8aa5
---
vlc-android/src/org/videolan/vlc/gui/tv/TimeUpdater.kt | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/TimeUpdater.kt b/vlc-android/src/org/videolan/vlc/gui/tv/TimeUpdater.kt
index 0da85a021..f1d312362 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/TimeUpdater.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/TimeUpdater.kt
@@ -30,6 +30,7 @@ import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
+import java.text.DateFormat
import java.util.*
private const val TAG = "VLC/TimeUpdater"
@@ -37,8 +38,9 @@ private const val TAG = "VLC/TimeUpdater"
class TimeUpdater(private val activity: Activity, private val tv: TextView) : LifecycleObserver {
private fun updateTime() {
- val calendar = Calendar.getInstance()
- tv.text = String.format("%d:%02d", calendar[Calendar.HOUR_OF_DAY], calendar[Calendar.MINUTE])
+
+ val format = DateFormat.getTimeInstance(DateFormat.SHORT, Locale.getDefault())
+ tv.text = format.format(Date())
}
@OnLifecycleEvent(Lifecycle.Event.ON_START)
More information about the Android
mailing list