diff options
author | BogDan Vatra <bogdan@kdab.com> | 2017-06-06 16:45:27 +0300 |
---|---|---|
committer | BogDan Vatra <bogdan@kdab.com> | 2017-06-13 04:00:16 +0000 |
commit | ea568c310d75fa921eba2c6ce2852f4617a176ea (patch) | |
tree | dea106c51d38e315042ea2d3cbfd8deb0dea3acd /src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java | |
parent | b91d37a600872298389e99fc354d76e9c37aa3bb (diff) |
Android: Fix RTL selection handles directions
Invert the selection handles icons when the selected text is rtl.
Task-number: QTBUG-61073
Change-Id: I8339a14d1e4d9e79d218516daf3ac783911f6026
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java')
-rw-r--r-- | src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 26f877235f..32d4abf43a 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -490,7 +490,7 @@ public class QtActivityDelegate be adjusted. mode is one of QAndroidInputContext::CursorHandleShowMode */ - public void updateHandles(int mode, int x1, int y1, int x2, int y2) + public void updateHandles(int mode, int x1, int y1, int x2, int y2, boolean rtl) { if (mode == CursorHandleNotShown) { if (m_cursorHandle != null) @@ -498,6 +498,8 @@ public class QtActivityDelegate if (m_rightSelectionHandle != null) { m_rightSelectionHandle.hide(); m_leftSelectionHandle.hide(); + m_rightSelectionHandle = null; + m_leftSelectionHandle = null; } if (m_editMenu != null) m_editMenu.hide(); @@ -506,19 +508,25 @@ public class QtActivityDelegate } else if (mode == CursorHandleShowNormal || mode == CursorHandleShowPopup) { if (m_cursorHandle == null) { m_cursorHandle = new CursorHandle(m_activity, m_layout, QtNative.IdCursorHandle, - android.R.attr.textSelectHandle); + android.R.attr.textSelectHandle, false); } m_cursorHandle.setPosition(x1, y1); if (m_rightSelectionHandle != null) { m_rightSelectionHandle.hide(); m_leftSelectionHandle.hide(); + m_rightSelectionHandle = null; + m_leftSelectionHandle = null; } } else if (mode == CursorHandleShowSelection) { if (m_rightSelectionHandle == null) { m_leftSelectionHandle = new CursorHandle(m_activity, m_layout, QtNative.IdLeftHandle, - android.R.attr.textSelectHandleLeft); + !rtl ? android.R.attr.textSelectHandleLeft : + android.R.attr.textSelectHandleRight, + rtl); m_rightSelectionHandle = new CursorHandle(m_activity, m_layout, QtNative.IdRightHandle, - android.R.attr.textSelectHandleRight); + !rtl ? android.R.attr.textSelectHandleRight : + android.R.attr.textSelectHandleLeft, + rtl); } m_leftSelectionHandle.setPosition(x1,y1); m_rightSelectionHandle.setPosition(x2,y2); |