diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5f7ca0d..dc90dd3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -76,6 +76,21 @@ android:name="android.support.PARENT_ACTIVITY" android:value=".MainActivity" /> + + + + + + + = Build.VERSION_CODES.N) { + view.startDragAndDrop(data, shadowBuilder, view, 0); + } else { + view.startDrag(data, shadowBuilder, view, 0); + } + return true; + } else + return false; + } + + @Override + public boolean onDrag(View v, DragEvent event) { + switch (event.getAction()) { + // signal for the start of a drag and drop operation + case DragEvent.ACTION_DRAG_STARTED: + // do nothing + break; + + // the drag point has entered the bounding box of the View + case DragEvent.ACTION_DRAG_ENTERED: + // do nothing + break; + + // the user has moved the drag shadow outside the bounding box of the View + case DragEvent.ACTION_DRAG_EXITED: + // do nothing + break; + + // the drag and drop operation has concluded + case DragEvent.ACTION_DRAG_ENDED: + if (win_counter == 2 && !done) { + done = true; + bravoPage(v); + } + break; + + //drag shadow has been released,the drag point is within the bounding box of the View + case DragEvent.ACTION_DROP: + //handle the dragged view being dropped over a target view + View view = (View) event.getLocalState(); + if ( + (v == findViewById(R.id.washing_hands) && view == findViewById(R.id.marseille_soap)) || + (v == findViewById(R.id.marseille_soap) && view == findViewById(R.id.washing_hands)) || + (v == findViewById(R.id.blue_toothbrush_pic) && view == findViewById(R.id.brushing_teeth)) || + (v == findViewById(R.id.brushing_teeth) && view == findViewById(R.id.blue_toothbrush_pic)) + ) { + //stop displaying the view where it was before it was dragged + view.setVisibility(View.INVISIBLE); + v.setVisibility(View.INVISIBLE); + win_counter++; + } + break; + } + + return true; + } + + @Override + protected void next() { + backHome(null); + } +} diff --git a/app/src/main/res/drawable/brushing_teeth.png b/app/src/main/res/drawable/brushing_teeth.png new file mode 100644 index 0000000..c9c7776 Binary files /dev/null and b/app/src/main/res/drawable/brushing_teeth.png differ diff --git a/app/src/main/res/drawable/marseille_soap.jpg b/app/src/main/res/drawable/marseille_soap.jpg new file mode 100644 index 0000000..b4a2bb9 Binary files /dev/null and b/app/src/main/res/drawable/marseille_soap.jpg differ diff --git a/app/src/main/res/drawable/washing_hands.jpg b/app/src/main/res/drawable/washing_hands.jpg new file mode 100644 index 0000000..81c2571 Binary files /dev/null and b/app/src/main/res/drawable/washing_hands.jpg differ diff --git a/app/src/main/res/layout/hygiene1_display.xml b/app/src/main/res/layout/hygiene1_display.xml index 71a65d5..d42da24 100644 --- a/app/src/main/res/layout/hygiene1_display.xml +++ b/app/src/main/res/layout/hygiene1_display.xml @@ -12,7 +12,7 @@ android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_margin="20dp" - android:maxWidth="500dp" + android:maxWidth="650dp" android:textAppearance="@style/TextFont" /> diff --git a/app/src/main/res/layout/hygiene2_display.xml b/app/src/main/res/layout/hygiene2_display.xml index 3f0be0b..1ec942b 100644 --- a/app/src/main/res/layout/hygiene2_display.xml +++ b/app/src/main/res/layout/hygiene2_display.xml @@ -12,7 +12,7 @@ android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_margin="20dp" - android:maxWidth="500dp" + android:maxWidth="650dp" android:textAppearance="@style/TextFont" /> diff --git a/app/src/main/res/layout/hygiene3_display.xml b/app/src/main/res/layout/hygiene3_display.xml index 2b2ec60..3bee6c6 100644 --- a/app/src/main/res/layout/hygiene3_display.xml +++ b/app/src/main/res/layout/hygiene3_display.xml @@ -12,7 +12,7 @@ android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_margin="20dp" - android:maxWidth="500dp" + android:maxWidth="650dp" android:textAppearance="@style/TextFont" /> diff --git a/app/src/main/res/layout/hygiene4_display.xml b/app/src/main/res/layout/hygiene4_display.xml index 80ec4cb..55c2dba 100644 --- a/app/src/main/res/layout/hygiene4_display.xml +++ b/app/src/main/res/layout/hygiene4_display.xml @@ -121,6 +121,7 @@ android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_margin="20dp" + android:maxWidth="650dp" android:textAppearance="@style/TextFont" /> @@ -130,7 +131,7 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentStart="true" - android:layout_margin="5dp" + android:layout_margin="20dp" android:onClick="backHome" android:text="@string/home" /> diff --git a/app/src/main/res/layout/hygiene5_display.xml b/app/src/main/res/layout/hygiene5_display.xml new file mode 100644 index 0000000..f79623b --- /dev/null +++ b/app/src/main/res/layout/hygiene5_display.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + +