Skip to content

Commit 949ed9e

Browse files
committed
- Fixed error showing tutorial from previous commit.
- Updated the version number and name
1 parent 2b02125 commit 949ed9e

File tree

14 files changed

+103
-46
lines changed

14 files changed

+103
-46
lines changed

.idea/dictionaries/braunster.xml

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

.idea/misc.xml

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

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,14 @@ dependencies {
9292

9393
You can also copy past it to your project and before adding it to your dependencies you need to add it to *settings.gradle* so the system will understand it's a module like this:
9494
```
95-
// Notice that in your settings file there would be more names so dont delete them, This are your other modules.
95+
// Notice that in your settings file there would be more names so don't delete them, This are your other modules.
9696
include':tutorial_view'
9797
```
9898

9999
###TODO:
100100
* Return result when `TutorialActivity` finishes so you could know when it was done and if was skipped.
101+
* add the roboto font family to the app assets so it will work on lower versions
102+
* Make a sample app and publish it on Google Play
101103

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

app/app.iml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
8585
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
8686
</content>
87-
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
87+
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
8888
<orderEntry type="sourceFolder" forTests="false" />
8989
<orderEntry type="module" module-name="tutorial_view" exported="" />
9090
</component>

app/build.gradle

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
apply plugin: 'com.android.application'
22

3+
def versionMajor = 0
4+
def versionMinor = 8
5+
def versionPatch = 1
6+
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
7+
38
android {
4-
compileSdkVersion 21
9+
compileSdkVersion 22
510
buildToolsVersion "21.1.2"
611

712
defaultConfig {
813
applicationId "com.braunster.tutorialviewapp"
914
minSdkVersion 15
10-
targetSdkVersion 21
11-
versionCode 1
12-
versionName "1.0"
15+
targetSdkVersion 22
16+
17+
versionCode versionMajor * 1000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild
18+
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
1319
}
20+
1421
buildTypes {
1522
release {
1623
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

app/src/main/java/com/braunster/tutorialviewapp/MainActivity.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import android.os.Bundle;
77
import android.view.Menu;
88
import android.view.View;
9+
import android.widget.TextView;
910

1011
import com.braunster.tutorialview.object.Tutorial;
1112
import com.braunster.tutorialview.object.TutorialBuilder;
@@ -30,6 +31,11 @@ protected void onCreate(Bundle savedInstanceState) {
3031
// getWindow().requestFeature(Window.FEATURE_NO_TITLE);
3132

3233
setContentView(R.layout.activity_main);
34+
35+
// Setting the version name.
36+
((TextView) findViewById(R.id.txt_version)).setText(String.format("Version: %s", BuildConfig.VERSION_NAME));
37+
38+
3339
tutorialView = (TutorialView) findViewById(R.id.tutorial_view);
3440

3541
findViewById(R.id.view_bottom_left).setOnClickListener(this);
@@ -41,6 +47,7 @@ protected void onCreate(Bundle savedInstanceState) {
4147
if (getActionBar() != null)
4248
getActionBar().setBackgroundDrawable(new ColorDrawable(Color.DKGRAY));
4349

50+
4451
//Using the tutorial view
4552
// This is used for the tutorial view that should be in your root view.
4653
// This may lead to problems when used inside LinearLayout and maybe other view.

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,16 @@
8484
android:layout_marginTop="50dp"
8585
android:id="@+id/view_top_right"/>
8686

87+
<TextView
88+
android:layout_width="wrap_content"
89+
android:layout_height="wrap_content"
90+
android:textSize="20sp"
91+
android:layout_margin="5dp"
92+
android:padding="5dp"
93+
android:id="@+id/txt_version"
94+
android:gravity="center"
95+
android:layout_alignParentBottom="true"
96+
android:layout_alignParentRight="true"
97+
android:text="V"/>
98+
8799
</RelativeLayout>

tutorial_view/build.gradle

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
apply plugin: 'com.android.library'
22

3+
def versionMajor = 0
4+
def versionMinor = 8
5+
def versionPatch = 1
6+
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
7+
8+
39
android {
4-
compileSdkVersion 21
10+
compileSdkVersion 22
511
buildToolsVersion "21.1.2"
612

713
defaultConfig {
814
minSdkVersion 15
9-
targetSdkVersion 21
10-
versionCode 1
11-
versionName "0.7.1"
15+
targetSdkVersion 22
16+
17+
versionCode versionMajor * 1000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild
18+
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
1219
}
20+
1321
buildTypes {
1422
release {
1523
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

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

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.os.Bundle;
66
import android.util.Log;
77

8+
import com.braunster.tutorialview.object.Debug;
89
import com.braunster.tutorialview.object.Tutorial;
910
import com.braunster.tutorialview.object.TutorialIntentBuilder;
1011
import com.braunster.tutorialview.view.TutorialLayout;
@@ -18,7 +19,7 @@
1819
public class TutorialActivity extends Activity {
1920

2021
public static final String TAG = TutorialActivity.class.getSimpleName();
21-
public static final boolean DEBUG = true;
22+
public static final boolean DEBUG = Debug.TutorialActivity;
2223

2324
private TutorialLayout mTutorialLayout;
2425

@@ -28,10 +29,14 @@ public class TutorialActivity extends Activity {
2829

2930
private static final String CURRENT_TUTORIAL = "current_tutorial";
3031

32+
private Bundle savedInstanceState;
33+
3134
@Override
3235
protected void onCreate(Bundle savedInstanceState) {
3336
super.onCreate(savedInstanceState);
3437

38+
this.savedInstanceState = savedInstanceState;
39+
3540
setContentView(R.layout.activity_tutorial_layout);
3641

3742
mTutorialLayout = (TutorialLayout) findViewById(R.id.tutorial_layout);
@@ -45,6 +50,25 @@ protected void onCreate(Bundle savedInstanceState) {
4550

4651
mTutorial = TutorialIntentBuilder.getTutorial(getIntent());
4752

53+
// Finish the activity when the tutorial is closed.
54+
mTutorialLayout.setTutorialClosedListener(new TutorialView.TutorialClosedListener() {
55+
@Override
56+
public void onClosed() {
57+
finish();
58+
}
59+
});
60+
61+
updateSystemUIColors();
62+
}
63+
64+
/**
65+
* Need to wait until the window get focused before doing the animation.
66+
* Also it is good to post it.
67+
* */
68+
@Override
69+
public void onWindowFocusChanged(boolean hasFocus) {
70+
super.onWindowFocusChanged(hasFocus);
71+
4872
if (TutorialIntentBuilder.isWalkThrough(getIntent()))
4973
{
5074
ArrayList<Tutorial> tutorials = TutorialIntentBuilder.getWalkThroughData(getIntent());
@@ -77,26 +101,6 @@ protected void onCreate(Bundle savedInstanceState) {
77101
mTutorialLayout.setTutorial(mTutorial, false);
78102
}
79103

80-
81-
// Finish the activity when the tutorial is closed.
82-
mTutorialLayout.setTutorialClosedListener(new TutorialView.TutorialClosedListener() {
83-
@Override
84-
public void onClosed() {
85-
finish();
86-
}
87-
});
88-
89-
updateSystemUIColors();
90-
}
91-
92-
/**
93-
* Need to wait until the window get focused before doing the animation.
94-
* Also it is good to post it.
95-
* */
96-
@Override
97-
public void onWindowFocusChanged(boolean hasFocus) {
98-
super.onWindowFocusChanged(hasFocus);
99-
100104
if (hasFocus && !mTutorialLayout.isShowing())
101105
mTutorialLayout.post(new Runnable() {
102106
@Override
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.braunster.tutorialview.object;
2+
3+
/**
4+
* Created by braunster on 03.05.15.
5+
*/
6+
public class Debug {
7+
8+
public static final boolean TutorialActivity = false;
9+
public static final boolean TutorialIntentBuilder = false;
10+
}

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
public class TutorialIntentBuilder {
1919

2020
public static final String TAG = TutorialIntentBuilder.class.getSimpleName();
21-
public static final boolean DEBUG = true;
21+
public static final boolean DEBUG = Debug.TutorialIntentBuilder;
2222

2323
private static final String TUTORIAL_OBJ = "tutorial_obj";
2424

@@ -30,7 +30,7 @@ public class TutorialIntentBuilder {
3030

3131
private static final String CHANGE_SYSTEM_UI_COLOR = "change_system_ui_colors";
3232

33-
private Intent intent;
33+
private final Intent intent;
3434

3535
public TutorialIntentBuilder(Context context){
3636
intent = new Intent(context, TutorialActivity.class );
@@ -193,9 +193,7 @@ public static Tutorial getTutorial(Intent intent){
193193
public static ArrayList<Tutorial> getWalkThroughData(Intent intent){
194194
if (intent.getExtras().containsKey(WALK_THROUGH_DATA))
195195
{
196-
ArrayList<Tutorial> tutorials = intent.getExtras().getParcelableArrayList(WALK_THROUGH_DATA);
197-
198-
return tutorials;
196+
return intent.getExtras().getParcelableArrayList(WALK_THROUGH_DATA);
199197
}
200198

201199
return new ArrayList<>();

tutorial_view/src/main/java/com/braunster/tutorialview/view/AbstractTutorialView.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ protected void drawInnerCircles(Canvas canvas){
523523
/**
524524
* OnClickListener for hiding the tutorial when clicked.
525525
* */
526-
private OnClickListener closeTutorialClickListener = new OnClickListener() {
526+
private final OnClickListener closeTutorialClickListener = new OnClickListener() {
527527
@Override
528528
public void onClick(View v) {
529529
closeTutorial();
@@ -533,7 +533,7 @@ public void onClick(View v) {
533533
/**
534534
* OnClickListener for skipping the walk through tutorial.
535535
* */
536-
private OnClickListener skipWalkThroughClickListener = new OnClickListener() {
536+
private final OnClickListener skipWalkThroughClickListener = new OnClickListener() {
537537
@Override
538538
public void onClick(View v) {
539539
((WalkThroughInterface) getParent()).skip();
@@ -782,9 +782,9 @@ && getParent() instanceof WalkThroughInterface
782782
}
783783

784784
/**
785-
* Posted on the tutorial info view to do ajustment and animation to the view.
785+
* Posted on the tutorial info view to do adjustment and animation to the view.
786786
* */
787-
private Runnable tutorialInfoViewPost = new Runnable() {
787+
private final Runnable tutorialInfoViewPost = new Runnable() {
788788

789789
RelativeLayout.LayoutParams skipButtonParams = null;
790790
RelativeLayout.LayoutParams titleParams = null;

tutorial_view/src/main/java/com/braunster/tutorialview/view/RippleTutorialView.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
*/
1616
public class RippleTutorialView extends AbstractTutorialView {
1717

18-
public static final String TAG = RippleTutorialView.class.getSimpleName();
19-
public static final boolean DEBUG = false;
18+
private static final String TAG = RippleTutorialView.class.getSimpleName();
19+
private static final boolean DEBUG = false;
2020

2121
private int mAnimatedRadius = -1;
2222

2323
private int mAnimationRadiusMax = -1;
2424

25-
private static PorterDuffXfermode sXfermodeClear = new PorterDuffXfermode(PorterDuff.Mode.CLEAR);
26-
private static PorterDuffXfermode sXfermodeNormal = new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER);
25+
private static final PorterDuffXfermode sXfermodeClear = new PorterDuffXfermode(PorterDuff.Mode.CLEAR);
26+
private static final PorterDuffXfermode sXfermodeNormal = new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER);
2727

2828
public RippleTutorialView(Context context) {
2929
super(context);
@@ -76,6 +76,8 @@ protected boolean shouldDraw() {
7676
return super.shouldDraw() && showing && mAnimatedRadius != -1;
7777
}
7878

79+
// To remove a warning regrading using maxHeight as an x parameter.
80+
@SuppressWarnings("all")
7981
@Override
8082
public void beforeFirstDraw(){
8183
if (DEBUG) Log.d(TAG, "FirstDraw, Width: " + getMeasuredWidth() + ", Height: " + getMeasuredHeight());

tutorial_view/tutorial_view.iml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
8686
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
8787
</content>
88-
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
88+
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
8989
<orderEntry type="sourceFolder" forTests="false" />
9090
</component>
9191
</module>

0 commit comments

Comments
 (0)