diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 53b6de6..f58ebd2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -145,6 +145,14 @@ + + + + diff --git a/app/src/main/java/tonio/noa/Food1Activity.java b/app/src/main/java/tonio/noa/Food1Activity.java index faf8ced..c9974b9 100644 --- a/app/src/main/java/tonio/noa/Food1Activity.java +++ b/app/src/main/java/tonio/noa/Food1Activity.java @@ -129,6 +129,5 @@ public class Food1Activity extends MyPlayActivity implements View.OnTouchListene @Override protected void next() { - //startActivity(new Intent(this, TutorialScene5Activity.class)); } } diff --git a/app/src/main/java/tonio/noa/Security1Activity.java b/app/src/main/java/tonio/noa/Security1Activity.java new file mode 100644 index 0000000..f1cf376 --- /dev/null +++ b/app/src/main/java/tonio/noa/Security1Activity.java @@ -0,0 +1,76 @@ +package tonio.noa; + +import android.content.Intent; +import android.graphics.Color; +import android.os.Bundle; +import android.view.MotionEvent; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +/** + * Created by psyk on 24/01/18. + */ + +public class Security1Activity extends MyPlayActivity implements View.OnTouchListener { + + private int win_counter = 0; + private boolean done = false; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + lanceConsigne("Montre moi les objets qui peuvent être dangereux."); + } + + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + + setContentView(R.layout.security1_display); + + TextView txtV = findViewById(R.id.cons_sec1); + smallCons = "Touche les objets dangereux."; + txtV.setText(smallCons); + setTts(); + + + findViewById(R.id.water).setOnTouchListener(this); + findViewById(R.id.knife).setOnTouchListener(this); + findViewById(R.id.bear).setOnTouchListener(this); + findViewById(R.id.pan).setOnTouchListener(this); + findViewById(R.id.pen).setOnTouchListener(this); + findViewById(R.id.bleach).setOnTouchListener(this); + findViewById(R.id.drugs).setOnTouchListener(this); + findViewById(R.id.iron).setOnTouchListener(this); + + } + + @Override + public boolean onTouch(View view, MotionEvent event) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { + if (view == findViewById(R.id.iron) + || view == findViewById(R.id.knife) + || view == findViewById(R.id.pan) + || view == findViewById(R.id.bleach) + || view == findViewById(R.id.drugs)) { + view.setVisibility(View.INVISIBLE); + win_counter++; + } else { + ((ImageView) view).setColorFilter(Color.GRAY); + view.setEnabled(false); + } + return true; + } + if (win_counter == 5 && !done) { + done = true; + this.bravoPage(null); + return true; + } else + return false; + } + + @Override + protected void next() { + this.backHome(null); + } +} diff --git a/app/src/main/java/tonio/noa/ThemeActivity.java b/app/src/main/java/tonio/noa/ThemeActivity.java index 66dd002..cbc3f57 100644 --- a/app/src/main/java/tonio/noa/ThemeActivity.java +++ b/app/src/main/java/tonio/noa/ThemeActivity.java @@ -62,6 +62,11 @@ public class ThemeActivity extends Activity implements View.OnLongClickListener startActivity(new Intent(this, Food1Activity.class)); } + public void securityPage(View view) { + + startActivity(new Intent(this, Security1Activity.class)); + } + public void backHome(View view) { startActivity(new Intent(this, MainActivity.class)); diff --git a/app/src/main/res/drawable/app_menu.png b/app/src/main/res/drawable/app_menu.png new file mode 100644 index 0000000..93900bc Binary files /dev/null and b/app/src/main/res/drawable/app_menu.png differ diff --git a/app/src/main/res/drawable/bear.png b/app/src/main/res/drawable/bear.png new file mode 100644 index 0000000..a9bb80c Binary files /dev/null and b/app/src/main/res/drawable/bear.png differ diff --git a/app/src/main/res/drawable/bleach.png b/app/src/main/res/drawable/bleach.png new file mode 100644 index 0000000..cb5a599 Binary files /dev/null and b/app/src/main/res/drawable/bleach.png differ diff --git a/app/src/main/res/drawable/drugs.png b/app/src/main/res/drawable/drugs.png new file mode 100644 index 0000000..7b952aa Binary files /dev/null and b/app/src/main/res/drawable/drugs.png differ diff --git a/app/src/main/res/drawable/iron.png b/app/src/main/res/drawable/iron.png new file mode 100644 index 0000000..e8dc333 Binary files /dev/null and b/app/src/main/res/drawable/iron.png differ diff --git a/app/src/main/res/drawable/knife.png b/app/src/main/res/drawable/knife.png new file mode 100644 index 0000000..a19b4d2 Binary files /dev/null and b/app/src/main/res/drawable/knife.png differ diff --git a/app/src/main/res/drawable/pan.png b/app/src/main/res/drawable/pan.png new file mode 100644 index 0000000..035c1bd Binary files /dev/null and b/app/src/main/res/drawable/pan.png differ diff --git a/app/src/main/res/drawable/pen.png b/app/src/main/res/drawable/pen.png new file mode 100644 index 0000000..196ec54 Binary files /dev/null and b/app/src/main/res/drawable/pen.png differ diff --git a/app/src/main/res/drawable/speech_icon.png b/app/src/main/res/drawable/speech_icon.png new file mode 100644 index 0000000..bad23a6 Binary files /dev/null and b/app/src/main/res/drawable/speech_icon.png differ diff --git a/app/src/main/res/drawable/water.png b/app/src/main/res/drawable/water.png new file mode 100644 index 0000000..58e5884 Binary files /dev/null and b/app/src/main/res/drawable/water.png differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index d889cf0..6c91e7a 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -20,9 +20,9 @@ android:layout_marginStart="130dp" android:layout_marginTop="160dp" android:onClick="themePage" - android:padding="70dp" + android:padding="50dp" android:text="@string/play" - android:textAppearance="@style/TextFont" /> + android:textAppearance="@style/TextButtonFont" />