From 4836534062c370cfe560eca75d3baf3983e1afed Mon Sep 17 00:00:00 2001 From: aarnaude Date: Wed, 24 Jan 2018 16:43:31 +0100 Subject: [PATCH] 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 | 11 ++++++++++- app/src/main/java/tonio/noa/TutorialScene3Activity.java | 2 +- app/src/main/java/tonio/noa/TutorialScene4Activity.java | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app/src/main/java/tonio/noa/TutorialScene5Activity.java | 0 app/src/main/res/layout/tutorial4_display.xml | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app/src/main/res/layout/tutorial5_display.xml | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 460 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/tonio/noa/TutorialScene4Activity.java create mode 100644 app/src/main/java/tonio/noa/TutorialScene5Activity.java create mode 100644 app/src/main/res/layout/tutorial4_display.xml create mode 100644 app/src/main/res/layout/tutorial5_display.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e8acebd..5b80ff7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -65,7 +65,16 @@ + + + + = 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 == 12) 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.anchor_red_rectangle)) { + if (view == findViewById(R.id.red_rectangle41) + || view == findViewById(R.id.red_rectangle42) + || view == findViewById(R.id.red_rectangle43)) { + //stop displaying the view where it was before it was dragged + view.setVisibility(View.INVISIBLE); + win_counter++; + } + } else if (v == findViewById(R.id.anchor_blue_rectangle)) { + if (view == findViewById(R.id.blue_rectangle41) + || view == findViewById(R.id.blue_rectangle42) + || view == findViewById(R.id.blue_rectangle43)) { + //stop displaying the view where it was before it was dragged + view.setVisibility(View.INVISIBLE); + win_counter++; + } + } else if (v == findViewById(R.id.anchor_green_rectangle)) { + if (view == findViewById(R.id.green_rectangle41) + || view == findViewById(R.id.green_rectangle42) + || view == findViewById(R.id.green_rectangle43)) { + //stop displaying the view where it was before it was dragged + view.setVisibility(View.INVISIBLE); + win_counter++; + } + } + break; + } + return true; + } + + @Override + protected void next() { + this.backHome(null); + } +} diff --git a/app/src/main/java/tonio/noa/TutorialScene5Activity.java b/app/src/main/java/tonio/noa/TutorialScene5Activity.java new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/src/main/java/tonio/noa/TutorialScene5Activity.java diff --git a/app/src/main/res/layout/tutorial4_display.xml b/app/src/main/res/layout/tutorial4_display.xml new file mode 100644 index 0000000..f05ed51 --- /dev/null +++ b/app/src/main/res/layout/tutorial4_display.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +