PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/commandslib/src/com/google/android/marvin/commands/Command.java

http://eyes-free.googlecode.com/
Java | 51 lines | 9 code | 7 blank | 35 comment | 0 complexity | c69636486044a9d0f4d65823fea5763e MD5 | raw file
 1// Copyright 2010 Google Inc. All Rights Reserved.
 2
 3package com.google.android.marvin.commands;
 4
 5/**
 6 * An interface that should be implemented by any user commands.  A user command is an event
 7 * sent to a {@link android.content.BroadcastReceiver} that requests some action be taken.  
 8 * 
 9 * Keyboards can choose to invoke the commands using the provided keyboard shortcut, consisting
10 * of a modifier key and additional key.
11 * 
12 * To invoke the command, send a broadcast with the provided action, via {@code getAction()}, 
13 * with an extra named {@code CommandConstants.EXTRA_EVENT_TYPE} whose contents are 
14 * {@code getDisplayName()}.
15 * 
16 * @author clsimon@google.com (Cheryl Simon)
17 *
18 */
19public interface Command {
20    /**
21     * @return The key code of the second key to be pressed to execute the command.
22     */
23    int getKeyCode();
24    
25    /**
26     * Set the key code of the second key to be pressed to execute the command.
27     */
28    void setKeyCode(int keyCode);
29    
30    /**
31     * @return The key code of the modifier key involved in the command execution.  Possible options
32     * are search and menu.
33     */
34    int getModifier();
35    
36    /**
37     * Set the key code of the modifier key involved in the command execution.
38     */
39    void setModifier(int keyCode);
40    
41    /**
42     * @return  The name of the command that will be displayed to the user in settings, and
43     * will be used as the contents of the extra when invoking the command.
44     */
45    String getDisplayName();
46    
47    /**
48     * @return The action to direct the broadcast at to invoke the command.
49     */
50    String getAction();
51}