Permalink
Browse files

Working varnam with bugs

  • Loading branch information...
malayaleecoder committed Aug 21, 2016
1 parent eb12811 commit 16a7e91db0cefc49409a347360914bccec254371
@@ -36,6 +36,7 @@
import android.os.Debug;
import android.os.IBinder;
import android.os.Message;
import android.os.StrictMode;
import android.preference.PreferenceManager;
import android.text.InputType;
import android.text.TextUtils;
@@ -209,6 +210,10 @@ public UIHandler(final LatinIME ownerInstance) {
}

public void onCreate() {
if (Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
final LatinIME latinIme = getOwnerInstance();
if (latinIme == null) {
return;
@@ -248,12 +248,12 @@ public void applyTransliterationByEngine(final Event event) {
refreshTypedWordCache();

String mTypedWord = mTypedWordCache.toString();

if(mTransliterationEngine != null && Constants.CODE_DELETE != event.mKeyCode) {
String current = new String(Character.toChars(primaryCode));
int startPos = mTypedWord.length() - 1 > mTransliterationEngine.getMaxKeyLength() ? mTypedWord.length() - mTransliterationEngine.getMaxKeyLength() - 1: 0;
String replacement = mTransliterationEngine.transliterate(mTypedWord);
mCombinerChain.replace(startPos + replacement.length() - 1, mTypedWord.length(), replacement);
String input = mTypedWord.subSequence(startPos, mTypedWord.length()).toString();
String replacement = mTransliterationEngine.transliterate(input);
mCombinerChain.replace(startPos, mTypedWord.length(), replacement);

context += current;
if(context.length() > mTransliterationEngine.getContextLength()) {
@@ -277,8 +277,10 @@ public void applyProcessedEvent(final Event event) {
final int keyY = event.mY;
final int newIndex = size();

applyTransliteration(event);
applyTransliterationByEngine(event);
if(mTransliterationMethod != null)
applyTransliteration(event);
if(mTransliterationEngine != null)
applyTransliterationByEngine(event);

refreshTypedWordCache();
mCursorPositionWithinWord = mCodePointSize;
@@ -2301,7 +2301,7 @@ public void enableTransliteration(String transliterationMethod, Context context)
try {
im = InputMethod.fromName(transliterationMethod, context);
mWordComposer.setTransliterationMethod(im);
mConnection.setTransliterationMethod(im);
//mConnection.setTransliterationMethod(im);
isTransliteration = true;
} catch (Exception e) {
e.printStackTrace();

0 comments on commit 16a7e91

Please sign in to comment.