Commit 4836534062c370cfe560eca75d3baf3983e1afed

Authored by aarnaude
1 parent c13d9bc3

ajout scène 4 tri : bug/ne se lance pas

ajout scène 5 selection parmi plusieurs choix : seulement interface graphique
app/src/main/AndroidManifest.xml
@@ -65,7 +65,16 @@ @@ -65,7 +65,16 @@
65 65
66 <activity 66 <activity
67 android:name=".TutorialScene3Activity" 67 android:name=".TutorialScene3Activity"
68 - android:parentActivityName=".TutorialScene1Activity" 68 + android:parentActivityName=".TutorialScene2Activity"
  69 + android:screenOrientation="userLandscape">
  70 + <meta-data
  71 + android:name="android.support.PARENT_ACTIVITY"
  72 + android:value=".MainActivity" />
  73 + </activity>
  74 +
  75 + <activity
  76 + android:name=".TutorialScene4Activity"
  77 + android:parentActivityName=".TutorialScene3Activity"
69 android:screenOrientation="userLandscape"> 78 android:screenOrientation="userLandscape">
70 <meta-data 79 <meta-data
71 android:name="android.support.PARENT_ACTIVITY" 80 android:name="android.support.PARENT_ACTIVITY"
app/src/main/java/tonio/noa/TutorialScene3Activity.java
@@ -117,6 +117,6 @@ public class TutorialScene3Activity extends MyPlayActivity implements View.OnTou @@ -117,6 +117,6 @@ public class TutorialScene3Activity extends MyPlayActivity implements View.OnTou
117 117
118 @Override 118 @Override
119 protected void next() { 119 protected void next() {
120 - this.backHome(null); 120 + startActivity(new Intent(this, TutorialScene4Activity.class));
121 } 121 }
122 } 122 }
app/src/main/java/tonio/noa/TutorialScene4Activity.java 0 → 100644
@@ -0,0 +1,139 @@ @@ -0,0 +1,139 @@
  1 +package tonio.noa;
  2 +
  3 +import android.content.ClipData;
  4 +import android.content.Intent;
  5 +import android.os.Build;
  6 +import android.os.Bundle;
  7 +import android.view.DragEvent;
  8 +import android.view.MotionEvent;
  9 +import android.view.View;
  10 +
  11 +/**
  12 + * Created by psyk on 24/01/18.
  13 + */
  14 +
  15 +public class TutorialScene4Activity extends MyPlayActivity implements View.OnTouchListener, View.OnDragListener {
  16 +
  17 + private int win_counter = 0;
  18 +
  19 + @Override
  20 + protected void onCreate(Bundle savedInstanceState) {
  21 +
  22 + super.onCreate(savedInstanceState);
  23 + Intent i = new Intent(this, ConsigneActivity.class);
  24 + i.putExtra("keyConsigne", "Tu peux mettre les petits carrés de couleurs sur les gros de la même couleur ?\nMerci mon pote!");
  25 + int requestCode = 0;
  26 + startActivityForResult(i, requestCode);
  27 +
  28 + }
  29 +
  30 + protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  31 + super.onActivityResult(requestCode, resultCode, data);
  32 +
  33 + setContentView(R.layout.tutorial3_display);
  34 +
  35 + findViewById(R.id.blue_rectangle41).setOnTouchListener(this);
  36 + findViewById(R.id.blue_rectangle42).setOnTouchListener(this);
  37 + findViewById(R.id.blue_rectangle43).setOnTouchListener(this);
  38 + findViewById(R.id.red_rectangle41).setOnTouchListener(this);
  39 + findViewById(R.id.red_rectangle42).setOnTouchListener(this);
  40 + findViewById(R.id.red_rectangle43).setOnTouchListener(this);
  41 + findViewById(R.id.green_rectangle41).setOnTouchListener(this);
  42 + findViewById(R.id.green_rectangle42).setOnTouchListener(this);
  43 + findViewById(R.id.green_rectangle43).setOnTouchListener(this);
  44 +
  45 +
  46 + findViewById(R.id.anchor_blue_rectangle).setOnDragListener(this);
  47 + findViewById(R.id.anchor_red_rectangle).setOnDragListener(this);
  48 + findViewById(R.id.anchor_green_rectangle).setOnDragListener(this);
  49 + findViewById(R.id.blue_rectangle41).setOnDragListener(this);
  50 + findViewById(R.id.blue_rectangle42).setOnDragListener(this);
  51 + findViewById(R.id.blue_rectangle43).setOnDragListener(this);
  52 + findViewById(R.id.red_rectangle41).setOnDragListener(this);
  53 + findViewById(R.id.red_rectangle42).setOnDragListener(this);
  54 + findViewById(R.id.red_rectangle43).setOnDragListener(this);
  55 + findViewById(R.id.green_rectangle41).setOnDragListener(this);
  56 + findViewById(R.id.green_rectangle42).setOnDragListener(this);
  57 + findViewById(R.id.green_rectangle43).setOnDragListener(this);
  58 +
  59 + }
  60 +
  61 + @Override
  62 + public boolean onTouch(View view, MotionEvent event) {
  63 + if (event.getAction() == MotionEvent.ACTION_DOWN) {
  64 +
  65 + View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
  66 + ClipData data = ClipData.newPlainText("id", view.getResources().getResourceEntryName(view.getId()));
  67 +
  68 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
  69 + view.startDragAndDrop(data, shadowBuilder, view, 0);
  70 + } else {
  71 + view.startDrag(data, shadowBuilder, view, 0);
  72 + }
  73 + return true;
  74 + } else
  75 + return false;
  76 + }
  77 +
  78 + @Override
  79 + public boolean onDrag(View v, DragEvent event) {
  80 + switch (event.getAction()) {
  81 + // signal for the start of a drag and drop operation
  82 + case DragEvent.ACTION_DRAG_STARTED:
  83 + // do nothing
  84 + break;
  85 +
  86 + // the drag point has entered the bounding box of the View
  87 + case DragEvent.ACTION_DRAG_ENTERED:
  88 + // do nothing
  89 + break;
  90 +
  91 + // the user has moved the drag shadow outside the bounding box of the View
  92 + case DragEvent.ACTION_DRAG_EXITED:
  93 + // do nothing
  94 + break;
  95 +
  96 + // the drag and drop operation has concluded
  97 + case DragEvent.ACTION_DRAG_ENDED:
  98 + if (win_counter == 12) bravoPage(v);
  99 + break;
  100 +
  101 + //drag shadow has been released,the drag point is within the bounding box of the View
  102 + case DragEvent.ACTION_DROP:
  103 + //handle the dragged view being dropped over a target view
  104 + View view = (View) event.getLocalState();
  105 + if (v == findViewById(R.id.anchor_red_rectangle)) {
  106 + if (view == findViewById(R.id.red_rectangle41)
  107 + || view == findViewById(R.id.red_rectangle42)
  108 + || view == findViewById(R.id.red_rectangle43)) {
  109 + //stop displaying the view where it was before it was dragged
  110 + view.setVisibility(View.INVISIBLE);
  111 + win_counter++;
  112 + }
  113 + } else if (v == findViewById(R.id.anchor_blue_rectangle)) {
  114 + if (view == findViewById(R.id.blue_rectangle41)
  115 + || view == findViewById(R.id.blue_rectangle42)
  116 + || view == findViewById(R.id.blue_rectangle43)) {
  117 + //stop displaying the view where it was before it was dragged
  118 + view.setVisibility(View.INVISIBLE);
  119 + win_counter++;
  120 + }
  121 + } else if (v == findViewById(R.id.anchor_green_rectangle)) {
  122 + if (view == findViewById(R.id.green_rectangle41)
  123 + || view == findViewById(R.id.green_rectangle42)
  124 + || view == findViewById(R.id.green_rectangle43)) {
  125 + //stop displaying the view where it was before it was dragged
  126 + view.setVisibility(View.INVISIBLE);
  127 + win_counter++;
  128 + }
  129 + }
  130 + break;
  131 + }
  132 + return true;
  133 + }
  134 +
  135 + @Override
  136 + protected void next() {
  137 + this.backHome(null);
  138 + }
  139 +}
