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 |
|
|
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 |
|
|
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); |
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 |
|
|