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

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

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

revision 238 by torben, Sat Aug 8 20:09:47 2009 UTC revision 239 by torben, Sun Aug 9 09:09:16 2009 UTC
# Line 7  import android.app.Dialog; Line 7  import android.app.Dialog;
7  import android.app.ListActivity;  import android.app.ListActivity;
8  import android.app.ProgressDialog;  import android.app.ProgressDialog;
9  import android.content.Intent;  import android.content.Intent;
10    import android.net.Uri;
11  import android.os.AsyncTask;  import android.os.AsyncTask;
12  import android.os.Bundle;  import android.os.Bundle;
13  import android.view.View;  import android.view.View;
# Line 32  public class DepartureList extends ListA Line 33  public class DepartureList extends ListA
33                    
34          DepartureFetcher fetcher;          DepartureFetcher fetcher;
35                    
36            double latitude,longitude;
37            
38          @Override          @Override
39          protected void onCreate(Bundle savedInstanceState) {          protected void onCreate(Bundle savedInstanceState) {
40                  super.onCreate(savedInstanceState);                  super.onCreate(savedInstanceState);
# Line 41  public class DepartureList extends ListA Line 44  public class DepartureList extends ListA
44                  setListAdapter(adapter);                  setListAdapter(adapter);
45                                    
46                  Intent launchedBy = getIntent();                  Intent launchedBy = getIntent();
47                    
48                    latitude = launchedBy.getDoubleExtra("latitude", 0.0);
49                    longitude = launchedBy.getDoubleExtra("longitude", 0.0);
50                    
51                  String name = launchedBy.getStringExtra("name");                  String name = launchedBy.getStringExtra("name");
52                  ((TextView) findViewById(R.id.stationName)).setText( name );                  ((TextView) findViewById(R.id.stationName)).setText( name );
53                                    
54                  String addr = launchedBy.getStringExtra("address");                  String addr = launchedBy.getStringExtra("address");
55                  ((TextView) findViewById(R.id.stationAddr)).setText( addr );                  ((TextView) findViewById(R.id.stationAddr)).setText( addr );
56                                    
57                    findViewById(R.id.header).setOnClickListener( mapLauncher );
58                                    
59                  NumberFormat format = NumberFormat.getNumberInstance();                  NumberFormat format = NumberFormat.getNumberInstance();
60                  format.setMaximumFractionDigits(1);                  format.setMaximumFractionDigits(1);
# Line 129  public class DepartureList extends ListA Line 137  public class DepartureList extends ListA
137                  }                  }
138          }          }
139                    
140            View.OnClickListener mapLauncher = new View.OnClickListener() {
141                    @Override
142                    public void onClick(View v) {
143                            Uri uri = Uri.parse("geo:" + latitude + "," + longitude);
144                            startActivity( new Intent(Intent.ACTION_VIEW, uri));
145                    }
146            };
147            
148                    
149          class DepartureFetcher extends AsyncTask<String, Void, Void> {          class DepartureFetcher extends AsyncTask<String, Void, Void> {
150    

Legend:
Removed from v.238  
changed lines
  Added in v.239

  ViewVC Help
Powered by ViewVC 1.1.20