gt:             if (mSatellite) {
context: package uk.co.spookypeanut.wake_me_at;
  /*
      This file is part of Wake Me At. Wake Me At is the legal property
      of its developer, Henry Bush (spookypeanut).
  
      Wake Me At 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, either version 3 of the License, or
      (at your option) any later version.
  
      Wake Me At 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 Wake Me At, in the file "COPYING".  If not, see
      <http://www.gnu.org/licenses/>.
   */
  import java.io.IOException;
  import java.util.List;
  import java.util.Locale;
  
  import android.app.AlertDialog;
  import android.app.Dialog;
  import android.app.ProgressDialog;
  import android.app.SearchManager;
  import android.content.Context;
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.content.res.Resources;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.graphics.Canvas;
  import android.graphics.Paint;
  import android.graphics.Point;
  import android.location.Address;
  import android.location.Criteria;
  import android.location.Geocoder;
  import android.location.Location;
  import android.location.LocationListener;
  import android.location.LocationManager;
  import android.media.AudioManager;
  import android.os.Bundle;
  import android.os.Handler;
  import android.util.Log;
  import android.view.ContextThemeWrapper;
  import android.view.GestureDetector;
  import android.view.GestureDetector.OnDoubleTapListener;
  import android.view.GestureDetector.OnGestureListener;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.MenuInflater;
  import android.view.MenuItem;
  import android.view.MotionEvent;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.BaseAdapter;
  import android.widget.Button;
  import android.widget.ListView;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import com.google.android.maps.GeoPoint;
  import com.google.android.maps.MapActivity;
  import com.google.android.maps.MapController;
  import com.google.android.maps.MapView;
  import com.google.android.maps.Overlay;
  import com.google.android.maps.Projection;
  
  public class GetLocationMap extends MapActivity
  implements LocationListener {
      public static final String PREFS_NAME = "WakeMeAtPrefs";
      private String LOG_NAME;
      Context mContext;
      LayoutInflater mInflater;
      MapView mapView;
      UnitConverter uc;
      Geocoder mGeocoder;
      static SearchManager mSearchManager;
      // Need handler for callbacks to the UI thread
      final Handler mHandler = new Handler();
  
      Location mCurrLoc;
      double mOrigLat, mOrigLong;
      GeoPoint mDest;
      String mNick;
      double mRadius;
      
      private List<Address> mResults;
      List<Address> mDestAddresses = null;
      Dialog mResultsDialog;
      boolean mSearching;
      String mSearchTerm;
      // If our search fails through lack of data, retry this many times
      int mTries = 0;
      private static final int MAX_TRIES = 10;
  
      ProgressDialog mProgressDialog;
      boolean mSatellite = false;
  
      /* This runnable is called when the address of the potential
       * destination has been retrieved, to cancel the progress dialog */
      final Runnable mGotAddresses = new Runnable() {
          public void run() {
              mProgressDialog.cancel();
              gotDestinationAddress();
          }
      };
  
      /* This runnable is called when the search results have been
       * retrieved, to cancel the progress dialog */
      final Runnable mGotSearchResults = new Runnable() {
          public void run() {
              mProgressDialog.cancel();
              resultsDialog();
          }
      };
  
      @Override
      public void onCreate(Bundle icicle) {
          LOG_NAME = (String) getText(R.string.app_name_nospaces);
          Log.d(LOG_NAME, "GetLocationMap.onCreate()");
          mContext = this;
          super.onCreate(icicle);
          // REF#0023: Setting a content view for a mapview is kinda slow (3 sec
          // or so on my Nexus One. However, we don't seem to be able to pop up a
          // progress window, as both need access to the ui. This sucks.
          setContentView(R.layout.get_location_map);
  
          setVolumeControlStream(AudioManager.STREAM_ALARM);
          mSearchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
          mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          mGeocoder = new Geocoder(this, Locale.getDefault());
          // We need this just to print out distances in the correct format, etc
          uc = new UnitConverter(this, "m");
  
          mapView = (MapView) findViewById(R.id.mapview);
          mapView.setBuiltInZoomControls(true);
          setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
          // This it probably pointless here: mSatellite should always be false
          mapView.setSatellite(mSatellite);
          
          // Get the information from the intent 
          Bundle extras = this.getIntent().getExtras();
          // We need the location to place our starting pointer
          mOrigLat = extras.getDouble("latitude");
          mOrigLong = extras.getDouble("longitude");
          // We need the radius to draw it on the map
          mRadius = extras.getDouble("radiusMetres");
          // We need the nick to pre-populate the search box
          mSearchTerm = extras.getString("nick");
          
          // If the location is the (invalid) default, we start from our current location
          if (mOrigLat == 1000 && mOrigLong == 1000) {
              Location currLoc = getCurrentLocation();
              if (currLoc != null) {
                  mOrigLat = currLoc.getLatitude();
                  mOrigLong = currLoc.getLongitude();
              }
          }
          moveDestinationTo(mOrigLat, mOrigLong);
  
          // See onRetainNonConfigurationInstance for the information that
          // we receive here
          final Bundle data = (Bundle) getLastNonConfigurationInstance();
  
          if (data != null) {
              // If we have an existing instance, we get the location,
              // the last search term, and whether the search box is open
              mSearchTerm = data.getString("mSearchTerm");
              mSearching = data.getBoolean("mSearching");
              double lat = (double) data.getInt("mDestLat") / 1E6;
              double longi = (double) data.getInt("mDestLong") / 1E6;
              moveMapTo(lat, longi);
          } else {
              // If we don't have an existing instance, we move the map to the
              // starting location and open the search box
              moveMapTo(mOrigLat, mOrigLong);
              mSearching = true;
          }
          if (mSearching) {
              onSearchRequested();
          }
      }
  
      /** (non-Javadoc)
       * @see android.app.Activity#onRetainNonConfigurationInstance()
       * Generally, when the screen is rotated, the activity gets started again
       * from scratch. In this case, that would be *really* annoying, if we had
       * chosen a location, got search up, etc. So this method gives us the 
       * ability to pass some information to future existences of ourself, and
       * handle it in onCreate
       */
      @Override
      public Object onRetainNonConfigurationInstance() {
          Bundle returnBundle = new Bundle();
          returnBundle.putString("mSearchTerm", mSearchTerm);
          returnBundle.putBoolean("mSearching", mSearching);
          mDest = mapView.getProjection().fromPixels(
                  mapView.getWidth()/2,
                  mapView.getHeight()/2);
          returnBundle.putInt("mDestLat",mDest.getLatitudeE6());
          returnBundle.putInt("mDestLong", mDest.getLongitudeE6());
          return returnBundle;
      }
  
      /* (non-Javadoc)
       * @see com.google.android.maps.MapActivity#onNewIntent(android.content.Intent)
       */
      @Override
      public void onNewIntent(Intent intent) {
          handleIntent(intent);
      }
  
      /**
       * When passed a new intent, run this.
       * Can be either via onNewIntent or onCreate
       * TODO: Seems to be run only from onNewIntent atm: maybe it could be
       * removed? But I'll leave it for now
       * @param intent
       */
      private void handleIntent(Intent intent) {
          setIntent(intent);
          if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
              // We've finished searching then
              mSearching = false;
              String query = intent.getStringExtra(SearchManager.QUERY);
              doSearch(query);
          }
      }
  
      /**
       * Toggle the map mode between map and satellite
       */
      private void toggleMapMode() {
          mSatellite = !mSatellite;
          mapView.setSatellite(mSatellite);
      }
  
      /**
       * Move the destination marker on the map
       * @param latitude The new latitude of the marker
       * @param longitude The new longitude of the marker
       */
      private void moveDestinationTo(double latitude, double longitude) {
          List<Overlay> mapOverlays = mapView.getOverlays();
  
          DestOverlay destOverlay = new DestOverlay(mContext, latitude, longitude, mRadius);
          mapOverlays.clear();
          mapOverlays.add(destOverlay);
      }
  
      /**
       * Move the map to a given point
       * @param latitude The new latitude
       * @param longitude The new longitude
       */
      private void moveMapTo(double latitude, double longitude) {
          GeoPoint location = new GeoPoint((int) (latitude * 1E6),
                                              (int) (longitude * 1E6));
          moveMapTo(location);
      }
  
      /**
       * Move the map to a given point
       * @param location The new location
       */
      private void moveMapTo(GeoPoint location) {
          if (location != null) {
              MapController mc = mapView.getController();
              // We also set the zoom level. Should we?
              mc.setZoom(15);
              mc.animateTo(location);
          } else {
              Log.e(LOG_NAME, "Location to move to was null");
          }
      }
  
      /* (non-Javadoc)
       * @see android.app.Activity#onCreateOptionsMenu(android.view.Menu)
       */
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.mn_get_location_map, menu);
          return true;
      }
  
      /* (non-Javadoc)
       * @see android.app.Activity#onOptionsItemSelected(android.view.MenuItem)
       */
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          switch (item.getItemId()) {
          case R.id.mn_orig_loc:
              // Move the map back to the original location
              moveMapTo(mOrigLat, mOrigLong);
              return true;
          case R.id.mn_search:
              // Pop-up the search dialog
              onSearchRequested();
              return true;
          case R.id.mn_curr_loc:
              // Move the centre of the map to the current location
              Location here = getCurrentLocation();
              if (here != null) {
                  moveMapTo(here.getLatitude(), here.getLongitude());
              } else {
                  Log.e(LOG_NAME, "Location inaccessible");
              }
              return true;
          case R.id.mn_satellite:
              toggleMapMode();
              // Switch the text of the menu item depending which mode we're
              // currently in
  