Commit cb34f9d50efa8c579adb596cde8c88102ce8043c

Authored by Imanol-Mikel Barba Sabariego
1 parent 5a976f7a

Bug file duplicate fixed

AndroidManifest.xml
@@ -24,8 +24,6 @@ @@ -24,8 +24,6 @@
24 <category android:name="android.intent.category.LAUNCHER" /> 24 <category android:name="android.intent.category.LAUNCHER" />
25 </intent-filter> 25 </intent-filter>
26 </activity> 26 </activity>
27 - <activity android:name=".Descarrega" >  
28 - </activity>  
29 <activity android:name=".Prefs" > 27 <activity android:name=".Prefs" >
30 </activity> 28 </activity>
31 <activity android:name=".Help" android:configChanges="orientation"> 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 +6,7 @@ import io.vov.vitamio.widget.MediaController;
6 import io.vov.vitamio.widget.VideoView; 6 import io.vov.vitamio.widget.VideoView;
7 7
8 import java.io.BufferedInputStream; 8 import java.io.BufferedInputStream;
  9 +import java.io.File;
9 import java.io.FileOutputStream; 10 import java.io.FileOutputStream;
10 import java.io.IOException; 11 import java.io.IOException;
11 import java.net.MalformedURLException; 12 import java.net.MalformedURLException;
@@ -230,7 +231,14 @@ public class VideoActivity extends Activity { @@ -230,7 +231,14 @@ public class VideoActivity extends Activity {
230 // Iniciem la connexi� i creem els Streams 231 // Iniciem la connexi� i creem els Streams
231 try 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 BufferedInputStream in = new BufferedInputStream(urls[0].openStream()); 242 BufferedInputStream in = new BufferedInputStream(urls[0].openStream());
235 Log.d(TAG, "\nDescarregant: \n"); 243 Log.d(TAG, "\nDescarregant: \n");
236 Log.d(TAG, ">> URL: " + urls[0]); 244 Log.d(TAG, ">> URL: " + urls[0]);