Skip to content

Commit dd779f6

Browse files
committed
Update README
1 parent 3ff4b6e commit dd779f6

14 files changed

+382
-76
lines changed

.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: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,26 @@
33

44
![alt tag](http://raw.github.com/ItzikBraun/TutorialView/master/screen_shots/example.gif)
55

6-
An Android library project providing Activity with explenation about views in your app.
6+
An Android library project providing `Activity` with explanation about views in your app.
77

8-
The TutorialActivity can be used as a walk through for the entire screen that is currently visible, Or just for one view on the screen.
8+
The `TutorialActivity` can be used as a walk through for the entire screen that is currently visible, Or just for one view on the screen.
99

10-
To get the intent to start the TutorialActivity you need to use the TutorialIntentBuilder, The builder will help you build the intent to start the activity, You would have to pass a Tutorial object to the intent builder.
10+
To get the intent to start the `TutorialActivity` you need to use the `TutorialIntentBuilder`,
11+
The builder will help you build the intent to start the activity, You would have to pass a `Tutorial` object to the intent builder.
1112

1213
###Usage
1314
####Tutorial
14-
The tutorial object holds the tutorial info and attributes. You can create a Tutorial by using the TutorialBuilder.
15+
The tutorial object holds the tutorial info and attributes. You can create a Tutorial by using the `TutorialBuilder`.
1516
You can customize the following:
16-
* Title - Will apear on the top of the view, If the view that is surrounded is on top it will be shown below it.
17-
* TutorialText - The explanation of about the view, It will apear above or below the view.
17+
* Title - Will appear on the top of the view, If the view that is surrounded is on top it will be shown below it.
18+
* TutorialText - The explanation of about the view, It will appear above or below the view.
1819
* BackgroundColor - The background color of the view.
19-
* TutorialTextSize - The size that will be used for the tutorial explantion text.
20+
* TutorialTextSize - The size that will be used for the tutorial explanation text.
2021
* TypefaceName - The path to the wanted typeface to use for all text view in the tutorial, Example: "/fonts/arial.ttf".
2122
* AnimationDuration - the duration time in milliseconds that will be used for the animation.
22-
* ~~AnimatinType - the animation that will be used for showing and hiding the tutorial~~ This is a work in progress currently not working.
23+
* InfoPosition - The position of the info text, This could be Above, Below, LeftOf and Right of all relevant to the view that need to be surrounded. Values are stored in `Tutorial.InfoPosition`
24+
* GotItPosition - The position of the "GotIt" button, This could be Top(If has title it will be below it) and Bottom. Values are stored in `Tutorial.GotItPosition`
25+
* ~~AnimationType - the animation that will be used for showing and hiding the tutorial~~ This is a work in progress currently not working.
2326

2427
Each tutorial that was passed holds it's position on screen, title, background color, the text explenation and more customizable attributes.
2528

@@ -66,7 +69,7 @@ overridePendingTransition(R.anim.dummy, R.anim.dummy);
6669
```
6770

6871
####Important!
69-
You should override the activity pending transition aniamtion like this, If you wont override it the TutorialActivity would animate itself in and will ruin the view animation. (Call it after you call startActivity(Intent) ).
72+
You should override the `Activity` pending transition animation like this, If you wont override it the `TutorialActivity` would animate itself in and will ruin the view animation. (Call it after you call `startActivity(Intent)` ).
7073

7174

7275
``` java
@@ -92,7 +95,7 @@ include':tutorial_view'
9295
```
9396

9497
###TODO:
95-
* Return result when TutorialActivity finishes so you could know when it was done and if was skipped.
98+
* Return result when `TutorialActivity` finishes so you could know when it was done and if was skipped.
9699

97100
###Author
98101
[Itzik Braun - Google+](https://plus.google.com/+ItzikBraunster)

TutorialView.iml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
3+
<component name="FacetManager">
4+
<facet type="java-gradle" name="Java-Gradle">
5+
<configuration>
6+
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
7+
</configuration>
8+
</facet>
9+
</component>
10+
<component name="NewModuleRootManager" inherit-compiler-output="false">
11+
<output url="file://$MODULE_DIR$/build/classes/main" />
12+
<output-test url="file://$MODULE_DIR$/build/classes/test" />
13+
<exclude-output />
14+
<content url="file://$MODULE_DIR$">
15+
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
16+
</content>
17+
<orderEntry type="inheritedJdk" />
18+
<orderEntry type="sourceFolder" forTests="false" />
19+
</component>
20+
</module>
21+

tutorial_view/src/main/java/com/braunster/tutorialview/TutorialInterface.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,12 @@ public interface TutorialInterface {
8787
public void setAnimationDuration(long duration);
8888

8989
public long getAnimationDuration();
90+
91+
public void setTutorialInfoTextPosition(int infoTextPosition);
92+
93+
public int getTutorialInfoTextPosition();
94+
95+
public void setTutorialGotItPosition(int gotItPosition);
96+
97+
public int getTutorialGotItPosition();
9098
}

tutorial_view/src/main/java/com/braunster/tutorialview/object/Tutorial.java

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.os.Parcel;
55
import android.os.Parcelable;
66
import android.view.View;
7+
import android.widget.RelativeLayout;
78

89
import com.braunster.tutorialview.TutorialInterface;
910
import com.braunster.tutorialview.view.AbstractTutorialView;
@@ -20,6 +21,20 @@ public class Tutorial implements Parcelable , TutorialInterface {
2021
* */
2122
private String mInfoText;
2223

24+
/**
25+
* Holds the value that will be used for placing the info text in the tutorial view.
26+
*
27+
* @see com.braunster.tutorialview.object.Tutorial.InfoPosition
28+
*/
29+
private int mTutorialInfoTextPosition = InfoPosition.AUTO;
30+
31+
/**
32+
* Holds the value that will be used for placing the "GotIt" button in the tutorial view.
33+
*
34+
* @see com.braunster.tutorialview.object.Tutorial.GotItPosition
35+
*/
36+
private int mTutorialGotItPosition = GotItPosition.AUTO;
37+
2338
private float mPositionToSurroundX, mPositionToSurroundY;
2439
private int mPositionToSurroundWidth, mPositionToSurroundHeight;
2540

@@ -185,6 +200,26 @@ public long getAnimationDuration() {
185200
return mAnimationDuration;
186201
}
187202

203+
@Override
204+
public void setTutorialInfoTextPosition(int infoTextPosition) {
205+
this.mTutorialInfoTextPosition = infoTextPosition;
206+
}
207+
208+
@Override
209+
public int getTutorialInfoTextPosition() {
210+
return mTutorialInfoTextPosition;
211+
}
212+
213+
@Override
214+
public void setTutorialGotItPosition(int gotItPosition) {
215+
this.mTutorialGotItPosition = gotItPosition;
216+
}
217+
218+
@Override
219+
public int getTutorialGotItPosition() {
220+
return mTutorialGotItPosition;
221+
}
222+
188223
@Override
189224
public void setAnimationDuration(long mAnimationDuration) {
190225
this.mAnimationDuration = mAnimationDuration;
@@ -194,7 +229,6 @@ public void setAnimationDuration(long mAnimationDuration) {
194229
public void setTutorialTextTypeFace(String mTutorialTextTypeFaceName) {
195230
this.mTutorialTextTypeFaceName = mTutorialTextTypeFaceName;
196231
}
197-
198232

199233
public String getTutorialTextTypeFace() {
200234
return mTutorialTextTypeFaceName;
@@ -217,6 +251,8 @@ public String getTutorialTextTypeFace() {
217251
this.mTutorialTextTypeFaceName = in.readString();
218252
this.mTutorialTextColor = in.readInt();
219253
this.mTutorialTextSize = in.readInt();
254+
this.mTutorialInfoTextPosition = in.readInt();
255+
this.mTutorialGotItPosition = in.readInt();
220256
}
221257

222258
public static final Parcelable.Creator<Tutorial> CREATOR
@@ -250,5 +286,41 @@ public void writeToParcel(Parcel dest, int flags) {
250286
dest.writeString(mTutorialTextTypeFaceName);
251287
dest.writeInt(mTutorialTextColor);
252288
dest.writeInt(mTutorialTextSize);
289+
dest.writeInt(mTutorialInfoTextPosition);
290+
dest.writeInt(mTutorialGotItPosition);
291+
}
292+
293+
294+
/**
295+
* Static values representing available positions for placing the info text in the TutorialView.
296+
*
297+
* @see Tutorial#mTutorialInfoTextPosition
298+
**/
299+
public class InfoPosition{
300+
public static final int AUTO = -1991, LEFT_OF = RelativeLayout.LEFT_OF, RIGHT_OF = RelativeLayout.RIGHT_OF, ABOVE = RelativeLayout.ABOVE, BELOW = RelativeLayout.BELOW;
301+
}
302+
303+
/**
304+
* Static values representing available positions for placing the "GotIt" button in the TutorialView.
305+
*
306+
* @see Tutorial#mTutorialGotItPosition
307+
**/
308+
public class GotItPosition{
309+
310+
/**
311+
* The "GotIt" button position will be automatically calculated according to the view to surround position.
312+
**/
313+
public static final int AUTO = -1991;
314+
315+
/**
316+
* Set the "GotIt" button to be in the top part of the tutorial,
317+
* If the tutorial has a title then the button will be placed below it.
318+
**/
319+
public static final int TOP = 0;
320+
321+
/**
322+
* Set the position of the "GotIt" button to be at the bottom of the tutorial.
323+
**/
324+
public static final int BOTTOM = 1;
253325
}
254326
}

tutorial_view/src/main/java/com/braunster/tutorialview/object/TutorialBuilder.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ public class TutorialBuilder {
2020
private float mPositionToSurroundX = -1, mPositionToSurroundY = -1;
2121
private int mPositionToSurroundWidth = -1, mPositionToSurroundHeight = -1;
2222

23+
/**
24+
* Holds the value that will be used for placing the info text in the tutorial view.
25+
*
26+
* @see com.braunster.tutorialview.object.Tutorial.InfoPosition
27+
*/
28+
private int mTutorialInfoTextPosition = Tutorial.InfoPosition.AUTO;
29+
30+
/**
31+
* Holds the value that will be used for placing the "GotIt" button in the tutorial view.
32+
*
33+
* @see com.braunster.tutorialview.object.Tutorial.GotItPosition
34+
*/
35+
private int mTutorialGotItPosition = Tutorial.GotItPosition.AUTO;
36+
2337
/**
2438
* Holds the animation duration that will be used to animate the tutorial in and out.
2539
*
@@ -148,6 +162,16 @@ public TutorialBuilder setAnimationDuration(long mAnimationDuration) {
148162
return this;
149163
}
150164

165+
public TutorialBuilder setTutorialInfoTextPosition(int infoTextPosition) {
166+
this.mTutorialInfoTextPosition = infoTextPosition;
167+
168+
return this;
169+
}
170+
171+
public void setTutorialGotItPosition(int gotItPosition) {
172+
this.mTutorialGotItPosition = gotItPosition;
173+
}
174+
151175
public Tutorial build(){
152176
Tutorial tutorial = new Tutorial();
153177

@@ -173,6 +197,8 @@ public Tutorial build(){
173197
tutorial.setAnimationDuration(mAnimationDuration);
174198
tutorial.setAnimationType(mAnimationType);
175199
tutorial.setTutorialTextTypeFace(mTutorialTextTypeFaceName);
200+
tutorial.setTutorialInfoTextPosition(mTutorialInfoTextPosition);
201+
tutorial.setTutorialGotItPosition(mTutorialGotItPosition);
176202

177203
return tutorial;
178204
}

tutorial_view/src/main/java/com/braunster/tutorialview/object/TutorialIntentBuilder.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public TutorialIntentBuilder(Intent intent){
4444
}
4545

4646

47-
4847
public TutorialIntentBuilder hasStatusBar(boolean hasStatusBar){
4948
intent.putExtra(HAS_STATUS_BAR, hasStatusBar);
5049
return this;

0 commit comments

Comments
 (0)