/[projects]/android/TrainInfo/src/dk/thoerup/traininfo/WelcomeScreen.java
ViewVC logotype

Diff of /android/TrainInfo/src/dk/thoerup/traininfo/WelcomeScreen.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1554 by torben, Thu Jul 7 20:45:17 2011 UTC revision 1555 by torben, Fri Jul 8 12:24:48 2011 UTC
# Line 2  package dk.thoerup.traininfo; Line 2  package dk.thoerup.traininfo;
2    
3    
4    
5    import java.io.InvalidClassException;
6    
7  import android.app.Activity;  import android.app.Activity;
8  import android.app.ProgressDialog;  import android.app.ProgressDialog;
9  import android.content.Intent;  import android.content.Intent;
# Line 86  public class WelcomeScreen extends Activ Line 88  public class WelcomeScreen extends Activ
88                                    
89                  if (sp instanceof OfflineStationProvider ) {                  if (sp instanceof OfflineStationProvider ) {
90                          OfflineStationProvider osp = (OfflineStationProvider) sp;                          OfflineStationProvider osp = (OfflineStationProvider) sp;
91                          try {                          long last = prefs.getLong(stationsreload, 0);
92                                                            long now = System.currentTimeMillis();
93                                  long last = prefs.getLong(stationsreload, 0);                          Log.i("TrainInfo", "Last Load: " + last);
94                                  long now = System.currentTimeMillis();                          
95                            if ( (now-last) > (14*24*60*60*1000) ) {
96                                    new StationLoader(osp).execute( (Void)null);
97                            } else {
98                            
99                                    boolean didLoad = false;
100                                                                    
101                                  Log.i("TrainInfo", "Last Load: " + last);                                  try {
102                                            didLoad = osp.loadStations(this);
103                                    }
104                                    catch (InvalidClassException e) {
105                                            Log.i("TrainInfo", "invalid class - do a new download of stationlist");
106                                    }
107                                    catch (Exception e) {
108                                            Toast.makeText(this, "" + e.getMessage(), Toast.LENGTH_SHORT).show();
109                                            Log.e("TrainInfo", "load error", e);
110                                    }
111                                                                    
112                                  if ( (now-last) > (14*24*60*60*1000) ) {                                  if (didLoad == false) {                                
113                                          new StationLoader(osp).execute( (Void)null);                                          new StationLoader(osp).execute( (Void)null);
                                 } else {  
                                   
                                         boolean didLoad = osp.loadStations(this);  
                                           
                                         if (didLoad == false) {                                  
                                                 new StationLoader(osp).execute( (Void)null);  
                                         }  
114                                  }                                  }
                                   
                         } catch (Exception e) {  
                                 Toast.makeText(this, "" + e.getMessage(), Toast.LENGTH_SHORT).show();  
115                          }                          }
116    
117                  }                  }
118          }          }
119                    

Legend:
Removed from v.1554  
changed lines
  Added in v.1555

  ViewVC Help
Powered by ViewVC 1.1.20