From 9a4d003a1c2681d660663001eba3ec5a8f0acf4e Mon Sep 17 00:00:00 2001 From: openharmony_ci <120357966@qq.com> Date: Thu, 24 Oct 2024 01:47:52 +0000 Subject: [PATCH 1/2] =?UTF-8?q?!510=20=E8=A7=A3=E5=86=B3getContext(this)?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E8=8E=B7=E5=8F=96=E7=9A=84window=E6=98=AFund?= =?UTF-8?q?efine=E7=9A=84=E9=97=AE=E9=A2=98=20Merge=20pull=20request=20!51?= =?UTF-8?q?0=20from=20shijie/dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/ets/embedding/ohos/FlutterAbility.ets | 2 +- .../src/main/ets/embedding/ohos/FlutterManager.ets | 11 ++++++----- .../flutter/src/main/ets/plugin/PlatformPlugin.ets | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterAbility.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterAbility.ets index edfb59ca4c..af3a61cd6d 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterAbility.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterAbility.ets @@ -180,7 +180,7 @@ export class FlutterAbility extends UIAbility implements Host { Log.i(TAG, 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); }); - FlutterManager.getInstance().setUseFullScreen(true); + FlutterManager.getInstance().setUseFullScreen(true, this.context); } catch (exception) { Log.e(TAG, 'Failed to enable the listener for window stage event changes. Cause:' + JSON.stringify(exception)); } diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterManager.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterManager.ets index e2ef4d772b..0f449572ed 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterManager.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterManager.ets @@ -109,8 +109,8 @@ export default class FlutterManager { return this.mFullScreenListener; } - setUseFullScreen(use: boolean) { - this.mFullScreenListener.setUseFullScreen(use) + setUseFullScreen(use: boolean, context?: Context | null | undefined) { + this.mFullScreenListener.setUseFullScreen(use, context); } useFullScreen(): boolean { @@ -120,7 +120,7 @@ export default class FlutterManager { export interface FullScreenListener { useFullScreen(): boolean; - setUseFullScreen(useFullScreen: boolean): void; + setUseFullScreen(useFullScreen: boolean, context?: Context | null | undefined): void; onScreenStateChanged(data: window.WindowStatusType): void; } @@ -132,12 +132,13 @@ export class DefaultFullScreenListener implements FullScreenListener { return this.fullScreen; } - setUseFullScreen(useFullScreen: boolean): void { + setUseFullScreen(useFullScreen: boolean, context?: Context | null | undefined): void { this.fullScreen = useFullScreen; this.skipCheck = true; + context = context??getContext(this); let window = FlutterManager.getInstance() - .getWindowStage(FlutterManager.getInstance().getUIAbility(getContext(this))); + .getWindowStage(FlutterManager.getInstance().getUIAbility(context)); window.getMainWindowSync().setWindowLayoutFullScreen(useFullScreen); Log.i(TAG, "WindowLayoutFullScreen is on") } diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/PlatformPlugin.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/PlatformPlugin.ets index 949480ec65..500390aeb9 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/PlatformPlugin.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/PlatformPlugin.ets @@ -279,13 +279,13 @@ export class PlatformPluginCallback implements PlatformMessageHandler { let uiConfig: ('status' | 'navigation')[] = []; if (mode == SystemUiMode.LEAN_BACK) { //全屏显示,通过点击显示器上的任何位置都可以显示状态和导航栏 - FlutterManager.getInstance().setUseFullScreen(true); + FlutterManager.getInstance().setUseFullScreen(true, null); } else if (mode == SystemUiMode.IMMERSIVE) { //全屏显示,通过在显示器边缘的滑动手势可以显示状态和导航栏,应用程序不会接收到此手势 - FlutterManager.getInstance().setUseFullScreen(true); + FlutterManager.getInstance().setUseFullScreen(true, null); } else if (mode == SystemUiMode.IMMERSIVE_STICKY) { //全屏显示,通过在显示器边缘的滑动手势可以显示状态和导航栏,此手势由应用程序接收 - FlutterManager.getInstance().setUseFullScreen(true); + FlutterManager.getInstance().setUseFullScreen(true, null); } else if (mode == SystemUiMode.EDGE_TO_EDGE) { uiConfig = ['status', 'navigation']; } else { -- Gitee From fc21950aef739251daa26b8afb519214c6ea7dc2 Mon Sep 17 00:00:00 2001 From: openharmony_ci <120357966@qq.com> Date: Fri, 25 Oct 2024 04:27:23 +0000 Subject: [PATCH 2/2] =?UTF-8?q?!513=20=E4=BF=AE=E6=94=B9ets=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84=E7=A8=B3=E5=AE=9A=E6=80=A7=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20Merge=20pull=20request=20!513=20from=20hazy/dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/ets/embedding/ohos/FlutterPage.ets | 2 +- .../src/main/ets/plugin/editing/TextInputPlugin.ets | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterPage.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterPage.ets index 1634db5f6f..de520a54ea 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterPage.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterPage.ets @@ -183,7 +183,7 @@ export struct FlutterPage { aboutToDisappear() { this.flutterView?.removeFirstFrameListener(this); - getContext().eventHub.off(OHOS_FLUTTER_PAGE_UPDATE) + getContext()?.eventHub.off(OHOS_FLUTTER_PAGE_UPDATE) } onFirstFrame() { diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets index 8c75488d7a..4ffbbd1dbd 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets @@ -322,12 +322,12 @@ class TextInputMethodHandlerImpl implements TextInputMethodHandler { } cancelListenKeyBoardEvent(): void { - this.inputMethodController.off('insertText', this.insertTextCallback); - this.inputMethodController.off('deleteLeft', this.deleteLeftCallback); - this.inputMethodController.off('deleteRight', this.deleteRightCallback); - this.inputMethodController.off('sendFunctionKey', this.sendFunctionKeyCallback); - this.inputMethodController.off('sendKeyboardStatus', this.sendKeyboardStatusCallback); - this.inputMethodController.off('selectByRange', this.selectByRangeCallback); + this.inputMethodController?.off('insertText', this.insertTextCallback); + this.inputMethodController?.off('deleteLeft', this.deleteLeftCallback); + this.inputMethodController?.off('deleteRight', this.deleteRightCallback); + this.inputMethodController?.off('sendFunctionKey', this.sendFunctionKeyCallback); + this.inputMethodController?.off('sendKeyboardStatus', this.sendKeyboardStatusCallback); + this.inputMethodController?.off('selectByRange', this.selectByRangeCallback); this.imcFlag = false; } -- Gitee