diff options
author | Jan Arve Saether <jan-arve.saether@theqtcompany.com> | 2014-11-13 14:41:03 +0100 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@theqtcompany.com> | 2014-12-02 12:01:29 +0100 |
commit | 438b65badaf8f4178c2b06ff2b1112bfb889fa3f (patch) | |
tree | 4fee762ca607ed55bf390d00a698f5a484c12c83 /src/android/jar | |
parent | afae4ee0b12a598c4b02d8ccd950489d190235ea (diff) |
Make sure that created surfaces are stacked on top of previous ones.
The old code would stack the new surface just below the topmost surface.
It also did not consider if the m_editText was added to the layout or
not (thus, m_layout.getChildCount() - m_nativeViews.size() - 1) was only
correct if the editText was added.
Spotted by plain code reading while investigating some accessiblity
issues.
Change-Id: I12c9f373a471c0a7ee624a47232e8952d69c9067
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Diffstat (limited to 'src/android/jar')
-rw-r--r-- | src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java | 17 |
1 files changed, 12 insertions, 5 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 f44465b4c5..96be5b1550 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -1179,8 +1179,8 @@ public class QtActivityDelegate // Native views are always inserted in the end of the stack (i.e., on top). // All other views are stacked based on the order they are created. - final int index = m_layout.getChildCount() - m_nativeViews.size() - 1; - m_layout.addView(surface, index < 0 ? 0 : index); + final int index = getSurfaceCount(); + m_layout.addView(surface, index); m_surfaces.put(id, surface); } @@ -1221,12 +1221,19 @@ public class QtActivityDelegate } } + public int getSurfaceCount() + { + return m_surfaces.size(); + } + + public void bringChildToFront(int id) { View view = m_surfaces.get(id); if (view != null) { - final int index = m_layout.getChildCount() - m_nativeViews.size() - 1; - m_layout.moveChild(view, index < 0 ? 0 : index); + final int surfaceCount = getSurfaceCount(); + if (surfaceCount > 0) + m_layout.moveChild(view, surfaceCount - 1); return; } @@ -1245,7 +1252,7 @@ public class QtActivityDelegate view = m_nativeViews.get(id); if (view != null) { - final int index = m_layout.getChildCount() - m_nativeViews.size(); + final int index = getSurfaceCount(); m_layout.moveChild(view, index); } } |