/[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 922 by torben, Sat Jun 26 14:23:48 2010 UTC revision 923 by torben, Sat Jun 26 18:04:07 2010 UTC
# Line 30  public class Side9WidgetProvider extends Line 30  public class Side9WidgetProvider extends
30          private static Side9Data usedData;          private static Side9Data usedData;
31          private static Bitmap usedBitmap;          private static Bitmap usedBitmap;
32          private static long timestamp;          private static long timestamp;
33            private static boolean reloadData;
34    
35          final static long UDPATESPAN = 4*60*60*1000;          final static long UDPATESPAN = 4*60*60*1000;
36    
# Line 113  public class Side9WidgetProvider extends Line 114  public class Side9WidgetProvider extends
114    
115                  if (System.currentTimeMillis() > (timestamp+UDPATESPAN) ) {                  if (System.currentTimeMillis() > (timestamp+UDPATESPAN) ) {
116                          Log.i(TAG, "time elapsed, force XML reload");                          Log.i(TAG, "time elapsed, force XML reload");
117                          usedData = null;                          reloadData = true;
118                  }                  }
119    
120                  try {                  try {
121                          Side9Data newData = Side9Xml.loadXml();                          Side9Data newData = Side9Xml.loadXml();
122    
123                          if (! newData.equals(usedData)) {                          if (! newData.equals(usedData) || reloadData == true) {
124    
125    
126                                  Log.i(TAG, "(Re)loading image:" + newData.url);                                  Log.i(TAG, "(Re)loading image:" + newData.url);
# Line 129  public class Side9WidgetProvider extends Line 130  public class Side9WidgetProvider extends
130                                  usedData = newData; // if we made it to here without exceptions, save the new data                                  usedData = newData; // if we made it to here without exceptions, save the new data
131                                  usedBitmap = image;                                  usedBitmap = image;
132                                  timestamp = System.currentTimeMillis();                                  timestamp = System.currentTimeMillis();
133                                                                    reloadData = false;
134    
135                          } // endif                          } // endif
136    

Legend:
Removed from v.922  
changed lines
  Added in v.923

  ViewVC Help
Powered by ViewVC 1.1.20