2 |
|
|
3 |
|
|
4 |
|
|
|
import java.util.ArrayList; |
|
|
|
|
5 |
import android.app.Activity; |
import android.app.Activity; |
6 |
import android.app.ProgressDialog; |
import android.app.ProgressDialog; |
7 |
import android.content.Intent; |
import android.content.Intent; |
8 |
import android.content.SharedPreferences; |
import android.content.SharedPreferences; |
9 |
import android.content.SharedPreferences.Editor; |
import android.content.SharedPreferences.Editor; |
|
import android.location.Location; |
|
10 |
import android.net.Uri; |
import android.net.Uri; |
11 |
import android.os.AsyncTask; |
import android.os.AsyncTask; |
12 |
import android.os.Bundle; |
import android.os.Bundle; |
22 |
|
|
23 |
import com.nullwire.trace.ExceptionHandler; |
import com.nullwire.trace.ExceptionHandler; |
24 |
|
|
|
import dk.thoerup.android.traininfo.common.StationEntry; |
|
25 |
import dk.thoerup.androidutils.CheckUpdates; |
import dk.thoerup.androidutils.CheckUpdates; |
26 |
import dk.thoerup.traininfo.provider.OfflineStationProvider; |
import dk.thoerup.traininfo.provider.OfflineStationProvider; |
27 |
import dk.thoerup.traininfo.provider.ProviderFactory; |
import dk.thoerup.traininfo.provider.ProviderFactory; |
28 |
import dk.thoerup.traininfo.provider.StationProvider; |
import dk.thoerup.traininfo.provider.StationProvider; |
29 |
import dk.thoerup.traininfo.stationmap.GeoPair; |
|
|
import dk.thoerup.traininfo.stationmap.StationMapView; |
|
|
import dk.thoerup.traininfo.util.MessageBox; |
|
30 |
|
|
31 |
public class WelcomeScreen extends Activity{ |
public class WelcomeScreen extends Activity{ |
32 |
|
|
91 |
long last = prefs.getLong(stationsreload, 0); |
long last = prefs.getLong(stationsreload, 0); |
92 |
long now = System.currentTimeMillis(); |
long now = System.currentTimeMillis(); |
93 |
|
|
94 |
|
Log.i("TrainInfo", "Last Load: " + last); |
95 |
|
|
96 |
if ( (now-last) > (14*24*60*60*1000) ) { |
if ( (now-last) > (14*24*60*60*1000) ) { |
97 |
new StationLoader(osp).execute( (Void)null); |
new StationLoader(osp).execute( (Void)null); |
98 |
} else { |
} else { |
197 |
boolean succeeded; |
boolean succeeded; |
198 |
ProgressDialog dlg; |
ProgressDialog dlg; |
199 |
OfflineStationProvider osp; |
OfflineStationProvider osp; |
200 |
|
String exMsg; |
201 |
|
|
202 |
public StationLoader(OfflineStationProvider osp) { |
public StationLoader(OfflineStationProvider osp) { |
203 |
this.osp = osp; |
this.osp = osp; |
210 |
succeeded = true; |
succeeded = true; |
211 |
} catch (Exception e) { |
} catch (Exception e) { |
212 |
succeeded = false; |
succeeded = false; |
213 |
Toast.makeText(WelcomeScreen.this, "Error " + e.getMessage(), Toast.LENGTH_LONG).show(); |
exMsg = e.getMessage(); |
214 |
} |
} |
215 |
return null; |
return null; |
216 |
} |
} |
236 |
Editor edit = prefs.edit(); |
Editor edit = prefs.edit(); |
237 |
edit.putLong(stationsreload, System.currentTimeMillis() ); |
edit.putLong(stationsreload, System.currentTimeMillis() ); |
238 |
edit.commit(); |
edit.commit(); |
239 |
|
} else { |
240 |
|
Toast.makeText(WelcomeScreen.this, "Error " + exMsg, Toast.LENGTH_LONG).show(); |
241 |
} |
} |
242 |
} |
} |
243 |
} |
} |