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

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

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

revision 369 by torben, Wed Sep 30 16:40:48 2009 UTC revision 489 by torben, Thu Oct 29 14:20:16 2009 UTC
# Line 10  import android.app.ListActivity; Line 10  import android.app.ListActivity;
10  import android.app.ProgressDialog;  import android.app.ProgressDialog;
11  import android.content.DialogInterface;  import android.content.DialogInterface;
12  import android.content.Intent;  import android.content.Intent;
13    import android.content.SharedPreferences;
14    import android.content.SharedPreferences.Editor;
15  import android.location.Address;  import android.location.Address;
16  import android.location.Geocoder;  import android.location.Geocoder;
17  import android.location.Location;  import android.location.Location;
# Line 18  import android.os.Bundle; Line 20  import android.os.Bundle;
20  import android.os.Handler;  import android.os.Handler;
21  import android.os.Message;  import android.os.Message;
22  import android.util.Log;  import android.util.Log;
23    import android.view.ContextMenu;
24    import android.view.LayoutInflater;
25  import android.view.Menu;  import android.view.Menu;
26  import android.view.MenuItem;  import android.view.MenuItem;
27  import android.view.View;  import android.view.View;
28    import android.view.ContextMenu.ContextMenuInfo;
29    import android.view.View.OnCreateContextMenuListener;
30    import android.widget.AdapterView;
31    import android.widget.EditText;
32  import android.widget.ListView;  import android.widget.ListView;
33    import android.widget.Toast;
   
