Skip to content

Commit 8660542

Browse files
authored
Merge pull request Cleveroad#46 from Cleveroad/develop
Develop
2 parents 7cea5c6 + d096fde commit 8660542

22 files changed

+281
-422
lines changed

CHANGELOG.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
Version | Changes
88
--- | ---
9-
v.1.0.5 | Fixed NullPointerException & IndexOutOfBoundsException inside ViewPager. Added SlidingTutorialViewPager
9+
v.1.0.6 | <ul><li>Added new simple way of creation of tutorial</li><li>Fixed memory leaks issues</li><li>Updated default sizes of page indicator's elements</li><li>Updated default colors of page indicator</li><li>Updated versions of dependencies</li><li>Removed unused or unnecessary methods</li></ul>
10+
v.1.0.5 | <ul><li>Fixed NullPointerException & IndexOutOfBoundsException inside ViewPager.</li><li>Added SlidingTutorialViewPager</li></ul>
1011
v.1.0.4 | Added ability to set PageTransformer
1112
v.1.0.3 | Fixed issues with layout customizations. Fixed issues with translate animations
1213
v.1.0.2 | Minor fixes
@@ -41,16 +42,6 @@ Changed gradle plugin version to stable `2.1.0`.
4142
* Created [Renderer] interface that responds for drawing single indicator item. There are 2 default implementation: [Renderer.Factory#newCircleRenderer()] and [Renderer.Factory#newSquareRenderer()].
4243
* Created [TutorialSupportFragment] and [PageSupportFragment] for use with **AppCompat** library. [TutorialFragment] and [PageFragment] now using **android.app.Fragment**.
4344

44-
## Support
45-
If you have any questions regarding the use of this tutorial, please contact us for support
46-
at info@cleveroad.com (email subject: «Sliding android app tutorial. Support request.»)
47-
<br>or
48-
<br>Use our contacts:
49-
<br><a href="https://www.cleveroad.com/?utm_source=github&utm_medium=link&utm_campaign=contacts">Cleveroad.com</a>
50-
<br><a href="https://www.facebook.com/cleveroadinc">Facebook account</a>
51-
<br><a href="https://twitter.com/CleveroadInc">Twitter account</a>
52-
<br><a href="https://plus.google.com/+CleveroadInc/">Google+ account</a>
53-
5445
[migration manuals]: https://github.com/Cleveroad/SlidingTutorial-Android/blob/master/MIGRATION.md
5546
[changelog history]: https://github.com/Cleveroad/SlidingTutorial-Android/blob/master/CHANGELOG.md
5647
[PageFragment]: https://github.com/Cleveroad/SlidingTutorial-Android/blob/master/lib/src/main/java/com/cleveroad/slidingtutorial/PageFragment.java

MIGRATION.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
## SlidingTutorial [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) <img src="https://www.cleveroad.com/public/comercial/label-android.svg" height="20"> <a href="https://www.cleveroad.com/?utm_source=github&utm_medium=label&utm_campaign=contacts"><img src="https://www.cleveroad.com/public/comercial/label-cleveroad.svg" height="20"></a>
22
![Header image](/images/header.jpg)
33

4+
## Migrations from v.1.0.5 to v.1.0.6
5+
`TutorialOptions.Builder#onSkipClickListener(...)` was renamed to `TutorialOptions.Builder#setOnSkipClickListener(...)`.
6+
47
## Migrations from v.0.9.5 to v.1.0.0
58
1. You must change creation [TransformItem] from `new TransformItem(R.id.ivFirstImage, true, 20)` to `TransformItem.create(R.id.ivFirstImage, Direction.LEFT_TO_RIGHT, 0.2f)`, where 2-nd parameter now is [Direction] of view translation and 3-rd parameter is *shiftCoefficient*.
69
2. Your fragment with tutorial must extend [TutorialFragment] instead of **PresentationPagerFragment**.
@@ -104,15 +107,6 @@ Added **isInfinityScrollEnabled()** method. Override it and return `true` to ena
104107

105108
**NOTE:** make sure you're returning new fragment instance when displaying tutorial with infinite scroll enabled.
106109

107-
## Support
108-
If you have any questions regarding the use of this tutorial, please contact us for support
109-
at info@cleveroad.com (email subject: «Sliding android app tutorial. Support request.»)
110-
<br>or
111-
<br>Use our contacts:
112-
<br><a href="https://www.cleveroad.com/?utm_source=github&utm_medium=link&utm_campaign=contacts">Cleveroad.com</a>
113-
<br><a href="https://www.facebook.com/cleveroadinc">Facebook account</a>
114-
<br><a href="https://twitter.com/CleveroadInc">Twitter account</a>
115-
<br><a href="https://plus.google.com/+CleveroadInc/">Google+ account</a>
116110

117111
[migration manuals]: https://github.com/Cleveroad/SlidingTutorial-Android/blob/master/MIGRATION.md
118112
[changelog history]: https://github.com/Cleveroad/SlidingTutorial-Android/blob/master/CHANGELOG.md

README.md

Lines changed: 11 additions & 301 deletions
Large diffs are not rendered by default.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.2.0'
8+
classpath 'com.android.tools.build:gradle:2.2.2'
99
// NOTE: Do not place your application dependencies here; they belong
1010
// in the individual module build.gradle files
1111
}

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
VERSION_NAME=1.0.5
2-
VERSION_CODE=15
1+
VERSION_NAME=1.0.6
2+
VERSION_CODE=16
33
GROUP=com.cleveroad
44

55
POM_DESCRIPTION=Sliding tutorial is simple library that help other developers easy create great tutotial

lib/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 24
5-
buildToolsVersion "24.0.2"
4+
compileSdkVersion 25
5+
buildToolsVersion "25.0.0"
66

