parent
ffa4f0b339
commit
f59cef72d8
|
|
@ -43,12 +43,12 @@
|
|||
"arkOptions": {
|
||||
"buildProfileFields": {
|
||||
"CHANNEL": "harmony",
|
||||
"BUILD_TIME": "2611031154"
|
||||
"BUILD_TIME": "2611031526"
|
||||
}
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"artifactName": "rabbit_harmony_debug_v1.0.1_2611031154"
|
||||
"artifactName": "rabbit_harmony_debug_v1.0.1_2611031526"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -28,6 +28,21 @@ interface FloatingNavigationInfo {
|
|||
region: number[];
|
||||
}
|
||||
|
||||
// 对齐 weiquan-har SafeAreaManager.getTabBarBottom:只有明确为隐藏/悬浮球才收紧手势区。
|
||||
// 缺少 region、设置不可用或未知 showType 时,不应把三键导航误当成手势导航。
|
||||
export function getTabBarBottomInset(bottom: number, systemBottom: number, navigationValue: string): number {
|
||||
if (systemBottom > 0) {
|
||||
return Math.max(systemBottom, bottom);
|
||||
}
|
||||
try {
|
||||
const navigation = JSON.parse(navigationValue) as FloatingNavigationInfo;
|
||||
if (navigation && (navigation.showType === -1 || navigation.showType === 1)) {
|
||||
return Math.min(bottom, 12);
|
||||
}
|
||||
} catch (_) {}
|
||||
return bottom;
|
||||
}
|
||||
|
||||
// 悬浮三键在部分系统版本不计入 TYPE_SYSTEM;region 是屏幕坐标,单位 px。
|
||||
export function getFloatingNavigationInsets(value: string, bounds: window.Rect): NavigationInsets {
|
||||
const result: NavigationInsets = { left: 0, right: 0, bottom: 0 };
|
||||
|
|
@ -87,6 +102,11 @@ export class WindowSafeArea {
|
|||
this.observingNavigation = settings.registerKeyObserver(context, FLOAT_NAVIGATION_KEY,
|
||||
settings.domainName.USER_PROPERTY, this.onFloatingNavigationChange);
|
||||
} catch (_) {}
|
||||
try {
|
||||
// 首帧前确定导航方式;后续变化继续异步读取,避免重复阻塞布局。
|
||||
this.floatingNavigationValue = settings.getValueSync(context, FLOAT_NAVIGATION_KEY,
|
||||
'', settings.domainName.USER_PROPERTY);
|
||||
} catch (_) {}
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
|
|
@ -128,10 +148,13 @@ export class WindowSafeArea {
|
|||
AppStorage.setOrCreate<number>('statusBarHeight', uiContext.px2vp(systemArea.topRect.height));
|
||||
AppStorage.setOrCreate<number>('navigationBarLeft', uiContext.px2vp(insets.left));
|
||||
AppStorage.setOrCreate<number>('navigationBarRight', uiContext.px2vp(insets.right));
|
||||
AppStorage.setOrCreate<number>('navigationBarBottom', uiContext.px2vp(insets.bottom));
|
||||
const bottom = uiContext.px2vp(insets.bottom);
|
||||
const systemBottom = uiContext.px2vp(Math.max(0, systemArea.bottomRect.height, floating.bottom));
|
||||
AppStorage.setOrCreate<number>('navigationBarBottom', bottom);
|
||||
// 三键导航是不可遮挡的系统区域;首页可单独收紧手势指示条上方的留白。
|
||||
AppStorage.setOrCreate<number>('systemNavigationBarBottom',
|
||||
uiContext.px2vp(Math.max(0, systemArea.bottomRect.height, floating.bottom)));
|
||||
AppStorage.setOrCreate<number>('systemNavigationBarBottom', systemBottom);
|
||||
AppStorage.setOrCreate<number>('tabBarBottom',
|
||||
getTabBarBottomInset(bottom, systemBottom, this.floatingNavigationValue));
|
||||
} catch (error) {
|
||||
Logger.error('WindowSafeArea', '更新系统栏避让区域失败: ' + JSON.stringify(error));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,21 @@ interface FloatingNavigationInfo {
|
|||
region: number[];
|
||||
}
|
||||
|
||||
// 对齐 weiquan-har SafeAreaManager.getTabBarBottom:只有明确为隐藏/悬浮球才收紧手势区。
|
||||
// 缺少 region、设置不可用或未知 showType 时,不应把三键导航误当成手势导航。
|
||||
export function getTabBarBottomInset(bottom: number, systemBottom: number, navigationValue: string): number {
|
||||
if (systemBottom > 0) {
|
||||
return Math.max(systemBottom, bottom);
|
||||
}
|
||||
try {
|
||||
const navigation = JSON.parse(navigationValue) as FloatingNavigationInfo;
|
||||
if (navigation && (navigation.showType === -1 || navigation.showType === 1)) {
|
||||
return Math.min(bottom, 12);
|
||||
}
|
||||
} catch (_) {}
|
||||
return bottom;
|
||||
}
|
||||
|
||||
// 悬浮三键在部分系统版本不计入 TYPE_SYSTEM;region 是屏幕坐标,单位 px。
|
||||
export function getFloatingNavigationInsets(value: string, bounds: window.Rect): NavigationInsets {
|
||||
const result: NavigationInsets = { left: 0, right: 0, bottom: 0 };
|
||||
|
|
@ -87,6 +102,11 @@ export class WindowSafeArea {
|
|||
this.observingNavigation = settings.registerKeyObserver(context, FLOAT_NAVIGATION_KEY,
|
||||
settings.domainName.USER_PROPERTY, this.onFloatingNavigationChange);
|
||||
} catch (_) {}
|
||||
try {
|
||||
// 首帧前确定导航方式;后续变化继续异步读取,避免重复阻塞布局。
|
||||
this.floatingNavigationValue = settings.getValueSync(context, FLOAT_NAVIGATION_KEY,
|
||||
'', settings.domainName.USER_PROPERTY);
|
||||
} catch (_) {}
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
|
|
@ -128,10 +148,13 @@ export class WindowSafeArea {
|
|||
AppStorage.setOrCreate<number>('statusBarHeight', uiContext.px2vp(systemArea.topRect.height));
|
||||
AppStorage.setOrCreate<number>('navigationBarLeft', uiContext.px2vp(insets.left));
|
||||
AppStorage.setOrCreate<number>('navigationBarRight', uiContext.px2vp(insets.right));
|
||||
AppStorage.setOrCreate<number>('navigationBarBottom', uiContext.px2vp(insets.bottom));
|
||||
const bottom = uiContext.px2vp(insets.bottom);
|
||||
const systemBottom = uiContext.px2vp(Math.max(0, systemArea.bottomRect.height, floating.bottom));
|
||||
AppStorage.setOrCreate<number>('navigationBarBottom', bottom);
|
||||
// 三键导航是不可遮挡的系统区域;首页可单独收紧手势指示条上方的留白。
|
||||
AppStorage.setOrCreate<number>('systemNavigationBarBottom',
|
||||
uiContext.px2vp(Math.max(0, systemArea.bottomRect.height, floating.bottom)));
|
||||
AppStorage.setOrCreate<number>('systemNavigationBarBottom', systemBottom);
|
||||
AppStorage.setOrCreate<number>('tabBarBottom',
|
||||
getTabBarBottomInset(bottom, systemBottom, this.floatingNavigationValue));
|
||||
} catch (error) {
|
||||
Logger.error('WindowSafeArea', '更新系统栏避让区域失败: ' + JSON.stringify(error));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
{
|
||||
"name": "default",
|
||||
"output": {
|
||||
"artifactName": "rabbit_harmony_v1.0.1_261131154"
|
||||
"artifactName": "rabbit_harmony_v1.0.1_261131526"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ export struct HomeBanner {
|
|||
if (event.type === TouchType.Up || event.type === TouchType.Cancel) { this.pressed = false; }
|
||||
})
|
||||
|
||||
if (this.banners.length > 1) {
|
||||
Row({ space: 6 }) {
|
||||
ForEach(this.banners, (_banner: HomeBannerEntity, index: number) => {
|
||||
Circle().width(6).height(6)
|
||||
|
|
@ -91,6 +92,7 @@ export struct HomeBanner {
|
|||
.hitTestBehavior(HitTestMode.None)
|
||||
}
|
||||
}
|
||||
}
|
||||
.id('home_banner')
|
||||
.width('100%').aspectRatio(BANNER_RATIO).clip(true)
|
||||
.onVisibleAreaChange([0, 1], (_visible: boolean, ratio: number) => { this.visible = ratio > 0; })
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ export struct SafeAreaPage {
|
|||
@StorageProp('navigationBarLeft') private navigationBarLeft: number = 0;
|
||||
@StorageProp('navigationBarRight') private navigationBarRight: number = 0;
|
||||
@StorageProp('navigationBarBottom') private navigationBarBottom: number = 0;
|
||||
@StorageProp('systemNavigationBarBottom') private systemNavigationBarBottom: number = 0;
|
||||
// TabBar:手势区最多 12vp,三键导航完整避让后再留 8vp;详情页使用完整安全区。
|
||||
@StorageProp('tabBarBottom') private tabBarBottom: number = 0;
|
||||
// 对齐 weiquan-har:三键/未知模式完整避让,明确为手势模式时最多 12vp。
|
||||
@Prop compactGestureBottom: boolean = false;
|
||||
@BuilderParam content: () => void;
|
||||
|
||||
|
|
@ -24,9 +24,7 @@ export struct SafeAreaPage {
|
|||
left: this.navigationBarLeft,
|
||||
right: this.navigationBarRight,
|
||||
bottom: this.compactGestureBottom
|
||||
? (this.systemNavigationBarBottom > 0
|
||||
? Math.max(this.systemNavigationBarBottom, this.navigationBarBottom)
|
||||
: Math.min(this.navigationBarBottom, 12))
|
||||
? this.tabBarBottom
|
||||
: this.navigationBarBottom
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue