[Android] Fixed inappropriate use of Calendar.roll in TimePickerDialogFragment

Mario Rabe git at videolan.org
Sat May 2 21:04:33 CEST 2015


vlc-ports/android | branch: master | Mario Rabe <mario.rabe at gmail.com> | Sat May  2 18:59:07 2015 +0000| [f94cf08718a971a7a2c7eb0e4834930af7c72dfe] | committer: Jean-Baptiste Kempf

Fixed inappropriate use of Calendar.roll in TimePickerDialogFragment

This fixes a bug that caused playback to stop immediately when it is
the last day of a month and you set the sleep-timer after midnight. The use
of Calendar.roll caused the resulting target-date to be in the past.
Calendar.add should be used instead of Calendar.roll so larger fields get
rolled over too.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=f94cf08718a971a7a2c7eb0e4834930af7c72dfe
---

 .../src/org/videolan/vlc/gui/dialogs/TimePickerDialogFragment.java   |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/TimePickerDialogFragment.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/TimePickerDialogFragment.java
index f2a55c9..693f0e0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/TimePickerDialogFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/TimePickerDialogFragment.java
@@ -87,7 +87,7 @@ public class TimePickerDialogFragment extends DialogFragment implements TimePick
         switch(action){
             case ACTION_SLEEP:
                 if (sleepTime.before(currentTime))
-                    sleepTime.roll(Calendar.DATE, true);
+                    sleepTime.add(Calendar.DATE, 1);
 
                 AdvOptionsDialog.setSleep(view.getContext(), sleepTime);
                 break;



More information about the Android mailing list