LastComposedWord.java revision 267563d1bb4d8091293fbd8774f0f95ef59f03c4
1/* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 * use this file except in compliance with the License. You may obtain a copy of 6 * the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 * License for the specific language governing permissions and limitations under 14 * the License. 15 */ 16 17package com.android.inputmethod.latin; 18 19/** 20 * This class encapsulates data about a word previously composed, but that has been 21 * committed already. This is used for resuming suggestion, and cancel auto-correction. 22 */ 23public class LastComposedWord { 24 // COMMIT_TYPE_USER_TYPED_WORD is used when the word committed is the exact typed word, with 25 // no hinting from the IME. It happens when some external event happens (rotating the device, 26 // for example) or when auto-correction is off by settings or editor attributes. 27 public static final int COMMIT_TYPE_USER_TYPED_WORD = 0; 28 // COMMIT_TYPE_MANUAL_PICK is used when the user pressed a field in the suggestion strip. 29 public static final int COMMIT_TYPE_MANUAL_PICK = 1; 30 // COMMIT_TYPE_DECIDED_WORD is used when the IME commits the word it decided was best 31 // for the current user input. It may be different from what the user typed (true auto-correct) 32 // or it may be exactly what the user typed if it's in the dictionary or the IME does not have 33 // enough confidence in any suggestion to auto-correct (auto-correct to typed word). 34 public static final int COMMIT_TYPE_DECIDED_WORD = 2; 35 // COMMIT_TYPE_CANCEL_AUTO_CORRECT is used upon committing back the old word upon cancelling 36 // an auto-correction. 37 public static final int COMMIT_TYPE_CANCEL_AUTO_CORRECT = 3; 38 39 public final int mType; 40 41 public LastComposedWord(final int type) { 42 mType = type; 43 } 44} 45