Skip to content

Commit c086245

Browse files
committed
Fixed translation animation in sample project. Added custom layout in sample. Fixed button appearance on top of all layout on lollipop.
1 parent 3607d34 commit c086245

File tree

6 files changed

+82
-8
lines changed

6 files changed

+82
-8
lines changed

build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ buildscript {
66
}
77
dependencies {
88
classpath 'com.android.tools.build:gradle:2.1.0'
9-
109
// NOTE: Do not place your application dependencies here; they belong
1110
// in the individual module build.gradle files
1211
}

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.2
2-
VERSION_CODE=12
1+
VERSION_NAME=1.0.3
2+
VERSION_CODE=13
33
GROUP=com.cleveroad
44

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ private class FragmentTransformer implements ViewPager.PageTransformer {
292292

293293
public void transformPage(View view, float position) {
294294
Object obj = view.getTag(R.id.st_page_fragment);
295-
if (obj instanceof PageFragment) {
296-
((PageFragment) obj).transformPage(view.getWidth(), position);
295+
if (obj instanceof PageImpl) {
296+
((PageImpl) obj).transformPage(view.getWidth(), position);
297297
}
298298
}
299299
}

sample/src/main/java/com/cleveroad/slidingtutorial/sample/CustomTutorialFragment.java

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public PageOptions provide(int position) {
4747
case 0: {
4848
pageLayoutResId = R.layout.fragment_page_first;
4949
tutorialItems = new TransformItem[]{
50-
TransformItem.create(R.id.ivFirstImage, Direction.LEFT_TO_RIGHT, 0.2f),
50+
TransformItem.create(R.id.ivFirstImage, Direction.LEFT_TO_RIGHT, 0.50f),
5151
TransformItem.create(R.id.ivSecondImage, Direction.RIGHT_TO_LEFT, 0.06f),
5252
TransformItem.create(R.id.ivThirdImage, Direction.LEFT_TO_RIGHT, 0.08f),
5353
TransformItem.create(R.id.ivFourthImage, Direction.RIGHT_TO_LEFT, 0.1f),
@@ -61,7 +61,7 @@ public PageOptions provide(int position) {
6161
case 1: {
6262
pageLayoutResId = R.layout.fragment_page_third;
6363
tutorialItems = new TransformItem[]{
64-
TransformItem.create(R.id.ivFirstImage, Direction.RIGHT_TO_LEFT, 0.2f),
64+
TransformItem.create(R.id.ivFirstImage, Direction.RIGHT_TO_LEFT, 0.50f),
6565
TransformItem.create(R.id.ivSecondImage, Direction.LEFT_TO_RIGHT, 0.06f),
6666
TransformItem.create(R.id.ivThirdImage, Direction.RIGHT_TO_LEFT, 0.08f),
6767
TransformItem.create(R.id.ivFourthImage, Direction.LEFT_TO_RIGHT, 0.1f),
@@ -74,7 +74,7 @@ public PageOptions provide(int position) {
7474
case 2: {
7575
pageLayoutResId = R.layout.fragment_page_second;
7676
tutorialItems = new TransformItem[]{
77-
TransformItem.create(R.id.ivFirstImage, Direction.RIGHT_TO_LEFT, 0.2f),
77+
TransformItem.create(R.id.ivFirstImage, Direction.RIGHT_TO_LEFT, 0.7f),
7878
TransformItem.create(R.id.ivSecondImage, Direction.LEFT_TO_RIGHT, 0.06f),
7979
TransformItem.create(R.id.ivThirdImage, Direction.RIGHT_TO_LEFT, 0.08f),
8080
TransformItem.create(R.id.ivFourthImage, Direction.LEFT_TO_RIGHT, 0.1f),
@@ -130,6 +130,31 @@ public void onCreate(Bundle savedInstanceState) {
130130
addOnTutorialPageChangeListener(this);
131131
}
132132

133+
@Override
134+
protected int getLayoutResId() {
135+
return R.layout.custom_tutorial_layout_ids_example;
136+
}
137+
138+
@Override
139+
protected int getIndicatorResId() {
140+
return R.id.indicatorCustom;
141+
}
142+
143+
@Override
144+
protected int getSeparatorResId() {
145+
return R.id.separatorCustom;
146+
}
147+
148+
@Override
149+
protected int getButtonSkipResId() {
150+
return R.id.tvSkipCustom;
151+
}
152+
153+
@Override
154+
protected int getViewPagerResId() {
155+
return R.id.viewPagerCustom;
156+
}
157+
133158
@Override
134159
protected TutorialOptions provideTutorialOptions() {
135160
return newTutorialOptionsBuilder(getActivity())

sample/src/main/res/layout/activity_main.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
android:layout_width="match_parent"
44
android:layout_height="match_parent">
55

6+
67
<Button
78
android:id="@+id/bRetry"
89
android:layout_width="wrap_content"
910
android:layout_height="wrap_content"
1011
android:layout_centerInParent="true"
12+
android:stateListAnimator="@null"
1113
android:text="Retry"/>
1214

1315
<FrameLayout
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<FrameLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:app="http://schemas.android.com/apk/res-auto"
5+
xmlns:tools="http://schemas.android.com/tools"
6+
android:layout_width="match_parent"
7+
android:layout_height="match_parent"
8+
tools:background="@android:color/darker_gray">
9+
10+
<android.support.v4.view.ViewPager
11+
android:id="@+id/viewPagerCustom"
12+
android:layout_width="match_parent"
13+
android:layout_height="match_parent"/>
14+
15+
<FrameLayout
16+
android:layout_width="match_parent"
17+
android:layout_height="50dp"
18+
android:layout_gravity="top|center_horizontal">
19+
20+
<View
21+
android:id="@+id/separatorCustom"
22+
android:layout_width="match_parent"
23+
android:layout_height="0.1dp"
24+
android:background="@android:color/white"/>
25+
26+
<TextView
27+
android:id="@+id/tvSkipCustom"
28+
android:layout_width="wrap_content"
29+
android:layout_height="match_parent"
30+
android:layout_gravity="bottom"
31+
android:layout_marginEnd="10dp"
32+
android:layout_marginRight="10dp"
33+
android:fontFamily="sans-serif-light"
34+
android:padding="10dp"
35+
android:text="@string/st_skip"
36+
android:textColor="@android:color/white"
37+
android:textSize="21sp"
38+
tools:ignore="UnusedAttribute"/>
39+
40+
<com.cleveroad.slidingtutorial.TutorialPageIndicator
41+
android:id="@+id/indicatorCustom"
42+
android:layout_width="match_parent"
43+
android:layout_height="wrap_content"
44+
android:layout_gravity="center"/>
45+
46+
</FrameLayout>
47+
48+
</FrameLayout>

0 commit comments

Comments
 (0)