182 Commits

Author SHA1 Message Date
cf07b2719f chore: update deprecations (#7046) 2019-03-21 14:25:36 +02:00
b40f027f10 Merge branch 'master' into mdonev/release-to-master-7011 2019-03-15 18:35:41 +02:00
91d90ccd0f fix: navigation b/n single and nested frame pages (#7011) 2019-03-15 15:38:04 +02:00
3c2c1d9b69 feat(HMR): style views at runtime (#7012)
* feat(HMR): style view at runtime

test: module root view component

test: update livesync tests

refactor: _onLivesync function

* style: remove a comment

* refactor: rename the property
2019-03-13 13:24:49 +02:00
2247e6d28b Merge branch 'release' into mdonev-merge-release-resourceid-fix 2019-02-22 15:37:32 +02:00
33d6d1f228 fix(android): resource ID #0xffffffec not found on nav (#6955) 2019-02-22 15:00:24 +02:00
07194225b3 Merge branch 'master' into merge-release-master-5.2.1 2019-02-19 11:53:30 +02:00
44b8acd79c feat(HMR): apply changes in page styles at runtime when app root is a frame (#6857)
* feat(HMR): apply changes in page styles at runtime

* fix: livesync tests

* test: changeCssFile method

* refactor: address comments

Add a comment.
Update `let` to `const`.
Update `changesCssFile` test.

* test: add an assert
2019-02-14 14:03:13 +02:00
57f07a3ec7 fix(frame-ios): tearDownUI when UINavigationController disappear (#6892) 2019-02-13 15:11:04 +02:00
cea97c6b45 fix(ios-frame): tearDownUI and reset UINavigationController (#6817) 2019-02-06 22:11:13 +02:00
1f1d722008 fix(Android): a crash on application restart after livesync changes (#6756)
```
An uncaught Exception occurred on "main" thread.
com.tns.NativeScriptException:
Calling js method run failed

TypeError: Cannot read property 'getRootView' of undefined
File: file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js, line: 56, column:29
```
2019-01-08 21:03:28 +02:00
46c9de020e fix(android): raise resume event on activity.onPostResume() (#6766) 2019-01-08 15:20:11 +02:00
4dc35a5e6f fix(android): failure saving state in mixed parent/nested frame nav (#6719) 2018-12-18 10:23:02 +02:00
c034d6ead6 fix(android): animator restore logic on simulated nav (#6710) 2018-12-17 15:27:52 +02:00
790bcfb470 refactor(HMR): apply changes in application styles at runtime 2018-12-14 14:34:50 +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
c084660d0b fix(android): nested fragment disappears on parent fragment removal (#6677) 2018-12-12 14:16:10 +02:00
5b9b335489 fix(android-fragment): child already has a parent (#6589) 2018-11-23 14:48:41 +02:00
fc1f8c1e42 fix(back-navigation): app freeze on going back in parent frame with states (#6595)
Endless loop while searching for parent frame that can go back.
Caught in Angular app when trying to go back from nested named lazy loaded outlet using the android hadrware back button.
2018-11-23 10:05:49 +02:00
efe331862f fix: doc of transitionAndroid property of NavigationEntry interface (#6563) 2018-11-15 20:10:29 +00:00
7df8038d09 fix: nested frames order with tabs & suspend/resume (#6528) 2018-11-14 10:20:52 +02:00
41ba93de41 fix(android): IllegalStateException with tabview&nested frames (#6495) 2018-11-05 16:17:51 +02:00
fac970e753 fix(android): back navigation on app suspend/resume (#6489) 2018-11-02 17:31:52 +02:00
95c4ec5a96 Revert "fix-next(android): restore fade animation for simulated nav (#6463)" (#6473)
This reverts commit 448936d6e6bf03c79e17648e8912a4f0eea0b43f.
2018-10-29 19:43:34 +02:00
448936d6e6 fix-next(android): restore fade animation for simulated nav (#6463) 2018-10-26 17:09:19 +03:00
e48782511d fix-next: handle action bar safe area nesting (#6455) 2018-10-26 14:05:14 +03:00
4765dd9302 fix-next(android): exit fragment animation (#6421) 2018-10-26 13:32:30 +03:00
0002624d3c feat(frame): add new actionBarVisibility property (#6449) 2018-10-24 14:51:43 +03:00
af651d6e83 feat(frame): hardware back in parent frame when back states available (#6446) 2018-10-24 10:18:50 +03:00
c8c0be7684 refactor: restore animators api usage (#6403) 2018-10-16 15:37:57 +03:00
307172003d fix: nested fragments interact thru child fragment manager (#6293) 2018-10-11 17:44:30 +03:00
436a318de5 fix(android): second livesync (#6330) 2018-10-04 15:57:11 +03:00
0bf6dc2e93 fix(android): nested frames on app suspend/resume (#6339) 2018-10-04 14:31:57 +03:00
46705ee332 refactor(core-modules): implement createNativeView and initNativeView for all components
refactor(core-modules): implement createNativeView and initNativeView for all components
2018-09-26 13:59:12 +03:00
71107533bb refactor: guard livesync for cases the app is not yet started (#6276) 2018-09-20 09:47:53 +03:00
6c9fa16f6e fix(android): parallel navigations should not be triggered (#6275) 2018-09-18 11:25:31 +03:00
12fade7155 fix: Page and Frame isLoaded undefined checks (#6255)
* fix(view): isLoaded handling

closes https://github.com/NativeScript/NativeScript/issues/6179

* refactor: Error handling code in onCreateView
2018-09-17 15:37:29 +03:00
cca548d31a refactor: AndroidFrame.hasOwnActivity cleanup (#6241) 2018-09-10 11:25:08 +03:00
0f2192d4d7 refactor: clean up unused sdkVersion lazy eval (#6194) 2018-08-17 17:04:44 +03:00
22cb539c9d fix(android-next): force frame fragment disposal on unload (#6189) 2018-08-17 11:31:44 +03:00
cc19b400b9 fix(android): suppress reflection for default animations (#6141)
Fixes `Error: java.lang.CloneNotSupportedException: Class android.support.v4.app.FragmentManagerImpl$AnimationOrAnimator doesn't implement Cloneable` in specific projects.

Related to #5785
Related to #6129 

BREAKING CHANGE


Before:
Default fragment enter animation was Android version specific

After:
Default fragment enter animation is now fade animation for all Android versions

You can customise the transition per navigation entry or globally via the [navigation transitions API](
https://docs.nativescript.org/core-concepts/navigation#navigation-transitions)
2018-08-02 16:01:52 +03: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
feaf1408a4 chore(android): update AndroidP sdk version check (#6093) 2018-07-23 13:57:14 +03:00
8813e9bc57 fix: require devtools-elements.js with the extension mentioned explicitly (#6079)
This is a workaround for the issue with `@ngtools/webpack@6.1.0-rc.2`, described here: https://github.com/NativeScript/nativescript-dev-webpack/issues/607#issuecomment-405209925
2018-07-18 11:38:22 +01:00
398c9b3f33 feat(typings): Adding Android typings for API levels from 17 to 27 (#5890)
Adding android typings for API levels from 17 to 27

BREAKING CHANGES:
There is no longer added `I` prefix in the names of the interfaces. For example `android.view.IMenuItem` is now `android.view.MenuItem`. This matches the original name of the interface in the android framework.
2018-07-05 18:36:23 +03:00
b0afd3ab30 fix(android): prevent error during tear down (#5947) 2018-06-14 10:01:03 +03:00
7851629a27 fix: crash at application launch on Android P (#5831)
* fix: crash at application launch on Android P

Reference: https://developer.android.com/preview/restrictions-non-sdk-interfaces

Android P introduces new restrictions on the use of non-SDK interfaces, whether directly, via reflection, or via JNI. These restrictions are applied whenever an app references a non-SDK interface or attempts to obtain its handle using reflection or JNI.

In particular, remove reflection via Class.getDeclaredField() and fallback default transition to fade transition.

* refactor: create default transition based on SDK version

Create default transition and setup default animations based on SDK version.
This is to avoid reflection via Class.getDeclaredMethod() for Android P where it throws.

* refactor: extract isAndroidP method
2018-05-23 14:59:24 +03:00
a86d41e7db fix(android): fix sporadic issue with transition cleanup logic called twice (#5805) 2018-05-14 18:11:02 +03:00
2fc1d8a8d4 chore(tsc): enable noUnusedLocals compiler option for tns-core-modules (#5755) 2018-05-10 16:12:59 +03:00
03cfc0cee3 chore(tslint): update tslint rules and fix errors (#5747)
* chore(tslint): fix tslint config & errors
* chore(tslint): enable double quotes, whitespace, and arrow-return-shorthand rules and fix errors
2018-04-26 18:36:32 +03:00