/[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 1226 by torben, Tue Feb 8 07:32:07 2011 UTC revision 1227 by torben, Wed Feb 9 18:23:53 2011 UTC
# Line 31  public class Side9WidgetProvider extends Line 31  public class Side9WidgetProvider extends
31          private static Side9Data mUsedData;          private static Side9Data mUsedData;
32          private static Bitmap mUsedBitmap;          private static Bitmap mUsedBitmap;
33          private static long mTimestamp;          private static long mTimestamp;
         private static boolean mReloadData;  
34    
35          final static long UDPATESPAN = 4*60*60*1000;          final static long UDPATESPAN = 4*60*60*1000;
36    
# Line 115  public class Side9WidgetProvider extends Line 114  public class Side9WidgetProvider extends
114    
115                  //we need to do a full reload of all data now and then because eb.dk sometimes are a bit slow with publishing the new                  //we need to do a full reload of all data now and then because eb.dk sometimes are a bit slow with publishing the new
116                  //daily picture, and this is a (crude) way to ensure we have the latest data                  //daily picture, and this is a (crude) way to ensure we have the latest data
117                    boolean reloadData = false;
118                  if (System.currentTimeMillis() > (mTimestamp+UDPATESPAN) ) {                  if (System.currentTimeMillis() > (mTimestamp+UDPATESPAN) ) {
119                          Log.i(TAG, "time elapsed, force XML reload");                          Log.i(TAG, "time elapsed, force XML reload");
120                          mReloadData = true;                          reloadData = true;
121                  }                  }
122                                    
123    
# Line 126  public class Side9WidgetProvider extends Line 126  public class Side9WidgetProvider extends
126                  try {                  try {
127                          Side9Data newData = Side9Xml.loadXml(androidID);                          Side9Data newData = Side9Xml.loadXml(androidID);
128    
129                          if (! newData.equals(mUsedData) || mReloadData == true) {                          if (! newData.equals(mUsedData) || reloadData == true) {
130    
131    
132                                  Log.i(TAG, "(Re)loading image:" + newData.url);                                  Log.i(TAG, "(Re)loading image:" + newData.url);
# Line 136  public class Side9WidgetProvider extends Line 136  public class Side9WidgetProvider extends
136                                  mUsedData = newData; // if we made it to here without exceptions, save the new data                                  mUsedData = newData; // if we made it to here without exceptions, save the new data
137                                  mUsedBitmap = image;                                  mUsedBitmap = image;
138                                  mTimestamp = System.currentTimeMillis();                                  mTimestamp = System.currentTimeMillis();
                                 mReloadData = false;  
139    
140                          } // endif                          } // endif
141    

Legend:
Removed from v.1226  
changed lines
  Added in v.1227

  ViewVC Help
Powered by ViewVC 1.1.20