diff --git a/app/src/androidTest/java/tonio/noa/ExampleInstrumentedTest.java b/app/src/androidTest/java/tonio/noa/ExampleInstrumentedTest.java deleted file mode 100644 index 34e662f..0000000 --- a/app/src/androidTest/java/tonio/noa/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package tonio.noa; - -import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() throws Exception { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getTargetContext(); - - assertEquals("tonio.noa", appContext.getPackageName()); - } -} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 30c26aa..e8acebd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -76,6 +76,10 @@ android:name=".BravoActivity" android:screenOrientation="userLandscape"> + + \ No newline at end of file diff --git a/app/src/main/java/tonio/noa/ConsigneActivity.java b/app/src/main/java/tonio/noa/ConsigneActivity.java new file mode 100644 index 0000000..8a97251 --- /dev/null +++ b/app/src/main/java/tonio/noa/ConsigneActivity.java @@ -0,0 +1,35 @@ +package tonio.noa; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.view.MotionEvent; +import android.view.View; +import android.widget.TextView; + +/** + * Created by psyk on 22/01/18. + */ + +public class ConsigneActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + final Intent intent = getIntent(); + setContentView(R.layout.consigne_display); + TextView consigneTxt = findViewById(R.id.consigne); + consigneTxt.setText(intent.getStringExtra("keyConsigne")); + View view = findViewById(R.id.consigne_view); + view.setOnTouchListener(new View.OnTouchListener() { + + @Override + public boolean onTouch(View view,MotionEvent event) { + setResult(RESULT_OK,intent); + finish(); + return true; + } + }); + } +} diff --git a/app/src/main/java/tonio/noa/TutorialScene1Activity.java b/app/src/main/java/tonio/noa/TutorialScene1Activity.java index acd7b4d..9e12724 100644 --- a/app/src/main/java/tonio/noa/TutorialScene1Activity.java +++ b/app/src/main/java/tonio/noa/TutorialScene1Activity.java @@ -10,14 +10,23 @@ import android.os.Bundle; public class TutorialScene1Activity extends MyPlayActivity{ @Override - protected void next() { - startActivity(new Intent(this, TutorialScene2Activity.class)); + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + Intent i = new Intent(this, ConsigneActivity.class); + i.putExtra("keyConsigne","Salut mon pote!\nJe suis Noa.\nTu peux m'aider ?\nRetrouve mon ballon de football."); + int requestCode = 0; + startActivityForResult(i,requestCode); } @Override - protected void onCreate(Bundle savedInstanceState) { - - super.onCreate(savedInstanceState); + 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. + } + + @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 9770533..d7d4ea5 100644 --- a/app/src/main/java/tonio/noa/TutorialScene2Activity.java +++ b/app/src/main/java/tonio/noa/TutorialScene2Activity.java @@ -21,11 +21,24 @@ public class TutorialScene2Activity extends MyPlayActivity implements View.OnTou super.onCreate(savedInstanceState); setContentView(R.layout.tutorial2_display); + Intent i = new Intent(this, ConsigneActivity.class); + i.putExtra("keyConsigne", "J'ai encore besoin de toi !\nMet le rectangle bleu sur le rouge."); + int requestCode = 0; + startActivityForResult(i, requestCode); + + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + setContentView(R.layout.tutorial2_display); 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. } + @Override public boolean onTouch(View view, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { diff --git a/app/src/main/java/tonio/noa/TutorialScene3Activity.java b/app/src/main/java/tonio/noa/TutorialScene3Activity.java index e17248a..d768768 100644 --- a/app/src/main/java/tonio/noa/TutorialScene3Activity.java +++ b/app/src/main/java/tonio/noa/TutorialScene3Activity.java @@ -1,6 +1,7 @@ package tonio.noa; import android.content.ClipData; +import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.view.DragEvent; @@ -20,6 +21,16 @@ public class TutorialScene3Activity extends MyPlayActivity implements View.OnTou protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + Intent i = new Intent(this, ConsigneActivity.class); + i.putExtra("keyConsigne", "J'ai encore une nouvelle mission pour toi!\nTu dois associer les carrés de même couleur."); + int requestCode = 0; + startActivityForResult(i, requestCode); + + } + + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + setContentView(R.layout.tutorial3_display); findViewById(R.id.blue_rectangle31).setOnTouchListener(this); @@ -106,5 +117,6 @@ public class TutorialScene3Activity extends MyPlayActivity implements View.OnTou @Override protected void next() { + this.backHome(null); } } diff --git a/app/src/main/res/layout/bravo_display.xml b/app/src/main/res/layout/bravo_display.xml index 87d013b..1696b7d 100644 --- a/app/src/main/res/layout/bravo_display.xml +++ b/app/src/main/res/layout/bravo_display.xml @@ -15,7 +15,7 @@ android:layout_alignParentStart="true" android:layout_margin="20dp" android:adjustViewBounds="true" - android:maxWidth="400dp" + android:maxWidth="430dp" android:src="@drawable/noa_bravo" /> + + + + + + + \ 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 f8459e1..087fd6c 100644 --- a/app/src/main/res/layout/tutorial1_display.xml +++ b/app/src/main/res/layout/tutorial1_display.xml @@ -7,24 +7,27 @@ + android:text="Clique sur le ballon de foot." + android:textAppearance="@style/TextFont" /> + android:onClick="bravoPage" + android:src="@drawable/ballondefoot" />