org.solovyev.android.keyboard
Class AbstractKeyboardController<K extends AKeyboard>

java.lang.Object
  extended by org.solovyev.android.keyboard.AbstractKeyboardController<K>
All Implemented Interfaces:
AKeyboardController
Direct Known Subclasses:
AbstractAndroidKeyboardController, MapKeyboardController

public abstract class AbstractKeyboardController<K extends AKeyboard>
extends Object
implements AKeyboardController

User: Solovyev_S Date: 02.11.12 Time: 11:33


Field Summary
static int KEYCODE_CLEAR
           
static int KEYCODE_COPY
           
static int KEYCODE_CURSOR_LEFT
           
static int KEYCODE_CURSOR_RIGHT
           
static int KEYCODE_ENTER
           
static int KEYCODE_NEXT_KEYBOARD
           
static int KEYCODE_PASTE
           
static int KEYCODE_PREV_KEYBOARD
           
static int KEYCODE_REDO
           
static int KEYCODE_UNDO
           
 
Constructor Summary
protected AbstractKeyboardController()
           
 
Method Summary
protected  DefaultKeyboardInput createKeyboardInput0(android.inputmethodservice.InputMethodService inputMethodService)
           
 AKeyboardView createKeyboardView(android.content.Context context, android.view.LayoutInflater layoutInflater)
          Called by the framework when your view for creating input needs to be generated.
protected abstract  AKeyboardView<K> createKeyboardView0(android.content.Context context)
           
protected  K getCurrentKeyboard()
           
protected  android.inputmethodservice.InputMethodService getInputMethodService()
           
protected  AKeyboardInput getKeyboardInput()
           
protected  AKeyboardView<K> getKeyboardView()
           
protected  AKeyboardControllerState<K> getState()
           
 boolean handleBackspace()
           
protected  void handleCharacter(int primaryCode, int[] keyCodes)
           
 void handleClose()
           
protected  void handleModeChange()
           
protected  void handleNextKeyboard()
           
protected  void handlePrevKeyboard()
           
protected  boolean handleSpecialKey(int primaryCode)
           
 boolean isWordSeparator(int code)
           
 void keyDownUp(int keyEventCode)
          Helper to send a key down / key up pair to the current editor.
 void onCreate(android.content.Context context)
          Main initialization of the input method component.
protected abstract  AKeyboardConfiguration onCreate0(android.content.Context context)
           
 android.view.View onCreateCandidatesView()
          Called by the framework when your view for showing candidates needs to be generated, like AKeyboardController.createKeyboardView(android.content.Context, android.view.LayoutInflater).
 void onCurrentInputMethodSubtypeChanged(android.view.inputmethod.InputMethodSubtype subtype)
           
 void onDisplayCompletions(android.view.inputmethod.CompletionInfo[] completions)
          This tells us about completions that the editor has determined based on the current text in it.
 void onFinishInput()
          This is called when the user is done editing a field.
 void onInitializeInterface(android.inputmethodservice.InputMethodService inputMethodService)
          This is the point where you can do all of your UI initialization.
protected abstract  AKeyboardControllerState<K> onInitializeInterface0(android.inputmethodservice.InputMethodService inputMethodService)
           
 boolean onKey(int primaryCode, int[] keyCodes)
           
 boolean onKeyDown(int keyCode, android.view.KeyEvent event)
          Use this to monitor key events being delivered to the application.
 boolean onKeyUp(int keyCode, android.view.KeyEvent event)
          Use this to monitor key events being delivered to the application.
 void onStartInput(android.view.inputmethod.EditorInfo attribute, boolean restarting)
          This is the main point where we do our initialization of the input method to begin operating on an application.
abstract  AKeyboardControllerState<K> onStartInput0(android.view.inputmethod.EditorInfo attribute, boolean restarting)
           
 void onStartInputView(android.view.inputmethod.EditorInfo attribute, boolean restarting)
           
 void onText(CharSequence text)
           
 void onUpdateSelection(int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd)
          Deal with the editor reporting movement of its cursor.
 void pickDefaultCandidate()
           
 void pickSuggestionManually(int index)
           
 void sendKey(int keyCode)
          Helper to send a character to the editor as raw key events.
protected  void setCurrentKeyboard(K keyboard)
           
protected  void setShifted(boolean shifted)
           
