diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index dc90dd3..53b6de6 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -137,6 +137,14 @@
+
+
+
+
diff --git a/app/src/main/java/tonio/noa/Food1Activity.java b/app/src/main/java/tonio/noa/Food1Activity.java
new file mode 100644
index 0000000..faf8ced
--- /dev/null
+++ b/app/src/main/java/tonio/noa/Food1Activity.java
@@ -0,0 +1,134 @@
+package tonio.noa;
+
+import android.content.ClipData;
+import android.content.Intent;
+import android.os.Build;
+import android.os.Bundle;
+import android.view.DragEvent;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.TextView;
+
+/**
+ * Created by psyk on 24/01/18.
+ */
+
+public class Food1Activity extends MyPlayActivity implements View.OnTouchListener, View.OnDragListener {
+
+ private int win_counter = 0;
+ private boolean done = false;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ lanceConsigne("Salut !\nTu peux m'aider à trier\nles aliments salés et sucrés ?\nTouche l'écran pour commencer.");
+ }
+
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+
+ setContentView(R.layout.food1_display);
+
+ TextView txtV = findViewById(R.id.cons_food1);
+ smallCons = "Tri les aliments sucrés et ceux salés.";
+ txtV.setText(smallCons);
+ setTts();
+
+ findViewById(R.id.bacon).setOnTouchListener(this);
+ findViewById(R.id.muskmelon).setOnTouchListener(this);
+ findViewById(R.id.cake).setOnTouchListener(this);
+ findViewById(R.id.fries).setOnTouchListener(this);
+ findViewById(R.id.apple).setOnTouchListener(this);
+ findViewById(R.id.hot_dog).setOnTouchListener(this);
+ findViewById(R.id.cheese).setOnTouchListener(this);
+ findViewById(R.id.muffin).setOnTouchListener(this);
+
+ findViewById(R.id.bacon).setOnDragListener(this);
+ findViewById(R.id.muffin).setOnDragListener(this);
+ findViewById(R.id.muskmelon).setOnDragListener(this);
+ findViewById(R.id.cake).setOnDragListener(this);
+ findViewById(R.id.fries).setOnDragListener(this);
+ findViewById(R.id.apple).setOnDragListener(this);
+ findViewById(R.id.hot_dog).setOnDragListener(this);
+ findViewById(R.id.cheese).setOnDragListener(this);
+ findViewById(R.id.salt).setOnDragListener(this);
+ findViewById(R.id.sugar).setOnDragListener(this);
+
+ }
+
+ @Override
+ public boolean onTouch(View view, MotionEvent event) {
+ if (event.getAction() == MotionEvent.ACTION_DOWN) {
+
+ View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
+ ClipData data = ClipData.newPlainText("id", view.getResources().getResourceEntryName(view.getId()));
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ view.startDragAndDrop(data, shadowBuilder, view, 0);
+ } else {
+ view.startDrag(data, shadowBuilder, view, 0);
+ }
+ return true;
+ } else
+ return false;
+ }
+
+ @Override
+ public boolean onDrag(View v, DragEvent event) {
+ switch (event.getAction()) {
+ // signal for the start of a drag and drop operation
+ case DragEvent.ACTION_DRAG_STARTED:
+ // do nothing
+ break;
+
+ // the drag point has entered the bounding box of the View
+ case DragEvent.ACTION_DRAG_ENTERED:
+ // do nothing
+ break;
+
+ // the user has moved the drag shadow outside the bounding box of the View
+ case DragEvent.ACTION_DRAG_EXITED:
+ // do nothing
+ break;
+
+ // the drag and drop operation has concluded
+ case DragEvent.ACTION_DRAG_ENDED:
+ if (win_counter == 8 && !done) {
+ done = true;
+ bravoPage(v);
+ }
+ break;
+
+ //drag shadow has been released,the drag point is within the bounding box of the View
+ case DragEvent.ACTION_DROP:
+ //handle the dragged view being dropped over a target view
+ View view = (View) event.getLocalState();
+ if (v == findViewById(R.id.salt)) {
+ if (view == findViewById(R.id.bacon)
+ || view == findViewById(R.id.hot_dog)
+ || view == findViewById(R.id.cheese)
+ || view == findViewById(R.id.fries)) {
+ //stop displaying the view where it was before it was dragged
+ view.setVisibility(View.INVISIBLE);
+ win_counter++;
+ }
+ } else if (v == findViewById(R.id.sugar)) {
+ if (view == findViewById(R.id.muffin)
+ || view == findViewById(R.id.apple)
+ || view == findViewById(R.id.muskmelon)
+ || view == findViewById(R.id.cake)) {
+ //stop displaying the view where it was before it was dragged
+ view.setVisibility(View.INVISIBLE);
+ win_counter++;
+ }
+ }
+ break;
+ }
+ return true;
+ }
+
+ @Override
+ protected void next() {
+ //startActivity(new Intent(this, TutorialScene5Activity.class));
+ }
+}
diff --git a/app/src/main/java/tonio/noa/MainActivity.java b/app/src/main/java/tonio/noa/MainActivity.java
index 0b30f6f..e411869 100644
--- a/app/src/main/java/tonio/noa/MainActivity.java
+++ b/app/src/main/java/tonio/noa/MainActivity.java
@@ -2,33 +2,65 @@ package tonio.noa;
import android.app.Activity;
import android.content.Intent;
+import android.speech.tts.TextToSpeech;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
+import android.widget.TextView;
-public class MainActivity extends Activity {
+import java.util.Locale;
+
+public class MainActivity extends Activity implements View.OnLongClickListener {
+
+ private TextToSpeech tts;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
+
+ findViewById(R.id.button_id_play).setOnLongClickListener(this);
+ findViewById(R.id.button_id_tutorial).setOnLongClickListener(this);
+
+ tts = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
+ @Override
+ public void onInit(int status) {
+ if (status != TextToSpeech.ERROR) {
+ tts.setLanguage(Locale.FRENCH);
+ }
+ }
+ });
}
- public void themePage(View view){
+ public void themePage(View view) {
startActivity(new Intent(this, ThemeActivity.class));
finish();
}
- public void configurePage(View view){
+ public void configurePage(View view) {
startActivity(new Intent(this, ConfigureActivity.class));
finish();
}
- public void tutorialPage(View view){
+ public void tutorialPage(View view) {
startActivity(new Intent(this, TutorialScene1Activity.class));
finish();
}
+
+ public boolean onLongClick(View view) {
+ tts.speak(((TextView) view).getText(), TextToSpeech.QUEUE_FLUSH, null, null);
+ return true;
+ }
+
+ @Override
+ public void onDestroy() {
+ if (tts != null) {
+ tts.stop();
+ tts.shutdown();
+ }
+ super.onDestroy();
+ }
}
diff --git a/app/src/main/java/tonio/noa/ThemeActivity.java b/app/src/main/java/tonio/noa/ThemeActivity.java
index 93955b1..66dd002 100644
--- a/app/src/main/java/tonio/noa/ThemeActivity.java
+++ b/app/src/main/java/tonio/noa/ThemeActivity.java
@@ -4,32 +4,75 @@ package tonio.noa;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
+import android.speech.tts.TextToSpeech;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
+import android.widget.TextView;
+import java.util.Locale;
/**
* Created by tonio on 16/11/17.
*/
-public class ThemeActivity extends Activity {
+public class ThemeActivity extends Activity implements View.OnLongClickListener {
- protected void onCreate(Bundle savedInstanceState){
+ private TextToSpeech tts;
+
+ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.theme_display);
+
+ findViewById(R.id.button_id_health).setOnLongClickListener(this);
+ findViewById(R.id.button_id_sociability).setOnLongClickListener(this);
+ findViewById(R.id.button_id_security).setOnLongClickListener(this);
+ findViewById(R.id.button_id_hygiene).setOnLongClickListener(this);
+ findViewById(R.id.button_id_independence).setOnLongClickListener(this);
+ findViewById(R.id.button_id_food).setOnLongClickListener(this);
+
+ tts = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
+ @Override
+ public void onInit(int status) {
+ if (status != TextToSpeech.ERROR) {
+ tts.setLanguage(Locale.FRENCH);
+ }
+ }
+ });
}
- public void healthPage(View view){
+ @Override
+ public boolean onLongClick(View view) {
+ tts.speak(((TextView) view).getText(), TextToSpeech.QUEUE_FLUSH, null, null);
+ return true;
+ }
+
+ public void healthPage(View view) {
startActivity(new Intent(this, HealthActivity.class));
}
- public void hygienePage(View view){
+
+ public void hygienePage(View view) {
startActivity(new Intent(this, Hygiene1Activity.class));
}
- public void backHome(View view){
- startActivity(new Intent( this, MainActivity.class));
+ public void foodPage(View view) {
+
+ startActivity(new Intent(this, Food1Activity.class));
+ }
+
+ public void backHome(View view) {
+
+ startActivity(new Intent(this, MainActivity.class));
+ }
+
+ @Override
+ public void onDestroy() {
+ if (tts != null) {
+ tts.stop();
+ tts.shutdown();
+ }
+ super.onDestroy();
}
}
diff --git a/app/src/main/res/drawable/apple.png b/app/src/main/res/drawable/apple.png
new file mode 100644
index 0000000..08b03a8
Binary files /dev/null and b/app/src/main/res/drawable/apple.png differ
diff --git a/app/src/main/res/drawable/bacon.png b/app/src/main/res/drawable/bacon.png
new file mode 100644
index 0000000..0689080
Binary files /dev/null and b/app/src/main/res/drawable/bacon.png differ
diff --git a/app/src/main/res/drawable/cake.png b/app/src/main/res/drawable/cake.png
new file mode 100644
index 0000000..8a8042e
Binary files /dev/null and b/app/src/main/res/drawable/cake.png differ
diff --git a/app/src/main/res/drawable/cheese.png b/app/src/main/res/drawable/cheese.png
new file mode 100644
index 0000000..24e4166
Binary files /dev/null and b/app/src/main/res/drawable/cheese.png differ
diff --git a/app/src/main/res/drawable/fries.png b/app/src/main/res/drawable/fries.png
new file mode 100644
index 0000000..08a7a64
Binary files /dev/null and b/app/src/main/res/drawable/fries.png differ
diff --git a/app/src/main/res/drawable/hot_dog.png b/app/src/main/res/drawable/hot_dog.png
new file mode 100644
index 0000000..ada1184
Binary files /dev/null and b/app/src/main/res/drawable/hot_dog.png differ
diff --git a/app/src/main/res/drawable/muffin.png b/app/src/main/res/drawable/muffin.png
new file mode 100644
index 0000000..d3d9547
Binary files /dev/null and b/app/src/main/res/drawable/muffin.png differ
diff --git a/app/src/main/res/drawable/muskmelon.png b/app/src/main/res/drawable/muskmelon.png
new file mode 100644
index 0000000..b8c14df
Binary files /dev/null and b/app/src/main/res/drawable/muskmelon.png differ
diff --git a/app/src/main/res/drawable/salt.jpg b/app/src/main/res/drawable/salt.jpg
new file mode 100644
index 0000000..4614a09
Binary files /dev/null and b/app/src/main/res/drawable/salt.jpg differ
diff --git a/app/src/main/res/drawable/sugar.jpg b/app/src/main/res/drawable/sugar.jpg
new file mode 100644
index 0000000..575eaba
Binary files /dev/null and b/app/src/main/res/drawable/sugar.jpg differ
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 24888b6..d889cf0 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -2,17 +2,27 @@
+ android:background="@color/colorPrimary">
+
+
+ android:padding="70dp"
+ android:text="@string/play"
+ android:textAppearance="@style/TextFont" />
+ android:padding="70dp"
+ android:text="@string/tutorial"
+ android:textAppearance="@style/TextFont" />
+ android:text="@string/configure"
+ android:textAppearance="@style/TextFont" />
diff --git a/app/src/main/res/layout/food1_display.xml b/app/src/main/res/layout/food1_display.xml
new file mode 100644
index 0000000..711d85d
--- /dev/null
+++ b/app/src/main/res/layout/food1_display.xml
@@ -0,0 +1,147 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/hygiene1_display.xml b/app/src/main/res/layout/hygiene1_display.xml
index d42da24..0e28d7f 100644
--- a/app/src/main/res/layout/hygiene1_display.xml
+++ b/app/src/main/res/layout/hygiene1_display.xml
@@ -46,6 +46,7 @@
android:layout_alignParentStart="true"
android:layout_margin="20dp"
android:onClick="backHome"
+ android:textAppearance="@style/TextFont"
android:text="@string/home" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/hygiene2_display.xml b/app/src/main/res/layout/hygiene2_display.xml
index 1ec942b..acfc30e 100644
--- a/app/src/main/res/layout/hygiene2_display.xml
+++ b/app/src/main/res/layout/hygiene2_display.xml
@@ -45,6 +45,7 @@
android:layout_alignParentStart="true"
android:layout_margin="20dp"
android:onClick="backHome"
+ android:textAppearance="@style/TextFont"
android:text="@string/home" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/hygiene3_display.xml b/app/src/main/res/layout/hygiene3_display.xml
index 3bee6c6..b099c68 100644
--- a/app/src/main/res/layout/hygiene3_display.xml
+++ b/app/src/main/res/layout/hygiene3_display.xml
@@ -45,6 +45,7 @@
android:layout_alignParentStart="true"
android:layout_margin="20dp"
android:onClick="backHome"
+ android:textAppearance="@style/TextFont"
android:text="@string/home" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/hygiene4_display.xml b/app/src/main/res/layout/hygiene4_display.xml
index 55c2dba..fd6f52e 100644
--- a/app/src/main/res/layout/hygiene4_display.xml
+++ b/app/src/main/res/layout/hygiene4_display.xml
@@ -133,6 +133,7 @@
android:layout_alignParentStart="true"
android:layout_margin="20dp"
android:onClick="backHome"
+ android:textAppearance="@style/TextFont"
android:text="@string/home" />
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/hygiene5_display.xml b/app/src/main/res/layout/hygiene5_display.xml
index f79623b..cc84b87 100644
--- a/app/src/main/res/layout/hygiene5_display.xml
+++ b/app/src/main/res/layout/hygiene5_display.xml
@@ -86,6 +86,7 @@
android:layout_alignParentStart="true"
android:layout_margin="20dp"
android:onClick="backHome"
+ android:textAppearance="@style/TextFont"
android:text="@string/home" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/hygiene6_display.xml b/app/src/main/res/layout/hygiene6_display.xml
index 46449a3..a7f3bff 100644
--- a/app/src/main/res/layout/hygiene6_display.xml
+++ b/app/src/main/res/layout/hygiene6_display.xml
@@ -67,7 +67,8 @@
android:layout_alignParentStart="true"
android:layout_margin="20dp"
android:onClick="backHome"
- android:text="@string/home" />
+ android:text="@string/home"
+ android:textAppearance="@style/TextFont" />
+ android:text="@string/instruction"
+ android:textAppearance="@style/TextFont" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/theme_display.xml b/app/src/main/res/layout/theme_display.xml
index 8136778..4f83170 100644
--- a/app/src/main/res/layout/theme_display.xml
+++ b/app/src/main/res/layout/theme_display.xml
@@ -2,65 +2,94 @@
+ android:background="@color/colorPrimary">
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:text="@string/home"
+ android:textAppearance="@style/TextFont" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/tutorial1_display.xml b/app/src/main/res/layout/tutorial1_display.xml
index f4eccdd..c13c2f7 100644
--- a/app/src/main/res/layout/tutorial1_display.xml
+++ b/app/src/main/res/layout/tutorial1_display.xml
@@ -8,10 +8,10 @@
android:id="@+id/cons_tut1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:maxWidth="650dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_margin="20dp"
+ android:maxWidth="650dp"
android:textAppearance="@style/TextFont" />
+ android:text="@string/home"
+ android:textAppearance="@style/TextFont" />
+ android:text="@string/instruction"
+ android:textAppearance="@style/TextFont" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/tutorial2_display.xml b/app/src/main/res/layout/tutorial2_display.xml
index 3782ac4..9aca3e2 100644
--- a/app/src/main/res/layout/tutorial2_display.xml
+++ b/app/src/main/res/layout/tutorial2_display.xml
@@ -42,7 +42,8 @@
android:layout_alignParentStart="true"
android:layout_margin="20dp"
android:onClick="backHome"
- android:text="@string/home" />
+ android:text="@string/home"
+ android:textAppearance="@style/TextFont" />
+ android:text="@string/instruction"
+ android:textAppearance="@style/TextFont" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/tutorial3_display.xml b/app/src/main/res/layout/tutorial3_display.xml
index 091017b..1d4473d 100644
--- a/app/src/main/res/layout/tutorial3_display.xml
+++ b/app/src/main/res/layout/tutorial3_display.xml
@@ -80,6 +80,7 @@
android:layout_alignParentStart="true"
android:layout_margin="20dp"
android:onClick="backHome"
+ android:textAppearance="@style/TextFont"
android:text="@string/home" />
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/tutorial4_display.xml b/app/src/main/res/layout/tutorial4_display.xml
index ad81f2d..a05f031 100644
--- a/app/src/main/res/layout/tutorial4_display.xml
+++ b/app/src/main/res/layout/tutorial4_display.xml
@@ -169,7 +169,8 @@
android:layout_alignParentStart="true"
android:layout_margin="20dp"
android:onClick="backHome"
- android:text="@string/home" />
+ android:text="@string/home"
+ android:textAppearance="@style/TextFont" />
+ android:text="@string/instruction"
+ android:textAppearance="@style/TextFont" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/tutorial5_display.xml b/app/src/main/res/layout/tutorial5_display.xml
index 6d2f8cd..3018103 100644
--- a/app/src/main/res/layout/tutorial5_display.xml
+++ b/app/src/main/res/layout/tutorial5_display.xml
@@ -131,7 +131,8 @@
android:layout_alignParentStart="true"
android:layout_margin="20dp"
android:onClick="backHome"
- android:text="@string/home" />
+ android:text="@string/home"
+ android:textAppearance="@style/TextFont" />
+ android:text="@string/instruction"
+ android:textAppearance="@style/TextFont" />
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4ddd8d7..9cc3e10 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -2,16 +2,17 @@
Noa
Paramètres
Jouer !
- santé
- hygiène
- autonomie
- sécurité
- sociabilité
- anatomie
+ Santé
+ Hygiène
+ Autonomie
+ Sécurité
+ Sociabilité
+ Anatomie
Salle de bain
- tutoriel
+ Tutoriel
Menu
Thème
Bravo ! Tu as réussi la mission. Clique sur l\'écran pour continuer à jouer.
Lire consigne
+ Alimentation
--
libgit2 0.21.2