!295 折叠屏监听优化

Merge pull request !295 from fanchenxuan/master-
This commit is contained in:
openharmony_ci 2024-08-13 11:23:34 +00:00 committed by Gitee
commit 2cf80cc80e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -20,6 +20,7 @@ import { GlobalContext } from '../common/utils/globalContext';
const TAG = 'PermissionManager_Log:';
const BG_COLOR = '#00000000';
const DELAY = 100;
export default class SecurityExtensionAbility extends extension {
/**
@ -99,9 +100,11 @@ export default class SecurityExtensionAbility extends extension {
try {
display.on('foldStatusChange', (data) => {
console.info(TAG + `monitor foldStatusChange: ${JSON.stringify(data)}`);
let dis = display.getDefaultDisplaySync();
win.resize(dis.width, dis.height);
win.moveWindowTo(0, 0);
setTimeout(() => {
let dis = display.getDefaultDisplaySync();
win.resize(dis.width, dis.height);
win.moveWindowTo(0, 0);
}, DELAY);
});
} catch (err) {
console.error(TAG + `monitor foldStatusChange failed: ${JSON.stringify(err)}`);