summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/androidjnimain.h
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-11-07 08:57:59 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-11-08 07:04:43 +0100
commitc17a5cec1901dd23f4c39ec2ae47a060fbb06895 (patch)
treef812b588124121f9938ca8a8d2d991b6f2f9a6ae /src/plugins/platforms/android/androidjnimain.h
parent3e529369eb16704aa0d601a7f4b8e490dc8b772c (diff)
Android: Implement MaximizeUsingFullscreenGeometryHint
This flag tells the app to use as much of the screen as possible while still keeping system UI visible, and can be supported on Android by using translucent system UI, similar to iOS. What this does: 1. It changes the current fullscreen/not-fullscreen logic to allow three states: fullscreen, fullscreen with translucent decorations and not-fullscreen. 2. In order for it to work, we have to send the actual screen geometry and available geometry, at least in the case where the user needs to know the available geometry to know the safe area of the window. So we get the real screen metrics and pass these to the QPA plugin (API level 17, so we can do that now that the minimum version is 21.) 3. Note that getting the insets and calculating the useable area does not work for non-fullscreen windows, since Android is quite inconsistent in this respect. So in this case we just use the window size and origin of 0,0 for the available geometry. 4. Since we are touching this code anyway, this patch also tries to use more consistent wording (calling it "available geometry" everywhere instead of desktop geometry in some places and just geometry in others, etc.) [ChangeLog][Android] Qt::MaximizeUsingFullscreenGeometryHint window flag is now supported, and will make the window fullscreen, but keep the system UI on-screen, with a translucent background color. Fixes: QTBUG-74202 Change-Id: I7a59a6c6fb51ebbdb86e7149e794726e67001279 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Diffstat (limited to 'src/plugins/platforms/android/androidjnimain.h')
-rw-r--r--src/plugins/platforms/android/androidjnimain.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/platforms/android/androidjnimain.h b/src/plugins/platforms/android/androidjnimain.h
index 17ae30a1be..63be5910f9 100644
--- a/src/plugins/platforms/android/androidjnimain.h
+++ b/src/plugins/platforms/android/androidjnimain.h
@@ -77,8 +77,8 @@ namespace QtAndroid
void bringChildToBack(int surfaceId);
QWindow *topLevelWindowAt(const QPoint &globalPos);
- int desktopWidthPixels();
- int desktopHeightPixels();
+ int availableWidthPixels();
+ int availableHeightPixels();
double scaledDensity();
double pixelDensity();
JavaVM *javaVM();
@@ -88,8 +88,13 @@ namespace QtAndroid
jobject activity();
jobject service();
- void showStatusBar();
- void hideStatusBar();
+ // Keep synchronized with flags in ActivityDelegate.java
+ enum SystemUiVisibility {
+ SYSTEM_UI_VISIBILITY_NORMAL = 0,
+ SYSTEM_UI_VISIBILITY_FULLSCREEN = 1,
+ SYSTEM_UI_VISIBILITY_TRANSLUCENT = 2
+ };
+ void setSystemUiVisibility(SystemUiVisibility uiVisibility);
jobject createBitmap(QImage img, JNIEnv *env = 0);
jobject createBitmap(int width, int height, QImage::Format format, JNIEnv *env);