Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

Version | Changes
--- | ---
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>
v.1.0.8 | Fixed issue with NullPointerException with addOnTutorialPageChangeListener() called before onCreate()
v.1.0.7 | <ul><li>Fixed import for SupportTutorialFragment</li><li>Updated versions of dependencies</li></ul>
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>
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ All you need to do is:

## Full Documentation

## Setup
To include this library to your project add dependency in **build.gradle** file:
```groovy
dependencies {
implementation "com.cleveroad:slidingtutorial:1.0.9"
}
```

[Quick Start]

* [Configure your tutorial with TutorialOptions]
Expand Down
12 changes: 10 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.junit_version = '4.12'
ext.support_version = '28.0.0'
ext.constraint_layout_version = '1.1.3'
ext.leakcanary_version = '1.5.4'
ext.tools_build_gradle_version = '3.1.3'

repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath "com.android.tools.build:gradle:$tools_build_gradle_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -14,5 +21,6 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
}
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION_NAME=1.0.8
VERSION_CODE=18
VERSION_NAME=1.0.9
VERSION_CODE=19
GROUP=com.cleveroad

POM_DESCRIPTION=Sliding tutorial is simple library that help other developers easy create great tutotial
Expand Down
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Wed Nov 14 13:57:01 EET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
17 changes: 9 additions & 8 deletions lib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 28

defaultConfig {
minSdkVersion 14
targetSdkVersion 25
versionCode 18
versionName "1.0.8"
minSdkVersion 15
targetSdkVersion 28
versionCode 19
versionName "1.0.9"
}
buildTypes {
release {
Expand All @@ -21,8 +20,10 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:25.3.1'
final support_version = '28.0.0'

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:support-v4:$support_version"
}

apply from: './gradle-mvn-push.gradle'
3 changes: 1 addition & 2 deletions lib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cleveroad.slidingtutorial"/>
<manifest package="com.cleveroad.slidingtutorial" />
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import android.app.FragmentTransaction;
import android.os.Build;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.v4.view.PagerAdapter;
import android.util.Log;
import android.view.View;
Expand Down Expand Up @@ -71,16 +72,17 @@ abstract class FragmentPagerAdapter extends PagerAdapter {
public abstract Fragment getItem(int position);

@Override
public void startUpdate(ViewGroup container) {
public void startUpdate(@NonNull ViewGroup container) {
if (container.getId() == View.NO_ID) {
throw new IllegalStateException("ViewPager with adapter " + this
+ " requires a view id");
}
}

@NonNull
@SuppressLint("CommitTransaction")
@Override
public Object instantiateItem(ViewGroup container, int position) {
public Object instantiateItem(@NonNull ViewGroup container, int position) {
if (mCurTransaction == null) {
mCurTransaction = mFragmentManager.beginTransaction();
}
Expand Down Expand Up @@ -115,7 +117,7 @@ private void setUserVisibilityHint(Fragment fragment, boolean isVisible) {

@SuppressLint("CommitTransaction")
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
if (mCurTransaction == null) {
mCurTransaction = mFragmentManager.beginTransaction();
}
Expand All @@ -125,31 +127,29 @@ public void destroyItem(ViewGroup container, int position, Object object) {
}

@Override
public void setPrimaryItem(ViewGroup container, int position, Object object) {
public void setPrimaryItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
Fragment fragment = (Fragment) object;
if (fragment != mCurrentPrimaryItem) {
if (mCurrentPrimaryItem != null) {
mCurrentPrimaryItem.setMenuVisibility(false);
setUserVisibilityHint(mCurrentPrimaryItem, false);
}
if (fragment != null) {
fragment.setMenuVisibility(true);
setUserVisibilityHint(fragment, true);
}
fragment.setMenuVisibility(true);
setUserVisibilityHint(fragment, true);
mCurrentPrimaryItem = fragment;
}
}

@Override
public void finishUpdate(ViewGroup container) {
public void finishUpdate(@NonNull ViewGroup container) {
if (mCurTransaction != null) {
mCurTransaction.commitAllowingStateLoss();
mCurTransaction = null;
}
}

@Override
public boolean isViewFromObject(View view, Object object) {
public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
return ((Fragment) object).getView() == view;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ public interface OnTutorialPageChangeListener {
* @param position Position index of the new selected page.
*/
void onPageChanged(int position);

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@
class PageImpl {

private InternalFragment mInternalFragment;

@LayoutRes
private int mLayoutResId;
private TransformItem[] mTransformItems;
private int mLayoutResId;

PageImpl(@NonNull InternalFragment internalFragment) {
mInternalFragment = internalFragment;
Expand All @@ -63,7 +61,6 @@ View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInst
}
transformItem.setView(transformView);
}

return view;
}

Expand Down Expand Up @@ -99,5 +96,4 @@ interface InternalFragment {

Bundle getArguments();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,4 @@ int getPosition() {
TransformItem[] getTransformItems() {
return mTransformItems;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
@SuppressWarnings("ConstantConditions")
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return mPage.onCreateView(inflater, container, savedInstanceState);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ static <T extends Parcelable> T[] getParcelableArray(@NonNull Bundle bundle, @No
}
return items;
}

return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,4 @@ TransformItem[] getTransformItems() {

return transformItems;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* @see <a href="https://code.google.com/p/android/issues/detail?id=66620">Issue 66620</a>
*/
public class SlidingTutorialViewPager extends ViewPager {

public SlidingTutorialViewPager(Context context) {
super(context);
}
Expand All @@ -33,11 +34,11 @@ public boolean onInterceptTouchEvent(MotionEvent event) {
}

@Override
public boolean onTouchEvent(MotionEvent ev) {
public boolean onTouchEvent(MotionEvent event) {
if (getAdapter() == null || getAdapter().getCount() == 0) {
return false;
}
return super.onTouchEvent(ev);
return super.onTouchEvent(event);
}

@Override
Expand All @@ -46,7 +47,6 @@ protected int getChildDrawingOrder(int childCount, int i) {
return super.getChildDrawingOrder(childCount, i);
} catch (IndexOutOfBoundsException ignored) {
}

return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,4 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeString(mDirection.name());
dest.writeFloat(mShiftCoefficient);
}

}
Loading