Skip to content

Commit b9e5bd5

Browse files
corrected
1 parent 4dbfa74 commit b9e5bd5

File tree

4 files changed

+74
-44
lines changed

4 files changed

+74
-44
lines changed

README.md

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,47 @@
1-
# Nativescript Intro Slides for iOS and Android
2-
###_Not just for intro slides any more! Great for **Image Carousels** too!_ ###
3-
4-
[![Nativescript Intro Slides. Click to Play](https://img.youtube.com/vi/1AatGtPA6J8/0.jpg)](https://www.youtube.com/embed/1AatGtPA6J8)
1+
# NativeScript Slides for iOS and Android
2+
###_The plugin formally known as nativescript-intro-slides_
3+
[![Nativescript Slides. Click to Play](https://img.youtube.com/vi/1AatGtPA6J8/0.jpg)](https://www.youtube.com/embed/1AatGtPA6J8)
54

65
##Example Usage:
76
###XML
87
```xml
98

10-
<IntroSlides:IntroSlides>
11-
<IntroSlides:Slide class="intro-slide-1">
9+
<Slides:SlideContainer>
10+
<Slides:Slide class="slide-1">
1211
<Label text="This is Panel 1" />
13-
</IntroSlides:Slide>
14-
<IntroSlides:Slide class="intro-slide-2">
12+
</Slides:Slide>
13+
<Slides:Slide class="slide-2">
1514
<Label text="This is Panel 2" />
16-
</IntroSlides:Slide>
17-
<IntroSlides:Slide class="intro-slide-3">
15+
</Slides:Slide>
16+
<Slides:Slide class="slide-3">
1817
<Label text="This is Panel 3" />
19-
</IntroSlides:Slide>
20-
<IntroSlides:Slide class="intro-slide-4">
18+
</Slides:Slide>
19+
<Slides:Slide class="slide-4">
2120
<Label text="This is Panel 4" />
22-
</IntroSlides:Slide>
23-
<IntroSlides:Slide class="intro-slide-5">
21+
</Slides:Slide>
22+
<Slides:Slide class="slide-5">
2423
<Label text="This is Panel 5" />
25-
</IntroSlides:Slide>
26-
</IntroSlides:IntroSlides>
24+
</Slides:Slide>
25+
</Slides:SlideContainer>
2726

2827
```
2928
###CSS
3029
```css
31-
.intro-slide-1{
30+
.slide-1{
3231
background-color: darkslateblue;
3332
}
3433

35-
.intro-slide-2{
34+
.slide-2{
3635
background-color: darkcyan;
3736
}
38-
.intro-slide-3{
37+
.slide-3{
3938
background-color: darkgreen;
4039
}
4140

42-
.intro-slide-4{
41+
.slide-4{
4342
background-color: darkgoldenrod;
4443
}
45-
.intro-slide-5{
44+
.slide-5{
4645
background-color: darkslategray;
4746
}
4847
Label{
@@ -53,18 +52,22 @@ Label{
5352
}
5453

5554
```
55+
Great for Intros/Tutorials to Image Carousels.
56+
57+
To use the intro slide plugin you need to first import it into your xml layout with `xmlns:Slides="nativescript-slides"`
5658

57-
To use the intro slide plugin you need to first import it into your xml layout with `xmlns:IntroSlides="nativescript-intro-slides"`
59+
when using the intro slide plugin you need at least two ``<Slides:Slide>`` views inside of the ``<Slides:SlideContainer>``.
5860

59-
when using the intro slide plugin you need at least two ``<IntroSlides:Slide>`` views inside of the ``<IntroSlides:IntroSlides>``.
61+
add as many ``<Slides:Slide>`` as you want.
6062

61-
add as many ``<IntroSlides:Slide>`` as you want.
63+
the `SlideContainer` class also has public `nextSlide` and `previousSlide` functions so you can add your own previous and next buttons as needed.
6264

63-
the `IntroSlides` class also has public `nextSlide` and `previousSlide` functions so you can add your own previous and next buttons as needed.
65+
the `<Slides:SlideContainer>` element also has a property called `loop` which is a boolean value and if set to true will cause the slide to be an endless loop. The suggested use case would be for a Image Carousel or something of that nature.
6466

65-
the `<IntroSlides:IntroSlides>` element also has a property called `loop` which is a boolean value and if set to true will cause the slide to be an endless loop. The suggested use case would be for a Image Carousel or something of that nature.
67+
the `<Slides:SlideContainer>` element also has a property called `interval` which is a integer value and the value is in milliseconds. The suggested use case would be for a Image Carousel or something of that nature which can change the image for every fixed intervals. In unloaded function call page.getViewById("your_id").stopSlideshow() to unregister it (your_id is the id given to `<Slides:SlideContainer>`).
6668

67-
the `<IntroSlides:IntroSlides>` element also has a property called `interval` which is a integer value and the value is in milliseconds. The suggested use case would be for a Image Carousel or something of that nature which can change the image for every fixed intervals. In unloaded function call page.getViewById("your_id").stopSlideshow() to unregister it (your_id is the id given to `<IntroSlides:IntroSlides>`).
69+
#### Android Optional Attribute
70+
- `AndroidTransparentStatusBar`: boolean - If true, the Android status bar will be transparent on devices that support it. Typically this is API >=21 (Lollipop).
6871

6972
###Plugin Development Work Flow:
7073

nativescript-slides.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ export interface ISlideMap {
77
left?: ISlideMap;
88
right?: ISlideMap;
99
}
10-
export declare class IntroSlides extends AbsoluteLayout {
10+
export declare class SlideContainer extends AbsoluteLayout {
1111
private _loaded;
1212
private currentPanel;
1313
private _pageWidth;
1414
private transitioning;
1515
private direction;
1616
private _loop;
17+
private _AndroidTransparentStatusBar;
1718
private timer_reference;
1819
private _interval;
1920
interval: number;
2021
loop: boolean;
22+
AndroidTransparentStatusBar: boolean;
2123
pageWidth: number;
2224
android: any;
2325
ios: any;

nativescript-slides.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ export interface ISlideMap {
2222
right?: ISlideMap;
2323
}
2424

25-
export class IntroSlides extends AbsoluteLayout {
25+
export class SlideContainer extends AbsoluteLayout {
2626
private _loaded: boolean;
2727
private currentPanel: ISlideMap;
2828
private _pageWidth: number;
2929
private transitioning: boolean;
3030
private direction: direction = direction.none;
3131
private _loop: boolean;
3232
private _interval: number;
33+
private _AndroidTransparentStatusBar: boolean;
3334

3435
get interval() {
3536
return this._interval;
@@ -47,6 +48,14 @@ export class IntroSlides extends AbsoluteLayout {
4748
this._loop = value;
4849
}
4950

51+
get AndroidTransparentStatusBar() {
52+
return this._AndroidTransparentStatusBar;
53+
}
54+
55+
set AndroidTransparentStatusBar(value: boolean) {
56+
this._AndroidTransparentStatusBar = value;
57+
}
58+
5059
get pageWidth() {
5160
return this._pageWidth;
5261
}
@@ -71,9 +80,6 @@ export class IntroSlides extends AbsoluteLayout {
7180
if (this._loop == null) {
7281
this.loop = false;
7382
}
74-
if (this._interval == null) {
75-
this.interval = 0;
76-
}
7783
this.transitioning = false;
7884

7985
this._pageWidth = Platform.screen.mainScreen.widthDIPs;
@@ -84,6 +90,16 @@ export class IntroSlides extends AbsoluteLayout {
8490
if (!this._loaded) {
8591
this._loaded = true;
8692

93+
// Android Transparent Status Bar
94+
if (this.AndroidTransparentStatusBar === true && app.android && Platform.device.sdkVersion >= '21') {
95+
const View = android.view.View;
96+
let window = app.android.startActivity.getWindow();
97+
// set the status bar to Color.Transparent
98+
window.setStatusBarColor(0x000000);
99+
}
100+
101+
102+
87103
let slides: StackLayout[] = [];
88104

89105
this.eachLayoutChild((view: View) => {

package.json

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "nativescript-intro-slides",
3-
"version": "1.0.3",
4-
"description": "NativeScript intro slides plugin.",
5-
"main": "nativescript-intro-slides.js",
2+
"name": "nativescript-slides",
3+
"version": "1.0.2",
4+
"description": "NativeScript Slides plugin.",
5+
"main": "nativescript-slides.js",
66
"nativescript": {
77
"platforms": {
88
"android": "2.0.0",
@@ -13,41 +13,50 @@
1313
"build": "tsc",
1414
"demo.ios": "npm run preparedemo && cd demo && tns emulate ios",
1515
"demo.android": "npm run preparedemo && cd demo && tns run android",
16-
"preparedemo": "npm run build && cd demo && tns plugin remove nativescript-intro-slides && tns plugin add .. && tns install",
16+
"preparedemo": "npm run build && cd demo && tns plugin remove nativescript-slides && tns plugin add .. && tns install",
1717
"setup": "npm install && cd demo && npm install && cd .. && npm run build && cd demo && tns plugin add .. && cd ..",
1818
"livesync.ios":"cd demo && tns livesync ios --watch",
1919
"livesync.android":"cd demo && tns livesync android --watch",
2020
"ios": "xcproj --project platforms/ios/YourApp.xcodeproj touch; xcproj --project platforms/ios/Pods/Pods.xcodeproj touch; tns livesync ios --emulator --watch"
2121
},
2222
"repository": {
2323
"type": "git",
24-
"url": "https://github.com/TheOriginalJosh/nativescript-intro-slides.git"
24+
"url": "https://github.com/TheOriginalJosh/nativescript-slides.git"
2525
},
2626
"keywords": [
2727
"NativeScript",
2828
"JavaScript",
2929
"Android",
30-
"iOS"
30+
"iOS",
31+
"TypeScript",
32+
"swipe slides",
33+
"Slides",
34+
"Carousel"
3135
],
3236
"author": {
3337
"name": "Josh Sommer",
3438
"email": "joshdsommer@gmail.com"
3539
},
3640
"contributors": [
37-
{
41+
{
42+
"name": "Brad Martin",
43+
"email": "bradwaynemartin@gmail.com",
44+
"url": "https://github.com/bradmartin"
45+
},
46+
{
3847
"name": "Obsessive Inc/Abhijith Reddy",
3948
"email": "mabhijith95a10@gmail.com",
4049
"url": "https://github.com/Obsessive"
4150
}
42-
],
51+
],
4352
"bugs": {
44-
"url": "https://github.com/TheOriginalJosh/nativescript-intro-slides/issues"
53+
"url": "https://github.com/TheOriginalJosh/nativescript-slides/issues"
4554
},
4655
"license": {
4756
"type": "MIT",
48-
"url": "https://github.com/TheOriginalJosh/nativescript-intro-slides/blob/master/LICENSE"
57+
"url": "https://github.com/TheOriginalJosh/nativescript-slides/blob/master/LICENSE"
4958
},
50-
"homepage": "https://github.com/TheOriginalJosh/nativescript-intro-slides",
59+
"homepage": "https://github.com/TheOriginalJosh/nativescript-slides",
5160
"readmeFilename": "README.md",
5261
"devDependencies": {
5362
"typescript": "^1.8.7"

0 commit comments

Comments
 (0)