diff options
author | Christian Strømme <christian.stromme@digia.com> | 2014-08-28 12:18:14 +0200 |
---|---|---|
committer | Christian Stromme <christian.stromme@digia.com> | 2014-09-26 23:44:42 +0200 |
commit | 8b0d9a16db7bcfb5d6439b8863aded5c583f9ed5 (patch) | |
tree | 5fca60950d6e7dba1f12f9ceda0e564965d35116 /src/android/jar/src/org/qtproject/qt5/android | |
parent | c30687f519de47279a70c3eca95eec2191eddbb1 (diff) |
Android: Improve the foreign-window implementation
Adds:
- Improved geometry calculations (e.g, inside a parent)
- Change visibility
- proper stacking order. Native views now reserve the top of the stack
to ensure that they stay visible.
- React to application state changes.
Change-Id: I35de0396937fff37ffcd272c9a7d8e9873a91dfb
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/android/jar/src/org/qtproject/qt5/android')
-rw-r--r-- | src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java | 11 |
1 files changed, 6 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 db970b6656..9507d7eb3b 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -1025,8 +1025,8 @@ public class QtActivityDelegate view.setLayoutParams(new QtLayout.LayoutParams(w, h, x, y)); } + view.setId(id); m_layout.addView(view); - m_layout.bringChildToFront(view); m_nativeViews.put(id, view); } @@ -1057,9 +1057,11 @@ public class QtActivityDelegate surface.setLayoutParams( new QtLayout.LayoutParams(w, h, x, y)); } - m_layout.addView(surface); - if (onTop) - m_layout.bringChildToFront(surface); + // 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); + m_surfaces.put(id, surface); } @@ -1070,7 +1072,6 @@ public class QtActivityDelegate } else if (m_nativeViews.containsKey(id)) { View view = m_nativeViews.get(id); view.setLayoutParams(new QtLayout.LayoutParams(w, h, x, y)); - m_layout.bringChildToFront(view); } else { Log.e(QtNative.QtTAG, "Surface " + id +" not found!"); return; |