|
|
@@ -60,12 +60,13 @@ export default class EntryAbility extends UIAbility {
|
|
|
|
|
|
|
|
|
onAvoidAreaChange = (data: window.AvoidAreaOptions) => {
|
|
|
-
|
|
|
- let topRectHeight = px2vp(data.area.topRect.height);
|
|
|
- AppStorage.setOrCreate('topRectHeight', topRectHeight);
|
|
|
- LogUtil.info('onecold onAvoidAreaChange topRectHeight = '+topRectHeight);
|
|
|
- let bottomRectHeight = px2vp(data.area.bottomRect.height);
|
|
|
- AppStorage.setOrCreate('bottomRectHeight', bottomRectHeight);
|
|
|
+ if (data.type === window.AvoidAreaType.TYPE_SYSTEM) {
|
|
|
+ let topRectHeight = px2vp(data.area.topRect.height);
|
|
|
+ AppStorage.setOrCreate('topRectHeight', topRectHeight);
|
|
|
+ } else if (data.type === window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR) {
|
|
|
+ let bottomRectHeight = px2vp(data.area.bottomRect.height);
|
|
|
+ AppStorage.setOrCreate('bottomRectHeight', bottomRectHeight);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -162,9 +163,20 @@ export default class EntryAbility extends UIAbility {
|
|
|
}).catch((e: BusinessError) => {
|
|
|
console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(e));
|
|
|
})
|
|
|
- let avoidArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM)
|
|
|
- let topRectHeight = px2vp(avoidArea.topRect.height);
|
|
|
+ // let avoidArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM)
|
|
|
+ // let topRectHeight = px2vp(avoidArea.topRect.height);
|
|
|
+ // AppStorage.setOrCreate('topRectHeight', topRectHeight);
|
|
|
+
|
|
|
+ let type = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR; // 以导航条避让为例
|
|
|
+ let avoidArea = windowClass.getWindowAvoidArea(type);
|
|
|
+ let bottomRectHeight = px2vp(avoidArea.bottomRect.height); // 获取到导航条区域的高度
|
|
|
+ AppStorage.setOrCreate('bottomRectHeight', bottomRectHeight);
|
|
|
+
|
|
|
+ type = window.AvoidAreaType.TYPE_SYSTEM; // 以状态栏避让为例
|
|
|
+ avoidArea = windowClass.getWindowAvoidArea(type);
|
|
|
+ let topRectHeight = px2vp(avoidArea.topRect.height) // 获取状态栏区域高度
|
|
|
AppStorage.setOrCreate('topRectHeight', topRectHeight);
|
|
|
+
|
|
|
LogUtil.info('onecold topRectHeight = '+topRectHeight);
|
|
|
windowClass.on('avoidAreaChange', this.onAvoidAreaChange)
|
|
|
})
|