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