/[projects]/android/Side9/src/dk/thoerup/side9/Side9WidgetProvider.java
ViewVC logotype

Diff of /android/Side9/src/dk/thoerup/side9/Side9WidgetProvider.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1221 by torben, Fri Jan 7 13:16:34 2011 UTC revision 1222 by torben, Tue Feb 8 07:32:07 2011 UTC
# Line 157  public class Side9WidgetProvider extends Line 157  public class Side9WidgetProvider extends
157                                    
158                  final String savepath = Environment.getExternalStorageDirectory() + "/Side9";                  final String savepath = Environment.getExternalStorageDirectory() + "/Side9";
159                                    
160                  File file = new File( savepath + "/" + data.getFilename() );                  File imageFile = new File( savepath + "/" + data.getFilename() );
161                                    
162                  /* if the picture changes later on the day we do NOT want to use an old and invalid image                                /* if the picture changes later on the day we do NOT want to use an old and invalid image              
163                  if (saveImage == true) {                                          if (saveImage == true) {                        
# Line 174  public class Side9WidgetProvider extends Line 174  public class Side9WidgetProvider extends
174                                  File savedir = new File(savepath);                                  File savedir = new File(savepath);
175                                  savedir.mkdirs();                                  savedir.mkdirs();
176                                                                    
177                                  if (file.exists()) {                                  if (imageFile.exists()) {
178                                          file.delete();                                          imageFile.delete();
179                                  }                                  }
180                                                                    
181                                  FileOutputStream fos = new FileOutputStream(file);                                  FileOutputStream fos = new FileOutputStream(imageFile);
182                                  fos.write(imageData);                                  fos.write(imageData);
183                                  fos.close();                                  fos.close();
184                                                                    
185                                  File infoFile = new File( file.toString().replace(".jpg", ".txt"));                                  File infoFile = new File( imageFile.toString().replace(".jpg", ".txt"));
186                                  if (infoFile.exists()) {                                  if (infoFile.exists()) {
187                                          infoFile.delete();                                          infoFile.delete();
188                                  }                                  }
189                                  fos = new FileOutputStream(infoFile);                                  fos = new FileOutputStream(infoFile);
190                                  fos.write(data.caption.getBytes());                                  fos.write(data.caption.getBytes());
191                                  fos.close();                                  fos.close();
192                                    
193                                    //save a thumb image
194                                    ImageAdapter.generateAndLoadThumb(imageFile);
195    
196                                  Intent rescan = new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()) );                                  Intent rescan = new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()) );
197                                  rescan.putExtra("read-only", false);                                                                                              rescan.putExtra("read-only", false);                                                            

Legend:
Removed from v.1221  
changed lines
  Added in v.1222

  ViewVC Help
Powered by ViewVC 1.1.20