51 Commits

Author SHA1 Message Date
4166e2d966 fix: expose orientation to application module (#7832) 2019-09-19 18:49:07 +03:00
3adba6826b feat: add CSS classes to app/modal root views to target platform/device/orientation/type (#7606) 2019-08-19 14:09:44 +03:00
e2c3c8c084 feat: expose application orientation (#7602) 2019-08-14 13:47:15 +03:00
1d12136816 feat: apply styles when adding them to the application scope (#7652) 2019-08-13 16:10:21 +03:00
4f39fb728b chore: update tslint rules (#7391) 2019-06-26 15:13:48 +03:00
b20e771552 chore: remove deprecated apis for ns 6.0 (#7382) 2019-06-25 16:52:01 +03:00
ecd9fc3e9d feat: bundle workflow support (#7337) 2019-06-20 15:58:36 +03:00
c5db112b8d feat(android): androidX support (#7039)
* feat: migrate support library namespaces to androidX

* feat(tns-platform-declarations): update to androidX typings

* chore(tests): migrate test apps to AndroidX

* chore(tns-platform-declarations): update tsconfig to include androidx dts files

* update package.json to androidx

* chore(androidx): migrate forgotten support library namspaces

* feat(tns-core-modules-widgets): migrate to AndroidX namespaces

* chore(utils): update androidx namspace for getPaletteColor method

* chore(apps): update tns-platform-declarations package

* Update package.json
2019-06-10 09:21:41 +03:00
3efc06ed98 feat(android): implement a 'activityNewIntent' event 2019-04-03 11:06:14 +03:00
761cd47360 chore: fix app.start deprecation (#7067) 2019-03-25 16:04:48 +02:00
cf07b2719f chore: update deprecations (#7046) 2019-03-21 14:25:36 +02:00
f9e008fd54 fix(android): throw new Error if no activity callbacks (#7044) 2019-03-20 14:42:50 +02:00
ff476d983d refactor: rename HmrContext to ModuleContext (#6843)
* refactor: rename HmrContext to ModuleContext

* refactor(ModuleContext): rename module to path
2019-01-31 18:32:25 +02:00
8cb726aedf fix-next: avoid circular reference (#6812) 2019-01-22 14:37:29 +02:00
46c9de020e fix(android): raise resume event on activity.onPostResume() (#6766) 2019-01-08 15:20:11 +02:00
42a1491e6e feat(HMR): apply changes in application styles at runtime
Expose `HmrContext` interface.
Apply changes in `app.css` instantly.
Avoid navigation on livesync when changes in `app.css` have been made.
Apply changes in `app.css` on back navigation.
2018-12-14 14:34:47 +02:00
cf034dd04d feat(android): migrate to support library apis (#6129)
Switch Activity / Fragment / FragmentManager implementation from native framework to support library APIs

BREAKING CHANGE:


NativeScript core framework now extends support library APIs versus native framework classes as per Google's latest guidelines:
- NativeScript activities now extend `android.support.v7.app.AppCompatActivity` (vs android.app.Activity)
- NativeScript fragments now extend `android.support.v4.app.Fragment` (vs android.app.Fragment)
- NativeScript now works internally with `android.support.v4.app.FragmentManager` (vs android.app.FragmentManager) 

The implications of these changes should be mostly transparent to the developer except for the fact that the support library Fragment / FragmentManager work with Animation APIs versus Animator APIs.

For Android API Levels lower than 28 the new Fragment API uses a different fragment enter animation by default. You can customise the transition per navigation entry or globally via the [navigation transitions API](https://docs.nativescript.org/core-concepts/navigation#navigation-transitions)
Before:
Default fragment enter animation was fade animation

After:
Default fragment enter animation for API levels lower than 28 is now a fast "push fade" animation; default fragment enter animation for API levels equal to or greater than 28 remains fade animation

Before:
AndroidFragmentCallbacks interface exposed the following `onCreateAnimator(...)` method
``` ts
export interface AndroidFragmentCallbacks {
    onCreateAnimator(fragment: any, transit: number, enter: boolean, nextAnim: number, superFunc: Function): any;
    // ...
}
```

After:
AndroidFragmentCallbacks interface now exposes the following `onCreateAnimation(...)` method instead (and `onCreateAnimator(...)` is now removed)
``` ts
export interface AndroidFragmentCallbacks {
    onCreateAnimation(fragment: any, transit: number, enter: boolean, nextAnim: number, superFunc: Function): any;
    // ...
}
```

Before:
Transition class exposed the following abstract `createAndroidAnimator(...)` method
``` ts
export class Transition {
    public createAndroidAnimator(transitionType: string): any;
    // ...
}
```

After:
Transition class now exposes the following abstract `createAndroidAnimation(...)` method instead (and `createAndroidAnimation(...) is now removed)
``` ts
export class Transition {
    public createAndroidAnimation(transitionType: string): any;
    // ...
}
```

To migrate the code of your custom transitions follow the example below:

Before:
``` ts
import * as transition from "tns-core-modules/ui/transition";

export class CustomTransition extends transition.Transition {
    constructor(duration: number, curve: any) {
        super(duration, curve);
    }

    public createAndroidAnimator(transitionType: string): android.animation.Animator {
        var scaleValues = Array.create("float", 2);
        switch (transitionType) {
            case transition.AndroidTransitionType.enter:
            case transition.AndroidTransitionType.popEnter:
                scaleValues[0] = 0;
                scaleValues[1] = 1;
                break;
            case transition.AndroidTransitionType.exit:
            case transition.AndroidTransitionType.popExit:
                scaleValues[0] = 1;
                scaleValues[1] = 0;
                break;
        }
        var objectAnimators = Array.create(android.animation.Animator, 2);
        objectAnimators[0] = android.animation.ObjectAnimator.ofFloat(null, "scaleX", scaleValues);
        objectAnimators[1] = android.animation.ObjectAnimator.ofFloat(null, "scaleY", scaleValues);
        var animatorSet = new android.animation.AnimatorSet();
        animatorSet.playTogether(objectAnimators);

        var duration = this.getDuration();
        if (duration !== undefined) {
            animatorSet.setDuration(duration);
        }
        animatorSet.setInterpolator(this.getCurve());

        return animatorSet;
    }
}
```

After:
``` ts
import * as transition from "tns-core-modules/ui/transition";

export class CustomTransition extends transition.Transition {
    constructor(duration: number, curve: any) {
        super(duration, curve);
    }

    public createAndroidAnimation(transitionType: string): android.view.animation.Animation {
        const scaleValues = [];

        switch (transitionType) {
            case transition.AndroidTransitionType.enter:
            case transition.AndroidTransitionType.popEnter:
                scaleValues[0] = 0;
                scaleValues[1] = 1;
                break;
            case transition.AndroidTransitionType.exit:
            case transition.AndroidTransitionType.popExit:
                scaleValues[0] = 1;
                scaleValues[1] = 0;
                break;
        }
            
        const animationSet = new android.view.animation.AnimationSet(false);
        const duration = this.getDuration();
        if (duration !== undefined) {
            animationSet.setDuration(duration);
        }

        animationSet.setInterpolator(this.getCurve());
        animationSet.addAnimation(
            new android.view.animation.ScaleAnimation(
                scaleValues[0], 
                scaleValues[1], 
                scaleValues[0], 
                scaleValues[1]
            ));

        return animationSet;
    }
}
```
2018-07-31 18:48:34 +03:00
bbe25d7ec1 keep some variable from early GC to speed up start time (#5823)
* keep some variable from early GC to speed up start time

* do not clear callbacks, as they shouldn't use much memory
2018-05-17 11:55:15 +03:00
4ce45666a5 test: add reset root view tests (#5437) 2018-02-21 11:38:37 +02:00
b113b0021a feat: Add methods to get the root view and set a different root view at run time (#5386)
* feat: add option to set a different root view at run time

* feat: expose application getRootView method

* refactor: Introduce ViewEntry interface

* fix: Respect root view rturned from launch event in Android

* refactor: getRootView() code + caching root view per activity.

* refactor: add app-root.xml in apps

* refactor: http test made async
2018-02-09 16:04:20 +02:00
af034089ca iOS Frame, Page and TabView measure/layout methods removed. We now rely on the framework positioning. This will result in a change that width, height, minWidth, minHeight, margins not respected on these controls
iOS layout positioning now respects native properties like automaticallyAdjustsScrollViewInsets, edgesForExtendedLayout, extendedLayoutIncludesOpaqueBars, navigationBar.translucent, tabBar.translucent
Removed frame-tests.ios.ts - those tests are now invalid
Added new layout tests inside page-tests.ios.ts
Commented few asserts in scroll-view-tests
View now expose ios namespace with layoutView method and UILayoutViewController used by page, tab-view and application module
ViewBase now expose viewController property that should be set from all widgets that are using viewcontrollers internally (like Page, Frame, TabView)
ViewBase now sets ios property to either the view returned from createNativeView or to nativeViewProptected
fragment.transitions now use animation/transition start to add fragments to waitingQueue. Before we did it manually in navigate/goBack. This way we can reuse the fragment.transition when calling showDialog. Also when animation/transition ends we check the animation/transition to see if this fragment should be set as current.
Frame expose new loadViewFromEntry method (to load a view from URI)
Frame navigation happens once frame is loaded
Frame now supports Page as a child in XML
Fixed GridLayout row, rowSpan, column, columnSpan properties type
Fixed bug in GridLayout where add/remove of columns/rows won't update the internal state of the grid (backport from android when GridLayout is recycled)
ListView will no longer invalidate layout when cell is removed
Fixed bug in ScrollView ios where effectiveMinWidth/Height was multiplied to density (it is already on device pixels so no need to multiply)
TabView android now calls loaded only on the selected child (not all)
Core refactoring
2017-12-15 13:06:34 +02:00
3a447b6f3f Added @profile on several key methods in the Android lifecycle, refactored by extracting into methods a little (#4685) 2017-08-24 13:10:53 +03:00
8adb2fdfef Fix TypeScript 2.4 errors, introduced mainly due weak types and covariant checking for callbacks (#4476) 2017-07-03 11:57:00 +03:00
655509c64d Refactored getting root view in android (#4463) 2017-06-28 15:54:55 +03:00
51b351f5b6 Add timeline traces in the console, let enabling them through the package.json 2017-06-02 16:34:15 +03:00
90d36b26d3 Add 'displayed' event for android, close to the Displayed point logged in the android monitor for activity startup 2017-05-16 10:55:10 +03:00
9e3222781a backgroundImage property now use Fetcher & Cache as Image component (#4030)
* backgroundImage property now use Fetcher & Cache as Image component
Fix GridLayout tests on iPhone Plus - actualLength wasn’t rounded
ImageCache is closed when activity is stopped

* Fix reset of background drawable.

* additional check for drawable

* imageCache init cache on activity Started
2017-04-21 16:50:12 +03:00
e6250e718a Disable recycling of native views
createNativeView will set iOS nativeView if it is null/undefined
2017-03-28 18:08:59 +03:00
f2898f84d5 NativeView recycled for android 2017-03-28 18:08:59 +03:00
629eb6e683 Use relative imports in tns-core-modules.
Use tns-core-modules/* imports in outside code (apps, tests, etc)
2017-03-13 14:37:59 +02:00
347755367e make tslint happy :( 2017-03-06 14:05:55 +02:00
2224cd6150 Reorganize imports/exports in order to make snapshot happy 2017-03-06 14:05:55 +02:00
a582adc561 Hhristov/fix (#3653)
* Fix action-bar systemIcon
Fix CSS applying

* refactoring

* fix console

* remove StyleScope import - it is private and cannot be imported in public .d.ts
2017-02-17 17:21:57 +02:00
86481cce4a Make typings compatible with @types/node.
Fixes name clashes and uses Node-compatible typings where possible.

Changes:
 - setTimout et al now return NodeJS.Timer instead of number
 - No "console" module anymore. Everyone uses it through global.console
 anyway.
 - We have a typed "global" instance with exposed properties now. Any
 "freeform" accesses must go through a `(<any>global).blah` cast.
 - remove tns-core-modules.{base,es6,es2015}.d.ts. Those were needed
 as workarounds for the ES6/DOM/Node type clashes.
2017-02-15 13:01:10 +02:00
177222f548 Remove two console.log's 2017-01-04 16:29:05 +02:00
d8e062da85 Fix: application.setCssFileName does not work 2017-01-04 15:23:59 +02:00
e6d64799d8 Fix: Android platform.screen.mainScreen props are not invalidated after orientation change
Resolves #3270
2017-01-03 11:17:06 +02:00
6feeb140e3 Fixing type errors in tests 2016-12-19 10:36:25 +02:00
19ee47ba24 got to layouts 2016-12-13 15:51:18 +02:00
3c9a2c7fa6 Foreground activity cleared on activity destroyed. 2016-11-15 11:59:45 +02:00
fd09a0c66c Remove console.log() leftover 2016-10-25 11:13:44 +03:00
20dc0b1ef5 Snapshot fix 2016-10-14 11:33:58 +03:00
1c4f40333e Application and ActivityEvents improvements 2016-10-11 18:40:03 +03:00
c4be6ce1de Fix LaunchTheme not cleared in some cases 2016-10-05 16:33:18 +03:00
ebcc3711d8 Add a mechanism the launch screen theme to be reset after launch 2016-07-27 14:44:22 +03:00
5a40b08bc3 CSS livesync fixed 2016-06-16 14:27:43 +03:00
192171232e Fix android orientation exception. (#2278)
Fix android activity destroy/resume.
Fix tslint - skipped all from node_modules & platforms
2016-06-09 14:02:15 +03:00
87b0f53c3d Remove redundant comment. Fix native method call. 2016-06-03 16:27:17 +03:00
36da401684 Remove the android.app.Application extend from the core modules. This will enable various scenarios where custom application implementation is needed. 2016-06-03 15:34:37 +03:00
caebf280ab LiveSync improved 2016-05-27 16:58:46 +03:00