mirror of
https://gitee.com/openharmony/applications_app_samples
synced 2024-11-23 08:30:06 +00:00
!4928 【Sample】SafeArea模块扩展安全区展示优化
Merge pull request !4928 from YangXin/master-CC
This commit is contained in:
commit
93eddc6569
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -17,11 +17,12 @@ import UIAbility from '@ohos.app.ability.UIAbility'
|
||||
import Logger from '../util/Logger'
|
||||
import window from '@ohos.window';
|
||||
import { KeyboardAvoidMode } from '@ohos.arkui.UIContext';
|
||||
import { AbilityConstant } from '@kit.AbilityKit';
|
||||
|
||||
const TAG: string = 'MainAbility'
|
||||
|
||||
export default class MainAbility extends UIAbility {
|
||||
onCreate(want, launchParam) {
|
||||
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) {
|
||||
Logger.info(TAG, 'onCreate');
|
||||
AppStorage.setOrCreate('context', this.context);
|
||||
}
|
||||
@ -30,11 +31,11 @@ export default class MainAbility extends UIAbility {
|
||||
Logger.info(TAG, 'onDestroy')
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage) {
|
||||
onWindowStageCreate(windowStage: window.WindowStage) {
|
||||
// Main window is created, set main page for this ability
|
||||
Logger.info(TAG, 'onWindowStageCreate')
|
||||
try {
|
||||
let windowClass = null;
|
||||
let windowClass: window.Window | undefined = undefined;
|
||||
window.getLastWindow(this.context, (err, data) => {
|
||||
if (err.code) {
|
||||
Logger.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err));
|
||||
@ -42,9 +43,7 @@ export default class MainAbility extends UIAbility {
|
||||
}
|
||||
Logger.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data));
|
||||
windowClass = data;
|
||||
let systemBarProperties = {
|
||||
statusBarColor: "#f1f3f5"
|
||||
};
|
||||
let systemBarProperties: window.SystemBarProperties = {};
|
||||
windowClass.setWindowSystemBarProperties(systemBarProperties, (err) => {
|
||||
if (err.code) {
|
||||
Logger.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(err));
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Copyright (c) 2023-2024 Hunan OpenValley Digital Industry Development Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -46,7 +46,6 @@ struct SafeAreaSample {
|
||||
|
||||
Column() {
|
||||
TitleBar({ title: $r('app.string.safe_area') })
|
||||
.backgroundColor($r('app.color.background_shallow_grey'))
|
||||
Column() {
|
||||
IntroductionTitle({ introduction: $r('app.string.safe_area_type_and_safe_area_edge') })
|
||||
ChangePanel({
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -36,7 +36,7 @@
|
||||
"abilities": [
|
||||
{
|
||||
"name": "MainAbility",
|
||||
"srcEntry": "./ets/MainAbility/MainAbility.ts",
|
||||
"srcEntry": "./ets/MainAbility/MainAbility.ets",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:entry_desc",
|
||||
|
Loading…
Reference in New Issue
Block a user