From 417064fd38fcfb53a0b27275b00ac90edbfe1358 Mon Sep 17 00:00:00 2001 From: Rossen Hristov Date: Tue, 20 Dec 2016 16:11:40 +0200 Subject: [PATCH] Fix Android lifecycle --- apps/.vscode/launch.json | 18 ++++++++++++------ apps/app/ui-tests-app/app.ts | 3 +-- tns-core-modules/ui/core/view.android.ts | 8 +++----- .../ui/styling/background.android.ts | 2 +- .../android/org.nativescript.widgets.d.ts | 3 ++- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/apps/.vscode/launch.json b/apps/.vscode/launch.json index ba955c4f1..95cc172ed 100644 --- a/apps/.vscode/launch.json +++ b/apps/.vscode/launch.json @@ -11,7 +11,8 @@ "diagnosticLogging": false, "emulator": false, "rebuild": false, - "syncAllFiles": true + "syncAllFiles": true, + "stopOnEntry": true }, { "name": "Launch on iOS", @@ -22,7 +23,8 @@ "sourceMaps": true, "diagnosticLogging": false, "emulator": false, - "rebuild": true + "rebuild": true, + "stopOnEntry": true }, { "name": "Attach on iOS", @@ -32,7 +34,8 @@ "appRoot": "${workspaceRoot}", "sourceMaps": true, "diagnosticLogging": false, - "emulator": false + "emulator": false, + "stopOnEntry": true }, { "name": "Sync on Android", @@ -44,7 +47,8 @@ "diagnosticLogging": false, "emulator": false, "rebuild": false, - "syncAllFiles": true + "syncAllFiles": true, + "stopOnEntry": true }, { "name": "Launch on Android", @@ -55,7 +59,8 @@ "sourceMaps": true, "diagnosticLogging": false, "emulator": false, - "rebuild": true + "rebuild": true, + "stopOnEntry": true }, { "name": "Attach on Android", @@ -65,7 +70,8 @@ "appRoot": "${workspaceRoot}", "sourceMaps": true, "diagnosticLogging": false, - "emulator": false + "emulator": false, + "stopOnEntry": true } ] } \ No newline at end of file diff --git a/apps/app/ui-tests-app/app.ts b/apps/app/ui-tests-app/app.ts index a1f0e311b..4f6b18447 100644 --- a/apps/app/ui-tests-app/app.ts +++ b/apps/app/ui-tests-app/app.ts @@ -4,7 +4,6 @@ trace.enable(); trace.setCategories(trace.categories.concat( trace.categories.NativeLifecycle, trace.categories.Navigation, - //trace.categories.Animation, trace.categories.Transition )); @@ -69,7 +68,7 @@ application.on(application.lowMemoryEvent, function (args: application.Applicati } }); -application.on(application.uncaughtErrorEvent, function (args: application.ApplicationEventData) { +application.on(application.uncaughtErrorEvent, function (args: application.UnhandledErrorEventData) { if (args.android) { // For Android applications, args.android is NativeScriptError. console.log("### NativeScriptError: " + args.android); diff --git a/tns-core-modules/ui/core/view.android.ts b/tns-core-modules/ui/core/view.android.ts index 8643e3828..6063e2c15 100644 --- a/tns-core-modules/ui/core/view.android.ts +++ b/tns-core-modules/ui/core/view.android.ts @@ -160,14 +160,12 @@ export class View extends ViewCommon { } // copy all the locally cached values to the native android widget - applyNativeSetters(child); return true; } this._eachChildView(eachChild); - } else if (this._nativeView && !this.parent) { - // copy all the locally cached values to the native android widget - applyNativeSetters(this); - } + } + + applyNativeSetters(this); } public _onDetached(force?: boolean) { diff --git a/tns-core-modules/ui/styling/background.android.ts b/tns-core-modules/ui/styling/background.android.ts index 4c43f296a..5daaa2d90 100644 --- a/tns-core-modules/ui/styling/background.android.ts +++ b/tns-core-modules/ui/styling/background.android.ts @@ -58,7 +58,7 @@ export module ad { _defaultBackgrounds.set(viewClass, nativeView.getBackground()); } - backgroundDrawable = new org.nativescript.widgets.BorderDrawable(v.toString()); + backgroundDrawable = new org.nativescript.widgets.BorderDrawable(1, v.toString()); refreshBorderDrawable(v, backgroundDrawable); if (getSDK() >= 16) { diff --git a/tns-platform-declarations/android/org.nativescript.widgets.d.ts b/tns-platform-declarations/android/org.nativescript.widgets.d.ts index 8ee7e7724..b4062bec2 100644 --- a/tns-platform-declarations/android/org.nativescript.widgets.d.ts +++ b/tns-platform-declarations/android/org.nativescript.widgets.d.ts @@ -46,7 +46,8 @@ } export class BorderDrawable extends android.graphics.drawable.ColorDrawable { - constructor(id: string); + constructor(density: number); + constructor(density: number, id: string); public refresh( borderTopColor: number,