Skip to content

Commit c1df62d

Browse files
Merge pull request #54 from TheOriginalJosh/2.0.0
2.0.0
2 parents f6279ec + a75445e commit c1df62d

File tree

18 files changed

+302
-336
lines changed

18 files changed

+302
-336
lines changed

README.md

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,39 @@ add as many ``<Slides:Slide>`` as you want.
8080

8181
- **loop : boolean** - If 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.
8282

83-
- **velocityScrolling : boolean** - If true will calculate transitions speeds based on the finger movement speed.
83+
- **disablePan : boolean** - If true panning is disabled. So that you can call nextSlide()/previousSlide() functions to change the slide. If slides is used to get details about users like email, phone number, username etc. in this case you don't want users to move from one slide to another slide without filling details.
84+
85+
- **pagerOffset : string** - Margin-top for the pager. Number or percentage, default 88%.
8486

8587
- **pageIndicators : boolean** - If true adds indicator dots to the bottom of your slides.
8688

87-
- **indicatorsColor : string** - color of the indicator dots.
89+
#### Indicators
8890

89-
- **interval : integer** - 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>`), it can be restarted with `startSlidShow`.
91+
If the property `pageIndicators` is `true` you won't see the page indicators anymore as of 2.0.0 right away. there are two css classes exposed that you can setup however you like for active and inactive indicators. below is an example for semi translucent dots.
9092

91-
- **disablePan : boolean** - If true panning is disabled. So that you can call nextSlide()/previousSlide() functions to change the slide. If slides is used to get details about users like email, phone number, username etc. in this case you don't want users to move from one slide to another slide without filling details.
93+
```css
94+
.slide-indicator-inactive{
95+
background-color: #fff;
96+
opacity : 0.4;
97+
width : 10;
98+
height : 10;
99+
margin-left : 2.5;
100+
margin-right : 2.5;
101+
margin-top : 0;
102+
border-radius : 5;
103+
}
92104

93-
- **pagerOffset : string** - Margin-top for the pager. Number or percentage, default 88%.
105+
.slide-indicator-active{
106+
background-color: #fff;
107+
opacity : 0.9;
108+
width : 10;
109+
height : 10;
110+
margin-left : 2.5;
111+
margin-right : 2.5;
112+
margin-top : 0;
113+
border-radius : 5;
114+
}
115+
```
94116

95117
#### Events
96118
- **start** - Start pan
@@ -102,10 +124,6 @@ add as many ``<Slides:Slide>`` as you want.
102124
To use the slides with Angular2 and the `registerElement` from `nativescript-angular` you will want to set the `SlideContainer`'s property of `angular` to `true`. Then in your angular component in the `ngAfterViewInit`. you will want to have an instance of your slide container to call the function `constructView()`.
103125
[Follow the example](https://github.com/TheOriginalJosh/nativescript-slides/issues/37#issuecomment-224820901)
104126

105-
#### Android Optional Attributes
106-
- **androidTranslucentStatusBar : boolean** - If true the Android status bar will be translucent on devices that support it. (Android sdk >= 19).
107-
- **androidTranslucentNavBar : boolean** - If true the Android navigation bar will be translucent on devices that support it. (Android sdk >= 19).
108-
109127
#### Plugin Development Work Flow:
110128

111129
* Clone repository to your machine.
@@ -115,7 +133,7 @@ To use the slides with Angular2 and the `registerElement` from `nativescript-ang
115133

116134
#### Known issues
117135

118-
* There apears to be a bug with the loop resulting in bad transitions going right to left.
136+
* There appears to be a bug with the loop resulting in bad transitions going right to left.
119137

