[Android] Avoid Calendar instanciations

Geoffrey Métais git at videolan.org
Wed Aug 9 15:12:34 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Aug  9 13:34:40 2017 +0200| [21e12427bff45030ee9f3b9be19b2e1e27cbd63a] | committer: Geoffrey Métais

Avoid Calendar instanciations

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java              | 2 +-
 vlc-android/src/org/videolan/vlc/gui/dialogs/SleepTimerDialog.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 2517ee6d7..9c3cba5af 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1524,7 +1524,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
         if (!mHasWidget)
             return;
         // no more than one widget mUpdateMeta for each 1/50 of the song
-        long timestamp = Calendar.getInstance().getTimeInMillis();
+        long timestamp = System.currentTimeMillis();
         if (!hasCurrentMedia() || timestamp - mWidgetPositionTimestamp < getCurrentMedia().getLength() / 50)
             return;
         mWidgetPositionTimestamp = timestamp;
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/SleepTimerDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/SleepTimerDialog.java
index 08507d7d9..e4eeaf4e3 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/SleepTimerDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/SleepTimerDialog.java
@@ -72,7 +72,7 @@ public class SleepTimerDialog extends PickTimeFragment {
 
         if (interval < ONE_DAY_IN_MILLIS) {
             Calendar sleepTime = Calendar.getInstance();
-            sleepTime.setTimeInMillis(Calendar.getInstance().getTimeInMillis() + interval);
+            sleepTime.setTimeInMillis(sleepTime.getTimeInMillis() + interval);
             sleepTime.set(Calendar.SECOND, 0);
             AdvOptionsDialog.setSleep(sleepTime);
         }



More information about the Android mailing list