commit 8c0206d80a75d0b78fde5c07e48cdedbefe48562 parent 4dddb4f4fc99db28bfe4d668d5396b49497965ab Author: Bertrand BRUN <bertrand0brun@gmail.com> Date: Wed, 2 Feb 2011 11:40:40 +0100 Ajout des nouvelles images et ajout du splash et de la page de garde Diffstat:
50 files changed, 321 insertions(+), 189 deletions(-)
diff --git a/.gitignore b/.gitignore @@ -1 +1,2 @@ -.DS_Store -\ No newline at end of file +.DS_Store +code.zip diff --git a/code/PtiClic/AndroidManifest.xml b/code/PtiClic/AndroidManifest.xml @@ -14,6 +14,7 @@ <activity android:name=".games.BaseGame" android:screenOrientation="portrait"></activity> <activity android:label="Information" android:name=".Information" android:screenOrientation="portrait"></activity> <activity android:name=".Score" android:label="Score" android:screenOrientation="portrait"></activity> +<activity android:name=".FrontPage" android:screenOrientation="portrait"></activity> </application> diff --git a/code/images/Aide72.png b/code/PtiClic/res/drawable-hdpi/aide.png Binary files differ. diff --git a/code/images/Contenant72.png b/code/PtiClic/res/drawable-hdpi/contenant.png Binary files differ. diff --git a/code/images/Contenu72.png b/code/PtiClic/res/drawable-hdpi/contenu.png Binary files differ. diff --git a/code/images/Contraire72.png b/code/PtiClic/res/drawable-hdpi/contraire.png Binary files differ. diff --git a/code/images/ModeNormal72.png b/code/PtiClic/res/drawable-hdpi/mode_normal.png Binary files differ. diff --git a/code/images/ModeOmbre72.png b/code/PtiClic/res/drawable-hdpi/mode_ombre.png Binary files differ. diff --git a/code/images/Rapport72.png b/code/PtiClic/res/drawable-hdpi/rapport.png Binary files differ. diff --git a/code/images/FondLogo.png b/code/PtiClic/res/drawable-hdpi/splash.png Binary files differ. diff --git a/code/images/Synonyme72.png b/code/PtiClic/res/drawable-hdpi/synonyme.png Binary files differ. diff --git a/code/images/Aide36.png b/code/PtiClic/res/drawable-ldpi/aide.png Binary files differ. diff --git a/code/images/Contenant36.png b/code/PtiClic/res/drawable-ldpi/contenant.png Binary files differ. diff --git a/code/images/Contenu36.png b/code/PtiClic/res/drawable-ldpi/contenu.png Binary files differ. diff --git a/code/images/Contraire36.png b/code/PtiClic/res/drawable-ldpi/contraire.png Binary files differ. diff --git a/code/images/ModeNormal36.png b/code/PtiClic/res/drawable-ldpi/mode_normal.png Binary files differ. diff --git a/code/images/ModeOmbre36.png b/code/PtiClic/res/drawable-ldpi/mode_ombre.png Binary files differ. diff --git a/code/images/Rapport36.png b/code/PtiClic/res/drawable-ldpi/rapport.png Binary files differ. diff --git a/code/images/FondLogo.png b/code/PtiClic/res/drawable-ldpi/splash.png Binary files differ. diff --git a/code/images/Synonyme36.png b/code/PtiClic/res/drawable-ldpi/synonyme.png Binary files differ. diff --git a/code/images/Aide48.png b/code/PtiClic/res/drawable-mdpi/aide.png Binary files differ. diff --git a/code/images/Contenant48.png b/code/PtiClic/res/drawable-mdpi/contenant.png Binary files differ. diff --git a/code/images/Contenu48.png b/code/PtiClic/res/drawable-mdpi/contenu.png Binary files differ. diff --git a/code/images/Contraire48.png b/code/PtiClic/res/drawable-mdpi/contraire.png Binary files differ. diff --git a/code/images/ModeNormal48.png b/code/PtiClic/res/drawable-mdpi/mode_normal.png Binary files differ. diff --git a/code/images/ModeOmbre48.png b/code/PtiClic/res/drawable-mdpi/mode_ombre.png Binary files differ. diff --git a/code/images/Rapport48.png b/code/PtiClic/res/drawable-mdpi/rapport.png Binary files differ. diff --git a/code/images/FondLogo.png b/code/PtiClic/res/drawable-mdpi/splash.png Binary files differ. diff --git a/code/images/Synonyme48.png b/code/PtiClic/res/drawable-mdpi/synonyme.png Binary files differ. diff --git a/code/PtiClic/res/layout/frontpage.xml b/code/PtiClic/res/layout/frontpage.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" android:layout_height="fill_parent" + android:orientation="vertical"> + + <TextView android:text="@string/app_name" android:id="@+id/logo" + android:layout_width="fill_parent" android:layout_height="wrap_content" + android:textSize="50px" android:layout_weight="1" /> + + <RelativeLayout android:layout_height="wrap_content" + android:id="@+id/RelativeLayout01" android:layout_width="wrap_content" + android:layout_gravity="bottom|center_horizontal"> + + <ImageView android:layout_height="wrap_content" + android:text="@string/play_label" android:layout_width="wrap_content" + android:id="@+id/play" android:clickable="true" android:padding="30dip" android:src="@drawable/mode_normal"/> + + <ImageView android:src="@drawable/config" android:layout_height="wrap_content" android:id="@+id/prefs" + android:layout_width="wrap_content" android:layout_below="@+id/play" + android:layout_alignLeft="@+id/play" android:layout_alignRight="@+id/play" android:padding="30dip"></ImageView> + + + + + + + +</RelativeLayout> + + <LinearLayout android:id="@+id/LinearLayout01" + android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="vertical" android:layout_weight="1"> + + <TextView android:layout_height="wrap_content" + android:layout_width="fill_parent" android:textStyle="bold" + android:gravity="center_horizontal" android:text="@+id/login" + android:id="@+id/login"></TextView> + <ImageView android:layout_height="wrap_content" android:id="@+id/infoButton" + android:layout_width="wrap_content" android:layout_gravity="right" android:layout_weight="5" + android:clickable="true" android:src="@drawable/aide"/> + + </LinearLayout> + +</LinearLayout> diff --git a/code/PtiClic/res/layout/main.xml b/code/PtiClic/res/layout/main.xml @@ -1,46 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" android:layout_height="fill_parent" - android:orientation="vertical"> - - <TextView android:text="@string/app_name" android:id="@+id/logo" - android:layout_width="fill_parent" android:layout_height="wrap_content" - android:textSize="50px" android:layout_weight="1" /> - - <RelativeLayout android:layout_height="wrap_content" - android:id="@+id/RelativeLayout01" android:layout_width="wrap_content" - android:layout_gravity="bottom|center_horizontal"> - - <ImageView android:layout_height="wrap_content" - android:text="@string/play_label" android:layout_width="wrap_content" - android:id="@+id/play" android:src="@drawable/mode_chrono" - android:clickable="true" android:padding="40dip" /> - - <ImageView android:src="@drawable/config" android:padding="40dip" - android:layout_height="wrap_content" android:id="@+id/prefs" - android:layout_width="wrap_content" android:layout_below="@+id/play" - android:layout_alignLeft="@+id/play" android:layout_alignRight="@+id/play"></ImageView> - - - - - - - -</RelativeLayout> - - <LinearLayout android:id="@+id/LinearLayout01" - android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="vertical" android:layout_weight="1"> - - <TextView android:layout_height="wrap_content" - android:layout_width="fill_parent" android:textStyle="bold" - android:gravity="center_horizontal" android:text="@+id/login" - android:id="@+id/login"></TextView> - <ImageView android:layout_height="wrap_content" android:id="@+id/infoButton" - android:layout_width="wrap_content" android:src="@android:drawable/ic_dialog_info" - android:layout_gravity="right" android:layout_weight="5" - android:clickable="true" /> - - </LinearLayout> - +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> +<ImageView android:id="@+id/ImageView01" android:src="@drawable/splash" android:layout_gravity="center_vertical|center_horizontal|center" android:layout_width="fill_parent" android:layout_height="fill_parent"></ImageView> </LinearLayout> diff --git a/code/PtiClic/src/org/pticlic/FrontPage.java b/code/PtiClic/src/org/pticlic/FrontPage.java @@ -0,0 +1,51 @@ +package org.pticlic; + +import org.pticlic.games.BaseGame; + +import android.app.Activity; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.preference.PreferenceManager; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.ImageView; +import android.widget.TextView; + +public class FrontPage extends Activity implements OnClickListener{ + + /** Called when the activity is first created. */ + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.frontpage); + // Écoute des clics sur les différents boutons + ((ImageView)findViewById(R.id.prefs)).setOnClickListener(this); + ((ImageView)findViewById(R.id.play)).setOnClickListener(this); + ((ImageView)findViewById(R.id.infoButton)).setOnClickListener(this); + + // On récupère le nom du joueur des préférences. + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); + String loginPref = sp.getString("login", "joueur"); + // On l'ajoute dans le TextView prévu à cet effet + ((TextView)findViewById(R.id.login)).setText("Login : " + loginPref); + } + + /* (non-Javadoc) + * @see android.view.View.OnClickListener#onClick(android.view.View) + */ + @Override + public void onClick(View v) { + switch (v.getId()) { + case (R.id.prefs) : startActivity(new Intent(this, Preference.class)); break; + case (R.id.play) : startActivity(new Intent(this, BaseGame.class)); break; + case (R.id.infoButton) : startActivity(new Intent(this, Information.class)); break; + } + } + + @Override + public void onBackPressed() { + System.exit(0); + } + +} diff --git a/code/PtiClic/src/org/pticlic/Main.java b/code/PtiClic/src/org/pticlic/Main.java @@ -1,51 +1,33 @@ package org.pticlic; -import org.pticlic.games.BaseGame; - import android.app.Activity; import android.content.Intent; -import android.content.SharedPreferences; import android.os.Bundle; -import android.preference.PreferenceManager; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.ImageView; -import android.widget.TextView; +import android.view.MotionEvent; -public class Main extends Activity implements OnClickListener { +public class Main extends Activity { - /** Called when the activity is first created. */ @Override - public void onCreate(Bundle savedInstanceState) { + protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); - // Écoute des clics sur les différents boutons - ((ImageView)findViewById(R.id.prefs)).setOnClickListener(this); - ((ImageView)findViewById(R.id.play)).setOnClickListener(this); - ((ImageView)findViewById(R.id.infoButton)).setOnClickListener(this); - - // On récupère le nom du joueur des préférences. - SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); - String loginPref = sp.getString("login", "joueur"); - // On l'ajoute dans le TextView prévu à cet effet - ((TextView)findViewById(R.id.login)).setText("Login : " + loginPref); } - /* (non-Javadoc) - * @see android.view.View.OnClickListener#onClick(android.view.View) - */ @Override - public void onClick(View v) { - switch (v.getId()) { - case (R.id.prefs) : startActivity(new Intent(this, Preference.class)); break; - case (R.id.play) : startActivity(new Intent(this, BaseGame.class)); break; - case (R.id.infoButton) : startActivity(new Intent(this, Information.class)); break; - } + protected void onStart() { + super.onStart(); + } - @Override - public void onBackPressed() { - System.exit(0); + public boolean onTouchEvent(MotionEvent event) { + startActivityForResult(new Intent(this, FrontPage.class), 0x0); + return super.onTouchEvent(event); } + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + + } + } \ No newline at end of file diff --git a/code/PtiClic/src/org/pticlic/Score.java b/code/PtiClic/src/org/pticlic/Score.java @@ -1,8 +1,7 @@ package org.pticlic; import org.pticlic.model.Constant; -import org.pticlic.model.DownloadedScore; -import org.pticlic.model.GamePlayed; +import org.pticlic.model.Match; import org.pticlic.model.Network; import org.pticlic.model.Network.Mode; @@ -21,7 +20,7 @@ import android.widget.Button; */ public class Score extends Activity implements OnClickListener{ - private GamePlayed gamePlayed; + private Match gamePlayed; @Override protected void onCreate(Bundle savedInstanceState) { @@ -36,7 +35,7 @@ public class Score extends Activity implements OnClickListener{ if (getIntent().getExtras() != null) { // Pour JC : GamePlayed contient toutes les infos sur la partie jouee - this.gamePlayed = (GamePlayed) getIntent().getExtras().get(Constant.SCORE_GAMEPLAYED); + this.gamePlayed = (Match) getIntent().getExtras().get(Constant.SCORE_GAMEPLAYED); mode = (Mode) getIntent().getExtras().get(Constant.SCORE_MODE); } diff --git a/code/PtiClic/src/org/pticlic/games/BaseGame.java b/code/PtiClic/src/org/pticlic/games/BaseGame.java @@ -4,12 +4,10 @@ import org.pticlic.R; import org.pticlic.Score; import org.pticlic.model.Constant; import org.pticlic.model.DownloadedGame; -import org.pticlic.model.GamePlayed; +import org.pticlic.model.Match; import org.pticlic.model.Network; -import org.pticlic.model.Relation; import org.pticlic.model.Network.Mode; - -import com.google.gson.Gson; +import org.pticlic.model.Relation; import android.app.Activity; import android.content.Intent; @@ -43,7 +41,7 @@ public class BaseGame extends Activity implements OnClickListener { private int currentWord = 0; private int nbWord = 0; private DownloadedGame game; - private GamePlayed gamePlayed; + private Match gamePlayed; /** Called when the activity is first created. */ @Override @@ -64,7 +62,7 @@ public class BaseGame extends Activity implements OnClickListener { nbWord = game.getNbWord(); // On initialise la partie. - gamePlayed = new GamePlayed(); + gamePlayed = new Match(); gamePlayed.setGame(game); Relation r = Relation.getInstance(); diff --git a/code/PtiClic/src/org/pticlic/model/DownloadedScore.java b/code/PtiClic/src/org/pticlic/model/DownloadedScore.java @@ -1,11 +0,0 @@ -package org.pticlic.model; - -/** - * @author Bertrand BRUN - * - * Classe metier reprensentant le score sous forme json envoyer par le serveur. - * - */ -public class DownloadedScore { - -} diff --git a/code/PtiClic/src/org/pticlic/model/GamePlayed.java b/code/PtiClic/src/org/pticlic/model/GamePlayed.java @@ -1,85 +0,0 @@ -package org.pticlic.model; - -import java.io.Serializable; -import java.util.ArrayList; - -/** - * @author Bertrand BRUN - * - * Cette classe represente une partie joue. - * Elle sera envoyer au serveur pour que celui-ci - * puisse calculer le score obtenue. - * - */ -public class GamePlayed implements Serializable { - - private static final long serialVersionUID = 1L; - private ArrayList<Integer> relation1; - private ArrayList<Integer> relation2; - private ArrayList<Integer> relation3; - private ArrayList<Integer> relation4; - private ArrayList<Integer> trash; - private DownloadedGame game; - - public GamePlayed() { - relation1 = new ArrayList<Integer>(); - relation2 = new ArrayList<Integer>(); - relation3 = new ArrayList<Integer>(); - relation4 = new ArrayList<Integer>(); - trash = new ArrayList<Integer>(); - } - - public void setGame(DownloadedGame game) { - this.game = game; - } - - public DownloadedGame getGame() { - return game; - } - - public void add(int relation, int word) { - switch (relation) { - case 1: relation1.add(word); break; - case 2: relation2.add(word); break; - case 3: relation3.add(word); break; - case 4: relation4.add(word); break; - default: trash.add(word); break; - } - } - - /** - * @return the relation1 - */ - public ArrayList<Integer> getRelation1() { - return relation1; - } - - /** - * @return the relation2 - */ - public ArrayList<Integer> getRelation2() { - return relation2; - } - - /** - * @return the relation3 - */ - public ArrayList<Integer> getRelation3() { - return relation3; - } - - /** - * @return the relation4 - */ - public ArrayList<Integer> getRelation4() { - return relation4; - } - - /** - * @return the trash - */ - public ArrayList<Integer> getTrash() { - return trash; - } - -} diff --git a/code/PtiClic/src/org/pticlic/model/Match.java b/code/PtiClic/src/org/pticlic/model/Match.java @@ -0,0 +1,85 @@ +package org.pticlic.model; + +import java.io.Serializable; +import java.util.ArrayList; + +/** + * @author Bertrand BRUN + * + * Cette classe represente une partie joue. + * Elle sera envoyer au serveur pour que celui-ci + * puisse calculer le score obtenue. + * + */ +public class Match implements Serializable { + + private static final long serialVersionUID = 1L; + private ArrayList<Integer> relation1; + private ArrayList<Integer> relation2; + private ArrayList<Integer> relation3; + private ArrayList<Integer> relation4; + private ArrayList<Integer> trash; + private DownloadedGame game; + + public Match() { + relation1 = new ArrayList<Integer>(); + relation2 = new ArrayList<Integer>(); + relation3 = new ArrayList<Integer>(); + relation4 = new ArrayList<Integer>(); + trash = new ArrayList<Integer>(); + } + + public void setGame(DownloadedGame game) { + this.game = game; + } + + public DownloadedGame getGame() { + return game; + } + + public void add(int relation, int word) { + switch (relation) { + case 1: relation1.add(word); break; + case 2: relation2.add(word); break; + case 3: relation3.add(word); break; + case 4: relation4.add(word); break; + default: trash.add(word); break; + } + } + + /** + * @return the relation1 + */ + public ArrayList<Integer> getRelation1() { + return relation1; + } + + /** + * @return the relation2 + */ + public ArrayList<Integer> getRelation2() { + return relation2; + } + + /** + * @return the relation3 + */ + public ArrayList<Integer> getRelation3() { + return relation3; + } + + /** + * @return the relation4 + */ + public ArrayList<Integer> getRelation4() { + return relation4; + } + + /** + * @return the trash + */ + public ArrayList<Integer> getTrash() { + return trash; + } + +} diff --git a/code/PtiClic/src/org/pticlic/model/Network.java b/code/PtiClic/src/org/pticlic/model/Network.java @@ -138,8 +138,8 @@ public class Network { * @param game La partie jouee par l'utilisateur * @return Le score sous forme JSON. */ - public DownloadedScore sendGame(GamePlayed game) { - DownloadedScore score = null; + public TotalScore sendGame(Match game) { + TotalScore score = null; try { URL url = new URL(this.serverURL); URLConnection connection = url.openConnection(); @@ -174,8 +174,8 @@ public class Network { Gson gson = new Gson(); JsonReader reader = new JsonReader(new InputStreamReader(connection.getInputStream(), "UTF-8")); - - score = gson.fromJson(reader, DownloadedScore.class); + + score = gson.fromJson(reader, TotalScore.class); } catch (IOException e) { diff --git a/code/PtiClic/src/org/pticlic/model/TotalScore.java b/code/PtiClic/src/org/pticlic/model/TotalScore.java @@ -0,0 +1,45 @@ +package org.pticlic.model; + +/** + * + * @author John CHARRON + * + */ + +public class TotalScore { + + private TotalScore scoreTotal; + private WordScore scores; + + public TotalScore() { + } + + public TotalScore(TotalScore scoreTotal, WordScore wordscores) { + this.scoreTotal = scoreTotal; + this.scores = wordscores; + } + + public TotalScore getScoreTotal() { + return scoreTotal; + } + + public void setScoreTotal(TotalScore scoreTotal) { + this.scoreTotal = scoreTotal; + } + + public WordScore getWordscores() { + return scores; + } + + public void setWordscores(WordScore wordscores) { + this.scores = wordscores; + } + + @Override + public String toString() { + return "TotalScore [scoreTotal=" + scoreTotal + ", wordscores=" + + scores + "]"; + } + + +} +\ No newline at end of file diff --git a/code/PtiClic/src/org/pticlic/model/WordScore.java b/code/PtiClic/src/org/pticlic/model/WordScore.java @@ -0,0 +1,62 @@ +package org.pticlic.model; + +/** + * + * @author John CHARRON + * + */ + +public class WordScore { + + private int idmot; + private double score; + private double probaR1; + private double probaR2; + + public WordScore() {} + + public WordScore(int idmot, double score, double probaR1, double probaR2) { + this.idmot = idmot; + this.score = score; + this.probaR1 = probaR1; + this.probaR2 = probaR2; + } + + public int getIdmot() { + return idmot; + } + + public void setIdmot(int idmot) { + this.idmot = idmot; + } + + public double getScore() { + return score; + } + + public void setScore(double score) { + this.score = score; + } + + public double getProbaR1() { + return probaR1; + } + + public void setProbaR1(double probaR1) { + this.probaR1 = probaR1; + } + + public double getProbaR2() { + return probaR2; + } + + public void setProbaR2(double probaR2) { + this.probaR2 = probaR2; + } + + @Override + public String toString() { + return "WordScore [idmot=" + idmot + ", score=" + score + ", probaR1=" + + probaR1 + ", probaR2=" + probaR2 + "]"; + } +} diff --git a/code/images/Config36.png b/code/images/Config36.png Binary files differ. diff --git a/code/images/Config48.png b/code/images/Config48.png Binary files differ. diff --git a/code/images/Config72.png b/code/images/Config72.png Binary files differ. diff --git a/code/images/ModeChrono36.png b/code/images/ModeChrono36.png Binary files differ. diff --git a/code/images/ModeChrono48.png b/code/images/ModeChrono48.png Binary files differ. diff --git a/code/images/ModeChrono72.png b/code/images/ModeChrono72.png Binary files differ. diff --git a/code/images/ModeMarathon36.png b/code/images/ModeMarathon36.png Binary files differ. diff --git a/code/images/ModeMarathon48.png b/code/images/ModeMarathon48.png Binary files differ. diff --git a/code/images/ModeMarathon72.png b/code/images/ModeMarathon72.png Binary files differ.