Android: Extend app state listener interface with native plugin state
Instead of using the generic onAppStateDetailsChanged function, use a specific callback for native plugin readiness state in cases where only native plugin readiness matters. Add default empty implementations for both functions in the interface. Task-number: QTBUG-118874 Change-Id: Ie736b0e7789400421247648cb3a008712fd959c5 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>bb10
parent
ed3ce4ebfa
commit
e46adeb599
|
|
@ -89,11 +89,17 @@ class QtEmbeddedDelegate extends QtActivityDelegateBase
|
|||
public void onAppStateDetailsChanged(QtNative.ApplicationStateDetails details) {
|
||||
synchronized (this) {
|
||||
m_stateDetails = details;
|
||||
if (m_stateDetails.nativePluginIntegrationReady) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNativePluginIntegrationReadyChanged(boolean ready)
|
||||
{
|
||||
synchronized (this) {
|
||||
if (ready) {
|
||||
QtNative.runAction(() -> {
|
||||
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
|
||||
QtDisplayManager.setApplicationDisplayMetrics(m_activity,
|
||||
metrics.widthPixels,
|
||||
QtDisplayManager.setApplicationDisplayMetrics(m_activity, metrics.widthPixels,
|
||||
metrics.heightPixels);
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -196,7 +196,8 @@ class QtNative
|
|||
}
|
||||
|
||||
interface AppStateDetailsListener {
|
||||
void onAppStateDetailsChanged(ApplicationStateDetails details);
|
||||
default void onAppStateDetailsChanged(ApplicationStateDetails details) {}
|
||||
default void onNativePluginIntegrationReadyChanged(boolean ready) {}
|
||||
}
|
||||
|
||||
// Keep in sync with src/corelib/global/qnamespace.h
|
||||
|
|
@ -228,6 +229,7 @@ class QtNative
|
|||
public static void notifyNativePluginIntegrationReady(boolean ready)
|
||||
{
|
||||
m_stateDetails.nativePluginIntegrationReady = ready;
|
||||
notifyNativePluginIntegrationReadyChanged(ready);
|
||||
notifyAppStateDetailsChanged(m_stateDetails);
|
||||
}
|
||||
|
||||
|
|
@ -258,6 +260,13 @@ class QtNative
|
|||
}
|
||||
}
|
||||
|
||||
static void notifyNativePluginIntegrationReadyChanged(boolean ready) {
|
||||
synchronized (m_appStateListenersLock) {
|
||||
for (final AppStateDetailsListener listener : m_appStateListeners)
|
||||
listener.onNativePluginIntegrationReadyChanged(ready);
|
||||
}
|
||||
}
|
||||
|
||||
static void notifyAppStateDetailsChanged(ApplicationStateDetails details) {
|
||||
synchronized (m_appStateListenersLock) {
|
||||
for (AppStateDetailsListener listener : m_appStateListeners)
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ class QtServiceEmbeddedDelegate implements QtEmbeddedViewInterface, QtNative.App
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAppStateDetailsChanged(QtNative.ApplicationStateDetails details)
|
||||
public void onNativePluginIntegrationReadyChanged(boolean ready)
|
||||
{
|
||||
synchronized (this) {
|
||||
if (details.nativePluginIntegrationReady) {
|
||||
if (ready) {
|
||||
QtNative.runAction(() -> {
|
||||
if (m_view == null)
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue