Changeset 68
- Timestamp:
- 08/13/07 22:00:20 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
bbtracker/trunk/src/org/bbtracker/mobile/gui/MainCanvas.java
r62 r68 20 20 import java.util.TimerTask; 21 21 22 import javax.microedition.lcdui.Alert; 23 import javax.microedition.lcdui.AlertType; 22 24 import javax.microedition.lcdui.Canvas; 23 25 import javax.microedition.lcdui.Command; … … 225 227 Displayable nextDisplayable = null; 226 228 if (command == exitCommand) { 227 BBTracker.getInstance().shutdown(true);229 exitAction(); 228 230 } else if (command == switchViewCommand) { 229 231 nextTileConfiguration(); … … 246 248 } 247 249 250 private void exitAction() { 251 final boolean isTracking = manager.getState() == TrackManager.STATE_TRACKING; 252 String question = "Do you really want to quit?"; 253 if (isTracking) { 254 question += "\nThe current Track will be finished and saved."; 255 } 256 final Alert alert = new Alert("Really Quit?", question, null, AlertType.CONFIRMATION); 257 final Command quitCommand = new Command("Quit", Command.OK, 1); 258 alert.addCommand(quitCommand); 259 alert.addCommand(new Command("Cancel", Command.CANCEL, 0)); 260 alert.setCommandListener(new CommandListener() { 261 262 public void commandAction(final Command cmd, final Displayable current) { 263 if (cmd == quitCommand) { 264 BBTracker.getInstance().shutdown(true); 265 } else { 266 BBTracker.getDisplay().setCurrent(MainCanvas.this); 267 } 268 } 269 }); 270 BBTracker.alert(alert, this); 271 } 272 248 273 protected void keyReleased(final int keyCode) { 249 274 final int gameAction = getGameAction(keyCode);
Note: See TracChangeset
for help on using the changeset viewer.