import { View , layout } from "ui/core/view" ; import { Page } from "ui/page" ; import { Frame , topmost } from "ui/frame" ; import "./layouts" ; import "./layouts.common" ; function listenFirstLayout ( native , resolve , reject ) { const nativeRef = new WeakRef ( native ) ; const listener = new android . view . View . OnLayoutChangeListener ( { onLayoutChange ( param0 , param1 , param2 , param3 , param4 , param5 , param6 , param7 , param8 ) { if ( nativeRef && nativeRef . get ( ) ) { nativeRef . get ( ) . removeOnLayoutChangeListener ( listener ) ; } resolve ( ) ; } } ) ; native . addOnLayoutChangeListener ( listener ) ; } View . prototype [ "waitNextLayout" ] = function ( ) { return new Promise < any > ( ( resolve , reject ) => { if ( this . nativeView ) { const native = this . nativeView ; listenFirstLayout ( native , resolve , reject ) ; } else { this . on ( "loaded" , ( ) => { const native = this . nativeView ; listenFirstLayout ( native , resolve , reject ) ; } ) ; } } ) ; } ; Page . prototype [ "setStatusBarTranslucent" ] = function ( translucent ) { let windows = this . _context . getWindow ( ) ; if ( translucent ) { windows . clearFlags ( android . view . WindowManager . LayoutParams . FLAG_TRANSLUCENT_STATUS ) ; windows . addFlags ( android . view . WindowManager . LayoutParams . FLAG_TRANSLUCENT_STATUS ) ; } else { windows . clearFlags ( android . view . WindowManager . LayoutParams . FLAG_TRANSLUCENT_STATUS ) ; } windows . clearFlags ( android . view . WindowManager . LayoutParams . FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS ) ; windows . addFlags ( android . view . WindowManager . LayoutParams . FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS ) ; } ; Page . prototype [ "getStatusBarHeight" ] = function ( ) { return 24 ; } ; Page . prototype [ "getStatusBarHeightPx" ] = function ( ) { const self = this ; return layout . toDevicePixels ( self . getStatusBarHeightDip ( ) ) ; } ; Page . prototype [ "getStatusBarHeightDip" ] = function ( ) { return 24 ; } ;