summaryrefslogtreecommitdiffstats
path: root/src/android/jar
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-06-07 00:40:44 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-07 00:40:44 +0200
commitd9a7ad80f78e7346d6f4dbae2cabe31305d6458f (patch)
tree26a410780b94c553051b8898d5abaf37a909691b /src/android/jar
parentd707acfc9e357ffc86feb5d9219372c30c5ff157 (diff)
parent0fcce50af009f97efa2a5c5f2c74415c92830962 (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/android/jar')
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java33
1 files changed, 27 insertions, 6 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 7e7312cde8..1561cead86 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
@@ -119,6 +119,7 @@ public class QtActivityDelegate
private InputMethodManager m_imm = null;
private boolean m_quitApp = true;
private Process m_debuggerProcess = null; // debugger process
+ private View m_dummyView = null;
private boolean m_keyboardIsVisible = false;
public boolean m_backKeyPressedSent = false;
@@ -673,7 +674,7 @@ public class QtActivityDelegate
DisplayMetrics metrics = new DisplayMetrics();
m_activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
QtNative.setApplicationDisplayMetrics(metrics.widthPixels, metrics.heightPixels,
- metrics.widthPixels, metrics.heightPixels,
+ 0, 0,
metrics.xdpi, metrics.ydpi, metrics.scaledDensity);
}
m_layout = new QtLayout(m_activity);
@@ -683,6 +684,10 @@ public class QtActivityDelegate
m_nativeViews = new HashMap<Integer, View>();
m_activity.registerForContextMenu(m_layout);
+ m_activity.setContentView(m_layout,
+ new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT));
+
int orientation = m_activity.getResources().getConfiguration().orientation;
int rotation = m_activity.getWindowManager().getDefaultDisplay().getRotation();
boolean rot90 = (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270);
@@ -1007,6 +1012,11 @@ public class QtActivityDelegate
}
public void insertNativeView(int id, View view, int x, int y, int w, int h) {
+ if (m_dummyView != null) {
+ m_layout.removeView(m_dummyView);
+ m_dummyView = null;
+ }
+
if (m_nativeViews.containsKey(id))
m_layout.removeView(m_nativeViews.remove(id));
@@ -1032,9 +1042,10 @@ public class QtActivityDelegate
m_activity.getWindow().setBackgroundDrawable(m_activity.getResources().getDrawable(attr.resourceId));
}
- m_activity.setContentView(m_layout,
- new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT));
+ if (m_dummyView != null) {
+ m_layout.removeView(m_dummyView);
+ m_dummyView = null;
+ }
}
if (m_surfaces.containsKey(id))
@@ -1071,12 +1082,22 @@ public class QtActivityDelegate
}
public void destroySurface(int id) {
+ View view = null;
+
if (m_surfaces.containsKey(id)) {
- m_layout.removeView(m_surfaces.remove(id));
+ view = m_surfaces.remove(id);
} else if (m_nativeViews.containsKey(id)) {
- m_layout.removeView(m_nativeViews.remove(id));
+ view = m_nativeViews.remove(id);
} else {
Log.e(QtNative.QtTAG, "Surface " + id +" not found!");
}
+
+ // Keep last frame in stack until it is replaced to get correct
+ // shutdown transition
+ if (m_surfaces.size() == 0 && m_nativeViews.size() == 0) {
+ m_dummyView = view;
+ } else if (view != null) {
+ m_layout.removeView(view);
+ }
}
}