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

Diff of /android/TrainInfo/src/dk/thoerup/traininfo/provider/OfflineStationProvider.java

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

revision 1561 by torben, Fri Jul 8 13:58:21 2011 UTC revision 1562 by torben, Fri Jul 8 16:26:09 2011 UTC
# Line 57  public class OfflineStationProvider impl Line 57  public class OfflineStationProvider impl
57                          StationEntry e = null;                          StationEntry e = null;
58                          while ( (o=in.readObject()) != null ) {                          while ( (o=in.readObject()) != null ) {
59                                  e = (StationEntry) o;                                  e = (StationEntry) o;
60                                  e.updateSearch();                                  updateSearchStrings(e);
61                                  stations.entries.add( e );                                  stations.entries.add( e );
62                          }                          }
63                          in.close();                          in.close();
# Line 69  public class OfflineStationProvider impl Line 69  public class OfflineStationProvider impl
69                  logElapsedTime(start, "loadStations");                  logElapsedTime(start, "loadStations");
70                                    
71                  return true;                  return true;
72          }                }
73            
74            public void updateSearchStrings(StationEntry entry) {          
75                    entry.nameLower = entry.getName().toLowerCase();
76                    entry.nameInternational = entry.nameLower.replace("æ", "ae").replace("ø", "oe").replace("å", "aa");
77            }
78                    
79          public void downloadStations(Context context) throws Exception {          public void downloadStations(Context context) throws Exception {
80                  File parent = context.getFilesDir();                  File parent = context.getFilesDir();
# Line 85  public class OfflineStationProvider impl Line 90  public class OfflineStationProvider impl
90                  Log.e("OFFLINE", "data size" + data.length);                  Log.e("OFFLINE", "data size" + data.length);
91                                    
92                  for (StationEntry entry : stations.entries) {                  for (StationEntry entry : stations.entries) {
93                          entry.updateSearch(); //prepare name fields for byName search                          updateSearchStrings( entry ); //prepare name fields for byName search
94                          out.writeObject(entry);                          out.writeObject(entry);
95                  }                  }
96                                    

Legend:
Removed from v.1561  
changed lines
  Added in v.1562

  ViewVC Help
Powered by ViewVC 1.1.20