/actionslib/src/com/google/android/marvin/commands/UtilityCommands.java
Java | 92 lines | 41 code | 15 blank | 36 comment | 0 complexity | c4f1ccd4dec89234af344207d10577cd MD5 | raw file
1// Copyright 2010 Google Inc. All Rights Reserved. 2 3package com.google.android.marvin.commands; 4 5import android.view.KeyEvent; 6 7/** 8 * A set of utility commands that result in some status being read out loud. 9 * 10 * @author clsimon@google.com (Cheryl Simon) 11 * 12 */ 13public enum UtilityCommands implements Command { 14 /** 15 * Speak the current batter level. 16 */ 17 BATTERY("Battery Level", KeyEvent.KEYCODE_MENU, KeyEvent.KEYCODE_B), 18 19 /** 20 * Speak the current date and time. 21 */ 22 TIME("Time and Date", KeyEvent.KEYCODE_MENU, KeyEvent.KEYCODE_T), 23 24 /** 25 * Speak the current location. 26 * TODO(clsimon): Implement the location command. 27 */ 28// LOCATION("Location", KeyEvent.KEYCODE_MENU, KeyEvent.KEYCODE_L), 29 30 /** 31 * Speak the current connection status of each current connection, wifi, 3G, etc. 32 */ 33 CONNECTIVITY("Connectivity", KeyEvent.KEYCODE_MENU, KeyEvent.KEYCODE_O ); 34 35 private String displayName; 36 private int defaultKeyCode; 37 private int defaultModifier; 38 private int keyCode; 39 private int modifier; 40 41 private UtilityCommands(String displayName, int defaultModifier, int defaultKeyCode) { 42 this.displayName = displayName; 43 this.defaultKeyCode = defaultKeyCode; 44 this.keyCode = defaultKeyCode; 45 this.defaultModifier = defaultModifier; 46 this.modifier = defaultModifier; 47 } 48 49 public void resetCommand() { 50 keyCode = defaultKeyCode; 51 modifier = defaultModifier; 52 } 53 54 /** 55 * @return the keyCode 56 */ 57 public int getKeyCode() { 58 return keyCode; 59 } 60 61 /** 62 * @param keyCode the keyCode to set 63 */ 64 public void setKeyCode(int keyCode) { 65 this.keyCode = keyCode; 66 } 67 68 /** 69 * @return the modifier 70 */ 71 public int getModifier() { 72 return modifier; 73 } 74 75 /** 76 * @param modifier the modifier to set 77 */ 78 public void setModifier(int modifier) { 79 this.modifier = modifier; 80 } 81 82 /** 83 * @return the displayName 84 */ 85 public String getDisplayName() { 86 return displayName; 87 } 88 89 public String getAction() { 90 return "com.google.android.marvin.commands.UTILITY_USER_EVENT_COMMAND"; 91 } 92}