Skip to content

Commit 7420f52

Browse files
Merge pull request #25 from TheOriginalJosh/page-indicators
fixing load indicator dots
2 parents 0259648 + 30fb1d1 commit 7420f52

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

demo/app/main-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:Slides="nativescript-slides" loaded="pageLoaded">
22

33
<GridLayout rows="* auto">
4-
<Slides:SlideContainer id="slides" row="0" pageIndicators="true">
4+
<Slides:SlideContainer id="slides" row="0" pageIndicators="true" androidTranslucentStatusBar ="true">
55
<Slides:Slide class="slide-1">
66
<Label text="This is Panel 1" />
77
</Slides:Slide>

nativescript-slides.ts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ export class SlideContainer extends AbsoluteLayout {
184184
return;
185185
}
186186
// Android Translucent bars API >= 19 only
187-
if ((this.androidTranslucentStatusBar === true || this._androidTranslucentNavBar === true) && app.android && Platform.device.sdkVersion >= '19') {
187+
188+
if (app.android && this.androidTranslucentStatusBar === true || this._androidTranslucentNavBar === true && Platform.device.sdkVersion >= '19') {
188189
let window = app.android.startActivity.getWindow();
189190

190191
// check for status bar
@@ -209,16 +210,17 @@ export class SlideContainer extends AbsoluteLayout {
209210
}
210211
});
211212

212-
if (this.pageIndicators) {
213-
this._footer = this.buildFooter(slides.length, 0);
214-
this.addChild(this._footer);
215-
// this.setActivePageIndicator(0);
216-
}
213+
// if (this.pageIndicators) {
214+
this._footer = this.buildFooter(slides.length, 0);
215+
this.insertChild(this._footer, this.getChildrenCount());
216+
// this.setActivePageIndicator(0);
217+
//}
217218

218219

219220
this.currentPanel = this.buildSlideMap(slides);
220221
this.currentPanel.panel.translateX = -this.pageWidth;
221-
if(disablePan == false) {
222+
223+
if(this.disablePan === false) {
222224
this.applySwipe(this.pageWidth);
223225
}
224226

@@ -231,7 +233,8 @@ export class SlideContainer extends AbsoluteLayout {
231233
view.width = this.pageWidth;
232234
}
233235
});
234-
if(disablePan == false) {
236+
237+
if(this.disablePan === false) {
235238
this.applySwipe(this.pageWidth);
236239
}
237240
let topOffset = Platform.screen.mainScreen.heightDIPs - 105;
@@ -308,7 +311,8 @@ export class SlideContainer extends AbsoluteLayout {
308311
this.transitioning = false;
309312
this.currentPanel.panel.off('pan');
310313
this.currentPanel = panel;
311-
if(disablePan == false) {
314+
315+
if(this.disablePan === false) {
312316
this.applySwipe(this.pageWidth);
313317
}
314318
this.setActivePageIndicator(this.currentPanel.index);
@@ -477,12 +481,12 @@ export class SlideContainer extends AbsoluteLayout {
477481
* */
478482
private buildFooter(pageCount: number = 5, activeIndex: number = 0): StackLayout {
479483
let footerInnerWrap = new StackLayout();
480-
const topOffset = Platform.screen.mainScreen.heightDIPs - 105;
481-
footerInnerWrap.height = 20;
484+
485+
footerInnerWrap.height = 50;
482486

483487
this.setwidthPercent(footerInnerWrap, 100);
484488
AbsoluteLayout.setLeft(footerInnerWrap, 0);
485-
AbsoluteLayout.setTop(footerInnerWrap, topOffset);
489+
AbsoluteLayout.setTop(footerInnerWrap, 0);
486490

487491
footerInnerWrap.orientation = 'horizontal';
488492
footerInnerWrap.verticalAlignment = 'top';
@@ -497,6 +501,9 @@ export class SlideContainer extends AbsoluteLayout {
497501
let activeIndicator = footerInnerWrap.getChildAt(0);
498502
activeIndicator.className = 'slide-indicator-active';
499503
activeIndicator.opacity = 0.9;
504+
505+
footerInnerWrap.marginTop = <any>'88%';
506+
500507
return footerInnerWrap;
501508
}
502509

@@ -529,7 +536,6 @@ export class SlideContainer extends AbsoluteLayout {
529536

530537
if (this.loop) {
531538
slideMap[0].left = slideMap[slideMap.length - 1];
532-
slideMap[slideMap.length - 1].right = slideMap[0];
533539
}
534540
this.startSlideshow();
535541
return slideMap[0];
@@ -543,6 +549,7 @@ export class SlideContainer extends AbsoluteLayout {
543549
indicator.height = 10;
544550
indicator.marginLeft = 2.5;
545551
indicator.marginRight = 2.5;
552+
indicator.marginTop = 0;
546553
indicator.borderRadius = 5;
547554
return indicator;
548555
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-slides",
3-
"version": "1.4.1",
3+
"version": "1.5.0",
44
"description": "NativeScript Slides plugin.",
55
"main": "nativescript-slides.js",
66
"nativescript": {

0 commit comments

Comments
 (0)