[Android] Rename PlayerController.getTime to fix shadowing

Geoffrey Métais git at videolan.org
Mon May 7 18:38:49 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon May  7 18:37:34 2018 +0200| [e058d8afa62e142539502ecc561e90d5c89e326d] | committer: Geoffrey Métais

Rename PlayerController.getTime to fix shadowing

> https://code.videolan.org/videolan/vlc-android/commit/e058d8afa62e142539502ecc561e90d5c89e326d
---

 vlc-android/src/org/videolan/vlc/PlaybackService.kt        | 2 +-
 vlc-android/src/org/videolan/vlc/media/PlayerController.kt | 2 +-
 vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt  | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index 415fa3374..a60f08a1b 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -320,7 +320,7 @@ class PlaybackService : MediaBrowserServiceCompat() {
 
     var time: Long
         @MainThread
-        get() = playlistManager.player.getTime()
+        get() = playlistManager.player.getCurrentTime()
         @MainThread
         set(time) = playlistManager.player.setTime(time)
 
diff --git a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
index 273837561..655a3e6ed 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
@@ -211,7 +211,7 @@ class PlayerController : IVLCVout.Callback, MediaPlayer.EventListener {
         switchToVideo = false
     }
 
-    fun getTime() = currentTime.value ?: 0L
+    fun getCurrentTime() = currentTime.value ?: 0L
 
     fun setRate(rate: Float, save: Boolean) {
         mediaplayer.rate = rate
diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 8bda43253..27ca211cc 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -207,7 +207,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
     @MainThread
     fun previous(force : Boolean) {
         if (hasPrevious() && currentIndex > 0 &&
-                (force || !player.seekable || player.getTime() < PREVIOUS_LIMIT_DELAY)) {
+                (force || !player.seekable || player.getCurrentTime() < PREVIOUS_LIMIT_DELAY)) {
             val size = mediaList.size()
             currentIndex = prevIndex
             if (previous.size > 0) previous.pop()
@@ -389,7 +389,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
         val canSwitchToVideo = player.canSwitchToVideo()
         if (media.type == MediaWrapper.TYPE_VIDEO || canSwitchToVideo || media.isPodcast) {
             //Save progress
-            val time = player.getTime()
+            val time = player.getCurrentTime()
             val length = player.length
             var progress = time / length.toFloat()
             if (progress > 0.95f || length - time < 10000) {
@@ -577,7 +577,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
         editor.putBoolean(if (audio) "audio_shuffling" else "media_shuffling", shuffling)
         editor.putInt(if (audio) "audio_repeating" else "media_repeating", repeating)
         editor.putInt(if (audio) "position_in_audio_list" else "position_in_media_list", if (reset) 0 else currentIndex)
-        editor.putLong(if (audio) "position_in_song" else "position_in_media", if (reset) 0L else player.getTime())
+        editor.putLong(if (audio) "position_in_song" else "position_in_media", if (reset) 0L else player.getCurrentTime())
         if (!audio) {
             editor.putBoolean(PreferencesActivity.VIDEO_PAUSED, !player.isPlaying())
             editor.putFloat(PreferencesActivity.VIDEO_SPEED, player.getRate())



More information about the Android mailing list