mais-devel team mailing list archive
-
mais-devel team
-
Mailing list archive
-
Message #00002
[Branch ~tiagofalcao/mais/trunk] Rev 20: Map v1
------------------------------------------------------------
revno: 20
committer: Tiago Falcao <tiagofalcao@xxxxxxxxx>
branch nick: mais
timestamp: Sat 2008-06-14 20:03:13 -0300
message:
Map v1
modified:
src/org/mais/Mais.java
src/org/mais/plugin/Places.java
=== modified file 'src/org/mais/Mais.java'
--- a/src/org/mais/Mais.java 2008-06-11 01:26:57 +0000
+++ b/src/org/mais/Mais.java 2008-06-14 23:03:13 +0000
@@ -7,11 +7,7 @@
import org.mais.plugin.Places;
import android.app.Activity;
-import android.content.ComponentName;
-import android.content.Intent;
-import android.net.Uri;
import android.os.Bundle;
-import android.speech.recognition.SlotItem;
import android.view.Menu;
import android.view.View;
import android.view.Window;
@@ -65,7 +61,7 @@
plugins.add(new Plugin(R.string.plugin_musics, R.main.plugin_music,
Musics.class));
plugins.add(new Plugin(R.string.plugin_places, R.main.plugin_places,
- ForwardTarget.class));
+ Places.class));
}
private void updateButtons() {
=== modified file 'src/org/mais/plugin/Places.java'
--- a/src/org/mais/plugin/Places.java 2008-06-11 01:26:57 +0000
+++ b/src/org/mais/plugin/Places.java 2008-06-14 23:03:13 +0000
@@ -3,24 +3,65 @@
//Need the following import to get access to the app resources, since this
//class is in a sub-package.
-import org.mais.R;
-import org.mais.R.layout;
-
-import android.app.Activity;
import android.os.Bundle;
+import android.view.KeyEvent;
+
+import com.google.android.maps.MapActivity;
+import com.google.android.maps.MapController;
+import com.google.android.maps.MapView;
+import com.google.android.maps.Point;
/**
* Example of removing yourself from the history stack after forwarding to
* another activity.
*/
-public class Places extends Activity
+public class Places extends MapActivity
{
- @Override
- protected void onCreate(Bundle icicle)
- {
- super.onCreate(icicle);
-
- setContentView(R.layout.forward_target);
- }
+ private MapView mapview;
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ mapview = new MapView(this);
+
+ // Lets start at the Statue of Liberty
+ // I grabbed the data from Google-Maps
+ Point p = new Point((int) (40.689213 * 1000000),
+ (int) (-74.044558 * 1000000));
+ // Get the controller, that is used for translation and zooming
+ MapController mc = mapview.getController();
+ // Translate to the Statue of Liberty
+ mc.animateTo(p);
+ // Zoom Very close
+ mc.zoomTo(21);
+
+ // Make myMapView the exilicit view of this app
+ setContentView(mapview);
+ // Enable Sattelite-Mode, so we will se the
+ // Statue of liberty instantly on the screen
+ mapview.toggleSatellite();
+ mapview.displayZoomDialog(0, 0);
+ }
+
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+ if (keyCode == KeyEvent.KEYCODE_I) {
+ // Zooming In
+ mapview.getController().zoomTo(mapview.getZoomLevel() + 1);
+ return true;
+ } else if (keyCode == KeyEvent.KEYCODE_O) {
+ // Zooming Out
+ mapview.getController().zoomTo(mapview.getZoomLevel() - 1);
+ return true;
+ } else if (keyCode == KeyEvent.KEYCODE_S) {
+ // Switch to satellite view
+ mapview.toggleSatellite();
+ return true;
+ } else if (keyCode == KeyEvent.KEYCODE_T) {
+ // Switch on traffic overlays
+ mapview.toggleTraffic();
+ return true;
+ }
+ return false;
+ }
}
--
https://code.launchpad.net/~tiagofalcao/mais/trunk
You are receiving this branch notification because you are subscribed to it.