protected  void setShifted0(boolean shifted)
           
protected  void setState(AKeyboardControllerState<K> state)
           
protected  void updateCandidates()
           
 void updateShiftKeyState(android.view.inputmethod.EditorInfo attr)
          Helper to update the shift state of our keyboard based on the initial editor state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEYCODE_CLEAR

public static final int KEYCODE_CLEAR
See Also:
Constant Field Values

KEYCODE_COPY

public static final int KEYCODE_COPY
See Also:
Constant Field Values

KEYCODE_ENTER

public static final int KEYCODE_ENTER
See Also:
Constant Field Values

KEYCODE_PASTE

public static final int KEYCODE_PASTE
See Also:
Constant Field Values

KEYCODE_CURSOR_LEFT

public static final int KEYCODE_CURSOR_LEFT
See Also:
Constant Field Values

KEYCODE_CURSOR_RIGHT

public static final int KEYCODE_CURSOR_RIGHT
See Also:
Constant Field Values

KEYCODE_PREV_KEYBOARD

public static final int KEYCODE_PREV_KEYBOARD
See Also:
Constant Field Values

KEYCODE_NEXT_KEYBOARD

public static final int KEYCODE_NEXT_KEYBOARD
See Also:
Constant Field Values

KEYCODE_UNDO

public static final int KEYCODE_UNDO
See Also:
Constant Field Values

KEYCODE_REDO

public static final int KEYCODE_REDO
See Also:
Constant Field Values
Constructor Detail

AbstractKeyboardController

protected AbstractKeyboardController()
Method Detail

onCreate

public final void onCreate(@Nonnull
                           android.content.Context context)
Description copied from interface: AKeyboardController
Main initialization of the input method component. Be sure to call to super class.

Specified by:
onCreate in interface AKeyboardController

onCreate0

@Nonnull
protected abstract AKeyboardConfiguration onCreate0(@Nonnull
                                                            android.content.Context context)

onInitializeInterface

public final void onInitializeInterface(@Nonnull
                                        android.inputmethodservice.InputMethodService inputMethodService)
Description copied from interface: AKeyboardController
This is the point where you can do all of your UI initialization. It is called after creation and any configuration change.

Specified by:
onInitializeInterface in interface AKeyboardController

onInitializeInterface0

@Nonnull
protected abstract AKeyboardControllerState<K> onInitializeInterface0(@Nonnull
                                                                              android.inputmethodservice.InputMethodService inputMethodService)

createKeyboardInput0

@Nonnull
protected DefaultKeyboardInput createKeyboardInput0(@Nonnull
                                                            android.inputmethodservice.InputMethodService inputMethodService)

createKeyboardView0

@Nonnull
protected abstract AKeyboardView<K> createKeyboardView0(@Nonnull
                                                                android.content.Context context)

createKeyboardView

@Nonnull
public final AKeyboardView createKeyboardView(@Nonnull
                                                      android.content.Context context,
                                                      @Nonnull
                                                      android.view.LayoutInflater layoutInflater)
Description copied from interface: AKeyboardController
Called by the framework when your view for creating input needs to be generated. This will be called the first time your input method is displayed, and every time it needs to be re-created such as due to a configuration change.

Specified by:
createKeyboardView in interface AKeyboardController

onCreateCandidatesView

public android.view.View onCreateCandidatesView()
Description copied from interface: AKeyboardController
Called by the framework when your view for showing candidates needs to be generated, like AKeyboardController.createKeyboardView(android.content.Context, android.view.LayoutInflater).

Specified by:
onCreateCandidatesView in interface AKeyboardController

onStartInput

public void onStartInput(@Nonnull
                         android.view.inputmethod.EditorInfo attribute,
                         boolean restarting)
Description copied from interface: AKeyboardController
This is the main point where we do our initialization of the input method to begin operating on an application. At this point we have been bound to the client, and are now receiving all of the detailed information about the target of our edits.

Specified by:
onStartInput in interface AKeyboardController

onFinishInput

public void onFinishInput()
Description copied from interface: AKeyboardController
This is called when the user is done editing a field. We can use this to reset our state.

Specified by:
onFinishInput in interface AKeyboardController

onStartInputView

public void onStartInputView(android.view.inputmethod.EditorInfo attribute,
                             boolean restarting)
