From 2ff79d6287baef82e2d5c5924b79fc9b0188d4b6 Mon Sep 17 00:00:00 2001 From: Equip de Desenvolupadors de PBE Date: Sun, 23 Dec 2012 14:22:39 +0000 Subject: [PATCH] Corregido bug al ir video atras y volver al que se tenia pendiente --- src/com/upc/pbe/upcnews/VideoActivity.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/com/upc/pbe/upcnews/VideoActivity.java b/src/com/upc/pbe/upcnews/VideoActivity.java index 5548fe5..7e2c3cf 100644 --- a/src/com/upc/pbe/upcnews/VideoActivity.java +++ b/src/com/upc/pbe/upcnews/VideoActivity.java @@ -38,6 +38,7 @@ public class VideoActivity extends Activity { boolean ended; boolean buffering; DescarregaSegment ds; + boolean videoNotPlayed; @Override @@ -53,6 +54,7 @@ public class VideoActivity extends Activity { } setContentView(R.layout.activity_video); currentPos = 0; + videoNotPlayed = false; queue = new ArrayList(); playedQueue = new ArrayList(); buffering = true; @@ -143,8 +145,15 @@ public class VideoActivity extends Activity { } if(currentPos == 0) { - playedQueue.add(queue.get(0)); - queue.remove(0); + if(!videoNotPlayed) + { + playedQueue.add(queue.get(0)); + queue.remove(0); + } + else + { + videoNotPlayed = false; + } if(ended && queue.isEmpty()) { quitPlayer(); @@ -166,6 +175,10 @@ public class VideoActivity extends Activity { public void playPrevious() { + if(currentPos == 0) + { + videoNotPlayed = true; + } if(playedQueue.isEmpty()) { play(queue.get(0)); @@ -241,7 +254,7 @@ public class VideoActivity extends Activity { Long downloaded = Long.valueOf(0); long startTime = System.currentTimeMillis(); long segmentBytes = TrafficStats.getTotalRxBytes(); - String fileName = urls[0].toString().substring(urls[0].toString().lastIndexOf("/")); + String fileName = urls[0].toString().substring(urls[0].toString().lastIndexOf("/")+1); // Iniciem la connexi� i creem els Streams try { -- libgit2 0.22.2