Skip to content

Commit afa69fb

Browse files
author
sergey_polohach_cr
committed
fixed issue
1 parent 6c48c8e commit afa69fb

File tree

63 files changed

+1207
-1226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1207
-1226
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
Version | Changes
88
--- | ---
9+
v.1.0.9 | <ul><li>Fixed issue #65 https://github.com/Cleveroad/SlidingTutorial-Android/issues/65</li><li>Scrolling in one direction. Added flag for rollback?</li></ul>
910
v.1.0.8 | Fixed issue with NullPointerException with addOnTutorialPageChangeListener() called before onCreate()
1011
v.1.0.7 | <ul><li>Fixed import for SupportTutorialFragment</li><li>Updated versions of dependencies</li></ul>
1112
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>

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ All you need to do is:
2828

2929
## Full Documentation
3030

31+
## Setup
32+
To include this library to your project add dependency in **build.gradle** file:
33+
```groovy
34+
dependencies {
35+
implementation "com.cleveroad:slidingtutorial:1.0.9"
36+
}
37+
```
38+
3139
[Quick Start]
3240

3341
* [Configure your tutorial with TutorialOptions]

build.gradle

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4+
ext.junit_version = '4.12'
5+
ext.support_version = '28.0.0'
6+
ext.constraint_layout_version = '1.1.3'
7+
ext.leakcanary_version = '1.5.4'
8+
ext.tools_build_gradle_version = '3.1.3'
9+
410
repositories {
511
jcenter()
12+
google()
613
}
714
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.3.0'
15+
classpath "com.android.tools.build:gradle:$tools_build_gradle_version"
916
// NOTE: Do not place your application dependencies here; they belong
1017
// in the individual module build.gradle files
1118
}
@@ -14,5 +21,6 @@ buildscript {
1421
allprojects {
1522
repositories {
1623
jcenter()
24+
google()
1725
}
18-
}
26+
}

gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
VERSION_NAME=1.0.8
2-
VERSION_CODE=18
1+
VERSION_NAME=1.0.9
2+
VERSION_CODE=19
33
GROUP=com.cleveroad
44

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

gradle/wrapper/gradle-wrapper.jar

53.4 KB
Binary file not shown.
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Wed Nov 14 13:57:01 EET 2018
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

lib/build.gradle

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 25
5-
buildToolsVersion "25.0.2"
4+
compileSdkVersion 28
65