120138
#### How To: Load slides dynamically
121139
You want to hook into the loaded event of the view and then create your view elements.
@@ -127,7 +145,7 @@ You want to hook into the loaded event of the view and then create your view ele
127145
``` ts
128146
import * as slides from 'nativescript-slides/nativescript-slides'
129147

130-
export function onSlideContainerLoaded(args) {
148+
export function onSlideContainerLoaded(args) {
131149
let slideContainer = <slides.SlideContainer>args.object;
132150

133151
//Construct the slides

demo/app/app.css

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
}
88
.slide-3{
99
background-color: #8BC34A;
10-
}
10+
}
1111

1212
.slide-4{
1313
background-color: #9C27B0;
@@ -25,7 +25,7 @@
2525
}
2626
.slide-8{
2727
background-color: #8BC34A;
28-
}
28+
}
2929

3030
.slide-9{
3131
background-color: #9C27B0;
@@ -60,3 +60,25 @@ Label{
6060
color: #fff;
6161
margin-right: 20;
6262
}
63+
64+
.slide-indicator-inactive{
65+
background-color: #fff;
66+
opacity : 0.4;
67+
width : 10;
68+
height : 10;
69+
margin-left : 2.5;
70+
margin-right : 2.5;
71+
margin-top : 0;
72+
border-radius : 5;
73+
}
74+
75+
.slide-indicator-active{
76+
background-color: #fff;
77+
opacity : 0.9;
78+
width : 10;
79+
height : 10;
80+
margin-left : 2.5;
81+
margin-right : 2.5;
82+
margin-top : 0;
83+
border-radius : 5;
84+
}

demo/app/loader.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
<StackLayout class="commands">
77
<Button text="Main Demo" tap="onLoadMain" />
88
<Button text="Dynamic Slides" tap="onLoadDynamic" />
9-
<Button text="Carousel" tap="onLoadCarousel" />
9+
<!--<Button text="Carousel" tap="onLoadCarousel" /> -->
1010
</StackLayout>
1111
</Page>

demo/app/views/carousel-page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function pageLoaded(args: observable.EventData) {
1111
var page = <pages.Page>args.object;
1212
page.actionBarHidden = true;
1313
let slideContainer = <slides.SlideContainer>page.getViewById("slides");
14-
slideContainer.startSlideshow();
14+
// slideContainer.startSlideshow();
1515
}
1616

1717
export function onNavHome() {

demo/app/views/carousel-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" androidTranslucentStatusBar="true" disablePan="true" interval="2000"
4+
<Slides:SlideContainer id="slides" row="0" pageIndicators="true" disablePan="true"
55
start="onStart" cancelled="onCancelled" changed="onChanged" finished="onFinished">
66
<Slides:Slide class="slide-1">
77
<Label text="This is Panel 1" />

demo/app/views/dynamic-page.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:Slides="nativescript-slides" navigatedTo="navigatedTo">
22

33
<GridLayout rows="* auto">
4-
<Slides:SlideContainer id="slides" row="0" pageIndicators="true" androidTranslucentStatusBar="true" loaded="onSlideContainerLoaded"
4+
<Slides:SlideContainer id="slides" row="0" pageIndicators="true" loaded="onSlideContainerLoaded"
55
start="onStart" cancelled="onCancelled" changed="onChanged" finished="onFinished">
6-
6+
77
</Slides:SlideContainer>
88
</GridLayout>
99
</Page>

demo/app/views/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" androidTranslucentStatusBar="true"
4+
<Slides:SlideContainer id="slides" row="0" pageIndicators="true" loop="true"
55
start="onStart" cancelled="onCancelled" changed="onChanged" finished="onFinished">
66
<Slides:Slide class="slide-1">
77
<Label text="This is Panel 1" />
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// TNSLabel.h
3+
// TNSWidgets
4+
//
5+
// Created by Hristo Hristov on 6/9/16.
6+
// Copyright © 2016 Telerik A D. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface TNSLabel : UILabel
12+
13+
@property(nonatomic) UIEdgeInsets padding;
14+
@property(nonatomic) UIEdgeInsets borderThickness;
15+
16+
@end
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// TNSWidgets.h
3+
// TNSWidgets
4+
//
5+
// Created by Panayot Cankov on 4/27/16.
6+
// Copyright © 2016 Telerik A D. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
//! Project version number for TNSWidgets.
12+
FOUNDATION_EXPORT double TNSWidgetsVersionNumber;
13+
14+
//! Project version string for TNSWidgets.
15+
FOUNDATION_EXPORT const unsigned char TNSWidgetsVersionString[];
16+
17+
// In this header, you should import all the public headers of your framework using statements like #import <TNSWidgets/PublicHeader.h>
18+
19+
#import "UIImage+TNSBlocks.h"
20+
#import "TNSLabel.h"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// UIImage+UIImage_Async.h
3+
// TKImageAsync
4+
//
5+
// Created by Panayot Cankov on 4/18/16.
6+
// Copyright © 2016 Telerik A D. All rights reserved.
7+
//
8+
9+
@interface UIImage (TNSBlocks)
10+
11+
/**
12+
* Similar to imageNamed: however it runs on a separate queue so the UI thread is not blocked.
13+
* It also draws the UIImage in a small thumb to force decoding potentially avoiding UI hicckups when displayed.
14+
*/
15+
+ (void) tns_safeDecodeImageNamed: (NSString*) name completion: (void (^) (UIImage*))callback;
16+
17+
/**
18+
* Same as imageNamed, however calls to this method are sinchronized to be thread safe in iOS8 along with calls to tns_safeImageNamed and tns_safeDecodeImageNamed:completion:
19+
* imageNamed is thread safe in iOS 9 and later so in later versions this methods simply fallbacks to imageNamed:
20+
*/
21+
+ (UIImage*) tns_safeImageNamed: (NSString*) name;
22+
23+
+ (void) tns_decodeImageWithData: (NSData*) data completion: (void (^) (UIImage*))callback;
24+
+ (void) tns_decodeImageWidthContentsOfFile: (NSString*) file completion: (void (^) (UIImage*))callback;
25+
26+
@end

0 commit comments

Comments
 (0)