Skip to content

Commit 9d6dd17

Browse files
committed
* updated readme file
1 parent 4081c97 commit 9d6dd17

File tree

2 files changed

+69
-24
lines changed

2 files changed

+69
-24
lines changed

README.md

Lines changed: 68 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ All you need to do is:
1616

1717
First, add gradle dependency with command:<br>
1818
```groovy
19-
dependencies {
20-
compile 'com.cleveroad:slidingtutorial:0.9'
21-
}
19+
dependencies {
20+
compile 'com.cleveroad:slidingtutorial:0.9.1'
21+
}
2222
```
2323

2424
After you have to create each fragment that must extend from PageFragment. Also you have to create your xml file with images.
@@ -28,21 +28,13 @@ public class FirstCustomPageFragment extends PageFragment {
2828

2929
@Override
3030
protected int getLayoutResId() {
31+
// layout id of fragment
3132
return R.layout.fragment_page_first;
3233
}
3334

34-
@Override
35-
protected int getBackgroundColorResId() {
36-
return android.R.color.holo_orange_dark;
37-
}
38-
39-
@Override
40-
public int getRootResId() {
41-
return R.id.rootFirstPage;
42-
}
43-
4435
@Override
4536
protected TransformItem[] provideTransformItems() {
37+
// list of transformation items
4638
return new TransformItem[]{
4739
new TransformItem(R.id.ivFirstImage, true, 20),
4840
new TransformItem(R.id.ivSecondImage, false, 6),
@@ -62,37 +54,90 @@ Then you should provide these fragments in main slidingtutroial fragment
6254
```java
6355
public class CustomPresentationPagerFragment extends PresentationPagerFragment {
6456

65-
@Override
66-
protected List<? extends PageFragment> getPageFragments() {
67-
List<PageFragment> pageFragments = new ArrayList<>();
68-
pageFragments.add(new FirstCustomPageFragment());
69-
pageFragments.add(new SecondCustomPageFragment());
70-
pageFragments.add(new ThirdCustomPageFragment());
71-
return pageFragments;
72-
}
73-
7457
@Override
7558
public int getLayoutResId() {
59+
// layout id of fragment
7660
return R.layout.fragment_presentation;
7761
}
7862

7963
@Override
8064
public int getViewPagerResId() {
65+
// id of view pager
8166
return R.id.viewPager;
8267
}
8368

8469
@Override
8570
public int getIndicatorResId() {
71+
// id of circular indicator
8672
return R.id.indicator;
8773
}
8874

8975
@Override
9076
public int getButtonSkipResId() {
77+
// id of skip button
9178
return R.id.tvSkip;
9279
}
80+
81+
@Override
82+
protected int getPagesCount() {
83+
// total number of pages
84+
return 3;
85+
}
86+
87+
@Override
88+
protected PageFragment getPage(int position) {
89+
// get page for position
90+
if (position == 0)
91+
return new FirstCustomPageFragment();
92+
if (position == 1)
93+
return new SecondCustomPageFragment();
94+
if (position == 2)
95+
return new ThirdCustomPageFragment();
96+
throw new IllegalArgumentException("Unknown position: " + position);
97+
}
98+
99+
@ColorInt
100+
@Override
101+
protected int getPageColor(int position) {
102+
// get color of page
103+
if (position == 0)
104+
return ContextCompat.getColor(getContext(), android.R.color.holo_orange_dark);
105+
if (position == 1)
106+
return ContextCompat.getColor(getContext(), android.R.color.holo_green_dark);
107+
if (position == 2)
108+
return ContextCompat.getColor(getContext(), android.R.color.holo_blue_dark);
109+
return Color.TRANSPARENT;
110+
}
111+
112+
@Override
113+
protected boolean isInfiniteScrollEnabled() {
114+
// enable/disable infinite scroll behavior
115+
return true;
116+
}
93117
}
94118
```
95119

120+
## Changelog
121+
122+
| Version | Changes |
123+
| v.0.9.1 | Added infinite scroll behavior |
124+
| v.0.9 | First public release |
125+
|-|-|
126+
127+
## Migrations from v.0.9 to v.0.9.1
128+
#####CirclePageIndicator
129+
This class is final now. Make sure you're not extending from it.
130+
131+
#####LayersHolder
132+
This class is package-local now. Make sure you're not using it.
133+
134+
#####PageFragment
135+
**getRootResId()** and **getBackgroundColorResId()** methods are deprecated. You can remove them now. To specify page's color see **PresentationPagerFragment.getPageColor(int)** method.
136+
137+
#####PresentationPagerFragment
138+
**getPageFragments()** method is deprecated. You can remove it now. Use **getPagesCount()** and **getPage(int)** methods instead.
139+
**NOTE:** make sure you're returning new fragment instance when displaying tutorial with infinite scroll enabled.
140+
96141
## Support
97142
If you have any questions regarding the use of this tutorial, please contact us for support
98143
at info@cleveroad.com (email subject: «Sliding android app tutorial. Support request.»)
@@ -108,7 +153,7 @@ at info@cleveroad.com (email subject: «Sliding android app tutorial. Support re
108153

109154
The MIT License (MIT)
110155

111-
Copyright (c) 2015 Cleveroad
156+
Copyright (c) 2015-2016 Cleveroad
112157

113158
Permission is hereby granted, free of charge, to any person obtaining a copy
114159
of this software and associated documentation files (the "Software"), to deal

lib/src/main/java/com/cleveroad/slidingtutorial/CirclePageIndicator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* Draws circles (one for each view). The current view position is filled and
4040
* others are only stroked.
4141
*/
42-
class CirclePageIndicator extends View implements ViewPager.OnPageChangeListener {
42+
public final class CirclePageIndicator extends View implements ViewPager.OnPageChangeListener {
4343
private float mRadius;
4444
private final Paint mPaintPageFill = new Paint(ANTI_ALIAS_FLAG);
4545
private final Paint mPaintStroke = new Paint(ANTI_ALIAS_FLAG);

0 commit comments

Comments
 (0)