gt: 		switch (id) {
context: /*
   * Copyright (C) 2011 Guillaume Delente
   *
   * This file is part of OpenBike.
   *
   * OpenBike is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, version 3 of the License.
   *
   * OpenBike is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License
   * along with OpenBike.  If not, see <http://www.gnu.org/licenses/>.
   */
  package fr.openbike.android.ui;
  
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.app.Dialog;
  import android.content.ComponentName;
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.content.ServiceConnection;
  import android.content.SharedPreferences;
  import android.database.Cursor;
  import android.location.Location;
  import android.net.Uri;
  import android.os.Bundle;
  import android.os.IBinder;
  import android.preference.PreferenceManager;
  import android.provider.BaseColumns;
  import android.view.Menu;
  import android.view.MenuInflater;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.CheckBox;
  import android.widget.CompoundButton;
  import android.widget.ImageView;
  import android.widget.TextView;
  import android.widget.CompoundButton.OnCheckedChangeListener;
  import fr.openbike.android.IActivityHelper;
  import fr.openbike.android.R;
  import fr.openbike.android.database.OpenBikeDBAdapter;
  import fr.openbike.android.database.StationsProvider;
  import fr.openbike.android.service.ILocationServiceListener;
  import fr.openbike.android.service.LocationService;
  import fr.openbike.android.service.LocationService.LocationBinder;
  import fr.openbike.android.utils.ActivityHelper;
  import fr.openbike.android.utils.Utils;
  
  /**
   * @author guitou
   * 
   */
  public class StationDetails extends Activity implements
  		ILocationServiceListener, IActivityHelper {
  
  	public static final int COMPUTE_DISTANCE = -2;
  	public static final int MAPS_NOT_AVAILABLE = 0;
  	public static final int NAVIGATION_NOT_AVAILABLE = 1;
  
  	private Cursor mStation = null;
  	private TextView mName = null;
  	private TextView mDistance = null;
  	private TextView mBikes = null;
  	private TextView mSlots = null;
  	private TextView mAddress = null;
  	private TextView mCreditCard = null;
  	private TextView mSpecial = null;
  	private CheckBox mFavorite = null;
  	private Button mNavigate = null;
  	private Button mGoogleMaps = null;
  	private Button mShowMap = null;
  	private SharedPreferences mSharedPreferences = null;
  	private Uri mUri = null;
  	private int mLatitude;
  	private int mLongitude;
  	private ActivityHelper mActivityHelper = null;
  	boolean mBound = false;
  
  	private LocationService mService = null;
  
  	private ServiceConnection mConnection = new ServiceConnection() {
  
  		@Override
  		public void onServiceConnected(ComponentName className, IBinder service) {
  			// We've bound to LocalService, cast the IBinder and get
  			// LocalService instance
  			LocationBinder binder = (LocationBinder) service;
  			mService = binder.getService();
  			mBound = true;
  			mService.addListener(StationDetails.this);
  		}
  
  		@Override
  		public void onServiceDisconnected(ComponentName arg0) {
  			mBound = false;
  		}
  	};
  
  	@Override
  	public void onCreate(Bundle savedInstanceState) {
  		super.onCreate(savedInstanceState);
  		setContentView(R.layout.station_details_layout);
  		mActivityHelper = new ActivityHelper(this);
  		mActivityHelper.setupActionBar(getString(R.string.station_details));
  		mSharedPreferences = PreferenceManager
  				.getDefaultSharedPreferences(this);
  		mName = (TextView) findViewById(R.id.name);
  		mFavorite = (CheckBox) findViewById(R.id.favorite);
  		mDistance = (TextView) findViewById(R.id.distance);
  		mCreditCard = (TextView) findViewById(R.id.cc);
  		mSpecial = (TextView) findViewById(R.id.special);
  		mAddress = (TextView) findViewById(R.id.address);
  		mNavigate = (Button) findViewById(R.id.navigate);
  		mGoogleMaps = (Button) findViewById(R.id.show_google_maps);
  		mShowMap = (Button) findViewById(R.id.show_map);
  		mGoogleMaps.setOnClickListener(new OnClickListener() {
  			@Override
  			public void onClick(View arg0) {
  				startMaps();
  			}
  		});
  		mNavigate.setOnClickListener(new OnClickListener() {
  
  			@Override
  			public void onClick(View arg0) {
  				startNavigation();
  			}
  		});
  		mShowMap.setOnClickListener(new OnClickListener() {
  			@Override
  			public void onClick(View arg0) {
  				showOnMap(mStation.getString(mStation
  						.getColumnIndex(BaseColumns._ID)));
  			}
  		});
  	}
  
  	private void showOnMap(Uri uri) {
  		Intent intent = new Intent(this, OpenBikeMapActivity.class)
  				.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  		intent.setAction(OpenBikeMapActivity.ACTION_DETAIL);
  		intent.setData(uri);
  		startActivity(intent);
  	}
  
  	@Override
  	protected void onPostCreate(Bundle savedInstanceState) {
  		super.onPostCreate(savedInstanceState);
  		mActivityHelper.onPostCreate(savedInstanceState);
  	}
  
  	private void showOnMap(String id) {
  		showOnMap(Uri.withAppendedPath(StationsProvider.CONTENT_URI, id));
  	}
  
  	@Override
  	public boolean onCreateOptionsMenu(Menu menu) {
  		mActivityHelper.onCreateOptionsMenu(menu);
  		MenuInflater inflater = getMenuInflater();
  		inflater.inflate(R.menu.station_details_menu, menu);
  		super.onCreateOptionsMenu(menu);
  		return true;
  	}
  
  	@Override
  	public boolean onOptionsItemSelected(MenuItem item) {
  		// Handle item selection
  		switch (item.getItemId()) {
  		case R.id.menu_show_on_map:
  			showOnMap(mStation.getString(mStation
  					.getColumnIndex(BaseColumns._ID)));
  			return true;
  		case R.id.menu_show_on_google_maps:
  			startMaps();
  			return true;
  		case R.id.menu_navigate_to:
  			startNavigation();
  			return true;
  		default:
  			return mActivityHelper.onOptionsItemSelected(item)
  					|| super.onOptionsItemSelected(item);
  		}
  	}
  
  	void startMaps() {
  		Intent intent = Utils.getMapsIntent(mStation.getInt(mStation
  				.getColumnIndex(OpenBikeDBAdapter.KEY_LATITUDE)), mStation
  				.getInt(mStation
  						.getColumnIndex(OpenBikeDBAdapter.KEY_LONGITUDE)),
  				mStation.getString(mStation
  						.getColumnIndex(OpenBikeDBAdapter.KEY_NAME)));
  		if (Utils.isIntentAvailable(intent, this))
  			startActivity(intent);
  		else
  			showDialog(MAPS_NOT_AVAILABLE);
  	}
  
  	void startNavigation() {
  		Intent intent = Utils.getNavigationIntent(mStation.getInt(mStation
  				.getColumnIndex(OpenBikeDBAdapter.KEY_LATITUDE)), mStation
  				.getInt(mStation
  						.getColumnIndex(OpenBikeDBAdapter.KEY_LONGITUDE)));
  		if (Utils.isIntentAvailable(intent, this))
  			startActivity(intent);
  		else
  			showDialog(NAVIGATION_NOT_AVAILABLE);
  	}
  
  	@Override
  	protected Dialog onCreateDialog(int id) {
  