aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/event
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-03-04 15:29:54 +0900
committerJean Chalard <jchalard@google.com>2014-03-05 17:04:10 +0900
commit7b905c40e98f76d04428542650b1491d0d307590 (patch)
tree4c396a05eaabed18185652f730a9988c966b3f2f /java/src/com/android/inputmethod/event
parent25d912df58dd1a7c524cbd547b03c22435b62817 (diff)
downloadlatinime-7b905c40e98f76d04428542650b1491d0d307590.tar.gz
latinime-7b905c40e98f76d04428542650b1491d0d307590.tar.xz
latinime-7b905c40e98f76d04428542650b1491d0d307590.zip
[IL121] Introduce InputTransaction
We probably can't put this off any longer Bug: 8636060 Change-Id: I1e5d3cf62d719f4d064ced3282bebf2e822f6baa
Diffstat (limited to 'java/src/com/android/inputmethod/event')
-rw-r--r--java/src/com/android/inputmethod/event/InputTransaction.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/event/InputTransaction.java b/java/src/com/android/inputmethod/event/InputTransaction.java
new file mode 100644
index 000000000..5e046a80e
--- /dev/null
+++ b/java/src/com/android/inputmethod/event/InputTransaction.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.event;
+
+/**
+ * An object encapsulating a single transaction for input.
+ */
+public class InputTransaction {
+ // UPDATE_LATER is stronger than UPDATE_NOW. The reason for this is, if we have to update later,
+ // it's because something will change that we can't evaluate now, which means that even if we
+ // re-evaluate now we'll have to do it again later. The only case where that wouldn't apply
+ // would be if we needed to update now to find out the new state right away, but then we
+ // can't do it with this deferred mechanism anyway.
+ public static final int SHIFT_NO_UPDATE = 0;
+ public static final int SHIFT_UPDATE_NOW = 1;
+ public static final int SHIFT_UPDATE_LATER = 2;
+
+ // Initial conditions
+ public final int mShiftState;
+
+ // Outputs
+ private int mRequiredShiftUpdate = SHIFT_NO_UPDATE;
+
+ public InputTransaction(final int shiftState) {
+ mShiftState = shiftState;
+ }
+
+ public void requireShiftUpdate(final int updateType) {
+ mRequiredShiftUpdate = Math.max(mRequiredShiftUpdate, updateType);
+ }
+ public int getRequiredShiftUpdate() {
+ return mRequiredShiftUpdate;
+ }
+}