Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 930bd769 authored by Eyad Aboulouz's avatar Eyad Aboulouz
Browse files

Fixes parenthesis direction in RTL languages as was fixed by commit: Ib2c14c96

except the fix should be done at the OS level and not at the keyboard app level because it broke
compatibility with other custom keyboards such as Smart Keyboard and Swype.

Change-Id: I8743a3446c153cb8fc18443d53f53c3752f1a640
parent e6a9d1f6
Loading
Loading
Loading
Loading
+10 −1
Original line number Original line Diff line number Diff line
@@ -17,7 +17,9 @@
package com.android.internal.widget;
package com.android.internal.widget;


import android.os.Bundle;
import android.os.Bundle;
import android.text.AndroidCharacter;
import android.text.Editable;
import android.text.Editable;
import android.text.TextUtils;
import android.text.method.KeyListener;
import android.text.method.KeyListener;
import android.util.Log;
import android.util.Log;
import android.view.inputmethod.BaseInputConnection;
import android.view.inputmethod.BaseInputConnection;
@@ -112,10 +114,17 @@ public class EditableInputConnection extends BaseInputConnection {


    @Override
    @Override
    public boolean commitText(CharSequence text, int newCursorPosition) {
    public boolean commitText(CharSequence text, int newCursorPosition) {

        if (mTextView == null) {
        if (mTextView == null) {
            return super.commitText(text, newCursorPosition);
            return super.commitText(text, newCursorPosition);
        }
        }


        //if text is in RTL mode then mirror symbols
        //we only want to process single characters because that's what gets sent when you use the keyboard
        //if you process everything in the text parameter, you'll end up mirroring things like emoticons!
        if (TextUtils.hasRTLCharacters(mTextView.getText(), 0, mTextView.getText().length()) && text.length() == 1)
            text = String.valueOf(AndroidCharacter.getMirror(text.charAt(0)));

        CharSequence errorBefore = mTextView.getError();
        CharSequence errorBefore = mTextView.getError();
        boolean success = super.commitText(text, newCursorPosition);
        boolean success = super.commitText(text, newCursorPosition);
        CharSequence errorAfter = mTextView.getError();
        CharSequence errorAfter = mTextView.getError();