Commit 2ff79d6287baef82e2d5c5924b79fc9b0188d4b6
1 parent
8eda8798
Corregido bug al ir video atras y volver al que se tenia pendiente
Showing
1 changed file
with
16 additions
and
3 deletions
src/com/upc/pbe/upcnews/VideoActivity.java
... | ... | @@ -38,6 +38,7 @@ public class VideoActivity extends Activity { |
38 | 38 | boolean ended; |
39 | 39 | boolean buffering; |
40 | 40 | DescarregaSegment ds; |
41 | + boolean videoNotPlayed; | |
41 | 42 | |
42 | 43 | |
43 | 44 | @Override |
... | ... | @@ -53,6 +54,7 @@ public class VideoActivity extends Activity { |
53 | 54 | } |
54 | 55 | setContentView(R.layout.activity_video); |
55 | 56 | currentPos = 0; |
57 | + videoNotPlayed = false; | |
56 | 58 | queue = new ArrayList<String>(); |
57 | 59 | playedQueue = new ArrayList<String>(); |
58 | 60 | buffering = true; |
... | ... | @@ -143,8 +145,15 @@ public class VideoActivity extends Activity { |
143 | 145 | } |
144 | 146 | if(currentPos == 0) |
145 | 147 | { |
146 | - playedQueue.add(queue.get(0)); | |
147 | - queue.remove(0); | |
148 | + if(!videoNotPlayed) | |
149 | + { | |
150 | + playedQueue.add(queue.get(0)); | |
151 | + queue.remove(0); | |
152 | + } | |
153 | + else | |
154 | + { | |
155 | + videoNotPlayed = false; | |
156 | + } | |
148 | 157 | if(ended && queue.isEmpty()) |
149 | 158 | { |
150 | 159 | quitPlayer(); |
... | ... | @@ -166,6 +175,10 @@ public class VideoActivity extends Activity { |
166 | 175 | |
167 | 176 | public void playPrevious() |
168 | 177 | { |
178 | + if(currentPos == 0) | |
179 | + { | |
180 | + videoNotPlayed = true; | |
181 | + } | |
169 | 182 | if(playedQueue.isEmpty()) |
170 | 183 | { |
171 | 184 | play(queue.get(0)); |
... | ... | @@ -241,7 +254,7 @@ public class VideoActivity extends Activity { |
241 | 254 | Long downloaded = Long.valueOf(0); |
242 | 255 | long startTime = System.currentTimeMillis(); |
243 | 256 | long segmentBytes = TrafficStats.getTotalRxBytes(); |
244 | - String fileName = urls[0].toString().substring(urls[0].toString().lastIndexOf("/")); | |
257 | + String fileName = urls[0].toString().substring(urls[0].toString().lastIndexOf("/")+1); | |
245 | 258 | // Iniciem la connexi� i creem els Streams |
246 | 259 | try |
247 | 260 | { | ... | ... |