404 Commits

Author SHA1 Message Date
ec24c5a96f fix(list-view): Layout list-view items on request (#6159)
* test: list items relayout example

* fix(list-view): Layout list-view items on request

* refactor(tests): refactor list-view tests imports
2018-08-09 18:19:56 +03:00
9c67d7ba02 chore(tests): increased wait-timeout for tests for slower ad emulators (#6172) 2018-08-09 15:49:19 +03:00
85b8c018a5 feat(styling): Added 2 functions to control applicationAdditionalSelectors (#6124)
* Added getAdditionalSelectors function so that nativescript-theme can be functional again in NS 4.x

* Change to a better more extensible additional css system.

* removed redunant function on the name.

* Fix lint issues

* Adding mergeSelectors to the remove function

* Added test of new add/remove css functions.

* fix: revert testRunner.ts changes that disabled all tests except style

* refactor: fix typo

* chore: fix typo and change test to no not affect global styles
2018-08-02 11:51:07 +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
81e63ee19e feat(image-asset-ios): add autoScaleFactor option to switch auto scaling (#6127) 2018-07-31 10:12:27 +03:00
7e89f942b4 fix(android): HEAD request should return statusCode 2018-07-30 16:37:08 +03:00
6ce1d22d9a feat(CSS): import of relative paths (#6023)
* feat(CSS): import of relative paths

* refactor: address comments
2018-07-21 05:54:32 +03:00
d53c6b3863 chore: add test for http gzip request (#6076) 2018-07-18 08:36:12 +03: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
3dc3a411c3 feat: Flexible Error/Exception handling (#5929)
* feat: trace.error() implementation

* refactor: Based on PR review

* chore: adding error-handling guide

* docs: fix typos
2018-06-18 16:37:55 +03:00
a75505fbc0 test(): move the tab view tests before frame tests (#5957) 2018-06-15 19:29:08 +03:00
69b3eb70d5 test(): add more timeout to tab navigations tests (#5953) 2018-06-14 13:19:06 +03:00
0e04cb4ad1 fix(android): NavigationButton was read as "Button" by screenreaders. (#5949)
The navigation button for the vision-impaired users were always read as:
"Button" by the TalkBack service on Android.
2018-06-14 12:54:33 +03:00
0b9d4aea0a fix(android): label width shrinking on shorter text change (#5917) 2018-06-07 16:44:33 +03:00
b122bd4a37 fix(ios): set current tab as topmost frame on load (#5908) 2018-06-06 14:47:42 +03:00
c3a7c815e5 chore(layout-changed): update layoutChanged event tests delay 2018-05-23 00:54:29 +03:00
0fc1547a19 feat(view): introduce LayoutChanged event on every View component (#5825)
* feat(view): introduce LayoutChanged event

* test(view): add LayoutChanged event tests

* chore(view-android): attach to onLayoutChange only if listener attached

* feat(view-android): override on/off in order to attach and detach from OnLayoutChangeListener
2018-05-21 17:22:40 +03:00
1365f13594 fix(modal): innerView.closeModal(...) not passing back context (#5833) 2018-05-18 16:50:27 +03:00
2168c36a5f tests: disable all tests related to outside urls (#5800) 2018-05-09 13:17:32 +03:00
d58665115b test(platform): fix typo in platform module cookbook example (#5758)
* test(platform): add missing properties to platformModule documentation

The platformModule cookbook documentation was missing a few properties
that are now available. This commit adds those properties to be
included in the examples.

resolves: NativeScript/NativeScript#5707

* test(platform): fix typo in platform module cookbook example
2018-04-30 10:49:54 +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
451589dbd6 fix(modal): exception when calling ViewBase.showModal(...) (#5737) 2018-04-26 00:19:44 +03:00
0fd0812ede test(platform): add missing properties to platformModule documentation (#5709)
The platformModule cookbook documentation was missing a few properties
that are now available. This commit adds those properties to be
included in the examples.

resolves: NativeScript/NativeScript#5707
2018-04-25 14:05:30 +03:00
49ea10b81e fix(layout): IOS Layout not invalidated with custom root (#5724)
* fix(layout): Buuple up layout trough viewControllers

* test: Layout invalidates correctly with different root view

* chore: tslint
2018-04-23 15:47:27 +03:00
6bdb5b553f feat(file-system): add ability to retrieve file size (#5710) 2018-04-20 18:01:15 +03:00
a616dbb9bb Updated weak event listener tests for v8 6.5 (#5697)
* Updated weak event listener tests for v8 6.5

* added missing parentheses
2018-04-18 16:57:26 +03:00
cf950e1ebb fix(navigation): fix frame.navigate call inside page.navigatedTo handler (#5649) 2018-04-11 11:25:54 +03:00
c06d5bae63 chore: set keepAspectRatio to true as default in image-asset (#5613)
* chore: set keepAspectRatio to true as default in image-asset

* fix: remove empty lines
2018-04-10 00:46:27 +03:00
a316e53d54 new tabview examples (#5628)
* new tabview exmples

* tabs limit example

* minor code snippet edits
2018-04-05 17:35:36 +03:00
81a2cbd0fe refactor(ios): clean up iOS8 or lower specific checks in codebase (#5581) 2018-03-26 13:37:21 +03:00
4b244921d4 feat(List-View) : Add the ability to check if an item is visible or not. (#5557)
* feat(list-view): Adds the ability to check whether or not an Item at index is Visible on screen within a listView

* feat(list-view): add the unit-test for checking if list-item is visible.

* clean(list-view): fix invalid reference in list-view-common

* chore(list-view): remove unused logic

* test(list-view) updates the tests for checking if item at index is visible

* chore(ListView Tests): update the test_check_if_item_at_index_is_visible unit test to include 40 children, and test if the last item is visible or not.

* Chore(ListView IOS): Apply requested changes to the for-loop, and replace with Array.some for readability.

* chore(ListView android): Fix TSLint issues.
2018-03-21 07:18:01 +01:00
7506905770 fix(image): image aspect dimensions for ImageSource.fromAsset(...) (#5556) 2018-03-19 17:01:26 +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
319c153360 feat(ios-image-source): standardize quality scale in image-source (#5517)
* feat(ios-image-source): standardize quality scale in image-source for both platforms

Normalize quality in saveToFile and toBase64String to follow 0-100 scale - standardize implementation on both platforms

closes #5474
2018-03-13 15:19:24 +01:00
fa80355464 fix(animations): change throw -> trace to avoid unnecessary app crash (#5475)
* fix(animations): change throw -> trace to avoid unnecessary app crash

Fixes major cause of crashes/bugs in production apps using animation.

* Fix fix animation throw (#1)

* chore(tests): Cleanup code snippets comments

* refactor(animations): Plat-specific cancel and play methods refactored
2018-03-08 20:42:33 +02:00
8141737f74 fix-next(tabview): visually pre-load tab items on android (#5495) 2018-03-08 14:39:59 +02:00
fb5c97cf57 fix-next(css): CSS not applied to "drawerContent" when RadSideDrawer is used as root (#5466)
* fix(XMLBuilder): Pass the "module path name" when building "custom component"
* test(root-view): root view css applied tests
2018-03-01 15:55:21 +02:00
2704915384 fix(frame): add generic frame cleanup logic after modal dialog close (#5479) 2018-03-01 10:37:26 +02:00
a94ec9946f Improve ImageAsset scaling (#5110)
* Do not depend on current device screen while calculating Image Asset size.

* Scale the image asset to the exact requested size.

* Process image assets natively, pass keepAspectRatio based on the stretch property and Asset options.

* Fixed the splashscreen resource name as it cannot be read when containing a dot.

* Updated the Image Asset scale and rotate logic based on the Native one.

* Make the ImageAsset size more important than the Image decode size as its more specific.

* Fixed tslint errors.

* Added filePath support in the ImageAsset constructor for iOS in order to unify it with the Android implementation, support for relative files and file not found support errors.

* Added unit tests for ImageAssets.

* Added a sample app for UI testing of image-view with ImageAsset src.

* chore: apply PR comments
2018-02-28 14:04:01 +02:00
27622d83ba fix-next: ensure proper events on tab change (#5468) 2018-02-28 10:40:05 +02:00
4898c33a04 fix-next(modal) fix crash when closing modal dialog with root tabview inside (#5446) 2018-02-23 16:46:49 +02:00
9423ae40fa test: Fixed unstable timer test (#5449) 2018-02-21 13:07:26 +02:00
4ce45666a5 test: add reset root view tests (#5437) 2018-02-21 11:38:37 +02:00
625d801014 hiding cookbook/ui/action-bar article in favor of ui/action-bar (#5404)
* hiding cookbook/ui/action-bar article in favor of ui/action-bar

* removing action-bar article from cookbook
2018-02-20 16:43:45 +02:00
68d86fb6c6 fix(profiling): resetProfiles doesn't reset all profiles (#5425) 2018-02-19 13:18:50 +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
f27d5f212f edit cookbook/image article improve code snippets (#5396) 2018-02-07 18:42:36 +02:00
7121eaea89 refactor: update image source documentation snippets and tests (#5390) 2018-02-07 14:58:28 +02:00
85dc75e09a fix-next: navigation events' workflow in modal dialog scenarios (#5341) 2018-02-06 19:18:28 +02:00