diff --git a/app/src/main/java/tonio/noa/Hygiene1Activity.java b/app/src/main/java/tonio/noa/Hygiene1Activity.java index 9ab6f3b..f7883a6 100644 --- a/app/src/main/java/tonio/noa/Hygiene1Activity.java +++ b/app/src/main/java/tonio/noa/Hygiene1Activity.java @@ -4,9 +4,11 @@ import android.content.ClipData; import android.content.Intent; import android.os.Build; import android.os.Bundle; +import android.speech.tts.TextToSpeech; import android.view.DragEvent; import android.view.MotionEvent; import android.view.View; +import android.widget.TextView; /** * Created by psyk on 31/01/18. @@ -24,6 +26,12 @@ public class Hygiene1Activity extends MyPlayActivity implements View.OnTouchList protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); setContentView(R.layout.hygiene1_display); + + TextView txtV = findViewById(R.id.cons_hyg1); + smallCons = "Met la brosse à dent dans la case correspondante."; + txtV.setText(smallCons); + setTts(); + findViewById(R.id.blue_toothbrush).setOnTouchListener(this); findViewById(R.id.blue_toothbrush).setOnDragListener(this); findViewById(R.id.shadow_toothbrush).setOnDragListener(this); @@ -85,7 +93,6 @@ public class Hygiene1Activity extends MyPlayActivity implements View.OnTouchList return true; } - @Override protected void next() { startActivity(new Intent(this, Hygiene2Activity.class)); diff --git a/app/src/main/java/tonio/noa/Hygiene2Activity.java b/app/src/main/java/tonio/noa/Hygiene2Activity.java index d2716a5..92a3e84 100644 --- a/app/src/main/java/tonio/noa/Hygiene2Activity.java +++ b/app/src/main/java/tonio/noa/Hygiene2Activity.java @@ -4,9 +4,11 @@ import android.content.ClipData; import android.content.Intent; import android.os.Build; import android.os.Bundle; +import android.speech.tts.TextToSpeech; import android.view.DragEvent; import android.view.MotionEvent; import android.view.View; +import android.widget.TextView; /** * Created by psyk on 31/01/18. @@ -24,6 +26,12 @@ public class Hygiene2Activity extends MyPlayActivity implements View.OnTouchList protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); setContentView(R.layout.hygiene2_display); + + TextView txtV = findViewById(R.id.cons_hyg2); + smallCons = "Met le dessin de la brosse à dent sur sa photo."; + txtV.setText(smallCons); + setTts(); + findViewById(R.id.blue_toothbrush).setOnTouchListener(this); findViewById(R.id.blue_toothbrush).setOnDragListener(this); findViewById(R.id.blue_toothbrush_pic).setOnDragListener(this); @@ -85,7 +93,6 @@ public class Hygiene2Activity extends MyPlayActivity implements View.OnTouchList return true; } - @Override protected void next() { startActivity(new Intent(this, Hygiene3Activity.class)); diff --git a/app/src/main/java/tonio/noa/Hygiene3Activity.java b/app/src/main/java/tonio/noa/Hygiene3Activity.java index c26a0bd..8b44e5e 100644 --- a/app/src/main/java/tonio/noa/Hygiene3Activity.java +++ b/app/src/main/java/tonio/noa/Hygiene3Activity.java @@ -7,6 +7,7 @@ import android.os.Bundle; import android.view.DragEvent; import android.view.MotionEvent; import android.view.View; +import android.widget.TextView; /** * Created by psyk on 31/01/18. @@ -24,6 +25,12 @@ public class Hygiene3Activity extends MyPlayActivity implements View.OnTouchList protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); setContentView(R.layout.hygiene3_display); + + TextView txtV = findViewById(R.id.cons_hyg3); + smallCons = "Met la brosse à dent bleu sur la rouge."; + txtV.setText(smallCons); + setTts(); + findViewById(R.id.blue_toothbrush).setOnTouchListener(this); findViewById(R.id.blue_toothbrush).setOnDragListener(this); findViewById(R.id.red_toothbrush).setOnDragListener(this); diff --git a/app/src/main/java/tonio/noa/Hygiene4Activity.java b/app/src/main/java/tonio/noa/Hygiene4Activity.java index 6af0222..a15fca7 100644 --- a/app/src/main/java/tonio/noa/Hygiene4Activity.java +++ b/app/src/main/java/tonio/noa/Hygiene4Activity.java @@ -9,6 +9,7 @@ import android.view.DragEvent; import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; +import android.widget.TextView; /** * Created by psyk on 24/01/18. @@ -30,6 +31,11 @@ public class Hygiene4Activity extends MyPlayActivity implements View.OnTouchList setContentView(R.layout.hygiene4_display); + TextView txtV = findViewById(R.id.cons_hyg4); + smallCons = "Met les affaires de toilettes dans la trousse de toilette."; + txtV.setText(smallCons); + setTts(); + findViewById(R.id.snail).setOnTouchListener(this); findViewById(R.id.towel).setOnTouchListener(this); findViewById(R.id.elephant).setOnTouchListener(this); diff --git a/app/src/main/java/tonio/noa/MyPlayActivity.java b/app/src/main/java/tonio/noa/MyPlayActivity.java index fb961ac..c8b005a 100644 --- a/app/src/main/java/tonio/noa/MyPlayActivity.java +++ b/app/src/main/java/tonio/noa/MyPlayActivity.java @@ -2,11 +2,12 @@ package tonio.noa; import android.app.Activity; import android.content.Intent; -import android.os.Bundle; import android.speech.tts.TextToSpeech; import android.view.View; import android.widget.Toast; +import java.util.Locale; + /** * Created by psyk on 09/01/18. @@ -16,9 +17,14 @@ public abstract class MyPlayActivity extends Activity { public static final int REQUEST_CODE = 1; protected TextToSpeech tts; + protected String smallCons; protected abstract void next(); + protected void enonceConsigne(View view) { + tts.speak(smallCons, TextToSpeech.QUEUE_FLUSH, null, null); + } + protected void bravoPage(View view) { startActivityForResult(new Intent(this, BravoActivity.class), REQUEST_CODE); } @@ -30,6 +36,18 @@ public abstract class MyPlayActivity extends Activity { startActivityForResult(i, requestCode); } + protected void setTts() { + + tts = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() { + @Override + public void onInit(int status) { + if (status != TextToSpeech.ERROR) { + tts.setLanguage(Locale.FRENCH); + } + } + }); + } + @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { try { @@ -45,7 +63,16 @@ public abstract class MyPlayActivity extends Activity { } } - public void backHome(View view) { + @Override + public void onDestroy() { + if (tts != null) { + tts.stop(); + tts.shutdown(); + } + super.onDestroy(); + } + + protected void backHome(View view) { startActivity(new Intent(this, MainActivity.class)); finish(); diff --git a/app/src/main/java/tonio/noa/TutorialScene1Activity.java b/app/src/main/java/tonio/noa/TutorialScene1Activity.java index 163b430..8e400d3 100644 --- a/app/src/main/java/tonio/noa/TutorialScene1Activity.java +++ b/app/src/main/java/tonio/noa/TutorialScene1Activity.java @@ -2,6 +2,9 @@ package tonio.noa; import android.content.Intent; import android.os.Bundle; +import android.speech.tts.TextToSpeech; +import android.view.View; +import android.widget.TextView; /** * Created by tonio on 22/11/17. @@ -19,11 +22,15 @@ public class TutorialScene1Activity extends MyPlayActivity { protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); setContentView(R.layout.tutorial1_display); - // do your stuff here after SecondActivity finished. + TextView txtV = findViewById(R.id.cons_tut1); + smallCons = "Touche le ballon de foot."; + txtV.setText(smallCons); + setTts(); } @Override protected void next() { startActivity(new Intent(this, TutorialScene2Activity.class)); } + } \ No newline at end of file diff --git a/app/src/main/java/tonio/noa/TutorialScene2Activity.java b/app/src/main/java/tonio/noa/TutorialScene2Activity.java index a28878a..03288a6 100644 --- a/app/src/main/java/tonio/noa/TutorialScene2Activity.java +++ b/app/src/main/java/tonio/noa/TutorialScene2Activity.java @@ -4,10 +4,12 @@ import android.content.ClipData; import android.content.Intent; import android.os.Build; import android.os.Bundle; +import android.speech.tts.TextToSpeech; import android.view.DragEvent; import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; +import android.widget.TextView; /** * Created by psyk on 09/01/18. @@ -28,7 +30,10 @@ public class TutorialScene2Activity extends MyPlayActivity implements View.OnTou findViewById(R.id.blue_rectangle).setOnTouchListener(this); findViewById(R.id.blue_rectangle).setOnDragListener(this); findViewById(R.id.red_rectangle).setOnDragListener(this); - // do your stuff here after SecondActivity finished. + TextView txtV = findViewById(R.id.cons_tut2); + smallCons = "Fais glisser le rectangle bleu sur le rectangle rouge."; + txtV.setText(smallCons); + setTts(); } @@ -96,4 +101,5 @@ public class TutorialScene2Activity extends MyPlayActivity implements View.OnTou startActivity(new Intent(this, TutorialScene3Activity.class)); } + } diff --git a/app/src/main/java/tonio/noa/TutorialScene3Activity.java b/app/src/main/java/tonio/noa/TutorialScene3Activity.java index a21c627..39f4a6a 100644 --- a/app/src/main/java/tonio/noa/TutorialScene3Activity.java +++ b/app/src/main/java/tonio/noa/TutorialScene3Activity.java @@ -4,10 +4,12 @@ import android.content.ClipData; import android.content.Intent; import android.os.Build; import android.os.Bundle; +import android.speech.tts.TextToSpeech; import android.view.DragEvent; import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; +import android.widget.TextView; /** * Created by psyk on 15/01/18. @@ -29,6 +31,11 @@ public class TutorialScene3Activity extends MyPlayActivity implements View.OnTou setContentView(R.layout.tutorial3_display); + TextView txtV = findViewById(R.id.cons_tut3); + smallCons = "Associe les carrés de même couleur."; + txtV.setText(smallCons); + setTts(); + findViewById(R.id.blue_rectangle31).setOnTouchListener(this); findViewById(R.id.blue_rectangle32).setOnTouchListener(this); findViewById(R.id.red_rectangle31).setOnTouchListener(this); diff --git a/app/src/main/java/tonio/noa/TutorialScene4Activity.java b/app/src/main/java/tonio/noa/TutorialScene4Activity.java index 694a268..701d372 100644 --- a/app/src/main/java/tonio/noa/TutorialScene4Activity.java +++ b/app/src/main/java/tonio/noa/TutorialScene4Activity.java @@ -4,9 +4,11 @@ import android.content.ClipData; import android.content.Intent; import android.os.Build; import android.os.Bundle; +import android.speech.tts.TextToSpeech; import android.view.DragEvent; import android.view.MotionEvent; import android.view.View; +import android.widget.TextView; /** * Created by psyk on 24/01/18. @@ -28,6 +30,12 @@ public class TutorialScene4Activity extends MyPlayActivity implements View.OnTou setContentView(R.layout.tutorial4_display); + TextView txtV = findViewById(R.id.cons_tut4); + smallCons = "Met les carrés dans les cases correspondantes."; + txtV.setText(smallCons); + setTts(); + + findViewById(R.id.blue_rectangle41).setOnTouchListener(this); findViewById(R.id.blue_rectangle42).setOnTouchListener(this); findViewById(R.id.blue_rectangle43).setOnTouchListener(this); diff --git a/app/src/main/java/tonio/noa/TutorialScene5Activity.java b/app/src/main/java/tonio/noa/TutorialScene5Activity.java index 8d46b4d..e2f28a7 100644 --- a/app/src/main/java/tonio/noa/TutorialScene5Activity.java +++ b/app/src/main/java/tonio/noa/TutorialScene5Activity.java @@ -2,8 +2,10 @@ package tonio.noa; import android.content.Intent; import android.os.Bundle; +import android.speech.tts.TextToSpeech; import android.view.MotionEvent; import android.view.View; +import android.widget.TextView; /** * Created by psyk on 24/01/18. @@ -25,6 +27,12 @@ public class TutorialScene5Activity extends MyPlayActivity implements View.OnTou setContentView(R.layout.tutorial5_display); + TextView txtV = findViewById(R.id.cons_tut5); + smallCons = "Clique sur les carrés verts."; + txtV.setText(smallCons); + setTts(); + + findViewById(R.id.blue_rectangle51).setOnTouchListener(this); findViewById(R.id.blue_rectangle52).setOnTouchListener(this); findViewById(R.id.blue_rectangle53).setOnTouchListener(this); diff --git a/app/src/main/res/layout/hygiene1_display.xml b/app/src/main/res/layout/hygiene1_display.xml index 7032898..71a65d5 100644 --- a/app/src/main/res/layout/hygiene1_display.xml +++ b/app/src/main/res/layout/hygiene1_display.xml @@ -6,13 +6,13 @@ android:orientation="vertical"> +