Skip to content

Commit 7704453

Browse files
Merge pull request #22 from TheOriginalJosh/page-indicators
Page indicators
2 parents e4e2981 + e1192b8 commit 7704453

File tree

3 files changed

+84
-111
lines changed

3 files changed

+84
-111
lines changed

nativescript-slides.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,7 @@ export declare class SlideContainer extends AbsoluteLayout {
2424
private _angular;
2525
private _footer;
2626
private _pageIndicators;
27-
private _pageIndicatorsColor;
28-
private _pageIndicatorsActiveImage;
29-
private indicatorImage;
3027
pageIndicators: boolean;
31-
pageIndicatorsColor: string;
32-
pageIndicatorsActiveImage: string;
3328
hasNext: boolean;
3429
hasPrevious: boolean;
3530
interval: number;

nativescript-slides.ts

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ export class SlideContainer extends AbsoluteLayout {
4949
private _angular: boolean;
5050
private _footer: StackLayout;
5151
private _pageIndicators: boolean;
52-
private _pageIndicatorsColor: Color;
53-
private _pageIndicatorsActiveImage: string;
54-
private indicatorImage: Image;
52+
5553
/* page indicator stuff*/
5654
get pageIndicators(): boolean {
5755
return this._pageIndicators;
@@ -60,23 +58,6 @@ export class SlideContainer extends AbsoluteLayout {
6058
this._pageIndicators = value;
6159
}
6260

63-
set pageIndicatorsColor(value: string) {
64-
this._pageIndicatorsColor = new Color(value);
65-
}
66-
get pageIndicatorsColor() {
67-
return this._pageIndicatorsColor.hex
68-
}
69-
70-
get pageIndicatorsActiveImage(): string {
71-
return this._pageIndicatorsActiveImage;
72-
}
73-
set pageIndicatorsActiveImage(value: string) {
74-
this.indicatorImage.imageSource = imageSource.fromFile(value);
75-
this._pageIndicatorsActiveImage = value;
76-
}
77-
78-
79-
8061
get hasNext(): boolean {
8162
return !!this.currentPanel.right;
8263
}
@@ -177,10 +158,6 @@ export class SlideContainer extends AbsoluteLayout {
177158

178159
if (this._pageIndicators == null) {
179160
this._pageIndicators = false;
180-
} else {
181-
if (this._pageIndicatorsColor == null) {
182-
this._pageIndicatorsColor = new Color('#fff')
183-
}
184161
}
185162
}
186163

@@ -222,7 +199,7 @@ export class SlideContainer extends AbsoluteLayout {
222199
if (this.pageIndicators) {
223200
this._footer = this.buildFooter(slides.length, 0);
224201
this.addChild(this._footer);
225-
this.setActivePageIndicator(0);
202+
// this.setActivePageIndicator(0);
226203
}
227204

228205

@@ -497,6 +474,10 @@ export class SlideContainer extends AbsoluteLayout {
497474
footerInnerWrap.addChild(this.createIndicator());
498475
i++;
499476
}
477+
478+
let activeIndicator = footerInnerWrap.getChildAt(0);
479+
activeIndicator.className = 'slide-indicator-active';
480+
activeIndicator.opacity = 0.9;
500481
return footerInnerWrap;
501482
}
502483

@@ -538,6 +519,7 @@ export class SlideContainer extends AbsoluteLayout {
538519
createIndicator(): Label {
539520
let indicator = new Label();
540521
indicator.backgroundColor = new Color('#fff');
522+
indicator.opacity = 0.4;
541523
indicator.width = 10;
542524
indicator.height = 10;
543525
indicator.marginLeft = 2.5;
@@ -551,19 +533,12 @@ export class SlideContainer extends AbsoluteLayout {
551533
this._footer.eachLayoutChild((view: View) => {
552534
if (view instanceof Label) {
553535
view.opacity = 0.4;
554-
if (this._pageIndicatorsActiveImage != null) {
555-
view.backgroundColor = new Color('#fff');
556-
view.className = 'slide-indicator-inactive';
557-
view.backgroundImage = null;
558-
}
536+
view.className = 'slide-indicator-inactive';
559537
}
560538
});
561539
let activeIndicator = this._footer.getChildAt(index);
562540
activeIndicator.className = 'slide-indicator-active';
563541
activeIndicator.opacity = 0.9;
564-
if (this._pageIndicatorsActiveImage != null) {
565-
activeIndicator.backgroundColor = null;
566-
activeIndicator.backgroundImage = this.pageIndicatorsActiveImage;
567-
}
542+
568543
}
569-
}
544+
}

package.json

Lines changed: 74 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,75 @@
11
{
2-
"name": "nativescript-slides",
3-
"version": "1.4.0",
4-
"description": "NativeScript Slides plugin.",
5-
"main": "nativescript-slides.js",
6-
"nativescript": {
7-
"platforms": {
8-
"android": "2.0.0",
9-
"ios": "2.0.0"
10-
}
11-
},
12-
"scripts": {
13-
"build": "tsc",
14-
"demo.ios": "npm run preparedemo && cd demo && tns emulate ios",
15-
"demo.android": "npm run preparedemo && cd demo && tns run android",
16-
"preparedemo": "npm run build && cd demo && tns plugin remove nativescript-slides && tns plugin add .. && tns install",
17-
"setup": "npm install && cd demo && npm install && cd .. && npm run build && cd demo && tns plugin add .. && cd ..",
18-
"livesync.ios": "cd demo && tns livesync ios --watch",
19-
"livesync.android": "cd demo && tns livesync android --watch",
20-
"ios": "xcproj --project platforms/ios/YourApp.xcodeproj touch; xcproj --project platforms/ios/Pods/Pods.xcodeproj touch; tns livesync ios --emulator --watch"
21-
},
22-
"repository": {
23-
"type": "git",
24-
"url": "https://github.com/TheOriginalJosh/nativescript-slides.git"
25-
},
26-
"keywords": [
27-
"NativeScript",
28-
"JavaScript",
29-
"Android",
30-
"iOS",
31-
"TypeScript",
32-
"swipe slides",
33-
"Slides",
34-
"Carousel"
35-
],
36-
"author": {
37-
"name": "Josh Sommer",
38-
"email": "joshdsommer@gmail.com"
39-
},
40-
"contributors": [
41-
{
42-
"name": "Brad Martin",
43-
"email": "bradwaynemartin@gmail.com",
44-
"url": "https://github.com/bradmartin"
45-
},
46-
{
47-
"name": "Obsessive Inc/Abhijith Reddy",
48-
"email": "mabhijith95a10@gmail.com",
49-
"url": "https://github.com/Obsessive"
50-
},
51-
{
52-
"name": "Victor Nascimento",
53-
"email": "victormota15@gmail.com",
54-
"url": "https://github.com/vjoao"
55-
}
56-
],
57-
"bugs": {
58-
"url": "https://github.com/TheOriginalJosh/nativescript-slides/issues"
59-
},
60-
"license": {
61-
"type": "MIT",
62-
"url": "https://github.com/TheOriginalJosh/nativescript-slides/blob/master/LICENSE"
63-
},
64-
"homepage": "https://github.com/TheOriginalJosh/nativescript-slides",
65-
"readmeFilename": "README.md",
66-
"devDependencies": {
67-
"typescript": "^1.8.7"
68-
},
69-
"dependencies": {
70-
"tns-platform-declarations": "^2.0.0"
71-
}
72-
}
2+
"name": "nativescript-slides",
3+
"version": "1.4.1",
4+
"description": "NativeScript Slides plugin.",
5+
"main": "nativescript-slides.js",
6+
"nativescript": {
7+
"platforms": {
8+
"android": "2.0.0",
9+
"ios": "2.0.0"
10+
},
11+
"tns-ios": {
12+
"version": "2.0.0"
13+
}
14+
},
15+
"scripts": {
16+
"build": "tsc",
17+
"demo.ios": "npm run preparedemo && cd demo && tns emulate ios",
18+
"demo.android": "npm run preparedemo && cd demo && tns run android",
19+
"preparedemo": "npm run build && cd demo && tns plugin remove nativescript-slides && tns plugin add .. && tns install",
20+
"setup": "npm install && cd demo && npm install && cd .. && npm run build && cd demo && tns plugin add .. && cd ..",
21+
"livesync.ios": "cd demo && tns livesync ios --watch",
22+
"livesync.android": "cd demo && tns livesync android --watch",
23+
"ios": "xcproj --project platforms/ios/YourApp.xcodeproj touch; xcproj --project platforms/ios/Pods/Pods.xcodeproj touch; tns livesync ios --emulator --watch"
24+
},
25+
"repository": {
26+
"type": "git",
27+
"url": "https://github.com/TheOriginalJosh/nativescript-slides.git"
28+
},
29+
"keywords": [
30+
"NativeScript",
31+
"JavaScript",
32+
"Android",
33+
"iOS",
34+
"TypeScript",
35+
"swipe slides",
36+
"Slides",
37+
"Carousel"
38+
],
39+
"author": {
40+
"name": "Josh Sommer",
41+
"email": "joshdsommer@gmail.com"
42+
},
43+
"contributors": [
44+
{
45+
"name": "Brad Martin",
46+
"email": "bradwaynemartin@gmail.com",
47+
"url": "https://github.com/bradmartin"
48+
},
49+
{
50+
"name": "Obsessive Inc/Abhijith Reddy",
51+
"email": "mabhijith95a10@gmail.com",
52+
"url": "https://github.com/Obsessive"
53+
},
54+
{
55+
"name": "Victor Nascimento",
56+
"email": "victormota15@gmail.com",
57+
"url": "https://github.com/vjoao"
58+
}
59+
],
60+
"bugs": {
61+
"url": "https://github.com/TheOriginalJosh/nativescript-slides/issues"
62+
},
63+
"license": {
64+
"type": "MIT",
65+
"url": "https://github.com/TheOriginalJosh/nativescript-slides/blob/master/LICENSE"
66+
},
67+
"homepage": "https://github.com/TheOriginalJosh/nativescript-slides",
68+
"readmeFilename": "README.md",
69+
"devDependencies": {
70+
"typescript": "^1.8.7"
71+
},
72+
"dependencies": {
73+
"tns-platform-declarations": "^2.0.0"
74+
}
75+
}

0 commit comments

Comments
 (0)