Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions nativescript-slides.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ export declare class SlideContainer extends AbsoluteLayout {
private _angular;
private _footer;
private _pageIndicators;
private _pageIndicatorsColor;
private _pageIndicatorsActiveImage;
private indicatorImage;
pageIndicators: boolean;
pageIndicatorsColor: string;
pageIndicatorsActiveImage: string;
hasNext: boolean;
hasPrevious: boolean;
interval: number;
Expand Down
45 changes: 10 additions & 35 deletions nativescript-slides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ export class SlideContainer extends AbsoluteLayout {
private _angular: boolean;
private _footer: StackLayout;
private _pageIndicators: boolean;
private _pageIndicatorsColor: Color;
private _pageIndicatorsActiveImage: string;
private indicatorImage: Image;

/* page indicator stuff*/
get pageIndicators(): boolean {
return this._pageIndicators;
Expand All @@ -60,23 +58,6 @@ export class SlideContainer extends AbsoluteLayout {
this._pageIndicators = value;
}

set pageIndicatorsColor(value: string) {
this._pageIndicatorsColor = new Color(value);
}
get pageIndicatorsColor() {
return this._pageIndicatorsColor.hex
}

get pageIndicatorsActiveImage(): string {
return this._pageIndicatorsActiveImage;
}
set pageIndicatorsActiveImage(value: string) {
this.indicatorImage.imageSource = imageSource.fromFile(value);
this._pageIndicatorsActiveImage = value;
}



get hasNext(): boolean {
return !!this.currentPanel.right;
}
Expand Down Expand Up @@ -177,10 +158,6 @@ export class SlideContainer extends AbsoluteLayout {

if (this._pageIndicators == null) {
this._pageIndicators = false;
} else {
if (this._pageIndicatorsColor == null) {
this._pageIndicatorsColor = new Color('#fff')
}
}
}

Expand Down Expand Up @@ -222,7 +199,7 @@ export class SlideContainer extends AbsoluteLayout {
if (this.pageIndicators) {
this._footer = this.buildFooter(slides.length, 0);
this.addChild(this._footer);
this.setActivePageIndicator(0);
// this.setActivePageIndicator(0);
}


Expand Down Expand Up @@ -497,6 +474,10 @@ export class SlideContainer extends AbsoluteLayout {
footerInnerWrap.addChild(this.createIndicator());
i++;
}

let activeIndicator = footerInnerWrap.getChildAt(0);
activeIndicator.className = 'slide-indicator-active';
activeIndicator.opacity = 0.9;
return footerInnerWrap;
}

Expand Down Expand Up @@ -538,6 +519,7 @@ export class SlideContainer extends AbsoluteLayout {
createIndicator(): Label {
let indicator = new Label();
indicator.backgroundColor = new Color('#fff');
indicator.opacity = 0.4;
indicator.width = 10;
indicator.height = 10;
indicator.marginLeft = 2.5;
Expand All @@ -551,19 +533,12 @@ export class SlideContainer extends AbsoluteLayout {
this._footer.eachLayoutChild((view: View) => {
if (view instanceof Label) {
view.opacity = 0.4;
if (this._pageIndicatorsActiveImage != null) {
view.backgroundColor = new Color('#fff');
view.className = 'slide-indicator-inactive';
view.backgroundImage = null;
}
view.className = 'slide-indicator-inactive';
}
});
let activeIndicator = this._footer.getChildAt(index);
activeIndicator.className = 'slide-indicator-active';
activeIndicator.opacity = 0.9;
if (this._pageIndicatorsActiveImage != null) {
activeIndicator.backgroundColor = null;
activeIndicator.backgroundImage = this.pageIndicatorsActiveImage;
}

}
}
}
145 changes: 74 additions & 71 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,72 +1,75 @@
{
"name": "nativescript-slides",
"version": "1.4.0",
"description": "NativeScript Slides plugin.",
"main": "nativescript-slides.js",
"nativescript": {
"platforms": {
"android": "2.0.0",
"ios": "2.0.0"
}
},
"scripts": {
"build": "tsc",
"demo.ios": "npm run preparedemo && cd demo && tns emulate ios",
"demo.android": "npm run preparedemo && cd demo && tns run android",
"preparedemo": "npm run build && cd demo && tns plugin remove nativescript-slides && tns plugin add .. && tns install",
"setup": "npm install && cd demo && npm install && cd .. && npm run build && cd demo && tns plugin add .. && cd ..",
"livesync.ios": "cd demo && tns livesync ios --watch",
"livesync.android": "cd demo && tns livesync android --watch",
"ios": "xcproj --project platforms/ios/YourApp.xcodeproj touch; xcproj --project platforms/ios/Pods/Pods.xcodeproj touch; tns livesync ios --emulator --watch"
},
"repository": {
"type": "git",
"url": "https://github.com/TheOriginalJosh/nativescript-slides.git"
},
"keywords": [
"NativeScript",
"JavaScript",
"Android",
"iOS",
"TypeScript",
"swipe slides",
"Slides",
"Carousel"
],
"author": {
"name": "Josh Sommer",
"email": "joshdsommer@gmail.com"
},
"contributors": [
{
"name": "Brad Martin",
"email": "bradwaynemartin@gmail.com",
"url": "https://github.com/bradmartin"
},
{
"name": "Obsessive Inc/Abhijith Reddy",
"email": "mabhijith95a10@gmail.com",
"url": "https://github.com/Obsessive"
},
{
"name": "Victor Nascimento",
"email": "victormota15@gmail.com",
"url": "https://github.com/vjoao"
}
],
"bugs": {
"url": "https://github.com/TheOriginalJosh/nativescript-slides/issues"
},
"license": {
"type": "MIT",
"url": "https://github.com/TheOriginalJosh/nativescript-slides/blob/master/LICENSE"
},
"homepage": "https://github.com/TheOriginalJosh/nativescript-slides",
"readmeFilename": "README.md",
"devDependencies": {
"typescript": "^1.8.7"
},
"dependencies": {
"tns-platform-declarations": "^2.0.0"
}
}
"name": "nativescript-slides",
"version": "1.4.1",
"description": "NativeScript Slides plugin.",
"main": "nativescript-slides.js",
"nativescript": {
"platforms": {
"android": "2.0.0",
"ios": "2.0.0"
},
"tns-ios": {
"version": "2.0.0"
}
},
"scripts": {
"build": "tsc",
"demo.ios": "npm run preparedemo && cd demo && tns emulate ios",
"demo.android": "npm run preparedemo && cd demo && tns run android",
"preparedemo": "npm run build && cd demo && tns plugin remove nativescript-slides && tns plugin add .. && tns install",
"setup": "npm install && cd demo && npm install && cd .. && npm run build && cd demo && tns plugin add .. && cd ..",
"livesync.ios": "cd demo && tns livesync ios --watch",
"livesync.android": "cd demo && tns livesync android --watch",
"ios": "xcproj --project platforms/ios/YourApp.xcodeproj touch; xcproj --project platforms/ios/Pods/Pods.xcodeproj touch; tns livesync ios --emulator --watch"
},
"repository": {
"type": "git",
"url": "https://github.com/TheOriginalJosh/nativescript-slides.git"
},
"keywords": [
"NativeScript",
"JavaScript",
"Android",
"iOS",
"TypeScript",
"swipe slides",
"Slides",
"Carousel"
],
"author": {
"name": "Josh Sommer",
"email": "joshdsommer@gmail.com"
},
"contributors": [
{
"name": "Brad Martin",
"email": "bradwaynemartin@gmail.com",
"url": "https://github.com/bradmartin"
},
{
"name": "Obsessive Inc/Abhijith Reddy",
"email": "mabhijith95a10@gmail.com",
"url": "https://github.com/Obsessive"
},
{
"name": "Victor Nascimento",
"email": "victormota15@gmail.com",
"url": "https://github.com/vjoao"
}
],
"bugs": {
"url": "https://github.com/TheOriginalJosh/nativescript-slides/issues"
},
"license": {
"type": "MIT",
"url": "https://github.com/TheOriginalJosh/nativescript-slides/blob/master/LICENSE"
},
"homepage": "https://github.com/TheOriginalJosh/nativescript-slides",
"readmeFilename": "README.md",
"devDependencies": {
"typescript": "^1.8.7"
},
"dependencies": {
"tns-platform-declarations": "^2.0.0"
}
}