www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 5ee517c49bd6a4e56111833d7c9ddc19064c2f38
parent 1025b809efa6f5ba3c7662610bd5aa2007284bd0
Author: John Charron <rm_rf_windows@yahoo.fr>
Date:   Mon, 31 Jan 2011 18:23:39 +0100

Merge branch 'master' of https://github.com/jsmaniac/2011-m1s2-ter

Conflicts:
	code/PtiClic/res/values/strings.xml
	code/PtiClic/src/org/pticlic/Score.java

Diffstat:
Mcode/PtiClic/res/layout/main.xml | 3++-
Mcode/PtiClic/res/values/strings.xml | 8++++----
Mcode/PtiClic/src/org/pticlic/Score.java | 32++++++++++++++++++++++++++++++++
Mcode/PtiClic/src/org/pticlic/games/BaseGame.java | 18++++++++++++++++--
Mcode/PtiClic/src/org/pticlic/model/Constant.java | 3+++
Mcode/PtiClic/src/org/pticlic/model/GamePlayed.java | 13++++++++++---
Dfeuille-route/gantt.pdf | 0
7 files changed, 67 insertions(+), 10 deletions(-)

diff --git a/code/PtiClic/res/layout/main.xml b/code/PtiClic/res/layout/main.xml @@ -11,7 +11,8 @@ android:id="@+id/RelativeLayout01" android:layout_width="wrap_content" android:layout_gravity="bottom|center_horizontal"> - <Button android:layout_height="wrap_content" android:text="@string/play_label" android:layout_width="wrap_content" + <Button android:layout_height="wrap_content" android:text="@string/play_label" + android:layout_width="wrap_content" android:paddingLeft="60px" android:paddingRight="60px" android:id="@+id/play"/> diff --git a/code/PtiClic/res/values/strings.xml b/code/PtiClic/res/values/strings.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">PtiClic</string> -<string name="prefs_name">Préférences</string> -<string name="games_name">Jouer</string> -<string name="textInfo">Ce projet a été réalisé l</string> -<color name="background">#FF0000</color> + <string name="prefs_name">Préférences</string> + <string name="games_name">Jouer</string> + <string name="textInfo">Ce projet a été réalisé l</string> + <color name="background">#FF0000</color> </resources> diff --git a/code/PtiClic/src/org/pticlic/Score.java b/code/PtiClic/src/org/pticlic/Score.java @@ -1,11 +1,18 @@ package org.pticlic; +<<<<<<< HEAD import model.GamePlayed; +======= +import org.pticlic.model.Constant; +import org.pticlic.model.GamePlayed; + +>>>>>>> f74dc5006757fe52d362cf1a0d642d01dda7cf43 import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; +<<<<<<< HEAD import android.widget.Button; import android.widget.TextView; @@ -15,6 +22,11 @@ public class Score extends Activity implements OnClickListener{ private double manquants; private double mauvais; private double total; +======= + +public class Score extends Activity implements OnClickListener{ + +>>>>>>> f74dc5006757fe52d362cf1a0d642d01dda7cf43 private GamePlayed gamePlayed; @@ -24,6 +36,7 @@ public class Score extends Activity implements OnClickListener{ setContentView(R.layout.score); if (getIntent().getExtras() != null) { +<<<<<<< HEAD this.corrects = getIntent().getExtras().getDouble("corrects"); this.manquants = getIntent().getExtras().getDouble("manquants"); this.mauvais = getIntent().getExtras().getDouble("mauvais"); @@ -38,12 +51,31 @@ public class Score extends Activity implements OnClickListener{ ((TextView)findViewById(R.id.total)).setText("Total de " + total + "point(s)"); ((Button)findViewById(R.id.jaivu)).setOnClickListener(this); +======= + // Pour JC : GamePlayed contient toutes les infos sur la partie jouee + this.gamePlayed = (GamePlayed) getIntent().getExtras().get(Constant.SCORE_INTENT); + } +// ((TextView)findViewById(R.id.corrects)).setText("Mots corrects : " +// + this.corrects); +// ((TextView)findViewById(R.id.manquants)).setText("Mots manquants : " +// + this.manquants); +// ((TextView)findViewById(R.id.mauvais)).setText("Mots mauvais : " +// + this.mauvais); +// ((TextView)findViewById(R.id.total)).setText("Total de " + total +// + "point(s)"); +// ((Button)findViewById(R.id.jaivu)).setOnClickListener(this); +>>>>>>> f74dc5006757fe52d362cf1a0d642d01dda7cf43 } protected double calculateTotal(){ +<<<<<<< HEAD return this.corrects - this.manquants - this.mauvais; +======= + throw new UnsupportedOperationException(); + //return this.corrects - this.manquants - this.mauvais; +>>>>>>> f74dc5006757fe52d362cf1a0d642d01dda7cf43 } @Override diff --git a/code/PtiClic/src/org/pticlic/games/BaseGame.java b/code/PtiClic/src/org/pticlic/games/BaseGame.java @@ -1,6 +1,7 @@ package org.pticlic.games; import org.pticlic.R; +import org.pticlic.Score; import org.pticlic.model.Constant; import org.pticlic.model.Game; import org.pticlic.model.GamePlayed; @@ -8,6 +9,7 @@ import org.pticlic.model.Network; import org.pticlic.model.Network.Mode; import android.app.Activity; +import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; @@ -33,7 +35,7 @@ public class BaseGame extends Activity implements OnClickListener { setContentView(R.layout.game); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); - String serverURL = sp.getString(Constant.SERVER_URL, "http://serveur/pticlic.php"); + String serverURL = sp.getString(Constant.SERVER_URL, "http://serveur/pticlic.php"); // TODO : Mettre comme valeur par defaut l'adresse reel du serveur Network network = new Network(serverURL, Mode.SIMPLE_GAME); game = network.getGames(1); @@ -55,6 +57,8 @@ public class BaseGame extends Activity implements OnClickListener { if (nbrel > 2) { r3.setOnClickListener(this); } else { r3.setVisibility(View.GONE); } if (nbrel > 3) { r4.setOnClickListener(this); } else { r4.setVisibility(View.GONE); } + + //TODO : Faudrait gere dynamiquement la gestion des nom des relations. r1.setText("="); r2.setText("Poubelle"); r3.setText("∈"); @@ -68,6 +72,9 @@ public class BaseGame extends Activity implements OnClickListener { start(); } + /** + * Cette methode permet au mot courant de partir du mot central vers le centre de l'appareil. + */ private void arrivalView() { //On recupere la largueur de l'ecran. Display display = getWindowManager().getDefaultDisplay(); @@ -93,17 +100,24 @@ public class BaseGame extends Activity implements OnClickListener { findViewById(R.id.currentWord).startAnimation(set); } + /** + * Cette methode permet de passer au mot courant suivant et de lancer l'animation. + */ private void start() { ((TextView)findViewById(R.id.currentWord)).setText(Game.getName(game.getWordInCloud(currentWord))); arrivalView(); } + /** + * Permet de verifier si la partie est fini auquel cas on lance l'activite Score, sinon on passe au mot suivant. + */ private void next() { if (currentWord < nbWord) { currentWord++; start(); } else { - //TODO : Ajout l'envoie de GamePlayed a Score + Intent intent = new Intent(this, Score.class); + intent.putExtra(Constant.SCORE_INTENT, gamePlayed); } } diff --git a/code/PtiClic/src/org/pticlic/model/Constant.java b/code/PtiClic/src/org/pticlic/model/Constant.java @@ -2,4 +2,7 @@ package org.pticlic.model; public class Constant { public static final String SERVER_URL = "SERVER_URL"; + + // Constant pour les intents + public static final String SCORE_INTENT = "SCORE_INTENT"; } diff --git a/code/PtiClic/src/org/pticlic/model/GamePlayed.java b/code/PtiClic/src/org/pticlic/model/GamePlayed.java @@ -1,13 +1,16 @@ package org.pticlic.model; +import java.io.Serializable; import java.util.ArrayList; -public class GamePlayed { +public class GamePlayed implements Serializable { + + private static final long serialVersionUID = 1L; private ArrayList<CharSequence> relation1; private ArrayList<CharSequence> relation2; private ArrayList<CharSequence> relation3; - private ArrayList<CharSequence> relation4; - private Game game; + private ArrayList<CharSequence> relation4; + private Game game; public GamePlayed() { relation1 = new ArrayList<CharSequence>(); @@ -18,6 +21,10 @@ public class GamePlayed { public void setGame(Game game) { this.game = game; + } + + public Game getGame() { + return game; } public void add(int relation, CharSequence word) { diff --git a/feuille-route/gantt.pdf b/feuille-route/gantt.pdf Binary files differ.