summaryrefslogtreecommitdiffstats
path: root/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@theqtcompany.com>2015-06-08 18:07:06 +0200
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2015-06-09 09:06:39 +0000
commit5ef662f1af2fb0c340b98edc083939b4383a04ac (patch)
treef9da281b684953feae34255f844b7ea4b65eead3 /src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
parent42f5f03d0abdd464a48f2a31122f52497dcc81c6 (diff)
Android: Delay initialization of Accessibility.
The accessibility class was created and activated in onCreate(), which meant we where trying to activate accessibility before the platform plugin was properly initialized. With this change we will also activate, or deactivate, accessibility in Qt whenever the state is changed by Android, compared to doing it at start-up only. Task-number: QTBUG-46355 Change-Id: I5cbae125df43f7694d4464d5054e6cfec4626e26 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
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.java34
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)