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

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

  ViewVC Help
Powered by ViewVC 1.1.20