101 Commits

Author SHA1 Message Date
d35e14ed0f feat(hmr): preserve navigation history on applying changes (#7146) 2019-04-23 17:47:29 +03:00
663dbb9dae chore: add deprecation console warnings (#7098) 2019-04-03 16:15:31 +03:00
3efc06ed98 feat(android): implement a 'activityNewIntent' event 2019-04-03 11:06:14 +03:00
4f0d6d36e3 refactor: guard ng and vue entry points (#7071) 2019-03-26 12:35:43 +02:00
26679d42ff refactor(): add better err msg for missing main entry (#7063) 2019-03-25 14:07:23 +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
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
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
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
0bf6dc2e93 fix(android): nested frames on app suspend/resume (#6339) 2018-10-04 14:31:57 +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
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
b0afd3ab30 fix(android): prevent error during tear down (#5947) 2018-06-14 10:01:03 +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
4f5887b0ad fix(android): lollipop crash on changing activity context after navigation w/transition (#5700) 2018-04-20 13:46:03 +03:00
e43c7546bd fix-next(frame): remove current entry fragment on reset root view (#5533)
* chore(e2e): add @types as devDependencies

Update `tsconfig.json` file.

* fix-next(frame): remove current entry fragment on reset root view

* refactor(e2e): undo skip tab root tests

* refactor(frame): extract disposeCurrentFragment() method

Extract the common logic from _onRootViewReset() and onUnloaded() methods to avoid code duplication.
2018-03-14 19:56:15 +02:00
cf8dcfa40c feat(view): expose method for android back override (#5537)
Expose method on View class onBackPressed(). Third party controls
like RadSideDrawer can use this method to override the default Android
back button handling. By default the app closes.
2018-03-14 18:15:05 +02:00
dfa70dd384 feat(frame): rework frame retrieval api (#5527)
Rework the frame api to support working with multiple Frames.
* frameModule.topmost() - now returns the last navigated Frame or
the currently selected tab item's Frame if the tab item's view is a
Frame.
* frameModule.getFrameById(id: string) - returns a navigated Frame by id.
* args.object.page.frame - can be used in page elements event handlers.
Returns the Frame of the current element's page.
* chore: Update madge-android npm script path
2018-03-13 18:10:45 +02:00
8141737f74 fix-next(tabview): visually pre-load tab items on android (#5495) 2018-03-08 14:39:59 +02:00
27622d83ba fix-next: ensure proper events on tab change (#5468) 2018-02-28 10:40:05 +02:00
4ce45666a5 test: add reset root view tests (#5437) 2018-02-21 11:38:37 +02:00
2edef3de3b fix(frame): root tabview with modal frame when suspend/resume app (#5408) 2018-02-12 16:09:51 +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
2b843195e4 fix-next(android-tabview): handle tab fragments attach/detach properly (#5333) 2018-01-29 17:25:36 +02:00
9d7f0e5315 fix(frame): recreate frame if no cached one found on app resume #5318 (#5330) 2018-01-25 11:37:47 +02:00
016c64fe04 showModal & closeModal can be called on any View
fix livesync implementation to be compatible with 3.4 and to replace mainEntry for 4.0 when root is not Frame
some refactoring of page.ios in order to allow showing multiple modal dialogs
2018-01-18 13:34:25 +02:00
9dd3e1a807 Fix crash with nested frames navigation when aactivity is recreated. We now check if frame native view is atached to window before running navigation.
Livesync now recreates the main page instead of calling frame.navigate
2018-01-15 18:07:20 +02:00
ef86addd6d Fix Page to be styleScope if frame is not 2018-01-12 10:23:54 +02:00
3384112ce8 When application start is called we don't set Frame to be styleScope
Added requestLayout for TextView
Round desiredSize in nativeMeasure
2018-01-09 13:17:50 +02:00