diff options
Diffstat (limited to 'src/android/jar')
-rw-r--r-- | src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegate.java | 19 | ||||
-rw-r--r-- | src/android/jar/src/org/qtproject/qt/android/QtView.java | 11 |
2 files changed, 9 insertions, 21 deletions
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegate.java b/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegate.java index 1c0fd0f7d8..5545b0a09d 100644 --- a/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegate.java +++ b/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegate.java @@ -24,13 +24,9 @@ import java.util.HashMap; class QtEmbeddedDelegate extends QtActivityDelegateBase implements QtNative.AppStateDetailsListener { // TODO simplistic implementation with one QtView, expand to support multiple views QTBUG-117649 private QtView m_view; - private long m_rootWindowRef = 0L; private QtNative.ApplicationStateDetails m_stateDetails; private boolean m_windowLoaded = false; - private static native void createRootWindow(View rootView, int x, int y, int width, int height); - static native void deleteWindow(long windowReference); - public QtEmbeddedDelegate(Activity context) { super(context); @@ -82,7 +78,6 @@ class QtEmbeddedDelegate extends QtActivityDelegateBase implements QtNative.AppS QtNative.terminateQt(); QtNative.setActivity(null); QtNative.getQtThread().exit(); - onDestroy(); } } }); @@ -154,20 +149,10 @@ class QtEmbeddedDelegate extends QtActivityDelegateBase implements QtNative.AppS m_inputDelegate.setEditPopupMenu(new EditPopupMenu(m_activity, m_view)); } - - public void setRootWindowRef(long ref) { - m_rootWindowRef = ref; - } - - public void onDestroy() { - if (m_rootWindowRef != 0L) - deleteWindow(m_rootWindowRef); - m_rootWindowRef = 0L; - } - private void createRootWindow() { if (m_view != null && !m_windowLoaded) { - createRootWindow(m_view, m_view.getLeft(), m_view.getTop(), m_view.getWidth(), m_view.getHeight()); + QtView.createRootWindow(m_view, m_view.getLeft(), m_view.getTop(), m_view.getWidth(), + m_view.getHeight()); m_windowLoaded = true; } } diff --git a/src/android/jar/src/org/qtproject/qt/android/QtView.java b/src/android/jar/src/org/qtproject/qt/android/QtView.java index 6836171187..b253548a5c 100644 --- a/src/android/jar/src/org/qtproject/qt/android/QtView.java +++ b/src/android/jar/src/org/qtproject/qt/android/QtView.java @@ -29,6 +29,7 @@ abstract class QtView extends ViewGroup { protected QtWindow m_window; protected long m_windowReference; + protected long m_parentWindowReference; protected QtWindowListener m_windowListener; protected QtEmbeddedDelegate m_delegate; // Implement in subclass to handle the creation of the QWindow and its parent container. @@ -37,6 +38,8 @@ abstract class QtView extends ViewGroup { // too much JNI back and forth. Related to parent window creation, so handle with QTBUG-121511. abstract protected void createWindow(long parentWindowRef); + static native void createRootWindow(View rootView, int x, int y, int width, int height); + static native void deleteWindow(long windowReference); private static native void setWindowVisible(long windowReference, boolean visible); private static native void resizeWindow(long windowReference, int x, int y, int width, int height); @@ -156,7 +159,7 @@ abstract class QtView extends ViewGroup { // viewReference - the reference to the created QQuickView void addQtWindow(QtWindow window, long viewReference, long parentWindowRef) { setWindowReference(viewReference); - m_delegate.setRootWindowRef(parentWindowRef); + m_parentWindowReference = parentWindowRef; final Handler handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { @Override @@ -176,9 +179,9 @@ abstract class QtView extends ViewGroup { // Destroy the underlying QWindow void destroyWindow() { - if (m_windowReference != 0L) - QtEmbeddedDelegate.deleteWindow(m_windowReference); - m_windowReference = 0L; + if (m_parentWindowReference != 0L) + deleteWindow(m_parentWindowReference); + m_parentWindowReference = 0L; } QtWindow getQtWindow() { |