From c98663337c9b32ff1115ccd86591a046611e55d8 Mon Sep 17 00:00:00 2001 From: aarnaude Date: Wed, 7 Feb 2018 17:39:45 +0100 Subject: [PATCH] ajout scènes thème hygiene --- app/src/main/AndroidManifest.xml | 15 +++++++++++++++ app/src/main/java/tonio/noa/Hygiene4Activity.java | 7 ++++++- app/src/main/java/tonio/noa/Hygiene5Activity.java | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app/src/main/java/tonio/noa/Hygiene6Activity.java | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app/src/main/res/drawable/brushing_teeth.png | Bin 0 -> 127820 bytes app/src/main/res/drawable/marseille_soap.jpg | Bin 0 -> 58258 bytes app/src/main/res/drawable/washing_hands.jpg | Bin 0 -> 81273 bytes app/src/main/res/layout/hygiene1_display.xml | 4 ++-- app/src/main/res/layout/hygiene2_display.xml | 4 ++-- app/src/main/res/layout/hygiene3_display.xml | 4 ++-- app/src/main/res/layout/hygiene4_display.xml | 3 ++- app/src/main/res/layout/hygiene5_display.xml | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app/src/main/res/layout/hygiene6_display.xml | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app/src/main/res/layout/tutorial1_display.xml | 1 + app/src/main/res/layout/tutorial2_display.xml | 6 +++--- app/src/main/res/layout/tutorial3_display.xml | 27 ++++++++++++++------------- app/src/main/res/layout/tutorial4_display.xml | 3 ++- app/src/main/res/layout/tutorial5_display.xml | 3 ++- 18 files changed, 424 insertions(+), 26 deletions(-) create mode 100644 app/src/main/java/tonio/noa/Hygiene5Activity.java create mode 100644 app/src/main/java/tonio/noa/Hygiene6Activity.java create mode 100644 app/src/main/res/drawable/brushing_teeth.png create mode 100644 app/src/main/res/drawable/marseille_soap.jpg create mode 100644 app/src/main/res/drawable/washing_hands.jpg create mode 100644 app/src/main/res/layout/hygiene5_display.xml create mode 100644 app/src/main/res/layout/hygiene6_display.xml 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 @@ + + + + + + + + + + + + + + + + + + +