/actionslib/src/com/google/android/marvin/commands/UtilityCommands.java

http://eyes-free.googlecode.com/ · Java · 92 lines · 41 code · 15 blank · 36 comment · 0 complexity · c4f1ccd4dec89234af344207d10577cd MD5 · raw file

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