Ajout des nouvelles images et ajout du splash et de la page de garde
3
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
.DS_Store
|
||||
.DS_Store
|
||||
code.zip
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
||||
|
|
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
BIN
code/PtiClic/res/drawable-ldpi/splash.png
Normal file
After Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
BIN
code/PtiClic/res/drawable-mdpi/splash.png
Normal file
After Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
43
code/PtiClic/res/layout/frontpage.xml
Normal file
|
@ -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>
|
|
@ -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>
|
||||
|
|
51
code/PtiClic/src/org/pticlic/FrontPage.java
Normal file
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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 boolean onTouchEvent(MotionEvent event) {
|
||||
startActivityForResult(new Intent(this, FrontPage.class), 0x0);
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
System.exit(0);
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 {
|
||||
|
||||
}
|
|
@ -11,7 +11,7 @@ import java.util.ArrayList;
|
|||
* puisse calculer le score obtenue.
|
||||
*
|
||||
*/
|
||||
public class GamePlayed implements Serializable {
|
||||
public class Match implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private ArrayList<Integer> relation1;
|
||||
|
@ -21,7 +21,7 @@ public class GamePlayed implements Serializable {
|
|||
private ArrayList<Integer> trash;
|
||||
private DownloadedGame game;
|
||||
|
||||
public GamePlayed() {
|
||||
public Match() {
|
||||
relation1 = new ArrayList<Integer>();
|
||||
relation2 = new ArrayList<Integer>();
|
||||
relation3 = new ArrayList<Integer>();
|
|
@ -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) {
|
||||
|
|
45
code/PtiClic/src/org/pticlic/model/TotalScore.java
Normal file
|
@ -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 + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
62
code/PtiClic/src/org/pticlic/model/WordScore.java
Normal file
|
@ -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 + "]";
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 7.7 KiB |