46 Commits

Author SHA1 Message Date
d985c33de3 chore: require relative path within tns-core-modules (#7367) 2019-06-28 18:23:39 +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
6d36041823 fix back navigation 2019-06-04 17:50:26 +03:00
7c22ffed45 fix(hmr): support for multi module replacement 2019-05-31 16:17:55 +03:00
d35e14ed0f feat(hmr): preserve navigation history on applying changes (#7146) 2019-04-23 17:47:29 +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
46c9de020e fix(android): raise resume event on activity.onPostResume() (#6766) 2019-01-08 15:20:11 +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
0002624d3c feat(frame): add new actionBarVisibility property (#6449) 2018-10-24 14:51:43 +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
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
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
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
ac04ede97e Implemented showModal on View 2017-12-15 13:08:15 +02:00
28f1a5875e Fix crash on android where we queue few back navigations an exception is thrown.
Fix https://github.com/NativeScript/NativeScript/issues/4986
2017-12-15 13:06:34 +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
7c68953009 Fix clear history transition (#4951)
* fix: Navigation test app added

* Removed native popToBackstack call.
Implemented custom fragment save/restore state.
When navigating back we reverse manually transitions/animations because we no longer add them to navite backstack.
Fragment instance stored on entry.
Animation and Transition listeners now holds reference to entry instead of fragment for easier update of fragment.
Animation and Transition listeners removed when entry removed from backstack.
Animation and Transition removed from fragment when fragment activity is destroyed.

* Revert package.json start up entry
Fixed bug where goBack took the last element in backstack while navigationQueue is not empty.
Fixed bug where goBack to specific entry in the backstack was removing that entry...
Removed duplicated method
Refactored method name
Fixed TS
2017-10-20 08:37:36 +03:00
cf48c9f6dd edit broken link (#4799) 2017-09-05 18:22:26 +03:00
bba7a82bdf Disable recycling, refactoring & fixes (#4705)
* Added tests for native view recycling
Disabled android native view recycling
Move toString from view-common to view-base
Fix crash on application restore and navigation back on API26
Added setAsRootView method
Added missing logo into perf-tests/recycling app

* additional fix for image-source-tests. ios is case sensitive.

* Add @private to some internal properties
Fix where padding is not respected when background is reset.
2017-08-17 09:15:35 +03:00
075e70e336 cache page on forward navigation (#4652)
* cache page on forward navigation
Still some failing navigation tests

* Current page is kept alive when navigating forward
Refactoring code and removing all hacks and flags
Remove one module circular reference

* Disable Page recycling because when there is transition between pages the nativeView stays animated (e.g. when transition is Fade the hidden page nativeView stays with Alpha 0)
Disable recycling if there is native anitmation

* Fix failing tests on ios & android API17
Fix wrong urls in http tests
Made some timer tests async

* Animations are not stored in BackstackEntry instead of Fragment because fragments could die (activity die) and recreated and we lose animations.

* Fix android crash when activity is recreated.
Refactoring transitionListener.
2017-08-07 17:24:12 +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
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
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
d448f3dc7f Animated nav-bar 2017-01-25 10:48:48 +02:00
19ee47ba24 got to layouts 2016-12-13 15:51:18 +02:00
befb494a50 up to segmented-bar.ios 2016-12-13 15:51:18 +02:00
1202cb7288 almost all without layouts 2016-12-13 15:51:18 +02:00
d795ee94e4 alpha2 2016-12-13 15:51:18 +02:00
bb2c7aa60a partial state 2016-12-13 15:51:18 +02:00
c84dc3e57b Small typo
-typo
-add android api number
2016-10-11 17:38:22 -05:00
682c465e56 setActivityCallbacks moved as public fucntion (#2696) 2016-09-09 14:03:55 +03:00
39050861f3 Add NavigationEntry.bindingContext property
Resolves Issue  #731
2016-07-19 12:06:29 +03:00
b0aee9d7a9 Fix: The navigation bar duplicates when going to TabView's "More" tab
Resolves #2121
2016-06-27 16:23:54 +03:00
1a88cf0e8c Fix frame.d.ts to not expose public android types. 2016-06-16 13:08:32 +03:00
a95d8c5c32 Fix android activity being destroyed then recreated. (#2321) 2016-06-16 09:30:35 +03:00
2740be2b05 Add API ref comments. 2016-06-13 11:10:15 +03:00
ef0577ed56 Decouple Fragment implementation logic from the Extend call. 2016-06-10 18:01:47 +03:00
92d66f6938 Extract the Activity implementation logic in a separate class. 2016-06-08 17:04:37 +03:00
9a8542869e Add fragmentForPage method to AndroidFrame interface. 2016-05-30 16:10:46 +03:00
e135c20b14 Rename the files 2016-05-26 14:30:25 +03:00