diff options
author | 2014-03-20 00:06:10 -0700 | |
---|---|---|
committer | 2014-03-20 00:06:10 -0700 | |
commit | 28d02d3fdd145cb3288c585277a1a274f67afc77 (patch) | |
tree | 1fa315179c3c7b168d6664770a64bbcf06e38f66 /java/src/com/android/inputmethod/event/CombinerChain.java | |
parent | c6e8730fb7f4029c76811c196e603ce682f61c33 (diff) | |
parent | c0837339721442ba43b1952ca64f7083bda7f377 (diff) | |
download | latinime-28d02d3fdd145cb3288c585277a1a274f67afc77.tar.gz latinime-28d02d3fdd145cb3288c585277a1a274f67afc77.tar.xz latinime-28d02d3fdd145cb3288c585277a1a274f67afc77.zip |
am c0837339: Merge "[CB08] Create a combiner chain in the word composer."
* commit 'c0837339721442ba43b1952ca64f7083bda7f377':
[CB08] Create a combiner chain in the word composer.
Diffstat (limited to 'java/src/com/android/inputmethod/event/CombinerChain.java')
-rw-r--r-- | java/src/com/android/inputmethod/event/CombinerChain.java | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/event/CombinerChain.java b/java/src/com/android/inputmethod/event/CombinerChain.java new file mode 100644 index 000000000..1deaed68f --- /dev/null +++ b/java/src/com/android/inputmethod/event/CombinerChain.java @@ -0,0 +1,54 @@ +/* + * 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; + +import com.android.inputmethod.latin.utils.CollectionUtils; + +import java.util.ArrayList; + +/** + * This class implements the logic chain between receiving events and generating code points. + * + * Event sources are multiple. It may be a hardware keyboard, a D-PAD, a software keyboard, + * or any exotic input source. + * This class will orchestrate the composing chain that starts with an event as its input. Each + * composer will be given turns one after the other. + * The output is composed of two sequences of code points: the first, representing the already + * finished combining part, will be shown normally as the composing string, while the second is + * feedback on the composing state and will typically be shown with different styling such as + * a colored background. + */ +public class CombinerChain { + // TODO: Create an object type to represent input material + visual feedback + decoding state + + private final ArrayList<Combiner> mCombiners; + + /** + * Create an combiner chain. + * + * The combiner chain takes events as inputs and outputs code points and combining state. + * For example, if the input language is Japanese, the combining chain will typically perform + * kana conversion. + * + * @param combinerList A list of combiners to be applied in order. + */ + public CombinerChain(final Combiner... combinerList) { + mCombiners = CollectionUtils.newArrayList(); + // The dead key combiner is always active, and always first + mCombiners.add(new DeadKeyCombiner()); + } +} |