Commit d55d5943e33f622b2edb4c3a96c0787dd2c6d5f2

Authored by aarnaude
1 parent 6b23e70e

resolution Bravo

@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <project version="4"> 2 <project version="4">
3 <component name="ProjectModuleManager"> 3 <component name="ProjectModuleManager">
4 <modules> 4 <modules>
5 - <module fileurl="file://$PROJECT_DIR$/Noa.iml" filepath="$PROJECT_DIR$/Noa.iml" /> 5 + <module fileurl="file://$PROJECT_DIR$/PFE.iml" filepath="$PROJECT_DIR$/PFE.iml" />
6 <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> 6 <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
7 </modules> 7 </modules>
8 </component> 8 </component>
app/src/main/AndroidManifest.xml
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 </activity> 46 </activity>
47 47
48 <activity 48 <activity
49 - android:name=".TutorialActivity" 49 + android:name=".TutorialScene1Activity"
50 android:parentActivityName=".MainActivity" 50 android:parentActivityName=".MainActivity"
51 android:screenOrientation="userLandscape"> 51 android:screenOrientation="userLandscape">
52 <meta-data 52 <meta-data
@@ -55,6 +55,15 @@ @@ -55,6 +55,15 @@
55 </activity> 55 </activity>
56 56
57 <activity 57 <activity
  58 + android:name=".TutorialScene2Activity"
  59 + android:parentActivityName=".TutorialScene1Activity"
  60 + android:screenOrientation="userLandscape">
  61 + <meta-data
  62 + android:name="android.support.PARENT_ACTIVITY"
  63 + android:value=".MainActivity" />
  64 + </activity>
  65 +
  66 + <activity
58 android:name=".BravoActivity" 67 android:name=".BravoActivity"
59 android:screenOrientation="userLandscape"> 68 android:screenOrientation="userLandscape">
60 </activity> 69 </activity>
app/src/main/java/tonio/noa/BravoActivity.java
1 package tonio.noa; 1 package tonio.noa;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
  4 +import android.content.Intent;
4 import android.os.Bundle; 5 import android.os.Bundle;
  6 +import android.view.MotionEvent;
  7 +import android.view.View;
5 8
6 /** 9 /**
7 * Created by tonio on 23/11/17. 10 * Created by tonio on 23/11/17.
8 */ 11 */
9 12
10 -class BravoActivity extends Activity{ 13 +public class BravoActivity extends Activity{
11 14
12 @Override 15 @Override
13 protected void onCreate(Bundle savedInstanceState) { 16 protected void onCreate(Bundle savedInstanceState) {
14 17
15 super.onCreate(savedInstanceState); 18 super.onCreate(savedInstanceState);
  19 + final Intent intent = getIntent();
16 setContentView(R.layout.bravo_display); 20 setContentView(R.layout.bravo_display);
17 - }  
18 - 21 + View view = findViewById(R.id.bravo_view);
  22 + view.setOnTouchListener(new View.OnTouchListener() {
19 23
  24 + @Override
  25 + public boolean onTouch(View view,MotionEvent event) {
  26 + setResult(RESULT_OK,intent);
  27 + finish();
  28 + return true;
  29 + }
  30 + });
  31 + }
20 } 32 }
app/src/main/java/tonio/noa/MainActivity.java
@@ -28,7 +28,7 @@ public class MainActivity extends Activity { @@ -28,7 +28,7 @@ public class MainActivity extends Activity {
28 28
29 public void tutorialPage(View view){ 29 public void tutorialPage(View view){
30 30
31 - startActivity(new Intent(this, TutorialActivity.class)); 31 + startActivity(new Intent(this, TutorialScene1Activity.class));
32 finish(); 32 finish();
33 } 33 }
34 } 34 }
app/src/main/java/tonio/noa/MyPlayActivity.java 0 → 100644
@@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
  1 +package tonio.noa;
  2 +
  3 +import android.app.Activity;
  4 +import android.content.Intent;
  5 +import android.view.View;
  6 +import android.widget.Toast;
  7 +
  8 +
  9 +/**
  10 + * Created by psyk on 09/01/18.
  11 + */
  12 +
  13 +public abstract class MyPlayActivity extends Activity {
  14 +
  15 + public static final int REQUEST_CODE = 1;
  16 +
  17 + protected abstract void next();
  18 +
  19 + protected void bravoPage(View view){
  20 + startActivityForResult(new Intent(this, BravoActivity.class), REQUEST_CODE);
  21 + }
  22 + @Override
  23 + protected void onActivityResult(int requestCode, int resultCode, Intent data){
  24 + try {
  25 + super.onActivityResult(requestCode, resultCode, data);
  26 +
  27 + if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
  28 + this.next();
  29 + finish();
  30 + }
  31 + } catch (Exception ex) {
  32 + Toast.makeText(MyPlayActivity.this, ex.toString(),
  33 + Toast.LENGTH_SHORT).show();
  34 + }
  35 + }
  36 +
  37 + public void backHome(View view) {
  38 +
  39 + startActivity(new Intent(this, MainActivity.class));
  40 + finish();
  41 + }
  42 +}
