コード例 #1
0
 /**
  * Apply a processed input event.
  *
  * <p>All input events should be supported, including software/hardware events, characters as well
  * as deletions, multiple inputs and gestures.
  *
  * @param event the event to apply. Must not be null.
  */
 public void applyProcessedEvent(final Event event) {
   mCombinerChain.applyProcessedEvent(event);
   final int primaryCode = event.mCodePoint;
   final int keyX = event.mX;
   final int keyY = event.mY;
   final int newIndex = size();
   refreshTypedWordCache();
   mCursorPositionWithinWord = mCodePointSize;
   // We may have deleted the last one.
   if (0 == mCodePointSize) {
     mIsOnlyFirstCharCapitalized = false;
   }
   if (Constants.CODE_DELETE != event.mKeyCode) {
     if (newIndex < MAX_WORD_LENGTH) {
       // In the batch input mode, the {@code mInputPointers} holds batch input points and
       // shouldn't be overridden by the "typed key" coordinates
       // (See {@link #setBatchInputWord}).
       if (!mIsBatchMode) {
         // TODO: Set correct pointer id and time
         mInputPointers.addPointerAt(newIndex, keyX, keyY, 0, 0);
       }
     }
     if (0 == newIndex) {
       mIsOnlyFirstCharCapitalized = Character.isUpperCase(primaryCode);
     } else {
       mIsOnlyFirstCharCapitalized =
           mIsOnlyFirstCharCapitalized && !Character.isUpperCase(primaryCode);
     }
     if (Character.isUpperCase(primaryCode)) mCapsCount++;
     if (Character.isDigit(primaryCode)) mDigitsCount++;
   }
   mAutoCorrection = null;
 }
コード例 #2
0
 void addInputPointerForTest(int index, int keyX, int keyY) {
   mInputPointers.addPointerAt(index, keyX, keyY, 0, 0);
 }