Specified by:
onStartInputView in interface AKeyboardController

getInputMethodService

@Nonnull
protected android.inputmethodservice.InputMethodService getInputMethodService()

onKey

public final boolean onKey(int primaryCode,
                           @Nullable
                           int[] keyCodes)
Specified by:
onKey in interface AKeyboardController

handleSpecialKey

protected boolean handleSpecialKey(int primaryCode)

handleModeChange

protected void handleModeChange()

handleNextKeyboard

protected void handleNextKeyboard()

handlePrevKeyboard

protected void handlePrevKeyboard()

setShifted

protected final void setShifted(boolean shifted)

setShifted0

protected void setShifted0(boolean shifted)

getCurrentKeyboard

@Nonnull
protected K getCurrentKeyboard()

setCurrentKeyboard

protected void setCurrentKeyboard(@Nonnull
                                  K keyboard)

getState

@Nonnull
protected AKeyboardControllerState<K> getState()

setState

protected void setState(@Nonnull
                        AKeyboardControllerState<K> state)

getKeyboardView

@Nonnull
protected AKeyboardView<K> getKeyboardView()

getKeyboardInput

@Nonnull
protected AKeyboardInput getKeyboardInput()

handleClose

public void handleClose()
Specified by:
handleClose in interface AKeyboardController

onStartInput0

@Nonnull
public abstract AKeyboardControllerState<K> onStartInput0(@Nonnull
                                                                  android.view.inputmethod.EditorInfo attribute,
                                                                  boolean restarting)

onText

public void onText(@Nullable
                   CharSequence text)
Specified by:
onText in interface AKeyboardController

onDisplayCompletions

public void onDisplayCompletions(@Nullable
                                 android.view.inputmethod.CompletionInfo[] completions)
Description copied from interface: AKeyboardController
This tells us about completions that the editor has determined based on the current text in it. We want to use this in fullscreen mode to show the completions ourself, since the editor can not be seen in that situation.

Specified by:
onDisplayCompletions in interface AKeyboardController

updateShiftKeyState

public void updateShiftKeyState(@Nullable
                                android.view.inputmethod.EditorInfo attr)
Helper to update the shift state of our keyboard based on the initial editor state.


onUpdateSelection

public void onUpdateSelection(int oldSelStart,
                              int oldSelEnd,
                              int newSelStart,
                              int newSelEnd,
                              int candidatesStart,
                              int candidatesEnd)
Description copied from interface: AKeyboardController
Deal with the editor reporting movement of its cursor.

Specified by:
onUpdateSelection in interface AKeyboardController

updateCandidates

protected void updateCandidates()

onKeyDown

public boolean onKeyDown(int keyCode,
                         @Nonnull
                         android.view.KeyEvent event)
Description copied from interface: AKeyboardController
Use this to monitor key events being delivered to the application. We get first crack at them, and can either resume them or let them continue to the app.

Specified by:
onKeyDown in interface AKeyboardController

handleBackspace

public boolean handleBackspace()
Specified by:
handleBackspace in interface AKeyboardController

keyDownUp

public void keyDownUp(int keyEventCode)
Helper to send a key down / key up pair to the current editor.


onKeyUp

public boolean onKeyUp(int keyCode,
                       android.view.KeyEvent event)
Description copied from interface: AKeyboardController
Use this to monitor key events being delivered to the application. We get first crack at them, and can either resume them or let them continue to the app.

Specified by:
onKeyUp in interface AKeyboardController

sendKey

public void sendKey(int keyCode)
Helper to send a character to the editor as raw key events.


pickDefaultCandidate

public void pickDefaultCandidate()
Specified by:
pickDefaultCandidate in interface AKeyboardController

pickSuggestionManually

public void pickSuggestionManually(int index)
Specified by:
pickSuggestionManually in interface AKeyboardController

handleCharacter

protected void handleCharacter(int primaryCode,
                               int[] keyCodes)

onCurrentInputMethodSubtypeChanged

public void onCurrentInputMethodSubtypeChanged(@Nonnull
                                               android.view.inputmethod.InputMethodSubtype subtype)
Specified by:
onCurrentInputMethodSubtypeChanged in interface AKeyboardController

isWordSeparator

public boolean isWordSeparator(int code)


Copyright © 2013. All Rights Reserved.