[Android] Set media length to the maximum we can go

Geoffrey Métais git at videolan.org
Mon Feb 23 18:17:40 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Feb 23 17:49:32 2015 +0100| [8a75f6f6d5aeeed0c0001c1a2f3c71b13b89a169] | committer: Geoffrey Métais

Set media length to the maximum we can go

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

 .../src/org/videolan/vlc/gui/dialogs/JumpToTimeDialog.java   |    1 +
 .../src/org/videolan/vlc/gui/dialogs/PickTimeFragment.java   |   10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/JumpToTimeDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/JumpToTimeDialog.java
index d1ccb95..a283c86 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/JumpToTimeDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/JumpToTimeDialog.java
@@ -35,6 +35,7 @@ public class JumpToTimeDialog extends PickTimeFragment {
     public JumpToTimeDialog(){
         super();
         mLiveAction = false;
+        max = mLibVLC.getLength() * 1000l;
     }
 
     @Override
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/PickTimeFragment.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/PickTimeFragment.java
index df87aa6..3cf52be 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/PickTimeFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/PickTimeFragment.java
@@ -53,13 +53,15 @@ public abstract class PickTimeFragment extends DialogFragment implements DialogI
     protected LibVLC mLibVLC = null;
     protected TextView mHours, mMinutes, mSeconds, mMillis, mSign;
     protected Button mActionButton;
+    protected long max = -1;
 
-    public PickTimeFragment(){}
+    public PickTimeFragment(){
+        mLibVLC = LibVLC.getInstance();
+    }
 
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) {
-        mLibVLC = LibVLC.getInstance();
         View view = inflater.inflate(R.layout.jump_to_time, container);
         ((TextView)view.findViewById(R.id.jump_dialog_title)).setText(getTitle());
         mHours = (TextView) view.findViewById(R.id.jump_hours);
@@ -187,7 +189,9 @@ public abstract class PickTimeFragment extends DialogFragment implements DialogI
             case R.id.jump_millis:
                 slide = delta * MILLIS_IN_MICROS;
         }
-        initTime(getTime() + slide);
+        slide += getTime();
+        if (max == -1 || slide <= max)
+            initTime(slide);
         if (mLiveAction)
             executeAction();
     }



More information about the Android mailing list