blob: a0a9ecec79371f9d19c677eb0f97514cd5b32072 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/*
********************************************************************************
* Copyright (c) 2012 Samsung Electronics, Inc.
* All rights reserved.
*
* This software is a confidential and proprietary information of Samsung
* Electronics, Inc. ("Confidential Information"). You shall not disclose such
* Confidential Information and shall use it only in accordance with the terms
* of the license agreement you entered into with Samsung Electronics.
********************************************************************************
*/
package us.minak;
import java.util.Queue;
import android.inputmethodservice.InputMethodService;
import android.view.View;
import android.view.inputmethod.EditorInfo;
/**
* Represent the application input service.
*/
public class IMEService extends InputMethodService {
private IMEView mIMEView;
@Override
public View onCreateInputView() {
final IMEView minakView = (IMEView) getLayoutInflater().inflate(R.layout.ime, null);
minakView.setOnCharacterEnteredListener(new StringReciever() {
@Override
public void putString(String character) {
getCurrentInputConnection().commitText(character, 1);
}
});
mIMEView = minakView;
return minakView;
}
@Override
public void onStartInput(EditorInfo attribute, boolean restarting) {
if (mIMEView != null) {
final Queue<Character> symbolsQueue = mIMEView.getSymbolsQueue();
while (!symbolsQueue.isEmpty()) {
final Character character = symbolsQueue.poll();
getCurrentInputConnection().commitText(String.valueOf(character), 1);
}
}
}
}
|