| 607 | let framesCounter = 0; |
| 608 | |
| 609 | class AndroidFrame extends Observable implements AndroidFrameDefinition { |
| 610 | public rootViewGroup: android.view.ViewGroup; |
| 611 | public readonly frameId: number; |
| 612 | |
| 613 | private _showActionBar = true; |
| 614 | private readonly _owner: FrameDefinition; |
| 615 | |
| 616 | constructor(owner: FrameDefinition) { |
| 617 | super(); |
| 618 | this._owner = owner; |
| 619 | this.frameId = framesCounter++; |
| 620 | framesCache.push(new WeakRef(this)); |
| 621 | } |
| 622 | |
| 623 | public get showActionBar(): boolean { |
| 624 | return this._showActionBar; |
| 625 | } |
| 626 | |
| 627 | public set showActionBar(value: boolean) { |
| 628 | if (this._showActionBar !== value) { |
| 629 | this._showActionBar = value; |
| 630 | if (this.owner.currentPage) { |
| 631 | this.owner.currentPage.actionBar.update(); |
| 632 | } |
| 633 | } |
| 634 | } |
| 635 | |
| 636 | public get activity(): androidx.appcompat.app.AppCompatActivity { |
| 637 | const activity: androidx.appcompat.app.AppCompatActivity = this.owner._context; |
| 638 | if (activity) { |
| 639 | return activity; |
| 640 | } |
| 641 | |
| 642 | // traverse the parent chain for an ancestor Frame |
| 643 | let currView = this._owner.parent; |
| 644 | while (currView) { |
| 645 | if (currView instanceof Frame) { |
| 646 | return (<Frame>currView).android.activity; |
| 647 | } |
| 648 | |
| 649 | currView = currView.parent; |
| 650 | } |
| 651 | |
| 652 | return undefined; |
| 653 | } |
| 654 | |
| 655 | public get actionBar(): android.app.ActionBar { |
| 656 | const activity = this.currentActivity; |
| 657 | if (!activity) { |
| 658 | return undefined; |
| 659 | } |
| 660 | |
| 661 | const bar = activity.getActionBar(); |
| 662 | if (!bar) { |
| 663 | return undefined; |
| 664 | } |
| 665 | |
| 666 | return bar; |
nothing calls this directly
no outgoing calls
no test coverage detected