-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from sladomic/master
Randomly present an unlocked letter and let the student draw the lett…
- Loading branch information
Showing
13 changed files
with
177 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
app/src/main/java/org/literacyapp/handwriting/FinalActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.literacyapp.handwriting; | ||
|
||
import android.content.Intent; | ||
import android.graphics.drawable.Animatable; | ||
import android.graphics.drawable.Drawable; | ||
import android.media.MediaPlayer; | ||
import android.os.Bundle; | ||
import android.os.Handler; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.View; | ||
import android.widget.ImageView; | ||
|
||
import org.literacyapp.handwriting.util.MediaPlayerHelper; | ||
|
||
|
||
public class FinalActivity extends AppCompatActivity { | ||
|
||
private ImageView mFinalCheckmarkImageView; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_final); | ||
|
||
mFinalCheckmarkImageView = (ImageView) findViewById(R.id.final_checkmark); | ||
} | ||
|
||
@Override | ||
protected void onStart() { | ||
super.onStart(); | ||
|
||
// Animate checkmark | ||
mFinalCheckmarkImageView.postDelayed(new Runnable() { | ||
@Override | ||
public void run() { | ||
mFinalCheckmarkImageView.setVisibility(View.VISIBLE); | ||
Drawable drawable = mFinalCheckmarkImageView.getDrawable(); | ||
((Animatable) drawable).start(); | ||
|
||
MediaPlayer mediaPlayer = MediaPlayerHelper.playLessonCompleted(getApplicationContext()); | ||
if (mediaPlayer != null){ | ||
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { | ||
@Override | ||
public void onCompletion(MediaPlayer mediaPlayer) { | ||
HandwritingApplication handwritingApplication = (HandwritingApplication) getApplicationContext(); | ||
handwritingApplication.setCompletionCounter(handwritingApplication.getCompletionCounter() + 1); | ||
if (handwritingApplication.getCompletionCounter() < 5){ | ||
Intent intent = new Intent(getApplicationContext(), WriteLetterActivity.class); | ||
startActivity(intent); | ||
} else { | ||
finishAffinity(); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
}, MediaPlayerHelper.DEFAULT_PLAYER_DELAY); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
app/src/main/java/org/literacyapp/handwriting/HandwritingApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.literacyapp.handwriting; | ||
|
||
import android.app.Application; | ||
|
||
/** | ||
* Created by sladomic on 28.04.17. | ||
*/ | ||
|
||
public class HandwritingApplication extends Application { | ||
private int completionCounter; | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
|
||
completionCounter = 0; | ||
} | ||
|
||
public int getCompletionCounter() { | ||
return completionCounter; | ||
} | ||
|
||
public void setCompletionCounter(int completionCounter) { | ||
this.completionCounter = completionCounter; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<set xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:interpolator="@android:anim/accelerate_interpolator" | ||
android:ordering="sequentially" | ||
android:shareInterpolator="false"> | ||
|
||
<!-- Step 1 --> | ||
<objectAnimator | ||
android:duration="@android:integer/config_shortAnimTime" | ||
android:propertyName="pathData" | ||
android:valueFrom="M6,11 l0,0 l0,0" | ||
android:valueTo="M6,11 l3.5,4 l0,0" | ||
android:valueType="pathType" /> | ||
|
||
<!-- Step 2 --> | ||
<objectAnimator | ||
android:duration="@android:integer/config_shortAnimTime" | ||
android:propertyName="pathData" | ||
android:valueFrom="M6,11 l3.5,4 l0,0" | ||
android:valueTo="M6,11 l3.5,4 l8,-7" | ||
android:valueType="pathType" /> | ||
</set> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:drawable="@drawable/checkmark"> | ||
<target | ||
android:name="tick" | ||
android:animation="@anim/checkmark_animation"/> | ||
</animated-vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportHeight="24.0" | ||
android:viewportWidth="24.0"> | ||
|
||
<group android:name="background"> | ||
<path | ||
android:name="circle" | ||
android:fillColor="@color/colorAccent" | ||
android:pathData="M12,12m-10,0a10,10 0,1 1,20 0a10,10 0,1 1,-20 0" /> | ||
</group> | ||
<group android:name="check"> | ||
<path | ||
android:name="tick" | ||
android:pathData="M6,11 l0,0 l0,0" | ||
android:strokeColor="#FFF" | ||
android:strokeWidth="1" /> | ||
</group> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<RelativeLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@android:color/white" | ||
tools:context="org.literacyapp.handwriting.FinalActivity"> | ||
|
||
<ImageView | ||
android:id="@+id/final_checkmark" | ||
android:visibility="gone" | ||
android:layout_width="256dp" | ||
android:layout_height="256dp" | ||
android:layout_centerInParent="true" | ||
android:src="@drawable/animated_checkmark" | ||
tools:visibility="visible"/> | ||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters