45 Commits

Author SHA1 Message Date
4166e2d966 fix: expose orientation to application module (#7832) 2019-09-19 18:49:07 +03:00
d23ffb8dbf fix-next(css): className to preserve root views classes (#7725) 2019-08-30 09:09:35 +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
c2656a4be4 chore: update application private apis (#7413) 2019-06-27 13:16:43 +03:00
b20e771552 chore: remove deprecated apis for ns 6.0 (#7382) 2019-06-25 16:52:01 +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
b436ecde36 refactor: replace var usage with let/const (#7064) 2019-03-25 18:09:14 +02:00
cf07b2719f chore: update deprecations (#7046) 2019-03-21 14:25:36 +02:00
f34068d59b fix(angular): Re-add references to tns-core-modules.d.ts (#6949)
They were removed in #6927 because we thought they were
unnecessary.
2019-02-21 09:43:38 +02:00
5449cfa238 fix(docs): Move NativeScriptError declaration to a separate file (#6927)
It is used by `application.d.ts` and needs to be documented. The reason
that it wasn't included in the documentation by now is that `tns-core-modules.d.ts`
(which imports `module.d.ts`) defines types which are part of the internal
modules and runtimes APIs. As such they are excluded from the generation
of API documentation.
2019-02-20 13:58:09 +02:00
28db2afbd4 feat: OnDiscardedError typings and event (#6777)
* feat: OnDiscardedError typings and event

* remove ios and android from DiscardedErrorEventData
2019-01-09 18:24:25 +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
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
0c8275fa06 refactor: unmark startActivity as deprecated (#5405)
https://github.com/NativeScript/NativeScript/issues/5307
2018-02-08 17:44:53 +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
f7a3a36b9c Housekeeping node tests, renamed to unit-tests (#4936)
Add parsers for the background css shorthand property, make ViewBase unit testable in node environment

Add background parser and linear-gradient parser

Use sticky regexes

Simplify some types, introduce generic Parsed<T> instead of & TokenRange

Apply each parser to return a { start, end, value } object

Move the css selector parser to the css/parser and unify types

Add the first steps toward building homegrown css parser

Add somewhat standards compliant tokenizer, add baseline, rework and shady css parsers

Enable all tests again, skip flaky perf test

Improve css parser tokenizer by converting some char token types to simple string

Implement 'parse a stylesheet'

Add gonzales css-parser

Add parseLib and css-tree perf

Add a thin parser layer that will convert CSS3 tokens to values, for now output is compatible with rework

Make root tsc green

Return the requires of tns-core-modules to use relative paths for webpack to work

Implement support for '@import 'url-string';

Fix function parser, function-token is no-longer neglected

Make the style-scope be able to load from "css" and "css-ast" modules

Add a loadAppCss event so theme can be added to snapshot separately from loaded
2017-10-20 10:42:07 +03:00
c98443b331 Fix breaking change - nativeView property should have setter (#4750)
Exposed savedInstanceState on LaunchEventArgs so some controls that need Bundle to initialize could get it from there.
2017-08-25 11:13:51 +03:00
6e06eba218 Fixed a bunch of typo's and minor errors in TypeScript definition files. (#4707)
* Fix a bunch of typo's and minor errors in TypeScript definition files.

* Implemented the requested change by @hshristov
2017-08-21 11:22:04 +03:00
7eb9cbfcb0 My IDE was screaming at me that commas were unacceptable here.. so I made it shut up 🤐 (#4641) 2017-08-04 11:59:42 +03:00
610794f709 Add 'displayed' event on application for iOS 2017-05-16 16:10:50 +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
0cae034a64 Changing module docs so they can appear in typedoc. 2017-05-10 11:55:47 +03:00
d098ff43f5 Add module names for the typedoc, make it work
Mark members with @private for typedoc.
2017-04-20 16:58:30 +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
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
d38e99cabd Expose hasLaunched() on the application, style-scope will load css-es if app hasLaunched 2017-03-13 10:57:51 +02:00
b487aa0790 Fix application.cssFile var, promoted to get/set function 2017-03-09 13:47:36 +02:00
b45cbe929b No more ambient modules for tns-core-modules/* subpackages.
- Use path mappings in tsconfig.json to resolve module typings
- Only use ambient mobules for global API's
- Move single-file modules to a subdir with the same name so that
we can provide a hand-written typing next to it (via package.json)
- Delete all mentions of tns-core-modules.d.ts
- Delete reference d.ts assembly build steps. Not needed anymore.
- HACK! Use a <reference> for global typings in application.d.ts
to avoid publishing a separate @types/tns-core-modules package.
- Rename declarations.d.ts to tns-core-modules.d.ts to preserve
JS project mappings in references.d.ts (the only place we use those)
2017-03-07 17:59:02 +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
295f9a432f apps app can now compile 2016-12-20 11:35:04 +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
0b7ea27fd5 Export set function for cssFile and resources. 2016-11-25 14:55:22 +02:00
303b609573 Adding request for write storage permissions. 2016-11-22 14:34:14 +02:00
c521f2db33 Merge pull request #2877 from NativeScript/existing-app
Existing iOS integration app support added
2016-10-14 09:38:11 +03:00
eab903e9e0 Existing iOS integration app support added 2016-10-13 18:15:24 +03:00
1c4f40333e Application and ActivityEvents improvements 2016-10-11 18:40:03 +03:00
c1aeeb51a7 Inital by-type split
Split type.class from CssTypeSelector to CssCompositeSelector, probably support type#id.class selectors

Apply review comments, refactor css-selectors internally

Applied refactoring, all tests pass, button does not notify changes

Add tests for the css selectors parser.

Added tests for css-selectors

Added basic implementation of mayMatch and changeMap for css match state

Implemented TKUnit.assertDeepEqual to check key and key/values in Map and Set

Watch for property and pseudoClass changes

Add one child group test

Add typings for animations

Added mechanism to enable/disable listeners for pseudo classes

Count listeners instead of checking handlers, reverse subscription and unsubscription
2016-07-18 17:24:09 +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
e135c20b14 Rename the files 2016-05-26 14:30:25 +03:00