app/src/main/java/tonio/noa/TutorialActivity.java renamed to app/src/main/java/tonio/noa/TutorialScene1Activity.java
1 package tonio.noa; 1 package tonio.noa;
2 2
3 -import android.app.Activity;  
4 import android.content.Intent; 3 import android.content.Intent;
5 import android.os.Bundle; 4 import android.os.Bundle;
6 import android.view.View; 5 import android.view.View;
@@ -9,21 +8,18 @@ import android.view.View; @@ -9,21 +8,18 @@ import android.view.View;
9 * Created by tonio on 22/11/17. 8 * Created by tonio on 22/11/17.
10 */ 9 */
11 10
12 -public class TutorialActivity extends Activity { 11 +public class TutorialScene1Activity extends MyPlayActivity{
13 12
14 @Override 13 @Override
15 - protected void onCreate(Bundle savedInstanceState) {  
16 -  
17 - super.onCreate(savedInstanceState);  
18 - setContentView(R.layout.tutorial_display); 14 + protected void next() {
  15 + startActivity(new Intent(this, TutorialScene2Activity.class));
  16 + finish();
19 } 17 }
20 18
21 - public void backHome(View view) {  
22 -  
23 - startActivity(new Intent(this, MainActivity.class));  
24 - } 19 + @Override
  20 + protected void onCreate(Bundle savedInstanceState) {
25 21
26 - public void bravoPage(View view){  
27 - startActivity(new Intent(this, BravoActivity.class)); 22 + super.onCreate(savedInstanceState);
  23 + setContentView(R.layout.tutorial1_display);
28 } 24 }
29 } 25 }
30 \ No newline at end of file 26 \ No newline at end of file
app/src/main/java/tonio/noa/TutorialScene2Activity.java 0 → 100644
@@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
  1 +package tonio.noa;
  2 +
  3 +import android.os.Bundle;
  4 +import android.view.View;
  5 +
  6 +/**
  7 + * Created by psyk on 09/01/18.
  8 + */
  9 +
  10 +public class TutorialScene2Activity extends MyPlayActivity {
  11 +
  12 + @Override
  13 + protected void onCreate(Bundle savedInstanceState) {
  14 +
  15 + super.onCreate(savedInstanceState);
  16 + setContentView(R.layout.tutorial2_display);
  17 + }
  18 +
  19 + @Override
  20 + protected void next() {
  21 + finish();
  22 + }
  23 +}
app/src/main/res/layout/bravo_display.xml
@@ -2,6 +2,10 @@ @@ -2,6 +2,10 @@
2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
  5 + android:focusable="true"
  6 + android:clickable="true"
  7 + android:focusableInTouchMode="true"
  8 + android:id="@+id/bravo_view"
5 android:orientation="vertical"> 9 android:orientation="vertical">
6 10
7 <TextView 11 <TextView
@@ -9,13 +13,14 @@ @@ -9,13 +13,14 @@
9 android:layout_height="wrap_content" 13 android:layout_height="wrap_content"
10 android:layout_alignParentTop="true" 14 android:layout_alignParentTop="true"
11 android:layout_centerHorizontal="true" 15 android:layout_centerHorizontal="true"
12 - android:text="Bien joué!" 16 + android:text="Bien joué! Touche l'écran pour continuer à jouer!"
13 android:textStyle="bold"/> 17 android:textStyle="bold"/>
14 18
15 <ImageView 19 <ImageView
16 android:layout_width="wrap_content" 20 android:layout_width="wrap_content"
17 android:layout_height="wrap_content" 21 android:layout_height="wrap_content"
18 android:layout_centerInParent="true" 22 android:layout_centerInParent="true"
  23 + android:maxHeight="50dp"
19 android:src="@drawable/bravo" /> 24 android:src="@drawable/bravo" />
20 25
21 </RelativeLayout> 26 </RelativeLayout>
22 \ No newline at end of file 27 \ No newline at end of file
app/src/main/res/layout/tutorial_display.xml renamed to app/src/main/res/layout/tutorial1_display.xml
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 android:layout_height="wrap_content" 9 android:layout_height="wrap_content"
10 android:layout_alignParentTop="true" 10 android:layout_alignParentTop="true"
11 android:layout_centerHorizontal="true" 11 android:layout_centerHorizontal="true"
12 - android:text="Bienvenue dans le tutoriel!" /> 12 + android:text="Bienvenue dans la scène 1 du tutoriel!" />
13 13
14 <ImageButton 14 <ImageButton
15 android:layout_width="wrap_content" 15 android:layout_width="wrap_content"
app/src/main/res/layout/tutorial2_display.xml 0 → 100644
@@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + android:orientation="vertical">
  6 +
  7 + <TextView
  8 + android:layout_width="wrap_content"
  9 + android:layout_height="wrap_content"
  10 + android:layout_alignParentTop="true"
  11 + android:layout_centerHorizontal="true"
  12 + android:text="Tutoriel scène 2" />
  13 +
  14 + <Button
  15 + android:id="@+id/button_id_home"
  16 + android:layout_width="wrap_content"
  17 + android:layout_height="wrap_content"
  18 + android:layout_alignParentBottom="true"
  19 + android:layout_alignParentLeft="true"
  20 + android:onClick="backHome"
  21 + android:text="@string/home" />
  22 +
  23 +</RelativeLayout>
0 \ No newline at end of file 24 \ No newline at end of file
@@ -7,7 +7,7 @@ buildscript { @@ -7,7 +7,7 @@ buildscript {
7 jcenter() 7 jcenter()
8 } 8 }
9 dependencies { 9 dependencies {
10 - classpath 'com.android.tools.build:gradle:3.0.0' 10 + classpath 'com.android.tools.build:gradle:3.0.1'
11 11
12 12
13 // NOTE: Do not place your application dependencies here; they belong 13 // NOTE: Do not place your application dependencies here; they belong