Skip to content

Commit 5eee8ff

Browse files
Merge pull request #100 from telerik/amiorkov/migration-4.0
Migrate to latest NativeScript and add "root" RadSideDrawer
2 parents 83664b5 + 1eccccf commit 5eee8ff

22 files changed

+189
-380
lines changed

Diff for: sdkAngular/app/App_Resources/Android/AndroidManifest.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
android:icon="@drawable/icon"
2525
android:label="@string/app_name"
2626
android:theme="@style/AppTheme" >
27-
27+
2828
<activity
29-
android:name="org.nativescript.sdkAngular.MainActivity"
29+
android:name="com.tns.NativeScriptActivity"
3030
android:label="@string/title_activity_kimera"
3131
android:configChanges="keyboardHidden|orientation|screenSize"
3232
android:theme="@style/LaunchScreenTheme">

Diff for: sdkAngular/app/app.css

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import '~nativescript-theme-core/css/core.light.css';

Diff for: sdkAngular/app/app.module.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ import { NativeScriptModule } from "nativescript-angular/nativescript.module";
22

33
// >> using-global-directives
44
// --- The built-in 'nativescript-pro-ui' modules, if you are not using 'lazy' loading, uncomment and import the below modules into the 'imports' of the first ngModule (AppModule) of the app.
5-
// import { NativeScriptUISideDrawerModule } from "nativescript-ui-sidedrawer/angular";
6-
// import { NativeScriptUIListViewModule } from "nativescript-ui-listview/angular";
75
// import { NativeScriptUICalendarModule } from "nativescript-ui-calendar/angular";
86
// import { NativeScriptUIChartModule } from "nativescript-ui-chart/angular";
97
// import { NativeScriptUIDataFormModule } from "nativescript-ui-dataform/angular";
108
// import { NativeScriptUIAutoCompleteTextViewModule } from "nativescript-ui-autocomplete/angular";
119
// import { NativeScriptUIGaugesModule } from "nativescript-pro-ui/gauges/angular";
1210

1311
import { NativeScriptUIListViewModule } from "nativescript-ui-listview/angular";
12+
import { NativeScriptUISideDrawerModule } from "nativescript-ui-sidedrawer/angular";
1413

