/talkback_preics/src/com/google/android/marvin/talkback/commands/TalkBackCommands.java

http://eyes-free.googlecode.com/ · Java · 84 lines · 41 code · 14 blank · 29 comment · 0 complexity · 5ac3ec2c98a335524fea25397a1e2d95 MD5 · raw file

  1. // Copyright 2010 Google Inc. All Rights Reserved.
  2. package com.google.android.marvin.talkback.commands;
  3. import com.google.android.marvin.commands.Command;
  4. import android.view.KeyEvent;
  5. /**
  6. * A set of user commands that will be executed by TalkBack. Only commands that require
  7. * information private to TalkBack should be implemented here.
  8. *
  9. * @author clsimon@google.com (Cheryl Simon)
  10. *
  11. */
  12. public enum TalkBackCommands implements Command {
  13. /**
  14. * Repeat the last spoken utterance.
  15. */
  16. REPEAT_LAST("Repeat Last Utterance", KeyEvent.KEYCODE_MENU, KeyEvent.KEYCODE_R),
  17. /**
  18. * Spell the last spoken utterance.
  19. */
  20. SPELL_LAST("Spell Last Utterance", KeyEvent.KEYCODE_MENU, KeyEvent.KEYCODE_S);
  21. private String displayName;
  22. private int defaultKeyCode;
  23. private int defaultModifier;
  24. private int keyCode;
  25. private int modifier;
  26. private TalkBackCommands(String displayName, int defaultModifier, int defaultKeyCode) {
  27. this.displayName = displayName;
  28. this.defaultKeyCode = defaultKeyCode;
  29. this.keyCode = defaultKeyCode;
  30. this.defaultModifier = defaultModifier;
  31. this.modifier = defaultModifier;
  32. }
  33. public void resetCommand() {
  34. keyCode = defaultKeyCode;
  35. modifier = defaultModifier;
  36. }
  37. /**
  38. * @return the keyCode
  39. */
  40. public int getKeyCode() {
  41. return keyCode;
  42. }
  43. /**
  44. * @param keyCode the keyCode to set
  45. */
  46. public void setKeyCode(int keyCode) {
  47. this.keyCode = keyCode;
  48. }
  49. /**
  50. * @return the modifier
  51. */
  52. public int getModifier() {
  53. return modifier;
  54. }
  55. /**
  56. * @param modifier the modifier to set
  57. */
  58. public void setModifier(int modifier) {
  59. this.modifier = modifier;
  60. }
  61. /**
  62. * @return the displayName
  63. */
  64. public String getDisplayName() {
  65. return displayName;
  66. }
  67. public String getAction() {
  68. return "com.google.android.marvin.commands.TALKBACK_USER_EVENT_COMMAND";
  69. }
  70. }