www

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

commit e48d32edb13670c1dafa9b7096771ae2304c1316
parent 76b92370453cd412f21517bf8466611d50b7d815
Author: Bertrand BRUN <bertrand0brun@gmail.com>
Date:   Fri, 25 Feb 2011 17:03:34 +0100

Modification de la precision du score. Passage de beaucoup de decimal a 2
Diffstat:
Mcode/PtiClic/src/org/pticlic/Score.java | 8+++++---
Mcode/PtiClic/src/org/pticlic/games/BaseGame.java | 2+-
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/code/PtiClic/src/org/pticlic/Score.java b/code/PtiClic/src/org/pticlic/Score.java @@ -1,5 +1,7 @@ package org.pticlic; +import java.text.DecimalFormat; + import org.pticlic.exception.PtiClicException; import org.pticlic.model.Constant; import org.pticlic.model.Match; @@ -44,11 +46,11 @@ public class Score extends Activity implements OnClickListener{ } Network network = new Network(serverURL, mode, id, passwd); - - // FIXME : Pour l'instant ne marche pas, attend de savoir comment est formater le score que l'on recois. try { + // Permet de regler la precision : rajoute/enlever des # pour modifier la precision + DecimalFormat dfrmtr = new DecimalFormat("#.##"); Double score = network.sendGame(gamePlayed); - ((TextView)findViewById(R.id.total)).setText(String.valueOf(score.floatValue())); + ((TextView)findViewById(R.id.total)).setText(String.valueOf(dfrmtr.format(score))); sp.edit().putString(Constant.NEW_BASE_GAME, network.getNewGame()).commit(); } catch (PtiClicException e) { AlertDialog.Builder builder = new AlertDialog.Builder(this); diff --git a/code/PtiClic/src/org/pticlic/games/BaseGame.java b/code/PtiClic/src/org/pticlic/games/BaseGame.java @@ -65,7 +65,7 @@ public class BaseGame extends Activity implements OnClickListener { // On recupere du PreferenceManager les differentes information dont on a besoin SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); - String serverURL = sp.getString(Constant.SERVER_URL, Constant.SERVER); // TODO : Mettre comme valeur par defaut l'adresse reel du serveur + String serverURL = sp.getString(Constant.SERVER_URL, Constant.SERVER); String id = sp.getString(Constant.USER_ID, "joueur"); String passwd = sp.getString(Constant.USER_PASSWD, ""); gameJson = sp.getString(Constant.NEW_BASE_GAME, null);