34  import dk.thoerup.traininfo.provider.ProviderFactory;  import dk.thoerup.traininfo.provider.ProviderFactory;
35  import dk.thoerup.traininfo.provider.StationProvider;  import dk.thoerup.traininfo.provider.StationProvider;
36  import dk.thoerup.traininfo.stationmap.GeoPair;  import dk.thoerup.traininfo.stationmap.GeoPair;
37  import dk.thoerup.traininfo.stationmap.StationMapView;  import dk.thoerup.traininfo.stationmap.StationMapView;
38    import dk.thoerup.traininfo.util.IntSet;
39  import dk.thoerup.traininfo.util.MessageBox;  import dk.thoerup.traininfo.util.MessageBox;
40    
41  public class StationList extends ListActivity  {  public class StationList extends ListActivity  {
# Line 36  public class StationList extends ListAct Line 44  public class StationList extends ListAct
44          public static final int NOPROVIDER = 1003;          public static final int NOPROVIDER = 1003;
45          public static final int LOCATIONFIXTIMEOUT = 1004;          public static final int LOCATIONFIXTIMEOUT = 1004;
46                    
47          public static final int OPTIONS_MAP = 2001;          public static final int OPTIONS_MAP = 2003;
48          public static final int OPTIONS_ABOUT = 2002;          public static final int OPTIONS_GPSINFO = 2004;
49    
50            
51    
52                    
53          public static final int DLG_PROGRESS = 1001;          public static final int DLG_PROGRESS = 3001;
54            public static final int DLG_STATIONNAME = 3002;
55            
56            static enum LookupMethod {
57                    ByLocation,
58                    ByName,
59                    ByList,
60                    MethodNone
61            }
62            
63                    
         /** Called when the activity is first created. */  
64          String dialogMessage = "";          String dialogMessage = "";
65          ProgressDialog dialog;          ProgressDialog dialog;
66          LocationLookup locator = null;          LocationLookup locationLookup = null;
67          LocatorTask locatorTask;          FindStationsTask findStationsTask;
68            StationsFetchedHandler stationsFetched = new StationsFetchedHandler();
69            
70            GeoPair location = new GeoPair();
71                    
72          boolean isRunning = false;          boolean isRunning = false;
73          List<StationBean> stations = new ArrayList<StationBean>();          List<StationBean> stations = new ArrayList<StationBean>();
74                    
75          StationProvider stationProvider = ProviderFactory.getStationProvider();          StationProvider stationProvider = ProviderFactory.getStationProvider();
76                    
77            StationListAdapter adapter = null;
78                    
79            FavoritesMenu contextMenu = new FavoritesMenu();
80            IntSet favorites = new IntSet();
81    
82            WelcomeScreen.ListType listType;
83            SharedPreferences prefs;
84            
85            ///////////////////////////////////////////////////////////////////////////////////////////
86            //Activity call backs
87                    
         StationListAdapter adapter = null;  
88          @SuppressWarnings("unchecked")          @SuppressWarnings("unchecked")
89          @Override          @Override
90          public void onCreate(Bundle savedInstanceState) {          public void onCreate(Bundle savedInstanceState) {
91                  super.onCreate(savedInstanceState);                  super.onCreate(savedInstanceState);
92                  setContentView(R.layout.main);                  setContentView(R.layout.stationlist);
93                                    
94                                    
95                  adapter = new StationListAdapter(this);                  adapter = new StationListAdapter(this);
96                  setListAdapter(adapter);                  setListAdapter(adapter);
97                                    
98                  locator = new LocationLookup(this, stationsFetched);                  ListView lv = getListView();
99                    lv.setOnCreateContextMenuListener(contextMenu);
100                    
101                    locationLookup = new LocationLookup(this, stationsFetched);
102                    
103    
104                    prefs = getSharedPreferences("TrainStation", 0);
105                    String favoriteString = prefs.getString("favorites", "");
106                    if (! favoriteString.equals("") ) {
107                            favorites.fromString(favoriteString);
108                    }
109                    
110                    listType = (WelcomeScreen.ListType) getIntent().getSerializableExtra("type");
111                    setTitle();
112                    
113                  if (savedInstanceState == null) {                  if (savedInstanceState == null) {
114                          startLookup();  
115                            
116                            switch (listType) {
117                            case ListNearest:
118                                    startLookup();
119                                    break;
120                            case ListSearch:
121                                    this.showDialog(DLG_STATIONNAME);
122                                    break;
123                            case ListFavorites:
124                                    startFavoriteLookup();
125                                    break;
126                            default:
127                                    // Not possible !?!
128                            }
129                            
130                  } else {                  } else {
131                          stations = (ArrayList<StationBean>) savedInstanceState.getSerializable("stations");                          stations = (ArrayList<StationBean>) savedInstanceState.getSerializable("stations");
132                          adapter.setStations(stations);                          adapter.setStations(stations);
133                            location = (GeoPair) savedInstanceState.getSerializable("location");
134                    }
135                    
136            }
137            protected void setTitle() {
138                    String dialogTitle = getResources().getString(R.string.app_name);
139                    switch (listType) {
140                    case ListNearest:
141                            dialogTitle += " - Nearby stations";
142                            break;
143                    case ListSearch:
144                            dialogTitle += " - Search";
145                            break;
146                    case ListFavorites:
147                            dialogTitle += " - Favorites";
148                            break;
149                    default:
150                            dialogTitle = "";//not possible                                
151                  }                  }
152            
153                    setTitle(dialogTitle);
154          }          }
155                    
156            
157    
158    
159      @Override      @Override
160      public void onSaveInstanceState(Bundle outState)      public void onSaveInstanceState(Bundle outState)
161      {      {
162          if (dialog != null && dialog.isShowing())          if (dialog != null && dialog.isShowing())
163                  dialog.dismiss();                  dialog.dismiss();
164          outState.putSerializable("stations", (ArrayList<StationBean>) stations);          outState.putSerializable("stations", (ArrayList<StationBean>) stations);
165            outState.putSerializable("location", location);
166            
167      }      }
168                    
169                    
170    
171          @Override          @Override
172          public boolean onCreateOptionsMenu(Menu menu) {          public boolean onCreateOptionsMenu(Menu menu) {
173                  menu.add(0, OPTIONS_MAP, 0, "Show station map");                  MenuItem item;
174                  menu.add(0, OPTIONS_ABOUT, 0, "About");                                  
175                    item = menu.add(0, OPTIONS_MAP, 0, "Station map");
176                    item.setIcon(android.R.drawable.ic_menu_mapmode);
177                    
178                    item = menu.add(0, OPTIONS_GPSINFO, 0, "GPS Info");
179                    item.setIcon(android.R.drawable.ic_menu_mapmode);              
180                                    
181                  return true;                  return true;
182          }          }
183    
184          @Override          @Override
185          public boolean onOptionsItemSelected(MenuItem item) {          public boolean onOptionsItemSelected(MenuItem item) {
186                  boolean retval;                  boolean retval = true;
187                    
188                    //TODO: Cleanup
189                  switch (item.getItemId()) {                  switch (item.getItemId()) {
190                  case OPTIONS_MAP:                  case OPTIONS_MAP:
191                                                    
192                          Intent intent = new Intent(this,StationMapView.class);                          Intent intent = new Intent(this,StationMapView.class);
                         intent.putExtra("userlocation", GeoPair.fromLocation(locator.getLocation()) );  
193                                                    
194                          ArrayList<GeoPair> stationPoints = new ArrayList<GeoPair>();                          ArrayList<GeoPair> stationPoints = new ArrayList<GeoPair>();
195                          for (StationBean st : stations ) {                          for (StationBean st : stations ) {
# Line 110  public class StationList extends ListAct Line 199  public class StationList extends ListAct
199                          intent.putExtra("stations", stationPoints);                          intent.putExtra("stations", stationPoints);
200                                                    
201                          startActivity(intent);                          startActivity(intent);
202                          retval = true;                          break;
203                    case OPTIONS_GPSINFO:
204                            Location loc = locationLookup.getLocation();
205                            StringBuffer message = new StringBuffer();
206                            message.append("Location info:\n");
207                            message.append("-Obtained by: ").append(loc != null ? loc.getProvider() : "-").append("\n");
208                            message.append("-Accuracy: ").append(loc != null ? (int)loc.getAccuracy() : "-").append("m\n");
209    
210                            MessageBox.showMessage(this, message.toString());
211                          break;                          break;
212                  default:                  default:
213                          retval = super.onOptionsItemSelected(item);                          retval = super.onOptionsItemSelected(item);
# Line 118  public class StationList extends ListAct Line 215  public class StationList extends ListAct
215                                    
216                  return retval;                  return retval;
217          }          }
218            
219            
220    
221            @Override
222            public boolean onContextItemSelected(MenuItem item) {
223                    contextMenu.onContextItemSelected(item);
224                    return true;
225    
226    
227            }
228    
229    
230    
231    
232          @Override          @Override
233          protected Dialog onCreateDialog(int id) {          protected Dialog onCreateDialog(int id) {
# Line 127  public class StationList extends ListAct Line 237  public class StationList extends ListAct
237                          dlg.setMessage("Wait for location fix");                          dlg.setMessage("Wait for location fix");
238                          dlg.setCancelable(false);                          dlg.setCancelable(false);
239                          return dlg;                                              return dlg;                    
240                    case DLG_STATIONNAME:
241                            LayoutInflater factory = LayoutInflater.from(this);
242                            final View rootView = factory.inflate(R.layout.textinput, null);
243                            
244                            
245                            AlertDialog.Builder builder = new AlertDialog.Builder(this);
246                            
247                            builder.setTitle("Station search");
248                            builder.setView(rootView);
249                            builder.setCancelable(true);
250                            builder.setPositiveButton("Search", new DialogInterface.OnClickListener() {
251                                    public void onClick(DialogInterface dialog, int which) {
252                                            EditText et = (EditText) rootView.findViewById(R.id.EditText);
253                                            dialog.dismiss();
254                                            if (et.getText().toString().length() >= 2) {
255                                                    startNameSearch(et.getText().toString());
256                                            } else {
257                                                    MessageBox.showMessage(StationList.this, "Two characters minimum" );
258                                            }
259                                    }
260                            });
261                            builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
262                                    public void onClick(DialogInterface dialog, int which) {
263                                            dialog.dismiss();
264                                    }
265                            });                    
266                            return builder.create();
267                            
268                  default:                  default:
269                          return super.onCreateDialog(id);                                          return super.onCreateDialog(id);                
270                  }                  }
# Line 134  public class StationList extends ListAct Line 272  public class StationList extends ListAct
272          }          }
273                    
274                    
   
275          @Override          @Override
276          protected void onPrepareDialog(int id, Dialog dialog) {          protected void onPrepareDialog(int id, Dialog dialog) {
277                  super.onPrepareDialog(id, dialog);                  super.onPrepareDialog(id, dialog);
# Line 148  public class StationList extends ListAct Line 285  public class StationList extends ListAct
285                          break;                          break;
286                  }                  }
287          }          }
288            
289            @Override
290            protected void onListItemClick(ListView l, View v, int position, long id) {
291                    super.onListItemClick(l, v, position, id);
292                                    
293                    StationBean station = stations.get(position);
294    
295                    double latitude = station.getLatitude();
296                    double longitude = station.getLongitude();
297    
298    
299                    
300                    Intent intent = new Intent(this, DepartureList.class);
301                    intent.putExtra("name", station.getName());
302                    intent.putExtra("distance", station.getDistance());
303                    intent.putExtra("latitude", latitude);
304                    intent.putExtra("longitude", longitude);
305                    intent.putExtra("stationid", station.getId());
306                    intent.putExtra("address", station.getAddress());
307                    startActivity(intent);
308            }
309    
310            /////////////////////////////////////////////////////////////
311            //
312    
313          public void startLookup() {          public void startLookup() {
314                  isRunning = true;                  isRunning = true;
315                    dialogMessage = "Wait for location fix";
316                  showDialog(DLG_PROGRESS);                  showDialog(DLG_PROGRESS);
317                                    
318                  locator.locateStations();                  locationLookup.locateStations();
319                  stationsFetched.sendEmptyMessageDelayed(LOCATIONFIXTIMEOUT, 20000);                  stationsFetched.sendEmptyMessageDelayed(LOCATIONFIXTIMEOUT, 20000);
320          }          }
321            
322            void startNameSearch(String name) {
323                    dialogMessage = "Finding stations by name";
324                    showDialog(DLG_PROGRESS);
325    
326                    findStationsTask = new FindStationsTask();
327                    findStationsTask.searchByName(name, locationLookup.getLocation());
328                    findStationsTask.execute();
329                    
330            }
331            
332            public void startFavoriteLookup() {
333                    
334                    if (favorites.size() > 0) {
335                            dialogMessage = "Loading favorites";
336                            showDialog(DLG_PROGRESS);
337    
338                            findStationsTask = new FindStationsTask();
339                            findStationsTask.searchByIds(favorites.toString(), locationLookup.getLocation());
340                            findStationsTask.execute();
341                    } else {
342                            MessageBox.showMessage(this, "Favorite list is empty");
343                    }
344            }
345    
346    
347            
348            void startLocatorTask()
349            {
350                    dialogMessage = "Finding nearby stations";
351                    showDialog(DLG_PROGRESS);
352                    
353                    findStationsTask = new FindStationsTask();
354                    findStationsTask.searchByLocation( locationLookup.getLocation() );
355                    findStationsTask.execute();    
356            }
357            
358    
359          Handler stationsFetched = new Handler() {          String lookupAddress(double latitude, double longitude) {
360                    
361                    Geocoder coder = new Geocoder(this, new Locale("da"));
362                    StringBuilder sb = new StringBuilder();
363                    Log.i("lookupaddr", "" + latitude + "/" + longitude);
364                    try {
365                            List<Address> addressList = coder.getFromLocation(latitude, longitude, 1);
366                            Address addr = addressList.get(0);
367                            
368                            
369                            int max = addr.getMaxAddressLineIndex();
370                            for (int i=0; i<max; i++) {
371                                    if (i>0)
372                                            sb.append(", ");
373                                    
374                                    sb.append(addr.getAddressLine(i));
375                            }
376                            
377                            
378                    } catch (Exception e) {
379                            Log.e("DepartureList", "geocoder failed", e);
380                    }
381                    
382                    return sb.toString();
383            }
384            
385            
386            ////////////////////////////////////////////////////////////////////////////
387            // Inner classes
388    
389            class StationsFetchedHandler extends Handler {
390                  @Override                  @Override
391                  public void handleMessage(Message msg) {                  public void handleMessage(Message msg) {
392    
# Line 167  public class StationList extends ListAct Line 395  public class StationList extends ListAct
395                                  dismissDialog(DLG_PROGRESS);                                  dismissDialog(DLG_PROGRESS);
396                                                                    
397                                  startLocatorTask();                                  startLocatorTask();
398                                    location = GeoPair.fromLocation( locationLookup.getLocation() );
399                                                                    
400                                  break;                                  break;
401    
# Line 176  public class StationList extends ListAct Line 405  public class StationList extends ListAct
405                                  break;                                  break;
406                          case LOCATIONFIXTIMEOUT:                                                          case LOCATIONFIXTIMEOUT:                                
407                                  if (isRunning) {                                  if (isRunning) {
408                                          locator.stopSearch();                                          locationLookup.stopSearch();
409                                          if (locator.hasLocation()) {                                          if (locationLookup.hasLocation()) {
410                                                  stationsFetched.sendEmptyMessage( GOTLOCATION );                                                  stationsFetched.sendEmptyMessage( GOTLOCATION );
411                                          } else {                                                                                          } else {                                                
412                                                  dismissDialog(DLG_PROGRESS);                                                  dismissDialog(DLG_PROGRESS);
413                                                                                                    
414                                                  AlertDialog.Builder builder = new AlertDialog.Builder(StationList.this);                                                                                                  AlertDialog.Builder builder = new AlertDialog.Builder(StationList.this);                                                
415                                                  builder.setMessage("GPS fix timed out");                                                  builder.setMessage("Location fix timed out");
416                                                  builder.setCancelable(true);                                                  builder.setCancelable(true);
417                                                  builder.setPositiveButton("Retry", new DialogInterface.OnClickListener() {                                                  builder.setPositiveButton("Retry", new DialogInterface.OnClickListener() {
418                                                          public void onClick(DialogInterface dialog, int id) {                                                          public void onClick(DialogInterface dialog, int id) {
# Line 206  public class StationList extends ListAct Line 435  public class StationList extends ListAct
435                          isRunning = false;                          isRunning = false;
436                  }                  }
437          };          };
438    
439                    
440          void startLocatorTask()          class FindStationsTask extends AsyncTask<Void,Void,Void> {
         {  
                 dialogMessage = "Finding nearby stations";  
                 showDialog(DLG_PROGRESS);  
441                                    
442                  locatorTask = new LocatorTask();                  LookupMethod method = LookupMethod.MethodNone;
443                  locatorTask.execute();                    boolean success;
444          }                  String name;
445                            Location loc;
446          @Override                  String ids;
447          protected void onListItemClick(ListView l, View v, int position, long id) {                  
448                  super.onListItemClick(l, v, position, id);                  public void searchByName(String n, Location l) {
449                                                            
450                  StationBean station = stations.get(position);                          method = LookupMethod.ByName;
451                            loc = l;
452                  double latitude = station.getLatitude();                          name = n;
453                  double longitude = station.getLongitude();                  }
   
   
454                                    
455                  Intent intent = new Intent(this, DepartureList.class);                  public void searchByLocation(Location l) {
456                  intent.putExtra("name", station.getName());                          method = LookupMethod.ByLocation;
457                  intent.putExtra("distance", station.getDistance());                          loc = l;
458                  intent.putExtra("latitude", latitude);                  }
                 intent.putExtra("longitude", longitude);  
                 intent.putExtra("stationid", station.getId());  
                 intent.putExtra("address", station.getAddress());  
                 startActivity(intent);  
         }  
   
         String lookupAddress(double latitude, double longitude) {  
459                                    
460                  Geocoder coder = new Geocoder(this, new Locale("da"));                  public void searchByIds(String id, Location l) {
                 StringBuilder sb = new StringBuilder();  
                 Log.i("lookupaddr", "" + latitude + "/" + longitude);  
                 try {  
                         List<Address> addressList = coder.getFromLocation(latitude, longitude, 1);  
                         Address addr = addressList.get(0);  
                           
                           
                         int max = addr.getMaxAddressLineIndex();  
                         for (int i=0; i<max; i++) {  
                                 if (i>0)  
                                         sb.append(", ");  
                                   
                                 sb.append(addr.getAddressLine(i));  
                         }  
461                                                    
462                                                    method = LookupMethod.ByList;
463                  } catch (Exception e) {                          loc = l;
464                          Log.e("DepartureList", "geocoder failed", e);                          ids = id;
465                  }                  }
466                                    
                 return sb.toString();  
         }  
           
         class LocatorTask extends AsyncTask<Void,Void,Void> {  
                 boolean success;  
467                  @Override                  @Override
468                  protected void onPreExecute() {                  protected void onPreExecute() {
469    
470                            if (method.equals(LookupMethod.MethodNone))
471                                    throw new RuntimeException("Method not set");
472                          super.onPreExecute();                          super.onPreExecute();
473                  }                  }
474                                    
475                  @Override                  @Override
476                  protected Void doInBackground(Void... params) {                  protected Void doInBackground(Void... params) {
477                          Location loc = locator.getLocation();  
478                          success = stationProvider.lookupStations(loc);                          switch (method) {
479                            case ByLocation:
480                                    success = stationProvider.lookupStations(loc);
481                                    break;
482                            case ByName:
483                                    success = stationProvider.lookupStationsByName(name);
484                                    break;
485                            case ByList:
486                                    success = stationProvider.lookupStationsByIds(ids);
487                                    break;
488                            default:
489                                    success = false; // not possible        
490                            }
491                                                    
492                                                    
493                            Location dummy = new Location("gps");
494                          List<StationBean> stations = stationProvider.getStations();                          List<StationBean> stations = stationProvider.getStations();
495                          for (StationBean station : stations) {                          
496                            for (StationBean station : stations) {
497                                  String addr = lookupAddress(station.getLatitude(), station.getLongitude());                                  String addr = lookupAddress(station.getLatitude(), station.getLongitude());
498                                  station.setAddress(addr);                                  station.setAddress(addr);
499                          }                                  
500                                    
501                                    if (method.equals(LookupMethod.ByName) || method.equals(LookupMethod.ByList)) {
502                                            if (loc != null) { //only do the distance calc if we have a location
503                                                    dummy.setLatitude(station.getLatitude());
504                                                    dummy.setLongitude(station.getLongitude());
505                                                    station.setDistance( (int)loc.distanceTo(dummy) );
506                                            } else {
507                                                    station.setDistance(0);
508                                            }
509                                    }
510    
511                            }                                              
512                                                    
513                          return null;                          return null;
514                  }                  }
# Line 291  public class StationList extends ListAct Line 518  public class StationList extends ListAct
518                          super.onPostExecute(result);                          super.onPostExecute(result);
519                          dialog.dismiss();                          dialog.dismiss();
520                                                    
521                            
522                          if (success) {                                                    if (success) {                          
523                                  if (stationProvider.getStations().size() == 0)                                  if (stationProvider.getStations().size() == 0)
524                                          MessageBox.showMessage(StationList.this, "No stations found!"); // this should not be possible !?!                                          MessageBox.showMessage(StationList.this, "No stations found!"); // this should not be possible !?!
# Line 322  public class StationList extends ListAct Line 550  public class StationList extends ListAct
550                          }                          }
551                  }                  }
552          }          }
553            
554            
555            class FavoritesMenu implements OnCreateContextMenuListener {
556                    private final static int FAVORITES_ADD = 9001;
557                    private final static int FAVORITES_REMOVE = 9002;
558                    
559                    private int selectedPosition;
560                    
561                    
562                    @Override
563                    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
564                                                    
565                            AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
566                            selectedPosition = info.position;
567                            int stationID = stations.get(selectedPosition).getId();
568    
569                            if (!favorites.contains(stationID)) {
570                                    menu.add(0, FAVORITES_ADD, 0, "Add to favorites");
571                            } else {
572                                    menu.add(0, FAVORITES_REMOVE, 0, "Remove from favorites");
573                            }
574                            
575                    }
576                    
577                    public void onContextItemSelected(MenuItem item) {
578                            StationBean sb = stations.get(selectedPosition);
579                            
580                            int stationID = sb.getId();
581                            if (item.getItemId() == FAVORITES_ADD) {
582                                    favorites.add(stationID);
583                                    Toast.makeText(StationList.this, "Station added", Toast.LENGTH_SHORT).show();
584                            } else {
585                                    
586                                    favorites.remove(stationID);
587                                    Toast.makeText(StationList.this, "Station removed", Toast.LENGTH_SHORT).show();
588                                    
589                                    
590                                    if (listType.equals( WelcomeScreen.ListType.ListFavorites) ) {
591                                            stations.remove(selectedPosition);
592                                            adapter.notifyDataSetChanged();
593                                    }
594                            }
595                            Editor ed = prefs.edit();
596                            ed.putString("favorites", favorites.toString());
597                            ed.commit();
598                    }
599            }
600  }  }

Legend:
Removed from v.369  
changed lines
  Added in v.489

  ViewVC Help
Powered by ViewVC 1.1.20