Android Open Source - Mero-Bhada-Meter Via Point Info Window






From Project

Back to project page Mero-Bhada-Meter.

License

The source code is released under:

GNU General Public License

If you think the Android project Mero-Bhada-Meter 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.nirab.merobhadameter;
/*from   ww w. j a v  a  2s . co  m*/
import org.osmdroid.bonuspack.overlays.DefaultInfoWindow;
import org.osmdroid.bonuspack.overlays.ExtendedOverlayItem;
import org.osmdroid.views.MapView;
import android.view.View;
import android.widget.Button;

/**
 * A customized InfoWindow handling "itinerary" points (start, destination and via-points). 
 * We inherit from DefaultInfoWindow as it already provides most of what we want. 
 * And we just add support for a "remove" button. 
 * 
 * @author M.Kergall
 */
public class ViaPointInfoWindow extends DefaultInfoWindow {

  int mSelectedPoint;
  
  public ViaPointInfoWindow(int layoutResId, MapView mapView) {
    super(layoutResId, mapView);
    Button btnDelete = (Button)(mView.findViewById(R.id.bubble_delete));
    btnDelete.setOnClickListener(new View.OnClickListener() {
      public void onClick(View view) {
        //Call the removePoint method on MapActivity. 
        //TODO: find a cleaner way to do that!
        MapActivity mapActivity = (MapActivity)view.getContext();
        mapActivity.removePoint(mSelectedPoint);
        close();
      }
    });
  }

  @Override public void onOpen(Object item) {
    ExtendedOverlayItem eItem = (ExtendedOverlayItem)item;
    mSelectedPoint = (Integer)eItem.getRelatedObject();
    super.onOpen(item);
  }

}




Java Source Code List

com.nirab.merobhadameter.AsyncTaskCompleteListener.java
com.nirab.merobhadameter.DownloadOfflineData.java
com.nirab.merobhadameter.Fare.java
com.nirab.merobhadameter.MainActivity.java
com.nirab.merobhadameter.MapActivity.java
com.nirab.merobhadameter.MenuActivity.java
com.nirab.merobhadameter.MyPreferencesActivity.java
com.nirab.merobhadameter.OfflineMapActivity.java
com.nirab.merobhadameter.OfflineRoute.java
com.nirab.merobhadameter.SamplesApplication.java
com.nirab.merobhadameter.Utils.java
com.nirab.merobhadameter.ViaPointInfoWindow.java