76
defaultConfig {
8-
minSdkVersion 14
9-
targetSdkVersion 25
10-
versionCode 18
11-
versionName "1.0.8"
7+
minSdkVersion 15
8+
targetSdkVersion 28
9+
versionCode 19
10+
versionName "1.0.9"
1211
}
1312
buildTypes {
1413
release {
@@ -21,8 +20,10 @@ android {
2120
}
2221

2322
dependencies {
24-
compile fileTree(dir: 'libs', include: ['*.jar'])
25-
compile 'com.android.support:support-v4:25.3.1'
23+
final support_version = '28.0.0'
24+
25+
implementation fileTree(dir: 'libs', include: ['*.jar'])
26+
implementation "com.android.support:support-v4:$support_version"
2627
}
2728

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

lib/src/main/AndroidManifest.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.cleveroad.slidingtutorial"/>
1+
<manifest package="com.cleveroad.slidingtutorial" />

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

+10-10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import android.app.FragmentTransaction;
3030
import android.os.Build;
3131
import android.os.Parcelable;
32+
import android.support.annotation.NonNull;
3233
import android.support.v4.view.PagerAdapter;
3334
import android.util.Log;
3435
import android.view.View;
@@ -71,16 +72,17 @@ abstract class FragmentPagerAdapter extends PagerAdapter {
7172
public abstract Fragment getItem(int position);
7273

7374
@Override
74-
public void startUpdate(ViewGroup container) {
75+
public void startUpdate(@NonNull ViewGroup container) {
7576
if (container.getId() == View.NO_ID) {
7677
throw new IllegalStateException("ViewPager with adapter " + this
7778
+ " requires a view id");
7879
}
7980
}
8081

82+
@NonNull
8183
@SuppressLint("CommitTransaction")
8284
@Override
83-
public Object instantiateItem(ViewGroup container, int position) {
85+
public Object instantiateItem(@NonNull ViewGroup container, int position) {
8486
if (mCurTransaction == null) {
8587
mCurTransaction = mFragmentManager.beginTransaction();
8688
}
@@ -115,7 +117,7 @@ private void setUserVisibilityHint(Fragment fragment, boolean isVisible) {
115117

116118
@SuppressLint("CommitTransaction")
117119
@Override
118-
public void destroyItem(ViewGroup container, int position, Object object) {
120+
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
119121
if (mCurTransaction == null) {
120122
mCurTransaction = mFragmentManager.beginTransaction();
121123
}
@@ -125,31 +127,29 @@ public void destroyItem(ViewGroup container, int position, Object object) {
125127
}
126128

127129
@Override
128-
public void setPrimaryItem(ViewGroup container, int position, Object object) {
130+
public void setPrimaryItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
129131
Fragment fragment = (Fragment) object;
130132
if (fragment != mCurrentPrimaryItem) {
131133
if (mCurrentPrimaryItem != null) {
132134
mCurrentPrimaryItem.setMenuVisibility(false);
133135
setUserVisibilityHint(mCurrentPrimaryItem, false);
134136
}
135-
if (fragment != null) {
136-
fragment.setMenuVisibility(true);
137-
setUserVisibilityHint(fragment, true);
138-
}
137+
fragment.setMenuVisibility(true);
138+
setUserVisibilityHint(fragment, true);
139139
mCurrentPrimaryItem = fragment;
140140
}
141141
}
142142

143143
@Override
144-
public void finishUpdate(ViewGroup container) {
144+
public void finishUpdate(@NonNull ViewGroup container) {
145145
if (mCurTransaction != null) {
146146
mCurTransaction.commitAllowingStateLoss();
147147
mCurTransaction = null;
148148
}
149149
}
150150

151151
@Override
152-
public boolean isViewFromObject(View view, Object object) {
152+
public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
153153
return ((Fragment) object).getView() == view;
154154
}
155155

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

-1
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,4 @@ public interface OnTutorialPageChangeListener {
3535
* @param position Position index of the new selected page.
3636
*/
3737
void onPageChanged(int position);
38-
3938
}

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

+1-5
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@
3535
class PageImpl {
3636

3737
private InternalFragment mInternalFragment;
38-
39-
@LayoutRes
40-
private int mLayoutResId;
4138
private TransformItem[] mTransformItems;
39+
private int mLayoutResId;
4240

4341
PageImpl(@NonNull InternalFragment internalFragment) {
4442
mInternalFragment = internalFragment;
@@ -63,7 +61,6 @@ View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInst
6361
}
6462
transformItem.setView(transformView);
6563
}
66-
6764
return view;
6865
}
6966

@@ -99,5 +96,4 @@ interface InternalFragment {
9996

10097
Bundle getArguments();
10198
}
102-
10399
}

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

-1
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,4 @@ int getPosition() {
6666
TransformItem[] getTransformItems() {
6767
return mTransformItems;
6868
}
69-
7069
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
6464
@SuppressWarnings("ConstantConditions")
6565
@Nullable
6666
@Override
67-
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
67+
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
6868
return mPage.onCreateView(inflater, container, savedInstanceState);
6969
}
7070

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

-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ static <T extends Parcelable> T[] getParcelableArray(@NonNull Bundle bundle, @No
6262
}
6363
return items;
6464
}
65-
6665
return null;
6766
}
68-
6967
}

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

-1
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,4 @@ TransformItem[] getTransformItems() {
7272

7373
return transformItems;
7474
}
75-
7675
}

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* @see <a href="https://code.google.com/p/android/issues/detail?id=66620">Issue 66620</a>
1717
*/
1818
public class SlidingTutorialViewPager extends ViewPager {
19+
1920
public SlidingTutorialViewPager(Context context) {
2021
super(context);
2122
}
@@ -33,11 +34,11 @@ public boolean onInterceptTouchEvent(MotionEvent event) {
3334
}
3435

3536
@Override
36-
public boolean onTouchEvent(MotionEvent ev) {
37+
public boolean onTouchEvent(MotionEvent event) {
3738
if (getAdapter() == null || getAdapter().getCount() == 0) {
3839
return false;
3940
}
40-
return super.onTouchEvent(ev);
41+
return super.onTouchEvent(event);
4142
}
4243

4344
@Override
@@ -46,7 +47,6 @@ protected int getChildDrawingOrder(int childCount, int i) {
4647
return super.getChildDrawingOrder(childCount, i);
4748
} catch (IndexOutOfBoundsException ignored) {
4849
}
49-
5050
return 0;
5151
}
5252

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

-1
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,4 @@ public void writeToParcel(Parcel dest, int flags) {
110110
dest.writeString(mDirection.name());
111111
dest.writeFloat(mShiftCoefficient);
112112
}
113-
114113
}

0 commit comments

Comments
 (0)