1/* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the 'License'); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an 'AS IS' BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16if (!('finalizeConstruction' in ViewPU.prototype)) { 17 Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { }); 18} 19const bundleManager = requireNapi('bundle.bundleManager'); 20const hilog = requireNapi('hilog'); 21const window = requireNapi('window'); 22const LengthMetrics = requireNapi('arkui.node').LengthMetrics; 23 24const BUTTON_WIDTH = 28; 25const VIEW_HEIGHT = 28; 26const IMAGE_SIZE = 16; 27const MENU_RADIUS = 15.5; 28const DIVIDER_HEIGHT = 16.5; 29const DIVIDER_WIDTH = 0.5; 30const MENU_BUTTON_MARGIN = 2; 31const VIEW_MARGIN_TOP = 14; 32const VIEW_MARGIN_RIGHT = 24; 33const MENU_BACK_BLUR = 5; 34const MENU_BORDER_WIDTH = '0.5px'; 35const ICON_FILL_COLOR_DEFAULT = '#182431'; 36const BORDER_COLOR_DEFAULT = '#33000000'; 37const MENU_BACK_COLOR = '#99FFFFFF'; 38const ARKUI_APP_BAR_COLOR_CONFIGURATION = 'arkui_app_bar_color_configuration'; 39const ARKUI_APP_BAR_CONTENT_SAFE_AREA = 'arkui_app_bar_content_safe_area'; 40const ARKUI_APP_BG_COLOR = 'arkui_app_bg_color'; 41const maximizeButtonResourceId = 125829923; 42const recoverButtonResourceId = 125829925; 43const EVENT_NAME_CUSTOM_APP_BAR_MENU_CLICK = 'arkui_custom_app_bar_menu_click'; 44const EVENT_NAME_CUSTOM_APP_BAR_DID_BUILD = 'arkui_custom_app_bar_did_build'; 45const EVENT_NAME_MIN_CLICK = 'arkui_custom_min_click'; 46const EVENT_NAME_CLOSE_CLICK = 'arkui_custom_close_click'; 47const EVENT_NAME_CUSTOM_MAX_CLICK = 'arkui_custom_max_click'; 48const ARKUI_APP_BAR_MENU_SAFE_AREA = 'arkui_app_bar_menu_safe_area'; 49 50class ColorGroup { 51 constructor(light, dark) { 52 this.light = '#000000'; 53 this.dark = '#FFFFFF'; 54 this.light = light; 55 this.dark = dark; 56 } 57} 58const colorMap = new Map([ 59 [ICON_FILL_COLOR_DEFAULT, new ColorGroup('#182431', '#e5ffffff')], 60 [BORDER_COLOR_DEFAULT, new ColorGroup('#33182431', '#4Dffffff')], 61 [MENU_BACK_COLOR, new ColorGroup('#99FFFFFF', '#33000000')], 62]); 63export class CustomAppBarForPC extends ViewPU { 64 constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) { 65 super(parent, __localStorage, elmtId, extraInfo); 66 if (typeof paramsLambda === 'function') { 67 this.paramsGenerator_ = paramsLambda; 68 } 69 this.__menuResource = new ObservedPropertyObjectPU({ 70 bundleName: '', 71 moduleName: '', 72 params: [], 73 id: 125830217, 74 type: 20000 75 }, this, 'menuResource'); 76 this.__closeResource = new ObservedPropertyObjectPU({ 77 bundleName: '', 78 moduleName: '', 79 params: [], 80 id: 125831084, 81 type: 20000 82 }, this, 'closeResource'); 83 this.__menuFillColor = new ObservedPropertySimplePU(this.getResourceColor(ICON_FILL_COLOR_DEFAULT), this, 'menuFillColor'); 84 this.__menubarBorderColor = new ObservedPropertySimplePU(this.getResourceColor(BORDER_COLOR_DEFAULT), this, 'menubarBorderColor'); 85 this.__menubarBackColor = new ObservedPropertySimplePU(this.getResourceColor(MENU_BACK_COLOR), this, 'menubarBackColor'); 86 this.__dividerBackgroundColor = new ObservedPropertySimplePU(this.getResourceColor(BORDER_COLOR_DEFAULT), this, 'dividerBackgroundColor'); 87 this.__contentBgColor = new ObservedPropertySimplePU('#FFFFFFFF', this, 'contentBgColor'); 88 this.__contentMarginTop = new ObservedPropertySimplePU('0vp', this, 'contentMarginTop'); 89 this.__contentMarginLeft = new ObservedPropertySimplePU('0vp', this, 'contentMarginLeft'); 90 this.__contentMarginRight = new ObservedPropertySimplePU('0vp', this, 'contentMarginRight'); 91 this.__contentMarginBottom = new ObservedPropertySimplePU('0vp', this, 'contentMarginBottom'); 92 this.__isAdaptPC = new ObservedPropertySimplePU(false, this, 'isAdaptPC'); 93 this.__maximizeResource = new ObservedPropertyObjectPU(this.getIconResource(maximizeButtonResourceId), this, 'maximizeResource'); 94 this.__statusBarHeight = new ObservedPropertySimplePU(0, this, 'statusBarHeight'); 95 this.isDark = true; 96 this.windowClass = undefined; 97 this.setInitiallyProvidedValue(params); 98 this.finalizeConstruction(); 99 } 100 setInitiallyProvidedValue(params) { 101 if (params.menuResource !== undefined) { 102 this.menuResource = params.menuResource; 103 } 104 if (params.closeResource !== undefined) { 105 this.closeResource = params.closeResource; 106 } 107 if (params.menuFillColor !== undefined) { 108 this.menuFillColor = params.menuFillColor; 109 } 110 if (params.menubarBorderColor !== undefined) { 111 this.menubarBorderColor = params.menubarBorderColor; 112 } 113 if (params.menubarBackColor !== undefined) { 114 this.menubarBackColor = params.menubarBackColor; 115 } 116 if (params.dividerBackgroundColor !== undefined) { 117 this.dividerBackgroundColor = params.dividerBackgroundColor; 118 } 119 if (params.contentBgColor !== undefined) { 120 this.contentBgColor = params.contentBgColor; 121 } 122 if (params.contentMarginTop !== undefined) { 123 this.contentMarginTop = params.contentMarginTop; 124 } 125 if (params.contentMarginLeft !== undefined) { 126 this.contentMarginLeft = params.contentMarginLeft; 127 } 128 if (params.contentMarginRight !== undefined) { 129 this.contentMarginRight = params.contentMarginRight; 130 } 131 if (params.contentMarginBottom !== undefined) { 132 this.contentMarginBottom = params.contentMarginBottom; 133 } 134 if (params.isAdaptPC !== undefined) { 135 this.isAdaptPC = params.isAdaptPC; 136 } 137 if (params.maximizeResource !== undefined) { 138 this.maximizeResource = params.maximizeResource; 139 } 140 if (params.statusBarHeight !== undefined) { 141 this.statusBarHeight = params.statusBarHeight; 142 } 143 if (params.isDark !== undefined) { 144 this.isDark = params.isDark; 145 } 146 if (params.windowClass !== undefined) { 147 this.windowClass = params.windowClass; 148 } 149 } 150 updateStateVars(params) { 151 } 152 purgeVariableDependenciesOnElmtId(rmElmtId) { 153 this.__menuResource.purgeDependencyOnElmtId(rmElmtId); 154 this.__closeResource.purgeDependencyOnElmtId(rmElmtId); 155 this.__menuFillColor.purgeDependencyOnElmtId(rmElmtId); 156 this.__menubarBorderColor.purgeDependencyOnElmtId(rmElmtId); 157 this.__menubarBackColor.purgeDependencyOnElmtId(rmElmtId); 158 this.__dividerBackgroundColor.purgeDependencyOnElmtId(rmElmtId); 159 this.__contentBgColor.purgeDependencyOnElmtId(rmElmtId); 160 this.__contentMarginTop.purgeDependencyOnElmtId(rmElmtId); 161 this.__contentMarginLeft.purgeDependencyOnElmtId(rmElmtId); 162 this.__contentMarginRight.purgeDependencyOnElmtId(rmElmtId); 163 this.__contentMarginBottom.purgeDependencyOnElmtId(rmElmtId); 164 this.__isAdaptPC.purgeDependencyOnElmtId(rmElmtId); 165 this.__maximizeResource.purgeDependencyOnElmtId(rmElmtId); 166 this.__statusBarHeight.purgeDependencyOnElmtId(rmElmtId); 167 } 168 aboutToBeDeleted() { 169 this.__menuResource.aboutToBeDeleted(); 170 this.__closeResource.aboutToBeDeleted(); 171 this.__menuFillColor.aboutToBeDeleted(); 172 this.__menubarBorderColor.aboutToBeDeleted(); 173 this.__menubarBackColor.aboutToBeDeleted(); 174 this.__dividerBackgroundColor.aboutToBeDeleted(); 175 this.__contentBgColor.aboutToBeDeleted(); 176 this.__contentMarginTop.aboutToBeDeleted(); 177 this.__contentMarginLeft.aboutToBeDeleted(); 178 this.__contentMarginRight.aboutToBeDeleted(); 179 this.__contentMarginBottom.aboutToBeDeleted(); 180 this.__isAdaptPC.aboutToBeDeleted(); 181 this.__maximizeResource.aboutToBeDeleted(); 182 this.__statusBarHeight.aboutToBeDeleted(); 183 SubscriberManager.Get().delete(this.id__()); 184 this.aboutToBeDeletedInternal(); 185 } 186 get menuResource() { 187 return this.__menuResource.get(); 188 } 189 set menuResource(newValue) { 190 this.__menuResource.set(newValue); 191 } 192 get closeResource() { 193 return this.__closeResource.get(); 194 } 195 set closeResource(newValue) { 196 this.__closeResource.set(newValue); 197 } 198 get menuFillColor() { 199 return this.__menuFillColor.get(); 200 } 201 set menuFillColor(newValue) { 202 this.__menuFillColor.set(newValue); 203 } 204 get menubarBorderColor() { 205 return this.__menubarBorderColor.get(); 206 } 207 set menubarBorderColor(newValue) { 208 this.__menubarBorderColor.set(newValue); 209 } 210 get menubarBackColor() { 211 return this.__menubarBackColor.get(); 212 } 213 set menubarBackColor(newValue) { 214 this.__menubarBackColor.set(newValue); 215 } 216 get dividerBackgroundColor() { 217 return this.__dividerBackgroundColor.get(); 218 } 219 set dividerBackgroundColor(newValue) { 220 this.__dividerBackgroundColor.set(newValue); 221 } 222 get contentBgColor() { 223 return this.__contentBgColor.get(); 224 } 225 set contentBgColor(newValue) { 226 this.__contentBgColor.set(newValue); 227 } 228 get contentMarginTop() { 229 return this.__contentMarginTop.get(); 230 } 231 set contentMarginTop(newValue) { 232 this.__contentMarginTop.set(newValue); 233 } 234 get contentMarginLeft() { 235 return this.__contentMarginLeft.get(); 236 } 237 set contentMarginLeft(newValue) { 238 this.__contentMarginLeft.set(newValue); 239 } 240 get contentMarginRight() { 241 return this.__contentMarginRight.get(); 242 } 243 set contentMarginRight(newValue) { 244 this.__contentMarginRight.set(newValue); 245 } 246 get contentMarginBottom() { 247 return this.__contentMarginBottom.get(); 248 } 249 set contentMarginBottom(newValue) { 250 this.__contentMarginBottom.set(newValue); 251 } 252 get isAdaptPC() { 253 return this.__isAdaptPC.get(); 254 } 255 set isAdaptPC(newValue) { 256 this.__isAdaptPC.set(newValue); 257 } 258 get maximizeResource() { 259 return this.__maximizeResource.get(); 260 } 261 set maximizeResource(newValue) { 262 this.__maximizeResource.set(newValue); 263 } 264 get statusBarHeight() { 265 return this.__statusBarHeight.get(); 266 } 267 set statusBarHeight(newValue) { 268 this.__statusBarHeight.set(newValue); 269 } 270 async aboutToAppear() { 271 let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE; 272 try { 273 bundleManager.getBundleInfoForSelf(bundleFlags).then((data) => { 274 hilog.info(0x0000, 'testTag', 'getBundleInfoForSelf successfully. Data: %{public}s', JSON.stringify(data.hapModulesInfo[0].deviceTypes)); 275 let devicetype = data.hapModulesInfo[0].deviceTypes; 276 for (let i = 0; i < devicetype.length; i++) { 277 if (devicetype[i] === '2in1') { 278 this.isAdaptPC = true; 279 break; 280 } 281 } 282 }).catch((err) => { 283 hilog.error(0x0000, 'testTag', 'getBundleInfoForSelf failed. Cause: %{public}s', err.message); 284 }); 285 } 286 catch (err) { 287 let message = err.message; 288 hilog.error(0x0000, 'testTag', 'getBundleInfoForSelf failed: %{public}s', message); 289 } 290 let context = getContext(this); 291 context?.windowStage?.getMainWindow().then(data => { 292 this.windowClass = data; 293 this.windowClass?.setWindowDecorVisible(false); 294 this.windowClass?.setWindowTitleButtonVisible(false, false, false); 295 this.updateMaximizeResource(this.windowClass?.getWindowStatus()); 296 this.windowClass?.on('windowStatusChange', (windowStatusType) => { 297 console.info('windowStatusChange windowStatusType: ' + JSON.stringify(windowStatusType)); 298 this.updateMaximizeResource(windowStatusType); 299 }); 300 if (!this.isAdaptPC) { 301 this.windowClass?.setWindowTitleMoveEnabled(false); 302 } 303 }).catch((err) => { 304 if (err.code) { 305 console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`); 306 } 307 }); 308 } 309 updateMaximizeResource(windowStatusType) { 310 if (windowStatusType === window.WindowStatusType.FULL_SCREEN || 311 windowStatusType === window.WindowStatusType.SPLIT_SCREEN || 312 windowStatusType === window.WindowStatusType.MAXIMIZE) { 313 this.maximizeResource = this.getIconResource(recoverButtonResourceId); 314 } else { 315 this.maximizeResource = this.getIconResource(maximizeButtonResourceId); 316 } 317 } 318 aboutToDisappear() { 319 this.windowClass?.off('windowStatusChange'); 320 } 321 parseBoolean(value) { 322 if (value === 'true') { 323 return true; 324 } 325 return false; 326 } 327 getResourceColor(defaultColor) { 328 if (colorMap.has(defaultColor)) { 329 const colorGroup = colorMap.get(defaultColor); 330 if (colorGroup) { 331 return this.isDark ? colorGroup.dark : colorGroup.light; 332 } 333 } 334 return defaultColor; 335 } 336 /** 337 * 监听来自arkui侧的回调 338 * @param eventName 事件名 339 * @param param 参数 340 */ 341 setCustomCallback(eventName, param) { 342 if (eventName === ARKUI_APP_BAR_COLOR_CONFIGURATION) { 343 this.onColorConfigurationUpdate(this.parseBoolean(param)); 344 } 345 else if (eventName === ARKUI_APP_BAR_CONTENT_SAFE_AREA) { 346 //top left right bottom 347 let splitArray = param.split('|'); 348 if (splitArray.length < 4) { 349 return; 350 } 351 this.statusBarHeight = Number(splitArray[0]); 352 this.contentMarginTop = splitArray[0]; 353 this.contentMarginLeft = splitArray[1]; 354 this.contentMarginRight = splitArray[2]; 355 this.contentMarginBottom = splitArray[3]; 356 } 357 else if (eventName === ARKUI_APP_BG_COLOR) { 358 this.contentBgColor = param; 359 } 360 } 361 /** 362 * menu按钮点击 363 */ 364 onMenuButtonClick() { 365 ContainerAppBar.callNative(EVENT_NAME_CUSTOM_APP_BAR_MENU_CLICK); 366 } 367 /** 368 * 点击放大按钮 369 */ 370 onMaximizeButtonClick() { 371 ContainerModal.callNative(EVENT_NAME_CUSTOM_MAX_CLICK); 372 } 373 /** 374 * 点击最小化按钮 375 */ 376 onMinimizeButtonClick() { 377 ContainerModal.callNative(EVENT_NAME_MIN_CLICK); 378 } 379 /** 380 * 点击关闭按钮 381 */ 382 onCloseButtonClick() { 383 ContainerModal.callNative(EVENT_NAME_CLOSE_CLICK); 384 } 385 onDidBuild() { 386 ContainerAppBar.callNative(EVENT_NAME_CUSTOM_APP_BAR_DID_BUILD); 387 } 388 dividerLine(parent = null) { 389 this.observeComponentCreation2((elmtId, isInitialRender) => { 390 Divider.create(); 391 Divider.id('AtomicServiceDividerId'); 392 Divider.vertical(true); 393 Divider.color(this.dividerBackgroundColor); 394 Divider.lineCap(LineCapStyle.Round); 395 Divider.strokeWidth(DIVIDER_WIDTH); 396 Divider.height(DIVIDER_HEIGHT); 397 }, Divider); 398 } 399 initialRender() { 400 this.observeComponentCreation2((elmtId, isInitialRender) => { 401 Column.create(); 402 Column.height('100%'); 403 Column.width('100%'); 404 Column.justifyContent(FlexAlign.End); 405 Column.backgroundColor(this.contentBgColor); 406 Column.hitTestBehavior(HitTestMode.Transparent); 407 }, Column); 408 this.observeComponentCreation2((elmtId, isInitialRender) => { 409 Stack.create({ alignContent: Alignment.TopEnd }); 410 Stack.id('AtomicServiceContainerId'); 411 Stack.height('100%'); 412 Stack.width('100%'); 413 Stack.backgroundColor(Color.Transparent); 414 Stack.hitTestBehavior(HitTestMode.Transparent); 415 }, Stack); 416 this.observeComponentCreation2((elmtId, isInitialRender) => { 417 Row.create(); 418 Row.padding({ 419 top: this.contentMarginTop, 420 left: this.contentMarginLeft, 421 right: this.contentMarginRight, 422 bottom: this.contentMarginBottom 423 }); 424 Row.height('100%'); 425 Row.width('100%'); 426 Row.id('AtomicServiceStageId'); 427 Row.backgroundColor(Color.Blue); 428 }, Row); 429 Row.pop(); 430 this.observeComponentCreation2((elmtId, isInitialRender) => { 431 Row.create(); 432 Row.id('AtomicServiceMenubarRowId'); 433 Row.justifyContent(FlexAlign.End); 434 Row.margin({ top: LengthMetrics.vp(this.statusBarHeight + VIEW_MARGIN_TOP), end: LengthMetrics.vp(VIEW_MARGIN_RIGHT) }); 435 Row.height(VIEW_HEIGHT); 436 Row.hitTestBehavior(HitTestMode.Transparent); 437 }, Row); 438 this.observeComponentCreation2((elmtId, isInitialRender) => { 439 Row.create(); 440 Row.borderRadius(MENU_RADIUS); 441 Row.borderColor(this.menubarBorderColor); 442 Row.backgroundColor(this.menubarBackColor); 443 Row.backdropBlur(MENU_BACK_BLUR); 444 Row.borderWidth(MENU_BORDER_WIDTH); 445 Row.borderColor($r('sys.color.icon_fourth')); 446 Row.height(VIEW_HEIGHT); 447 Row.align(Alignment.Top); 448 Row.draggable(false); 449 Row.id('AtomicServiceMenubarId'); 450 }, Row); 451 this.observeComponentCreation2((elmtId, isInitialRender) => { 452 Button.createWithChild(); 453 Button.id('AtomicServiceMenuId'); 454 Button.type(ButtonType.Normal); 455 Button.borderRadius({ topLeft: MENU_RADIUS, bottomLeft: MENU_RADIUS }); 456 Button.backgroundColor(Color.Transparent); 457 Button.width(BUTTON_WIDTH + MENU_BUTTON_MARGIN); 458 Button.height(VIEW_HEIGHT); 459 Gesture.create(GesturePriority.Low); 460 TapGesture.create(); 461 TapGesture.onAction(() => { 462 this.onMenuButtonClick(); 463 }); 464 TapGesture.pop(); 465 Gesture.pop(); 466 }, Button); 467 this.observeComponentCreation2((elmtId, isInitialRender) => { 468 Image.create(this.menuResource); 469 Image.width(IMAGE_SIZE); 470 Image.height(IMAGE_SIZE); 471 Image.fillColor(this.menuFillColor); 472 Image.draggable(false); 473 Image.interpolation(ImageInterpolation.High); 474 Image.margin({ start: LengthMetrics.vp(MENU_BUTTON_MARGIN) }); 475 }, Image); 476 Button.pop(); 477 this.dividerLine.bind(this)(); 478 this.observeComponentCreation2((elmtId, isInitialRender) => { 479 If.create(); 480 if (this.isAdaptPC) { 481 this.ifElseBranchUpdateFunction(0, () => { 482 if (!If.canRetake('AtomicServiceexpendId')) { 483 this.observeComponentCreation2((elmtId, isInitialRender) => { 484 Button.createWithChild(); 485 Button.id('AtomicServiceexpendId'); 486 Button.type(ButtonType.Normal); 487 Button.backgroundColor(Color.Transparent); 488 Button.width(BUTTON_WIDTH); 489 Button.height(VIEW_HEIGHT); 490 Gesture.create(GesturePriority.Low); 491 TapGesture.create(); 492 TapGesture.onAction(() => { 493 this.onMaximizeButtonClick(); 494 }); 495 TapGesture.pop(); 496 Gesture.pop(); 497 }, Button); 498 this.observeComponentCreation2((elmtId, isInitialRender) => { 499 Image.create(this.maximizeResource); 500 Image.width(IMAGE_SIZE); 501 Image.height(IMAGE_SIZE); 502 Image.fillColor(this.menuFillColor); 503 Image.draggable(false); 504 Image.interpolation(ImageInterpolation.High); 505 }, Image); 506 Button.pop(); 507 } 508 this.dividerLine.bind(this)(); 509 }); 510 } 511 else { 512 this.ifElseBranchUpdateFunction(1, () => { 513 }); 514 } 515 }, If); 516 If.pop(); 517 this.observeComponentCreation2((elmtId, isInitialRender) => { 518 Button.createWithChild(); 519 Button.id('AtomicServiceMinusId'); 520 Button.type(ButtonType.Normal); 521 Button.backgroundColor(Color.Transparent); 522 Button.width(BUTTON_WIDTH); 523 Button.height(VIEW_HEIGHT); 524 Gesture.create(GesturePriority.Low); 525 TapGesture.create(); 526 TapGesture.onAction(() => { 527 this.onMinimizeButtonClick(); 528 }); 529 TapGesture.pop(); 530 Gesture.pop(); 531 }, Button); 532 this.observeComponentCreation2((elmtId, isInitialRender) => { 533 SymbolGlyph.create({ 'id': -1, 'type': 40000, params: ['sys.symbol.minus'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 534 SymbolGlyph.fontSize(IMAGE_SIZE); 535 SymbolGlyph.fontColor([this.menuFillColor]); 536 SymbolGlyph.draggable(false); 537 }, SymbolGlyph); 538 Button.pop(); 539 this.dividerLine.bind(this)(); 540 this.observeComponentCreation2((elmtId, isInitialRender) => { 541 Button.createWithChild(); 542 Button.id('AtomicServiceCloseId'); 543 Button.type(ButtonType.Normal); 544 Button.backgroundColor(Color.Transparent); 545 Button.borderRadius({ topRight: MENU_RADIUS, bottomRight: MENU_RADIUS }); 546 Button.width(BUTTON_WIDTH + MENU_BUTTON_MARGIN); 547 Button.height(VIEW_HEIGHT); 548 Gesture.create(GesturePriority.Low); 549 TapGesture.create(); 550 TapGesture.onAction(() => { 551 this.onCloseButtonClick(); 552 }); 553 TapGesture.pop(); 554 Gesture.pop(); 555 }, Button); 556 this.observeComponentCreation2((elmtId, isInitialRender) => { 557 Image.create(this.closeResource); 558 Image.width(IMAGE_SIZE); 559 Image.height(IMAGE_SIZE); 560 Image.fillColor(this.menuFillColor); 561 Image.margin({ end: LengthMetrics.vp(MENU_BUTTON_MARGIN) }); 562 Image.draggable(false); 563 Image.interpolation(ImageInterpolation.High); 564 }, Image); 565 Button.pop(); 566 Row.pop(); 567 Row.pop(); 568 Stack.pop(); 569 Column.pop(); 570 } 571 onColorConfigurationUpdate(isDark) { 572 this.isDark = isDark; 573 this.menuFillColor = this.getResourceColor(ICON_FILL_COLOR_DEFAULT); 574 this.menubarBorderColor = this.getResourceColor(BORDER_COLOR_DEFAULT); 575 this.dividerBackgroundColor = this.getResourceColor(BORDER_COLOR_DEFAULT); 576 this.menubarBackColor = this.getResourceColor(MENU_BACK_COLOR); 577 } 578 getIconResource(resourceId) { 579 return { 580 bundleName: '', 581 moduleName: '', 582 params: [], 583 id: resourceId, 584 type: 20000 585 }; 586 } 587 rerender() { 588 this.updateDirtyElements(); 589 } 590} 591 592loadCustomAppbar(new CustomAppBarForPC(undefined, {})); 593ViewStackProcessor.StopGetAccessRecording(); 594