1514
// Not required imports, these are used by the nativescript-samples-angular SDK examples - https://github.com/telerik/nativescript-ui-samples-angular
1615
import { NativeScriptRouterModule, NSModuleFactoryLoader } from "nativescript-angular/router";
@@ -54,6 +53,7 @@ if (applicationModule.android) {
5453
CommonDirectivesModule,
5554
TNSFrescoModule,
5655
NativeScriptUIListViewModule,
56+
NativeScriptUISideDrawerModule,
5757
NativeScriptFormsModule,
5858
NativeScriptRouterModule,
5959
routing

Diff for: sdkAngular/app/app.routing.ts

-14
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,6 @@ let APP_ROUTES: Routes = [
187187
"title": "Getting Started"
188188
}
189189
},
190-
{
191-
path: "SideDrawerOverNavigationComponent",
192-
loadChildren: './sidedrawer/sidedrawer-examples.module#SideDrawerExamplesModule',
193-
data: {
194-
"title": "Over Navigation"
195-
}
196-
},
197-
{
198-
path: "SecondSideDrawerOverNavigationComponent",
199-
loadChildren: './sidedrawer/sidedrawer-examples.module#SideDrawerExamplesModule',
200-
data: {
201-
"title": "Over Navigation Second"
202-
}
203-
},
204190
{
205191
path: "SideDrawerEventsComponent",
206192
loadChildren: './sidedrawer/sidedrawer-examples.module#SideDrawerExamplesModule',

Diff for: sdkAngular/app/main-activity.android.ts

-42
This file was deleted.

Diff for: sdkAngular/app/main.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { platformNativeScriptDynamic } from "nativescript-angular/platform";
22
import { AppModule } from "./app.module";
3+
import * as application from "tns-core-modules/application";
34

45
platformNativeScriptDynamic().bootstrapModule(AppModule);

Diff for: sdkAngular/app/navigation/app.component.css

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.root-drawer-content {
2+
background-color: lightgray;
3+
}
4+
5+
.root-item-stack-layout {
6+
text-align: left;
7+
vertical-align: center;
8+
font-size: 16;
9+
color:#404040;
10+
}
11+
12+
.btn {
13+
margin: 0;
14+
}

Diff for: sdkAngular/app/navigation/app.component.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<RadSideDrawer>
2+
<GridLayout tkDrawerContent rows="auto, *" class="root-drawer-content">
3+
<StackLayout>
4+
<Label [text]="currentExample.title" class="h1 text-center"></Label>
5+
</StackLayout>
6+
<ListView row="1" [items]="currentExample.subItems" (itemTap)="onNavigationItemTap($event)" class="root-drawer-content">
7+
<ng-template let-item="item">
8+
<StackLayout class="root-item-stack-layout">
9+
<Label [text]="item.title" textWrap="true" class="btn btn-primary btn-active"></Label>
10+
<StackLayout height="1" class="root-drawer-content"></StackLayout>
11+
</StackLayout>
12+
</ng-template>
13+
</ListView>
14+
</GridLayout>
15+
16+
<page-router-outlet tkMainContent></page-router-outlet>
17+
</RadSideDrawer>

Diff for: sdkAngular/app/navigation/app.component.ts

+39-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,43 @@
1-
import { Component } from "@angular/core";
1+
import { Component, OnInit } from "@angular/core";
2+
import { RouterExtensions } from "nativescript-angular/router";
3+
import { RadSideDrawer } from "nativescript-ui-sidedrawer";
4+
import * as app from "application";
5+
import { ExampleItem } from "./exampleItem";
6+
import { ExampleItemService } from "./exampleItemService.service";
7+
import { ActivatedRoute, Router } from '@angular/router';
28

39
@Component({
10+
moduleId: module.id,
411
selector: "tk-app",
5-
template: "<page-router-outlet></page-router-outlet>"
12+
templateUrl: 'app.component.html',
13+
styleUrls: ['app.component.css']
614
})
7-
export class AppComponent {
8-
}
15+
export class AppComponent implements OnInit {
16+
private _currentExample: ExampleItem;
17+
18+
constructor(private _router: Router, private _exampleItemsService: ExampleItemService) { }
19+
20+
ngOnInit() {
21+
this._currentExample = this._exampleItemsService.getParentExampleItem(0);
22+
}
23+
24+
public get currentExample(): ExampleItem {
25+
return this._currentExample;
26+
}
27+
28+
public set currentExample(value: ExampleItem) {
29+
this._currentExample = value;
30+
}
31+
32+
public onNavigationItemTap(args: any) {
33+
var itemIndex = args.index;
34+
var tappedItem = this._currentExample.subItems[itemIndex];
35+
const sideDrawer = <RadSideDrawer>app.getRootView();
36+
sideDrawer.closeDrawer();
37+
if (tappedItem.subItems.length === 0) {
38+
this._router.navigateByUrl(tappedItem.path);
39+
} else {
40+
this._router.navigate(['/examples-depth-2', this._currentExample.title, tappedItem.title]);
41+
}
42+
}
43+
}

Diff for: sdkAngular/app/navigation/mock-exampleItems.ts

-5
Original file line numberDiff line numberDiff line change
@@ -441,11 +441,6 @@ export var EXAMPLEITEMS: ExampleItem[] = [
441441
"title": "Events",
442442
"path": "SideDrawerEventsComponent/SideDrawerEventsComponent",
443443
"subItems": []
444-
},
445-
{
446-
"title": "Drawer Over Navigation",
447-
"path": "SideDrawerOverNavigationComponent/SideDrawerOverNavigationComponent",
448-
"subItems": []
449444
}
450445
]
451446
},

Diff for: sdkAngular/app/sidedrawer/over-navigation/over-navigation.component.css

-36
This file was deleted.

Diff for: sdkAngular/app/sidedrawer/over-navigation/over-navigation.component.html

-26
This file was deleted.

Diff for: sdkAngular/app/sidedrawer/over-navigation/over-navigation.component.ts

-49
This file was deleted.

Diff for: sdkAngular/app/sidedrawer/over-navigation/second-page/second-over-navigation.component.css

-36
This file was deleted.

Diff for: sdkAngular/app/sidedrawer/over-navigation/second-page/second-over-navigation.component.html

-28
This file was deleted.

0 commit comments

Comments
 (0)