app/src/main/java/tonio/noa/TutorialScene5Activity.java 0 → 100644
app/src/main/res/layout/tutorial4_display.xml 0 → 100644
@@ -0,0 +1,174 @@ @@ -0,0 +1,174 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:id="@+id/tut4"
  4 + android:layout_width="match_parent"
  5 + android:layout_height="match_parent"
  6 + android:orientation="vertical">
  7 +
  8 + <LinearLayout
  9 + android:id="@+id/linear51"
  10 + android:layout_width="match_parent"
  11 + android:layout_height="wrap_content"
  12 + android:weightSum="3">
  13 +
  14 + <ImageView
  15 + android:id="@+id/anchor_blue_rectangle"
  16 + android:layout_width="match_parent"
  17 + android:layout_height="300dp"
  18 + android:layout_weight="1"
  19 + android:background="@drawable/blue_rectangle" />
  20 +
  21 +
  22 + <ImageView
  23 + android:id="@+id/anchor_red_rectangle"
  24 + android:layout_width="match_parent"
  25 + android:layout_height="300dp"
  26 + android:layout_weight="1"
  27 + android:background="@drawable/red_rectangle"
  28 + android:nextFocusRight="@id/anchor_blue_rectangle" />
  29 +
  30 + <ImageView
  31 + android:id="@+id/anchor_green_rectangle"
  32 + android:layout_width="match_parent"
  33 + android:layout_height="300dp"
  34 + android:layout_weight="1"
  35 + android:background="@drawable/green_rectangle"
  36 + android:nextFocusRight="@id/anchor_red_rectangle" />
  37 +
  38 + </LinearLayout>
  39 +
  40 + <ImageView
  41 + android:id="@+id/blue_rectangle41"
  42 + android:layout_width="70dp"
  43 + android:layout_height="70dp"
  44 + android:layout_alignParentStart="true"
  45 + android:layout_below="@id/linear51"
  46 + android:layout_margin="50dp"
  47 + android:background="@drawable/blue_rectangle" />
  48 +
  49 +
  50 + <ImageView
  51 + android:id="@+id/red_rectangle41"
  52 + android:layout_width="70dp"
  53 + android:layout_height="70dp"
  54 + android:layout_below="@id/linear51"
  55 + android:layout_margin="50dp"
  56 + android:layout_toEndOf="@id/blue_rectangle41"
  57 + android:background="@drawable/red_rectangle" />
  58 +
  59 + <ImageView
  60 + android:id="@+id/green_rectangle41"
  61 + android:layout_width="70dp"
  62 + android:layout_height="70dp"
  63 + android:layout_below="@id/linear51"
  64 + android:layout_margin="50dp"
  65 + android:layout_toEndOf="@id/red_rectangle41"
  66 + android:background="@drawable/green_rectangle" />
  67 +
  68 + <ImageView
  69 + android:id="@+id/blue_rectangle42"
  70 + android:layout_width="70dp"
  71 + android:layout_height="70dp"
  72 + android:layout_below="@id/linear51"
  73 + android:layout_margin="50dp"
  74 + android:layout_toEndOf="@id/green_rectangle41"
  75 + android:background="@drawable/blue_rectangle" />
  76 +
  77 +
  78 + <ImageView
  79 + android:id="@+id/red_rectangle42"
  80 + android:layout_width="70dp"
  81 + android:layout_height="70dp"
  82 + android:layout_below="@id/linear51"
  83 + android:layout_margin="50dp"
  84 + android:layout_toEndOf="@id/blue_rectangle42"
  85 + android:background="@drawable/red_rectangle" />
  86 +
  87 + <ImageView
  88 + android:id="@+id/green_rectangle42"
  89 + android:layout_width="70dp"
  90 + android:layout_height="70dp"
  91 + android:layout_below="@id/linear51"
  92 + android:layout_margin="50dp"
  93 + android:layout_toEndOf="@id/red_rectangle42"
  94 + android:background="@drawable/green_rectangle" />
  95 +
  96 +
  97 + <ImageView
  98 + android:id="@+id/red_rectangle43"
  99 + android:layout_width="70dp"
  100 + android:layout_height="70dp"
  101 + android:layout_alignParentStart="true"
  102 + android:layout_below="@id/blue_rectangle41"
  103 + android:layout_margin="50dp"
  104 + android:background="@drawable/red_rectangle" />
  105 +
  106 + <ImageView
  107 + android:id="@+id/green_rectangle43"
  108 + android:layout_width="70dp"
  109 + android:layout_height="70dp"
  110 + android:layout_below="@id/blue_rectangle41"
  111 + android:layout_margin="50dp"
  112 + android:layout_toEndOf="@id/red_rectangle43"
  113 + android:background="@drawable/green_rectangle" />
  114 +
  115 + <ImageView
  116 + android:id="@+id/blue_rectangle43"
  117 + android:layout_width="70dp"
  118 + android:layout_height="70dp"
  119 + android:layout_below="@id/blue_rectangle41"
  120 + android:layout_margin="50dp"
  121 + android:layout_toEndOf="@id/green_rectangle43"
  122 + android:background="@drawable/blue_rectangle" />
  123 +
  124 +
  125 + <ImageView
  126 + android:id="@+id/red_rectangle44"
  127 + android:layout_width="70dp"
  128 + android:layout_height="70dp"
  129 + android:layout_below="@id/blue_rectangle41"
  130 + android:layout_margin="50dp"
  131 + android:layout_toEndOf="@id/blue_rectangle43"
  132 + android:background="@drawable/red_rectangle" />
  133 +
  134 + <ImageView
  135 + android:id="@+id/green_rectangle44"
  136 + android:layout_width="70dp"
  137 + android:layout_height="70dp"
  138 + android:layout_below="@id/blue_rectangle41"
  139 + android:layout_margin="50dp"
  140 + android:layout_toEndOf="@id/red_rectangle44"
  141 + android:background="@drawable/green_rectangle" />
  142 +
  143 +
  144 + <ImageView
  145 + android:id="@+id/blue_rectangle44"
  146 + android:layout_width="70dp"
  147 + android:layout_height="70dp"
  148 + android:layout_below="@id/blue_rectangle41"
  149 + android:layout_margin="50dp"
  150 + android:layout_toEndOf="@id/green_rectangle44"
  151 + android:background="@drawable/blue_rectangle" />
  152 +
  153 + <TextView
  154 + android:id="@+id/text4"
  155 + android:layout_width="wrap_content"
  156 + android:layout_height="wrap_content"
  157 + android:layout_alignParentBottom="true"
  158 + android:layout_centerHorizontal="true"
  159 + android:layout_margin="20dp"
  160 + android:text="Met les carrés dans les cases correspondantes."
  161 + android:textAppearance="@style/TextFont" />
  162 +
  163 +
  164 + <Button
  165 + android:id="@+id/button_id_home"
  166 + android:layout_width="wrap_content"
  167 + android:layout_height="wrap_content"
  168 + android:layout_alignParentBottom="true"
  169 + android:layout_alignParentStart="true"
  170 + android:layout_margin="5dp"
  171 + android:onClick="backHome"
  172 + android:text="@string/home" />
  173 +
  174 +</RelativeLayout>
