Skip to content

Commit 56e1baa

Browse files
committed
#2 feature added to library
v1.0.2 released
1 parent 41c4221 commit 56e1baa

File tree

5 files changed

+37
-81
lines changed

5 files changed

+37
-81
lines changed

.idea/misc.xml

Lines changed: 1 addition & 78 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,35 @@ public class MainActivity extends TutorialActivity {
2121
addFragment(new Step.Builder().setTitle("This is header")
2222
.setContent("This is content")
2323
.setBackgroundColor(Color.parseColor("#FF0957")) // int background color
24-
.setDrawable(R.drawable.ss_1) // int top drawable
24+
.setDrawable(R.drawable.ss_1) // int top drawable
2525
.setSummary("This is summary")
2626
.build());
2727
}
2828
}
2929

3030
```
3131

32+
Some helper methods
33+
```java
34+
35+
setPrevText(text); // Previous button text
36+
setNextText(text); // Next button text
37+
setFinishText(text); // Finish button text
38+
setCancelText(text); // Cancel button text
39+
40+
```
41+
42+
If you want to open another activity on tutorial finish
43+
```java
44+
45+
@Override
46+
public void finishTutorial() {
47+
// Your implementation
48+
}
49+
50+
```
51+
52+
3253
## Download
3354

3455
### Step 1. Add the JitPack repository to your build file
@@ -50,7 +71,7 @@ Add it in your root build.gradle at the end of repositories:
5071
```groovy
5172
5273
dependencies {
53-
compile 'com.github.msayan:tutorial-view:v1.0.0'
74+
compile 'com.github.msayan:tutorial-view:v1.0.2'
5475
}
5576
5677
```

app/src/main/java/com/hololo/tutorial/sample/MainActivity.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.graphics.Color;
44
import android.os.Bundle;
5+
import android.widget.Toast;
56

67
import com.hololo.tutorial.library.Step;
78
import com.hololo.tutorial.library.TutorialActivity;
@@ -17,4 +18,10 @@ protected void onCreate(Bundle savedInstanceState) {
1718
addFragment(new Step.Builder().setTitle(getString(R.string.edit_data)).setContent(getString(R.string.update_easily)).setBackgroundColor(Color.parseColor("#1098FE")).setDrawable(R.drawable.ss_3).setSummary(getString(R.string.continue_and_result)).build());
1819
addFragment(new Step.Builder().setTitle(getString(R.string.result_awesome)).setContent(getString(R.string.after_updating)).setBackgroundColor(Color.parseColor("#CA70F3")).setDrawable(R.drawable.ss_4).setSummary(getString(R.string.thank_you)).build());
1920
}
21+
22+
@Override
23+
public void finishTutorial() {
24+
Toast.makeText(this, "Tutorial finished", Toast.LENGTH_SHORT).show();
25+
finish();
26+
}
2027
}

library/src/main/java/com/hololo/tutorial/library/TutorialActivity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,15 @@ private void changeFragment(boolean isNext) {
183183
}
184184

185185
if (item < 0 || item == steps.size()) {
186-
finish();
186+
finishTutorial();
187187
} else
188188
pager.setCurrentItem(item, true);
189189
}
190190

191+
public void finishTutorial() {
192+
finish();
193+
}
194+
191195
public void setPrevText(String text) {
192196
prevText = text;
193197
}

0 commit comments

Comments
 (0)