From 38d6484539f90fac9fb9c429f9bfda38df81a833 Mon Sep 17 00:00:00 2001 From: Nathanael Anderson Date: Mon, 5 Dec 2016 03:05:46 -0600 Subject: [PATCH] Fixes the metrics issue when soft-navigation is used on a device/emulator. (#3236) --- tns-core-modules/platform/platform.android.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tns-core-modules/platform/platform.android.ts b/tns-core-modules/platform/platform.android.ts index f60de5800..0d26ef187 100644 --- a/tns-core-modules/platform/platform.android.ts +++ b/tns-core-modules/platform/platform.android.ts @@ -105,7 +105,8 @@ class MainScreen implements definition.ScreenMetrics { private _metrics: android.util.DisplayMetrics; private get metrics(): android.util.DisplayMetrics { if (!this._metrics) { - this._metrics = utils.ad.getApplicationContext().getResources().getDisplayMetrics(); + this._metrics = new android.util.DisplayMetrics(); + utils.ad.getApplicationContext().getSystemService(android.content.Context.WINDOW_SERVICE).getDefaultDisplay().getRealMetrics(this._metrics); } return this._metrics; }