77
defaultConfig {
88
minSdkVersion 14
9-
targetSdkVersion 24
9+
targetSdkVersion 25
1010
versionCode 15
1111
versionName "1.0.5"
1212
}
@@ -22,7 +22,7 @@ android {
2222

2323
dependencies {
2424
compile fileTree(dir: 'libs', include: ['*.jar'])
25-
compile 'com.android.support:support-v4:24.2.1'
25+
compile 'com.android.support:support-v4:25.0.1'
2626
}
2727

2828
apply from: './gradle-mvn-push.gradle'

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

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@
2424
package com.cleveroad.slidingtutorial;
2525

2626
import android.content.Context;
27-
import android.graphics.Color;
28-
import android.os.Build;
2927
import android.support.annotation.ColorInt;
3028
import android.support.annotation.ColorRes;
3129
import android.support.annotation.DimenRes;
3230
import android.support.annotation.NonNull;
3331
import android.support.annotation.Nullable;
32+
import android.support.v4.content.ContextCompat;
3433

3534
/**
3635
* Class contains configuration for {@link TutorialPageIndicator}.
@@ -50,28 +49,7 @@ public final class IndicatorOptions {
5049

5150
private Renderer mRenderer;
5251

53-
/**
54-
* Provide default configuration for indicator:
55-
* <ul>
56-
* <li>elementColor : {@link android.graphics.Color#DKGRAY}</li>
57-
* <li>selectedElementColor : {@link android.graphics.Color#WHITE}</li>
58-
* <li>elementSize : {@link com.cleveroad.slidingtutorial.R.dimen#st_indicator_size_default} = 4dp</li>
59-
* <li>setElementSpacing : {@link com.cleveroad.slidingtutorial.R.dimen#st_indicator_spacing_default} = 4dp</li>
60-
* </ul>
61-
*
62-
* @param context {@link Context} instance
63-
* @return default {@link IndicatorOptions} configuration for {@link TutorialPageIndicator}
64-
*/
65-
public static IndicatorOptions provideDefault(@NonNull Context context) {
66-
return new Builder(context)
67-
.setElementColor(Color.DKGRAY)
68-
.setSelectedElementColor(Color.WHITE)
69-
.setElementSizeRes(R.dimen.st_indicator_size_default)
70-
.setElementSpacingRes(R.dimen.st_indicator_spacing_default)
71-
.build();
72-
}
73-
74-
private IndicatorOptions(Builder builder) {
52+
private IndicatorOptions(@NonNull Builder builder) {
7553
mElementColor = builder.mElementColor;
7654
mSelectedElementColor = builder.mSelectedElementColor;
7755
mElementSize = builder.mElementSize;
@@ -135,7 +113,7 @@ private Builder(@NonNull Context context) {
135113
* @see #setSelectedElementColorRes(int)
136114
*/
137115
public Builder setSelectedElementColorRes(@ColorRes int indicatorColorResource) {
138-
return setSelectedElementColor(getColor(mContext, indicatorColorResource));
116+
return setSelectedElementColor(ContextCompat.getColor(mContext, indicatorColorResource));
139117
}
140118

141119
/**
@@ -158,7 +136,7 @@ public Builder setSelectedElementColor(@ColorInt int indicatorElementColor) {
158136
* @see #setSelectedElementColorRes(int)
159137
*/
160138
public Builder setElementColorRes(@ColorRes int indicatorColorResource) {
161-
return setElementColor(getColor(mContext, indicatorColorResource));
139+
return setElementColor(ContextCompat.getColor(mContext, indicatorColorResource));
162140
}
163141

164142
/**
@@ -230,15 +208,6 @@ public Builder setRenderer(@NonNull Renderer renderer) {
230208
return this;
231209
}
232210

233-
@SuppressWarnings("deprecation")
234-
private static int getColor(@NonNull Context context, @ColorRes int colorResource) {
235-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
236-
return context.getColor(colorResource);
237-
} else {
238-
return context.getResources().getColor(colorResource);
239-
}
240-
}
241-
242211
/**
243212
* Build {@link IndicatorOptions} instance with specified configuration.
244213
*

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
6868
return mPage.onCreateView(inflater, container, savedInstanceState);
6969
}
7070

71-
/**
72-
* Method that apply a custom transformation to the page views
73-
*
74-
* @param pageWidth pageWidth
75-
* @param position Position of page relative to the current front-and-center
76-
* position of the pager. 0 is front and center. 1 is one full
77-
* page position to the right, and -1 is one page position to the left.
78-
*/
79-
final void transformPage(int pageWidth, float position) {
80-
mPage.transformPage(pageWidth, position);
71+
@Override
72+
public void onDestroyView() {
73+
mPage.onDestroyView();
74+
super.onDestroyView();
8175
}
8276

8377
@LayoutRes

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInst
6767
return view;
6868
}
6969

70+
void onDestroyView() {
71+
for (TransformItem transformItem : mTransformItems) {
72+
transformItem.setView(null);
73+
}
74+
}
75+
7076
/**
7177
* Method that apply a custom transformation to the page views
7278
*

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
6868
return mPage.onCreateView(inflater, container, savedInstanceState);
6969
}
7070

71-
/**
72-
* Method that apply a custom transformation to the page views
73-
*
74-
* @param pageWidth pageWidth
75-
* @param position Position of page relative to the current front-and-center
76-
* position of the pager. 0 is front and center. 1 is one full
77-
* page position to the right, and -1 is one page position to the left.
78-
*/
79-
final void transformPage(int pageWidth, float position) {
80-
mPage.transformPage(pageWidth, position);
71+
@Override
72+
public void onDestroyView() {
73+
mPage.onDestroyView();
74+
super.onDestroyView();
8175
}
8276

8377
@LayoutRes

0 commit comments

Comments
 (0)