Commit 2ff2b441759fdd9cd98405c9907a33d559686e9e

Authored by aarnaude
1 parent 4d5786fb

scene 3 : done

app/src/main/java/tonio/noa/TutorialScene1Activity.java
@@ -12,7 +12,6 @@ public class TutorialScene1Activity extends MyPlayActivity{ @@ -12,7 +12,6 @@ public class TutorialScene1Activity extends MyPlayActivity{
12 @Override 12 @Override
13 protected void next() { 13 protected void next() {
14 startActivity(new Intent(this, TutorialScene2Activity.class)); 14 startActivity(new Intent(this, TutorialScene2Activity.class));
15 - finish();  
16 } 15 }
17 16
18 @Override 17 @Override
app/src/main/java/tonio/noa/TutorialScene2Activity.java
@@ -88,7 +88,6 @@ public class TutorialScene2Activity extends MyPlayActivity implements View.OnTou @@ -88,7 +88,6 @@ public class TutorialScene2Activity extends MyPlayActivity implements View.OnTou
88 @Override 88 @Override
89 protected void next() { 89 protected void next() {
90 startActivity(new Intent(this, TutorialScene3Activity.class)); 90 startActivity(new Intent(this, TutorialScene3Activity.class));
91 - finish();  
92 } 91 }
93 92
94 } 93 }
app/src/main/java/tonio/noa/TutorialScene3Activity.java
@@ -14,6 +14,8 @@ import android.widget.ImageView; @@ -14,6 +14,8 @@ import android.widget.ImageView;
14 14
15 public class TutorialScene3Activity extends MyPlayActivity implements View.OnTouchListener, View.OnDragListener { 15 public class TutorialScene3Activity extends MyPlayActivity implements View.OnTouchListener, View.OnDragListener {
16 16
  17 + private int win_counter = 0;
  18 +
17 @Override 19 @Override
18 protected void onCreate(Bundle savedInstanceState) { 20 protected void onCreate(Bundle savedInstanceState) {
19 21
@@ -72,13 +74,21 @@ public class TutorialScene3Activity extends MyPlayActivity implements View.OnTou @@ -72,13 +74,21 @@ public class TutorialScene3Activity extends MyPlayActivity implements View.OnTou
72 74
73 // the drag and drop operation has concluded 75 // the drag and drop operation has concluded
74 case DragEvent.ACTION_DRAG_ENDED: 76 case DragEvent.ACTION_DRAG_ENDED:
  77 + if (win_counter == 3) bravoPage(v);
75 break; 78 break;
76 79
77 //drag shadow has been released,the drag point is within the bounding box of the View 80 //drag shadow has been released,the drag point is within the bounding box of the View
78 case DragEvent.ACTION_DROP: 81 case DragEvent.ACTION_DROP:
79 //handle the dragged view being dropped over a target view 82 //handle the dragged view being dropped over a target view
80 View view = (View) event.getLocalState(); 83 View view = (View) event.getLocalState();
81 - if (v == findViewById(R.id.red_rectangle)) { 84 + if (
  85 + (v == findViewById(R.id.red_rectangle31) && view == findViewById(R.id.red_rectangle32)) ||
  86 + (v == findViewById(R.id.red_rectangle32) && view == findViewById(R.id.red_rectangle31)) ||
  87 + (v == findViewById(R.id.blue_rectangle31) && view == findViewById(R.id.blue_rectangle32)) ||
  88 + (v == findViewById(R.id.blue_rectangle32) && view == findViewById(R.id.blue_rectangle31)) ||
  89 + (v == findViewById(R.id.green_rectangle31) && view == findViewById(R.id.green_rectangle32)) ||
  90 + (v == findViewById(R.id.green_rectangle32) && view == findViewById(R.id.green_rectangle31))
  91 + ) {
82 //stop displaying the view where it was before it was dragged 92 //stop displaying the view where it was before it was dragged
83 view.setVisibility(View.INVISIBLE); 93 view.setVisibility(View.INVISIBLE);
84 //view dragged item is being dropped on 94 //view dragged item is being dropped on
@@ -86,7 +96,7 @@ public class TutorialScene3Activity extends MyPlayActivity implements View.OnTou @@ -86,7 +96,7 @@ public class TutorialScene3Activity extends MyPlayActivity implements View.OnTou
86 //view being dragged and dropped 96 //view being dragged and dropped
87 ImageView dropped = (ImageView) view; 97 ImageView dropped = (ImageView) view;
88 dropTarget.setBackgroundColor(dropped.getSolidColor()); 98 dropTarget.setBackgroundColor(dropped.getSolidColor());
89 - bravoPage(v); 99 + win_counter++;
90 } 100 }
91 break; 101 break;
92 } 102 }
@@ -96,7 +106,5 @@ public class TutorialScene3Activity extends MyPlayActivity implements View.OnTou @@ -96,7 +106,5 @@ public class TutorialScene3Activity extends MyPlayActivity implements View.OnTou
96 106
97 @Override 107 @Override
98 protected void next() { 108 protected void next() {
99 - finish();  
100 } 109 }
101 -  
102 } 110 }