Commit cb34f9d50efa8c579adb596cde8c88102ce8043c

Authored by Imanol-Mikel Barba Sabariego
1 parent 5a976f7a

Bug file duplicate fixed

AndroidManifest.xml
... ... @@ -24,8 +24,6 @@
24 24 <category android:name="android.intent.category.LAUNCHER" />
25 25 </intent-filter>
26 26 </activity>
27   - <activity android:name=".Descarrega" >
28   - </activity>
29 27 <activity android:name=".Prefs" >
30 28 </activity>
31 29 <activity android:name=".Help" android:configChanges="orientation">
... ...
src/com/upc/pbe/upcnews/VideoActivity.java
... ... @@ -6,6 +6,7 @@ import io.vov.vitamio.widget.MediaController;
6 6 import io.vov.vitamio.widget.VideoView;
7 7  
8 8 import java.io.BufferedInputStream;
  9 +import java.io.File;
9 10 import java.io.FileOutputStream;
10 11 import java.io.IOException;
11 12 import java.net.MalformedURLException;
... ... @@ -230,7 +231,14 @@ public class VideoActivity extends Activity {
230 231 // Iniciem la connexi� i creem els Streams
231 232 try
232 233 {
233   - FileOutputStream out = new FileOutputStream(filePath + fileName,true);
  234 + int index = 0;
  235 + String newFileName = fileName;
  236 + while(new File(filePath + newFileName).exists())
  237 + {
  238 + newFileName = fileName + index++;
  239 + }
  240 + fileName = newFileName;
  241 + FileOutputStream out = new FileOutputStream(filePath + fileName);
234 242 BufferedInputStream in = new BufferedInputStream(urls[0].openStream());
235 243 Log.d(TAG, "\nDescarregant: \n");
236 244 Log.d(TAG, ">> URL: " + urls[0]);
... ...