Search in sources :

Example 1 with MapView

use of com.google.android.maps.MapView in project GreenDroid by cyrilmottier.

the class MapPinMapActivity method onCreate.

//@formatter:on
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setActionBarContentView(R.layout.map_pin);
    final MapView mapView = (MapView) findViewById(R.id.map_view);
    mapView.setBuiltInZoomControls(true);
    final Resources r = getResources();
    for (int i = 0; i < sAreas.length; i++) {
        final OverlayItem[] items = sAreas[i];
        ColorStateList pinCsl = createRandomColorStateList();
        ColorStateList dotCsl = createRandomColorStateList();
        BasicItemizedOverlay itemizedOverlay = new BasicItemizedOverlay(new MapPinDrawable(r, pinCsl, dotCsl));
        for (int j = 0; j < items.length; j++) {
            itemizedOverlay.addOverlay(items[j]);
        }
        mapView.getOverlays().add(itemizedOverlay);
    }
}
Also used : OverlayItem(com.google.android.maps.OverlayItem) MapView(com.google.android.maps.MapView) ColorStateList(android.content.res.ColorStateList) Resources(android.content.res.Resources) GeoPoint(com.google.android.maps.GeoPoint) MapPinDrawable(greendroid.graphics.drawable.MapPinDrawable)

Example 2 with MapView

use of com.google.android.maps.MapView in project android-support-v4-googlemaps by petedoyle.

the class FragmentLayout method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_layout);
    // Check to see if we have a frame in which to embed the details
    // fragment directly in the containing UI.
    View detailsFrame = findViewById(R.id.details);
    boolean dualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE;
    // Decide where to place TitlesFragment.
    // See fragment_layout.xml in res/layout/ and res/layout-land/ to see the difference
    int targetLayout = dualPane ? R.id.titles : R.id.main;
    // do not add to backstack, or user will be able to press back and
    // view the blank layout with nothing in it (a blank screen).
    // In this case, we want the back button to exit the app.
    getSupportFragmentManager().beginTransaction().add(targetLayout, TitlesFragment.newInstance(dualPane)).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).commit();
    mMapViewContainer = LayoutInflater.from(this).inflate(R.layout.mapview, null);
    mMapView = (MapView) mMapViewContainer.findViewById(R.id.map);
//TODO: There's still a bug.  To reproduce:
// 1) Start app in portrait mode.
// 2) Flip to landscape.
// 3) Flip back to portrait.
// 4) Select an item (item displays fine)
// 5) Press back
// 6) Select another item
//    RESULT:   Both the details and list view display on top of each other
//    EXPECTED: The details should show without the list
}
Also used : MapView(com.google.android.maps.MapView) View(android.view.View) ListView(android.widget.ListView) GeoPoint(com.google.android.maps.GeoPoint)

Example 3 with MapView

use of com.google.android.maps.MapView in project cw-android by commonsguy.

the class MapFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    map = new MapView(getActivity(), "0mjl6OufrY-tHs6WFurtL7rsYyEMpdEqBCbyjXg");
    map.setClickable(true);
    map.getController().setCenter(getPoint(40.76793169992044, -73.98180484771729));
    map.getController().setZoom(17);
    map.setBuiltInZoomControls(true);
    Drawable marker = getResources().getDrawable(R.drawable.marker);
    marker.setBounds(0, 0, marker.getIntrinsicWidth(), marker.getIntrinsicHeight());
    map.getOverlays().add(new SitesOverlay(marker));
    me = new MyLocationOverlay(getActivity(), map);
    map.getOverlays().add(me);
    ((ViewGroup) getView()).addView(map);
}
Also used : MyLocationOverlay(com.google.android.maps.MyLocationOverlay) ViewGroup(android.view.ViewGroup) Drawable(android.graphics.drawable.Drawable) MapView(com.google.android.maps.MapView)

Example 4 with MapView

use of com.google.android.maps.MapView in project robolectric by robolectric.

the class ShadowMapViewTest method setUp.

@Before
public void setUp() throws Exception {
    mapView = new MapView(new Activity(), "foo");
    overlay1 = new MyOverlay(null);
    overlay2 = new MyOverlay(null);
    mapTouchListener = new MyOnTouchListener();
    mapView.getOverlays().add(overlay1);
    mapView.getOverlays().add(overlay2);
    mapView.setOnTouchListener(mapTouchListener);
    sourceEvent = MotionEvent.obtain(0, 0, 0, 0, 0, 0);
}
Also used : MapView(com.google.android.maps.MapView) Activity(android.app.Activity) Before(org.junit.Before)

Example 5 with MapView

use of com.google.android.maps.MapView in project robolectric by robolectric.

the class ShadowMapViewTest method initMapForDrag.

private void initMapForDrag() {
    mapView = new MapView(RuntimeEnvironment.application, "");
    mapView.layout(0, 0, 50, 50);
    mapView.getController().setCenter(new GeoPoint(toE6(25), toE6(25)));
    mapView.getController().zoomToSpan(toE6(50), toE6(50));
}
Also used : GeoPoint(com.google.android.maps.GeoPoint) MapView(com.google.android.maps.MapView)

Aggregations

MapView (com.google.android.maps.MapView)5 GeoPoint (com.google.android.maps.GeoPoint)3 Activity (android.app.Activity)1 ColorStateList (android.content.res.ColorStateList)1 Resources (android.content.res.Resources)1 Drawable (android.graphics.drawable.Drawable)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 ListView (android.widget.ListView)1 MyLocationOverlay (com.google.android.maps.MyLocationOverlay)1 OverlayItem (com.google.android.maps.OverlayItem)1 MapPinDrawable (greendroid.graphics.drawable.MapPinDrawable)1 Before (org.junit.Before)1