Permalink
Browse files

Merge branch 'refs/heads/master' of

https://kanalj@github.com/phyrex1an/PathPal.git
  • Loading branch information...
2 parents 8133d5f + 1c3c76c commit 2d7a64574f88c8a3bf5b4883dddb93450d104f48 @northOfThule northOfThule committed May 5, 2011
View
@@ -3,5 +3,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+ <classpathentry kind="lib" path="geoGoogle-1.5.0.jar" sourcepath="/home/phyrex1an/Desktop/geoGoogle-1.5.0-sources.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
View
@@ -21,5 +21,4 @@
</application>
<uses-permission android:name="android.permission.INTERNET"/>
-
</manifest>
View
Binary file not shown.
View
@@ -3,7 +3,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:orientation="vertical" >
+ android:orientation="vertical">
+
<TextView
@@ -0,0 +1,43 @@
+package org.pathpal;
+
+import java.io.IOException;
+import java.util.*;
+
+import android.location.Address;
+
+public class DirectionsForm {
+// private List<Waypoint> waypoints = new ArrayList<Waypoint>();
+
+ private Waypoint to, from;
+
+ public interface Waypoint {
+ public abstract Address findLocation(SearchApi api) throws IOException;
+ }
+
+ private class AddressLine implements Waypoint {
+ private String name;
+
+ AddressLine(String name) {
+ this.name = name;
+ }
+
+ public Address findLocation(SearchApi api) throws IOException {
+ return api.geocoder.getFromLocationName(name, 0).remove(0);
+ }
+ }
+
+ public void goToAddress(String name) {
+ to = new AddressLine(name);
+ }
+
+ public void startAtAddress(String name) {
+ from = new AddressLine(name);
+ }
+
+ public List<Address> getWalkPath(SearchApi api) throws IOException {
+ List<Address> path = new ArrayList<Address>();
+ path.add(from.findLocation(api));
+ path.add(to.findLocation(api));
+ return path;
+ }
+}
@@ -18,6 +18,7 @@
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.location.Address;
+import android.location.Criteria;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
@@ -89,6 +90,18 @@ public void onCreate(Bundle savedInstanceState) {
System.out.println("=======================" + a.getFeatureName());
System.out.println("=======================" + a.getFeatureName());
}
+
+ System.out.println("Getting current location");
+ LocationManager lm = (LocationManager) getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
+ if (lm == null) System.out.println("lm is null");
+ Location l = lm.getLastKnownLocation(lm.getBestProvider(new Criteria(), true));
+ if (l == null) System.out.println("l is null");
+ double lon = l.getLongitude();
+ double lat = l.getLatitude();
+ System.out.println("Printing current location");
+ for (Address adr : gc.getFromLocation(lat, lon, 1)) {
+ System.out.println(adr.getAddressLine(0) + "; " + adr.getAddressLine(1));
+ }
} catch (IOException e) {
// TODO Auto-generated catch block
@@ -0,0 +1,23 @@
+package org.pathpal;
+
+import android.os.AsyncTask;
+
+public class Geocoding {
+ public interface IGeocodingListener {
+
+ }
+
+ public void geocode(String address, IGeocodingListener listener ) {
+
+ }
+
+ private class LoadGeocodingTask extends AsyncTask<Void, Void, Void> {
+
+ @Override
+ protected Void doInBackground(Void... params) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ }
+}
@@ -0,0 +1,7 @@
+package org.pathpal;
+
+import android.location.Geocoder;
+
+public class SearchApi {
+ public Geocoder geocoder;
+}

0 comments on commit 2d7a645

Please sign in to comment.