/[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 775 by torben, Tue Jun 1 07:46:12 2010 UTC revision 778 by torben, Tue Jun 1 09:14:19 2010 UTC
# Line 14  import android.content.SharedPreferences Line 14  import android.content.SharedPreferences
14  import android.graphics.Bitmap;  import android.graphics.Bitmap;
15  import android.graphics.BitmapFactory;  import android.graphics.BitmapFactory;
16  import android.net.ConnectivityManager;  import android.net.ConnectivityManager;
17    import android.net.Uri;
18  import android.os.Environment;  import android.os.Environment;
19  import android.util.Log;  import android.util.Log;
20  import android.widget.RemoteViews;  import android.widget.RemoteViews;
# Line 40  public class Side9WidgetProvider extends Line 41  public class Side9WidgetProvider extends
41          public Side9WidgetProvider() {          public Side9WidgetProvider() {
42                  Log.i(TAG, "WidgetProvider constructor called");                  Log.i(TAG, "WidgetProvider constructor called");
43          }          }
44            
45            public void resetStatics() {
46                    Log.i(TAG, "resetStatics");
47                    usedData = null;
48                    usedBitmap = null;              
49            }
50            
51            
52    
53    
54    
55          private void setImage(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds, Bitmap image) {          private void setImage(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds, Bitmap image) {
56                  // Perform this loop procedure for each App Widget that belongs to this provider                  // Perform this loop procedure for each App Widget that belongs to this provider
# Line 57  public class Side9WidgetProvider extends Line 68  public class Side9WidgetProvider extends
68                          //views.setTextViewText(R.id.caption, newData.caption);                          //views.setTextViewText(R.id.caption, newData.caption);
69    
70    
71                            Intent viewIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://www.ekstrabladet.dk/side9/"));                    
72    
73                                                    
74                          //View single file                          //View single file
# Line 72  public class Side9WidgetProvider extends Line 84  public class Side9WidgetProvider extends
84                          //viewIntent.setClassName("com.android.camera", "com.android.camera.GalleryPicker");                          //viewIntent.setClassName("com.android.camera", "com.android.camera.GalleryPicker");
85                                                    
86    
87                          Intent viewIntent = new Intent();                          /*Intent viewIntent = new Intent();
88                          viewIntent.addCategory(Intent.CATEGORY_LAUNCHER);                          viewIntent.addCategory(Intent.CATEGORY_LAUNCHER);
89                          viewIntent.setAction(Intent.ACTION_MAIN);                          viewIntent.setAction(Intent.ACTION_MAIN);
90                          viewIntent.setComponent(new ComponentName("com.android.camera", ".GalleryPicker"));                          viewIntent.setComponent(new ComponentName("com.android.camera", ".GalleryPicker"));
91                          viewIntent.setFlags(0x10200000);                          viewIntent.setFlags(0x10200000);*/
92    
93                                                    
94                                                    
# Line 169  public class Side9WidgetProvider extends Line 181  public class Side9WidgetProvider extends
181                                  FileOutputStream fos = new FileOutputStream(file);                                  FileOutputStream fos = new FileOutputStream(file);
182                                  fos.write(imageData);                                  fos.write(imageData);
183                                  fos.close();                                  fos.close();
184                            } else {
185                                    Log.i(TAG, "sdcard is not mounted");
186                          }                          }
187                  }                  }
188                                    
# Line 181  public class Side9WidgetProvider extends Line 195  public class Side9WidgetProvider extends
195          public void onDisabled(Context context) {          public void onDisabled(Context context) {
196                  super.onDisabled(context);                  super.onDisabled(context);
197                  Log.i(TAG, "onDisabled");                  Log.i(TAG, "onDisabled");
198                    
199                  usedData = null; //free memory                  resetStatics();//free memory
                 usedBitmap = null;  
200          }          }
201    
202            @Override
203            public void onEnabled(Context context) {
204                    super.onEnabled(context);
205                    Log.i(TAG, "onEnabled");
206                    
207                    resetStatics();//free memory
208            }
209            
210  }  }

Legend:
Removed from v.775  
changed lines
  Added in v.778

  ViewVC Help
Powered by ViewVC 1.1.20