chore: cleanup

This commit is contained in:
Nathan Walker
2020-07-24 14:37:14 -07:00
parent 6ed1b7c89b
commit 502d263281
16 changed files with 348 additions and 276 deletions

View File

@@ -1,5 +1,5 @@
/* tslint:disable:class-name */
import * as appModule from '../application';
import { getNativeApplication, on, off, orientationChangedEvent } from '../application';
const MIN_TABLET_PIXELS = 600;
@@ -19,15 +19,15 @@ class MainScreen {
}
private initMetrics(): void {
const nativeApp = <android.app.Application>appModule.getNativeApplication();
const nativeApp = <android.app.Application>getNativeApplication();
nativeApp.getSystemService(android.content.Context.WINDOW_SERVICE).getDefaultDisplay().getRealMetrics(this._metrics);
}
private get metrics(): android.util.DisplayMetrics {
if (!this._metrics) {
// NOTE: This will be memory leak but we MainScreen is singleton
appModule.on('cssChanged', this.reinitMetrics, this);
appModule.on(appModule.orientationChangedEvent, this.reinitMetrics, this);
on('cssChanged', this.reinitMetrics, this);
on(orientationChangedEvent, this.reinitMetrics, this);
this._metrics = new android.util.DisplayMetrics();
this.initMetrics();