/talkback_preics/src/com/google/android/marvin/talkback/commands/TalkBackCommands.java
Java | 84 lines | 41 code | 14 blank | 29 comment | 0 complexity | 5ac3ec2c98a335524fea25397a1e2d95 MD5 | raw file
1// Copyright 2010 Google Inc. All Rights Reserved. 2 3package com.google.android.marvin.talkback.commands; 4 5import com.google.android.marvin.commands.Command; 6 7import android.view.KeyEvent; 8 9/** 10 * A set of user commands that will be executed by TalkBack. Only commands that require 11 * information private to TalkBack should be implemented here. 12 * 13 * @author clsimon@google.com (Cheryl Simon) 14 * 15 */ 16public enum TalkBackCommands implements Command { 17 /** 18 * Repeat the last spoken utterance. 19 */ 20 REPEAT_LAST("Repeat Last Utterance", KeyEvent.KEYCODE_MENU, KeyEvent.KEYCODE_R), 21 22 /** 23 * Spell the last spoken utterance. 24 */ 25 SPELL_LAST("Spell Last Utterance", KeyEvent.KEYCODE_MENU, KeyEvent.KEYCODE_S); 26 27 private String displayName; 28 private int defaultKeyCode; 29 private int defaultModifier; 30 private int keyCode; 31 private int modifier; 32 33 private TalkBackCommands(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 41 public void resetCommand() { 42 keyCode = defaultKeyCode; 43 modifier = defaultModifier; 44 } 45 46 /** 47 * @return the keyCode 48 */ 49 public int getKeyCode() { 50 return keyCode; 51 } 52 53 /** 54 * @param keyCode the keyCode to set 55 */ 56 public void setKeyCode(int keyCode) { 57 this.keyCode = keyCode; 58 } 59 60 /** 61 * @return the modifier 62 */ 63 public int getModifier() { 64 return modifier; 65 } 66 67 /** 68 * @param modifier the modifier to set 69 */ 70 public void setModifier(int modifier) { 71 this.modifier = modifier; 72 } 73 74 /** 75 * @return the displayName 76 */ 77 public String getDisplayName() { 78 return displayName; 79 } 80 81 public String getAction() { 82 return "com.google.android.marvin.commands.TALKBACK_USER_EVENT_COMMAND"; 83 } 84}