Commit c13d9bc36446b5ee12ce718fc02ac3f7723cc708
1 parent
e5e6f3ef
activity consigne ajoutée lien entre bravo et next activity + uniformisation police
Showing
12 changed files
with
136 additions
and
68 deletions
Show diff stats
app/src/androidTest/java/tonio/noa/ExampleInstrumentedTest.java deleted
... | ... | @@ -1,26 +0,0 @@ |
1 | -package tonio.noa; | |
2 | - | |
3 | -import android.content.Context; | |
4 | -import android.support.test.InstrumentationRegistry; | |
5 | -import android.support.test.runner.AndroidJUnit4; | |
6 | - | |
7 | -import org.junit.Test; | |
8 | -import org.junit.runner.RunWith; | |
9 | - | |
10 | -import static org.junit.Assert.*; | |
11 | - | |
12 | -/** | |
13 | - * Instrumented test, which will execute on an Android device. | |
14 | - * | |
15 | - * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | |
16 | - */ | |
17 | -@RunWith(AndroidJUnit4.class) | |
18 | -public class ExampleInstrumentedTest { | |
19 | - @Test | |
20 | - public void useAppContext() throws Exception { | |
21 | - // Context of the app under test. | |
22 | - Context appContext = InstrumentationRegistry.getTargetContext(); | |
23 | - | |
24 | - assertEquals("tonio.noa", appContext.getPackageName()); | |
25 | - } | |
26 | -} |
app/src/main/AndroidManifest.xml
... | ... | @@ -76,6 +76,10 @@ |
76 | 76 | android:name=".BravoActivity" |
77 | 77 | android:screenOrientation="userLandscape"></activity> |
78 | 78 | |
79 | + <activity | |
80 | + android:name=".ConsigneActivity" | |
81 | + android:screenOrientation="userLandscape"></activity> | |
82 | + | |
79 | 83 | </application> |
80 | 84 | |
81 | 85 | </manifest> |
82 | 86 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,35 @@ |
1 | +package tonio.noa; | |
2 | + | |
3 | +import android.app.Activity; | |
4 | +import android.content.Intent; | |
5 | +import android.os.Bundle; | |
6 | +import android.view.MotionEvent; | |
7 | +import android.view.View; | |
8 | +import android.widget.TextView; | |
9 | + | |
10 | +/** | |
11 | + * Created by psyk on 22/01/18. | |
12 | + */ | |
13 | + | |
14 | +public class ConsigneActivity extends Activity { | |
15 | + | |
16 | + @Override | |
17 | + protected void onCreate(Bundle savedInstanceState) { | |
18 | + | |
19 | + super.onCreate(savedInstanceState); | |
20 | + final Intent intent = getIntent(); | |
21 | + setContentView(R.layout.consigne_display); | |
22 | + TextView consigneTxt = findViewById(R.id.consigne); | |
23 | + consigneTxt.setText(intent.getStringExtra("keyConsigne")); | |
24 | + View view = findViewById(R.id.consigne_view); | |
25 | + view.setOnTouchListener(new View.OnTouchListener() { | |
26 | + | |
27 | + @Override | |
28 | + public boolean onTouch(View view,MotionEvent event) { | |
29 | + setResult(RESULT_OK,intent); | |
30 | + finish(); | |
31 | + return true; | |
32 | + } | |
33 | + }); | |
34 | + } | |
35 | +} | ... | ... |
app/src/main/java/tonio/noa/TutorialScene1Activity.java
... | ... | @@ -10,14 +10,23 @@ import android.os.Bundle; |
10 | 10 | public class TutorialScene1Activity extends MyPlayActivity{ |
11 | 11 | |
12 | 12 | @Override |
13 | - protected void next() { | |
14 | - startActivity(new Intent(this, TutorialScene2Activity.class)); | |
13 | + protected void onCreate(Bundle savedInstanceState) { | |
14 | + super.onCreate(savedInstanceState); | |
15 | + Intent i = new Intent(this, ConsigneActivity.class); | |
16 | + i.putExtra("keyConsigne","Salut mon pote!\nJe suis Noa.\nTu peux m'aider ?\nRetrouve mon ballon de football."); | |
17 | + int requestCode = 0; | |
18 | + startActivityForResult(i,requestCode); | |
15 | 19 | } |
16 | 20 | |
17 | 21 | @Override |
18 | - protected void onCreate(Bundle savedInstanceState) { | |
19 | - | |
20 | - super.onCreate(savedInstanceState); | |
22 | + protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
23 | + super.onActivityResult(requestCode, resultCode, data); | |
21 | 24 | setContentView(R.layout.tutorial1_display); |
25 | + // do your stuff here after SecondActivity finished. | |
26 | + } | |
27 | + | |
28 | + @Override | |
29 | + protected void next() { | |
30 | + startActivity(new Intent(this, TutorialScene2Activity.class)); | |
22 | 31 | } |
23 | 32 | } |
24 | 33 | \ No newline at end of file | ... | ... |
app/src/main/java/tonio/noa/TutorialScene2Activity.java
... | ... | @@ -21,11 +21,24 @@ public class TutorialScene2Activity extends MyPlayActivity implements View.OnTou |
21 | 21 | super.onCreate(savedInstanceState); |
22 | 22 | setContentView(R.layout.tutorial2_display); |
23 | 23 | |
24 | + Intent i = new Intent(this, ConsigneActivity.class); | |
25 | + i.putExtra("keyConsigne", "J'ai encore besoin de toi !\nMet le rectangle bleu sur le rouge."); | |
26 | + int requestCode = 0; | |
27 | + startActivityForResult(i, requestCode); | |
28 | + | |
29 | + } | |
30 | + | |
31 | + @Override | |
32 | + protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
33 | + super.onActivityResult(requestCode, resultCode, data); | |
34 | + setContentView(R.layout.tutorial2_display); | |
24 | 35 | findViewById(R.id.blue_rectangle).setOnTouchListener(this); |
25 | 36 | findViewById(R.id.blue_rectangle).setOnDragListener(this); |
26 | 37 | findViewById(R.id.red_rectangle).setOnDragListener(this); |
38 | + // do your stuff here after SecondActivity finished. | |
27 | 39 | } |
28 | 40 | |
41 | + | |
29 | 42 | @Override |
30 | 43 | public boolean onTouch(View view, MotionEvent event) { |
31 | 44 | if (event.getAction() == MotionEvent.ACTION_DOWN) { | ... | ... |
app/src/main/java/tonio/noa/TutorialScene3Activity.java
1 | 1 | package tonio.noa; |
2 | 2 | |
3 | 3 | import android.content.ClipData; |
4 | +import android.content.Intent; | |
4 | 5 | import android.os.Build; |
5 | 6 | import android.os.Bundle; |
6 | 7 | import android.view.DragEvent; |
... | ... | @@ -20,6 +21,16 @@ public class TutorialScene3Activity extends MyPlayActivity implements View.OnTou |
20 | 21 | protected void onCreate(Bundle savedInstanceState) { |
21 | 22 | |
22 | 23 | super.onCreate(savedInstanceState); |
24 | + Intent i = new Intent(this, ConsigneActivity.class); | |
25 | + i.putExtra("keyConsigne", "J'ai encore une nouvelle mission pour toi!\nTu dois associer les carrés de même couleur."); | |
26 | + int requestCode = 0; | |
27 | + startActivityForResult(i, requestCode); | |
28 | + | |
29 | + } | |
30 | + | |
31 | + protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
32 | + super.onActivityResult(requestCode, resultCode, data); | |
33 | + | |
23 | 34 | setContentView(R.layout.tutorial3_display); |
24 | 35 | |
25 | 36 | findViewById(R.id.blue_rectangle31).setOnTouchListener(this); |
... | ... | @@ -106,5 +117,6 @@ public class TutorialScene3Activity extends MyPlayActivity implements View.OnTou |
106 | 117 | |
107 | 118 | @Override |
108 | 119 | protected void next() { |
120 | + this.backHome(null); | |
109 | 121 | } |
110 | 122 | } | ... | ... |
app/src/main/res/layout/bravo_display.xml
... | ... | @@ -0,0 +1,31 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | + android:id="@+id/consigne_view" | |
4 | + android:layout_width="match_parent" | |
5 | + android:layout_height="match_parent" | |
6 | + android:clickable="true" | |
7 | + android:focusable="true" | |
8 | + android:focusableInTouchMode="true" | |
9 | + android:orientation="vertical"> | |
10 | + | |
11 | + <ImageView | |
12 | + android:layout_width="wrap_content" | |
13 | + android:layout_height="wrap_content" | |
14 | + android:layout_alignParentBottom="true" | |
15 | + android:layout_alignParentStart="true" | |
16 | + android:layout_margin="20dp" | |
17 | + android:adjustViewBounds="true" | |
18 | + android:maxWidth="580dp" | |
19 | + android:src="@drawable/noa_consigne" /> | |
20 | + | |
21 | + <TextView | |
22 | + android:id="@+id/consigne" | |
23 | + android:layout_width="wrap_content" | |
24 | + android:layout_height="wrap_content" | |
25 | + android:layout_margin="50dp" | |
26 | + android:layout_centerHorizontal="true" | |
27 | + android:gravity="center" | |
28 | + android:maxLines="4" | |
29 | + android:textAppearance="@style/TextFont"/> | |
30 | + | |
31 | +</RelativeLayout> | |
0 | 32 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/tutorial1_display.xml
... | ... | @@ -7,24 +7,27 @@ |
7 | 7 | <TextView |
8 | 8 | android:layout_width="wrap_content" |
9 | 9 | android:layout_height="wrap_content" |
10 | - android:layout_alignParentTop="true" | |
10 | + android:layout_alignParentBottom="true" | |
11 | + android:layout_margin="20dp" | |
11 | 12 | android:layout_centerHorizontal="true" |
12 | - android:text="Bienvenue dans la scène 1 du tutoriel!" /> | |
13 | + android:text="Clique sur le ballon de foot." | |
14 | + android:textAppearance="@style/TextFont" /> | |
13 | 15 | |
14 | 16 | <ImageButton |
15 | 17 | android:layout_width="wrap_content" |
16 | 18 | android:layout_height="wrap_content" |
17 | 19 | android:layout_centerInParent="true" |
18 | 20 | android:background="?android:attr/selectableItemBackgroundBorderless" |
19 | - android:src="@drawable/ballondefoot" | |
20 | - android:onClick="bravoPage"/> | |
21 | + android:onClick="bravoPage" | |
22 | + android:src="@drawable/ballondefoot" /> | |
21 | 23 | |
22 | 24 | <Button |
23 | 25 | android:id="@+id/button_id_home" |
24 | 26 | android:layout_width="wrap_content" |
25 | 27 | android:layout_height="wrap_content" |
26 | 28 | android:layout_alignParentBottom="true" |
27 | - android:layout_alignParentLeft="true" | |
29 | + android:layout_alignParentStart="true" | |
30 | + android:layout_margin="20dp" | |
28 | 31 | android:onClick="backHome" |
29 | 32 | android:text="@string/home" /> |
30 | 33 | ... | ... |
app/src/main/res/layout/tutorial2_display.xml
... | ... | @@ -8,25 +8,30 @@ |
8 | 8 | <TextView |
9 | 9 | android:layout_width="wrap_content" |
10 | 10 | android:layout_height="wrap_content" |
11 | - android:layout_margin="5dp" | |
11 | + android:layout_alignParentBottom="true" | |
12 | 12 | android:layout_centerHorizontal="true" |
13 | + android:maxWidth="500dp" | |
14 | + android:layout_margin="20dp" | |
13 | 15 | android:text="Fais glisser le rectangle bleu sur le rectangle rouge." |
14 | - android:textSize="15sp" /> | |
16 | + android:textAppearance="@style/TextFont" /> | |
15 | 17 | |
16 | 18 | <ImageView |
17 | 19 | android:id="@+id/blue_rectangle" |
18 | - android:layout_width="50dp" | |
19 | - android:layout_height="50dp" | |
20 | - android:layout_margin="50dp" | |
21 | - android:layout_centerHorizontal="true" | |
20 | + android:layout_width="70dp" | |
21 | + android:layout_height="70dp" | |
22 | + android:layout_alignParentStart="true" | |
23 | + android:layout_centerVertical="true" | |
24 | + android:layout_margin="100dp" | |
22 | 25 | android:background="@drawable/blue_rectangle" /> |
23 | 26 | |
24 | 27 | |
25 | 28 | <ImageView |
26 | 29 | android:id="@+id/red_rectangle" |
27 | - android:layout_width="50dp" | |
28 | - android:layout_height="50dp" | |
29 | - android:layout_centerInParent="true" | |
30 | + android:layout_width="70dp" | |
31 | + android:layout_height="70dp" | |
32 | + android:layout_alignParentEnd="true" | |
33 | + android:layout_centerVertical="true" | |
34 | + android:layout_margin="100dp" | |
30 | 35 | android:background="@drawable/red_rectangle" /> |
31 | 36 | |
32 | 37 | <Button |
... | ... | @@ -35,7 +40,7 @@ |
35 | 40 | android:layout_height="wrap_content" |
36 | 41 | android:layout_alignParentBottom="true" |
37 | 42 | android:layout_alignParentStart="true" |
38 | - android:layout_margin="5dp" | |
43 | + android:layout_margin="10dp" | |
39 | 44 | android:onClick="backHome" |
40 | 45 | android:text="@string/home" /> |
41 | 46 | ... | ... |
app/src/main/res/layout/tutorial3_display.xml
... | ... | @@ -10,16 +10,16 @@ |
10 | 10 | android:layout_width="wrap_content" |
11 | 11 | android:layout_height="wrap_content" |
12 | 12 | android:layout_centerHorizontal="true" |
13 | + android:layout_alignParentBottom="true" | |
13 | 14 | android:layout_margin="20dp" |
14 | - android:text="Associe les carrés de même couleur ensemble." | |
15 | - android:textSize="15sp" /> | |
15 | + android:text="Associe les carrés de même couleur." | |
16 | + android:textAppearance="@style/TextFont" /> | |
16 | 17 | |
17 | 18 | <ImageView |
18 | 19 | android:id="@+id/blue_rectangle31" |
19 | 20 | android:layout_width="50dp" |
20 | 21 | android:layout_height="50dp" |
21 | 22 | android:layout_alignParentStart="true" |
22 | - android:layout_below="@id/text3" | |
23 | 23 | android:layout_margin="50dp" |
24 | 24 | android:background="@drawable/blue_rectangle" /> |
25 | 25 | |
... | ... | @@ -29,7 +29,6 @@ |
29 | 29 | android:layout_width="50dp" |
30 | 30 | android:layout_height="50dp" |
31 | 31 | android:layout_alignParentEnd="true" |
32 | - android:layout_below="@id/text3" | |
33 | 32 | android:layout_margin="50dp" |
34 | 33 | android:background="@drawable/red_rectangle" |
35 | 34 | android:nextFocusRight="@id/blue_rectangle31" /> | ... | ... |
app/src/test/java/tonio/noa/ExampleUnitTest.java deleted
... | ... | @@ -1,17 +0,0 @@ |
1 | -package tonio.noa; | |
2 | - | |
3 | -import org.junit.Test; | |
4 | - | |
5 | -import static org.junit.Assert.*; | |
6 | - | |
7 | -/** | |
8 | - * Example local unit test, which will execute on the development machine (host). | |
9 | - * | |
10 | - * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | |
11 | - */ | |
12 | -public class ExampleUnitTest { | |
13 | - @Test | |
14 | - public void addition_isCorrect() throws Exception { | |
15 | - assertEquals(4, 2 + 2); | |
16 | - } | |
17 | -} | |
18 | 0 | \ No newline at end of file |