There may be some other solutions for your problem, but I have done one trick and came up with following :
Step-1 You have to remove all the calls to the method updateShiftKeyState(getCurrentInputEditorInfo());
in your code like:
private void handleCharacter(int primaryCode, int[] keyCodes) {
if (isInputViewShown()) {
if (mInputView.isShifted()) {
primaryCode = Character.toUpperCase(primaryCode);
}
}
if (isAlphabet(primaryCode) && mPredictionOn) {
/**
* Swapping here with my desired unicode character
* */
if (primaryCode >= 97 && primaryCode <= 122 ) {
mComposing.append(Swap.swapLetters(primaryCode));
}else{
mComposing.append((char) primaryCode);
}
getCurrentInputConnection().setComposingText(mComposing, 1);
//updateShiftKeyState(getCurrentInputEditorInfo()); // you can delete this method from your class and clean-up all the occurances of that
updateCandidates();
} else {
getCurrentInputConnection().commitText(
String.valueOf((char) primaryCode), 1);
}}
Step-2 change your handleShift
method to his:
private void handleShift() {
if (mInputView == null) {
return;
}
Keyboard currentKeyboard = mInputView.getKeyboard();
if (mQwertyKeyboard == currentKeyboard) {
mInputView.setKeyboard(mSindhi);
} else if (currentKeyboard == mSymbolsKeyboard) {
mInputView.setKeyboard(mSymbolsShiftedKeyboard);
} else if (currentKeyboard == mSymbolsShiftedKeyboard) {
mInputView.setKeyboard(mSymbolsKeyboard);
}
}
that is all, Hope this may work for you...