diff options
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 | 34 |
1 files changed, 18 insertions, 16 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 d6cd49f44c..f4d2645e9a 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -794,7 +794,25 @@ public class QtActivityDelegate m_surfaces = new HashMap<Integer, QtSurface>(); 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); + boolean currentlyLandscape = (orientation == Configuration.ORIENTATION_LANDSCAPE); + if ((currentlyLandscape && !rot90) || (!currentlyLandscape && rot90)) + m_nativeOrientation = Configuration.ORIENTATION_LANDSCAPE; + else + m_nativeOrientation = Configuration.ORIENTATION_PORTRAIT; + + QtNative.handleOrientationChanged(rotation, m_nativeOrientation); + m_currentRotation = rotation; + } + + public void initializeAccessibility() + { // Initialize accessibility try { final String a11yDelegateClassName = "org.qtproject.qt5.android.accessibility.QtAccessibilityDelegate"; @@ -810,22 +828,6 @@ public class QtActivityDelegate // Unknown exception means something went wrong. Log.w("Qt A11y", "Unknown exception: " + e.toString()); } - - 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); - boolean currentlyLandscape = (orientation == Configuration.ORIENTATION_LANDSCAPE); - if ((currentlyLandscape && !rot90) || (!currentlyLandscape && rot90)) - m_nativeOrientation = Configuration.ORIENTATION_LANDSCAPE; - else - m_nativeOrientation = Configuration.ORIENTATION_PORTRAIT; - - QtNative.handleOrientationChanged(rotation, m_nativeOrientation); - m_currentRotation = rotation; } public void onConfigurationChanged(Configuration configuration) |