Android Open Source - storage_room_android_example Restaurants Overlay






From Project

Back to project page storage_room_android_example.

License

The source code is released under:

Copyright (c) 2011 Till Simon http://www.tillsimon.com mail@tillsimon.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation f...

If you think the Android project storage_room_android_example listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.tillsimon.storageroom_example.activities.maphelper;
/*ww w. ja v a2 s  .  c  o  m*/
import java.util.ArrayList;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;

import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;
import com.readystatesoftware.mapviewballoons.BalloonItemizedOverlay;
import com.tillsimon.storageroom_example.activities.RestaurantDetailActivity;

public class RestaurantsOverlay extends BalloonItemizedOverlay<OverlayItem> {
  
  private ArrayList<OverlayItem> mOverlayItemsArrayList = new ArrayList<OverlayItem>();
  private Context mContext;

  public RestaurantsOverlay(Context context, Drawable defaultMarker, MapView mapView) {
    super(boundCenter(defaultMarker), mapView);
    this.mContext = context;
  }

  @Override
  protected boolean onBalloonTap(int index, OverlayItem item) {
    Intent intent = new Intent(mContext, RestaurantDetailActivity.class);
    intent.putExtra("clickedItemId", ((RestaurantOverlayItem)item).getId());
    mContext.startActivity(intent);
    return true;
  }
  @Override
  protected OverlayItem createItem(int i) {
    return mOverlayItemsArrayList.get(i);
  }
  
  @Override
  public int size() {
    return mOverlayItemsArrayList.size();
  }  
    
  @Override
  public void hideBalloon() {
    super.hideBalloon();
  }

  public void addOverlayItem(OverlayItem overlay) {
    mOverlayItemsArrayList.add(overlay);
    populate();
  }

}




Java Source Code List

com.readystatesoftware.mapviewballoons.BalloonItemizedOverlay.java
com.readystatesoftware.mapviewballoons.BalloonOverlayView.java
com.tillsimon.storageroom_example.activities.RestaurantDetailActivity.java
com.tillsimon.storageroom_example.activities.RestaurantListViewActivity.java
com.tillsimon.storageroom_example.activities.RestaurantMapActivity.java
com.tillsimon.storageroom_example.activities.maphelper.RestaurantOverlayItem.java
com.tillsimon.storageroom_example.activities.maphelper.RestaurantsOverlay.java
com.tillsimon.storageroom_example.application.AppConfigInterface.java
com.tillsimon.storageroom_example.application.RestaurantApplication.java
com.tillsimon.storageroom_example.model.database.RestaurantsDatabaseHelper.java
com.tillsimon.storageroom_example.model.database.RestaurantsTableInterface.java
com.tillsimon.storageroom_example.model.webconnect.AnnouncementDownloaderDelegate.java
com.tillsimon.storageroom_example.model.webconnect.AnnouncementDownloader.java
com.tillsimon.storageroom_example.model.webconnect.RestaurantsDownloaderDelegate.java
com.tillsimon.storageroom_example.model.webconnect.RestaurantsDownloader.java