/** @see android.app.Activity#onOptionsItemSelected(android.view.MenuItem) */
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case 0:
       // Zoom in
       zoomIn();
       return true;
     case 1:
       // Zoom out
       zoomOut();
       return true;
     case 2:
       // Toggle satellite views
       mvMap.setSatellite(!mvMap.isSatellite());
       return true;
     case 3:
       // Toggle street views
       mvMap.setStreetView(!mvMap.isStreetView());
       return true;
     case 4:
       // Toggle traffic views
       mvMap.setTraffic(!mvMap.isTraffic());
       return true;
     case 5:
       // Show the job list activity
       startActivity(new Intent(MicroJobs.this, MicroJobsList.class));
       return true;
   }
   return false;
 }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   // Handles the menu item selection.
   switch (item.getItemId()) {
     case R.id.menu_satellite:
       mMapView.setSatellite(true);
       mMapView.setTraffic(false);
       return true;
     case R.id.menu_map:
       mMapView.setSatellite(false);
       return true;
     case R.id.menu_traffic:
       if (mMapView.isTraffic()) {
         mMapView.setTraffic(false);
       } else {
         mMapView.setTraffic(true);
         mMapView.setSatellite(false);
       }
       return true;
     case R.id.menu_help:
       showHelpDialog();
       return true;
     default:
       return super.onOptionsItemSelected(item);
   }
 }
Esempio n. 3
0
 public boolean onKeyDown(int keyCode, KeyEvent e) {
   if (keyCode == KeyEvent.KEYCODE_S) {
     mapView.setSatellite(!mapView.isSatellite());
     return true;
   } else if (keyCode == KeyEvent.KEYCODE_T) {
     mapView.setTraffic(!mapView.isTraffic());
     mapControl.animateTo(gp); // To ensure change displays immediately
   }
   return (super.onKeyDown(keyCode, e));
 }
 /**
  * When traffic mode is clicked by the user.
  *
  * @param view The traffic view.
  */
 public void onTrafficModeClicked(View view) {
   if (mMapView.isTraffic()) {
     mMapView.setTraffic(false);
     mMapModeView.setEnabled(false);
     mSatelliteModeView.setEnabled(true);
   } else {
     // If Traffic mode is selected, show the traffic in Map Mode only.
     // If Map is already on satellite mode than automatically change it
     // to Map Mode and enable the traffic.
     mMapView.setTraffic(true);
     mMapView.setSatellite(false);
     mMapModeView.setEnabled(false);
     mTrafficModeView.setEnabled(false);
     mSatelliteModeView.setEnabled(true);
   }
 }