0 \ No newline at end of file 175 \ No newline at end of file
app/src/main/res/layout/tutorial5_display.xml 0 → 100644
@@ -0,0 +1,136 @@ @@ -0,0 +1,136 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:id="@+id/tut5"
  4 + android:layout_width="match_parent"
  5 + android:layout_height="match_parent"
  6 + android:orientation="vertical">
  7 +
  8 + <ImageView
  9 + android:id="@+id/blue_rectangle51"
  10 + android:layout_width="70dp"
  11 + android:layout_height="70dp"
  12 + android:layout_alignParentStart="true"
  13 + android:layout_margin="50dp"
  14 + android:background="@drawable/blue_rectangle" />
  15 +
  16 +
  17 + <ImageView
  18 + android:id="@+id/red_rectangle51"
  19 + android:layout_width="70dp"
  20 + android:layout_height="70dp"
  21 + android:layout_margin="50dp"
  22 + android:layout_toEndOf="@id/blue_rectangle51"
  23 + android:background="@drawable/red_rectangle" />
  24 +
  25 + <ImageView
  26 + android:id="@+id/green_rectangle51"
  27 + android:layout_width="70dp"
  28 + android:layout_height="70dp"
  29 + android:layout_margin="50dp"
  30 + android:layout_toEndOf="@id/red_rectangle51"
  31 + android:background="@drawable/green_rectangle" />
  32 +
  33 + <ImageView
  34 + android:id="@+id/blue_rectangle52"
  35 + android:layout_width="70dp"
  36 + android:layout_height="70dp"
  37 + android:layout_margin="50dp"
  38 + android:layout_toEndOf="@id/green_rectangle51"
  39 + android:background="@drawable/blue_rectangle" />
  40 +
  41 +
  42 + <ImageView
  43 + android:id="@+id/red_rectangle52"
  44 + android:layout_width="70dp"
  45 + android:layout_height="70dp"
  46 + android:layout_margin="50dp"
  47 + android:layout_toEndOf="@id/blue_rectangle52"
  48 + android:background="@drawable/red_rectangle" />
  49 +
  50 + <ImageView
  51 + android:id="@+id/green_rectangle52"
  52 + android:layout_width="70dp"
  53 + android:layout_height="70dp"
  54 + android:layout_margin="50dp"
  55 + android:layout_toEndOf="@id/red_rectangle52"
  56 + android:background="@drawable/green_rectangle" />
  57 +
  58 +
  59 + <ImageView
  60 + android:id="@+id/red_rectangle53"
  61 + android:layout_width="70dp"
  62 + android:layout_height="70dp"
  63 + android:layout_alignParentStart="true"
  64 + android:layout_below="@id/blue_rectangle51"
  65 + android:layout_margin="50dp"
  66 + android:background="@drawable/red_rectangle" />
  67 +
  68 + <ImageView
  69 + android:id="@+id/green_rectangle53"
  70 + android:layout_width="70dp"
  71 + android:layout_height="70dp"
  72 + android:layout_below="@id/blue_rectangle51"
  73 + android:layout_margin="50dp"
  74 + android:layout_toEndOf="@id/red_rectangle53"
  75 + android:background="@drawable/green_rectangle" />
  76 +
  77 + <ImageView
  78 + android:id="@+id/blue_rectangle53"
  79 + android:layout_width="70dp"
  80 + android:layout_height="70dp"
  81 + android:layout_below="@id/blue_rectangle51"
  82 + android:layout_margin="50dp"
  83 + android:layout_toEndOf="@id/green_rectangle53"
  84 + android:background="@drawable/blue_rectangle" />
  85 +
  86 +
  87 + <ImageView
  88 + android:id="@+id/red_rectangle54"
  89 + android:layout_width="70dp"
  90 + android:layout_height="70dp"
  91 + android:layout_below="@id/blue_rectangle51"
  92 + android:layout_margin="50dp"
  93 + android:layout_toEndOf="@id/blue_rectangle53"
  94 + android:background="@drawable/red_rectangle" />
  95 +
  96 + <ImageView
  97 + android:id="@+id/green_rectangle54"
  98 + android:layout_width="70dp"
  99 + android:layout_height="70dp"
  100 + android:layout_below="@id/blue_rectangle51"
  101 + android:layout_margin="50dp"
  102 + android:layout_toEndOf="@id/red_rectangle54"
  103 + android:background="@drawable/green_rectangle" />
  104 +
  105 +
  106 + <ImageView
  107 + android:id="@+id/blue_rectangle54"
  108 + android:layout_width="70dp"
  109 + android:layout_height="70dp"
  110 + android:layout_below="@id/blue_rectangle51"
  111 + android:layout_margin="50dp"
  112 + android:layout_toEndOf="@id/green_rectangle54"
  113 + android:background="@drawable/blue_rectangle" />
  114 +
  115 + <TextView
  116 + android:id="@+id/text4"
  117 + android:layout_width="wrap_content"
  118 + android:layout_height="wrap_content"
  119 + android:layout_alignParentBottom="true"
  120 + android:layout_centerHorizontal="true"
  121 + android:layout_margin="20dp"
  122 + android:text="Clique sur les carrés verts."
  123 + android:textAppearance="@style/TextFont" />
  124 +
  125 +
  126 + <Button
  127 + android:id="@+id/button_id_home"
  128 + android:layout_width="wrap_content"
  129 + android:layout_height="wrap_content"
  130 + android:layout_alignParentBottom="true"
  131 + android:layout_alignParentStart="true"
  132 + android:layout_margin="5dp"
  133 + android:onClick="backHome"
  134 + android:text="@string/home" />
  135 +
  136 +</RelativeLayout>
0 \ No newline at end of file 137 \ No newline at end of file