Android: move setSystemUiVisibility() to QAndroidPlatformWindow
Move calls for handling system UI visibility to QAndroidPlatformWindow where they belongs. Change-Id: I3802cf9d205ee6678f71b787c5ea4804d3aaeb29 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
5c37d3f06b
commit
a2385e5c9d
@ -94,7 +94,6 @@ static const char m_methodErrorMsg[] = "Can't find method \"%s%s\"";
|
|||||||
|
|
||||||
Q_CONSTINIT static QBasicAtomicInt startQtAndroidPluginCalled = Q_BASIC_ATOMIC_INITIALIZER(0);
|
Q_CONSTINIT static QBasicAtomicInt startQtAndroidPluginCalled = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||||
|
|
||||||
Q_DECLARE_JNI_CLASS(QtWindowInterface, "org/qtproject/qt/android/QtWindowInterface")
|
|
||||||
Q_DECLARE_JNI_CLASS(QtAccessibilityInterface, "org/qtproject/qt/android/QtAccessibilityInterface");
|
Q_DECLARE_JNI_CLASS(QtAccessibilityInterface, "org/qtproject/qt/android/QtAccessibilityInterface");
|
||||||
|
|
||||||
namespace QtAndroid
|
namespace QtAndroid
|
||||||
@ -183,14 +182,6 @@ namespace QtAndroid
|
|||||||
return m_applicationClass;
|
return m_applicationClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO move calls from here to where they logically belong
|
|
||||||
void setSystemUiVisibility(SystemUiVisibility uiVisibility)
|
|
||||||
{
|
|
||||||
AndroidBackendRegister *reg = QtAndroid::backendRegister();
|
|
||||||
reg->callInterface<QtJniTypes::QtWindowInterface, void>("setSystemUiVisibility",
|
|
||||||
jint(uiVisibility));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isQtApplication()
|
bool isQtApplication()
|
||||||
{
|
{
|
||||||
// Returns true if the app is a Qt app, i.e. Qt controls the whole app and
|
// Returns true if the app is a Qt app, i.e. Qt controls the whole app and
|
||||||
|
@ -50,14 +50,6 @@ namespace QtAndroid
|
|||||||
AAssetManager *assetManager();
|
AAssetManager *assetManager();
|
||||||
jclass applicationClass();
|
jclass applicationClass();
|
||||||
|
|
||||||
// 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 = nullptr);
|
jobject createBitmap(QImage img, JNIEnv *env = nullptr);
|
||||||
jobject createBitmap(int width, int height, QImage::Format format, JNIEnv *env);
|
jobject createBitmap(int width, int height, QImage::Format format, JNIEnv *env);
|
||||||
jobject createBitmapDrawable(jobject bitmap, JNIEnv *env = nullptr);
|
jobject createBitmapDrawable(jobject bitmap, JNIEnv *env = nullptr);
|
||||||
|
@ -16,6 +16,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
Q_LOGGING_CATEGORY(lcQpaWindow, "qt.qpa.window")
|
Q_LOGGING_CATEGORY(lcQpaWindow, "qt.qpa.window")
|
||||||
|
|
||||||
|
Q_DECLARE_JNI_CLASS(QtWindowInterface, "org/qtproject/qt/android/QtWindowInterface")
|
||||||
Q_DECLARE_JNI_CLASS(QtInputInterface, "org/qtproject/qt/android/QtInputInterface")
|
Q_DECLARE_JNI_CLASS(QtInputInterface, "org/qtproject/qt/android/QtInputInterface")
|
||||||
Q_DECLARE_JNI_CLASS(QtInputConnectionListener,
|
Q_DECLARE_JNI_CLASS(QtInputConnectionListener,
|
||||||
"org/qtproject/qt/android/QtInputConnection$QtInputConnectionListener")
|
"org/qtproject/qt/android/QtInputConnection$QtInputConnectionListener")
|
||||||
@ -257,12 +258,16 @@ void QAndroidPlatformWindow::updateSystemUiVisibility()
|
|||||||
Qt::WindowFlags flags = window()->flags();
|
Qt::WindowFlags flags = window()->flags();
|
||||||
bool isNonRegularWindow = flags & (Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window;
|
bool isNonRegularWindow = flags & (Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window;
|
||||||
if (!isNonRegularWindow) {
|
if (!isNonRegularWindow) {
|
||||||
|
SystemUiVisibility visibility;
|
||||||
if (m_windowState & Qt::WindowFullScreen)
|
if (m_windowState & Qt::WindowFullScreen)
|
||||||
QtAndroid::setSystemUiVisibility(QtAndroid::SYSTEM_UI_VISIBILITY_FULLSCREEN);
|
visibility = SYSTEM_UI_VISIBILITY_FULLSCREEN;
|
||||||
else if (flags & Qt::ExpandedClientAreaHint)
|
else if (flags & Qt::ExpandedClientAreaHint)
|
||||||
QtAndroid::setSystemUiVisibility(QtAndroid::SYSTEM_UI_VISIBILITY_TRANSLUCENT);
|
visibility = SYSTEM_UI_VISIBILITY_TRANSLUCENT;
|
||||||
else
|
else
|
||||||
QtAndroid::setSystemUiVisibility(QtAndroid::SYSTEM_UI_VISIBILITY_NORMAL);
|
visibility = SYSTEM_UI_VISIBILITY_NORMAL;
|
||||||
|
|
||||||
|
QtAndroid::backendRegister()->callInterface<QtJniTypes::QtWindowInterface, void>(
|
||||||
|
"setSystemUiVisibility", jint(visibility));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,13 @@ public:
|
|||||||
TextureView
|
TextureView
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Keep synchronized with flags in ActivityDelegate.java
|
||||||
|
enum SystemUiVisibility {
|
||||||
|
SYSTEM_UI_VISIBILITY_NORMAL = 0,
|
||||||
|
SYSTEM_UI_VISIBILITY_FULLSCREEN = 1,
|
||||||
|
SYSTEM_UI_VISIBILITY_TRANSLUCENT = 2
|
||||||
|
};
|
||||||
|
|
||||||
explicit QAndroidPlatformWindow(QWindow *window);
|
explicit QAndroidPlatformWindow(QWindow *window);
|
||||||
void initialize() override;
|
void initialize() override;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user