commit 3ab6fe92ddfe6d5c0d8a2982779216acd9ca03cf
parent ad30dc65ca4cfaf9489de9e3b9fc36441eb6f8e1
Author: Bertrand BRUN <bertrand0brun@gmail.com>
Date: Sat, 26 Feb 2011 22:53:15 +0100
Toutes les chaines de textes visible sont dans strings.xml
Diffstat:
5 files changed, 38 insertions(+), 34 deletions(-)
diff --git a/code/PtiClic/res/layout/basegame.xml b/code/PtiClic/res/layout/basegame.xml
@@ -38,64 +38,64 @@
<LinearLayout android:layout_height="wrap_content"
android:layout_width="fill_parent" android:orientation="horizontal"
android:id="@+id/relation1Layout" android:layout_weight="1"
- android:layout_gravity="center">
+ android:layout_gravity="center" android:clickable="true">
<ImageView android:id="@+id/relation1" android:src="@drawable/contenant"
android:layout_weight="1" android:layout_height="wrap_content"
- android:layout_width="wrap_content">
+ android:layout_width="wrap_content" android:layout_marginLeft="10dip">
</ImageView>
<TextView android:id="@+id/relation1Name"
- android:layout_width="wrap_content" android:text="contenant"
+ android:text="contenant"
android:textStyle="bold" android:textSize="15dip"
android:layout_height="wrap_content" android:layout_weight="3"
- android:layout_gravity="center_vertical" android:visibility="gone">
+ android:layout_gravity="center_vertical" android:visibility="gone" android:layout_width="fill_parent" android:gravity="center">
</TextView>
</LinearLayout>
<LinearLayout android:layout_height="wrap_content"
android:layout_width="fill_parent" android:orientation="horizontal"
android:id="@+id/relation2Layout" android:layout_weight="1"
- android:layout_gravity="center">
+ android:layout_gravity="center" android:clickable="true">
<ImageView android:id="@+id/relation2" android:src="@drawable/contenu"
android:layout_weight="1" android:layout_height="wrap_content"
- android:layout_width="wrap_content">
+ android:layout_width="wrap_content" android:layout_marginLeft="10dip">
</ImageView>
<TextView android:id="@+id/relation2Name"
- android:layout_width="wrap_content" android:text="contenu"
+ android:text="contenu"
android:textStyle="bold" android:textSize="15dip"
android:layout_height="wrap_content" android:layout_weight="3"
- android:layout_gravity="center_vertical" android:visibility="gone">
+ android:layout_gravity="center_vertical" android:visibility="gone" android:layout_width="fill_parent" android:gravity="center">
</TextView>
</LinearLayout>
<LinearLayout android:layout_height="wrap_content"
android:layout_width="fill_parent" android:orientation="horizontal"
android:id="@+id/relation3Layout" android:layout_weight="1"
- android:layout_gravity="center">
+ android:layout_gravity="center" android:clickable="true">
<ImageView android:id="@+id/relation3" android:src="@drawable/contraire"
android:layout_weight="1" android:layout_height="wrap_content"
- android:layout_width="wrap_content">
+ android:layout_width="wrap_content" android:layout_marginLeft="10dip">
</ImageView>
<TextView android:id="@+id/relation3Name"
- android:layout_width="wrap_content" android:text="contraire"
+ android:text="contraire"
android:textStyle="bold" android:textSize="15dip"
android:layout_height="wrap_content" android:layout_weight="3"
- android:layout_gravity="center_vertical" android:visibility="gone">
+ android:layout_gravity="center_vertical" android:visibility="gone" android:layout_width="fill_parent" android:gravity="center">
</TextView>
</LinearLayout>
<LinearLayout android:layout_height="wrap_content"
android:layout_width="fill_parent" android:orientation="horizontal"
android:id="@+id/relation4Layout" android:layout_weight="1"
- android:layout_gravity="center">
+ android:layout_gravity="center" android:clickable="true">
<ImageView android:id="@+id/relation4" android:src="@drawable/synonyme"
android:layout_weight="1" android:layout_height="wrap_content"
- android:layout_width="wrap_content" android:layout_gravity="center">
+ android:layout_width="wrap_content" android:layout_gravity="center" android:layout_marginLeft="10dip">
</ImageView>
<TextView android:id="@+id/relation4Name"
- android:layout_width="wrap_content" android:text="synonyme"
+ android:text="synonyme"
android:textStyle="bold" android:textSize="15dip"
android:layout_height="wrap_content" android:layout_weight="3"
- android:layout_gravity="center_vertical" android:visibility="gone">
+ android:layout_gravity="center_vertical" android:visibility="gone" android:layout_width="fill_parent" android:gravity="center">
</TextView>
</LinearLayout>
diff --git a/code/PtiClic/res/values/strings.xml b/code/PtiClic/res/values/strings.xml
@@ -8,4 +8,11 @@
<string name="server_down">Il y a actuellement un probleme avec le serveur. Veuillez re-essayer dans quelque minutes.</string>
<string name="basegame_title">Le principe du jeu</string>
<string name="basegame_explication">Choisissez l\'association qui lie le plus convenablement les mots apparaissant successivement au mot cible en haut de l\'écran. Optez pour la poubelle si aucune relation vous convient.</string>
+<string name="preferences_nonetworks">Pas connecter au reseau, verification du login/mdp impossible</string>
+<string name="preferences_loginmdp_notvalid">Couple login/mdp non valide.</string>
+<string name="preferences_loginmdp_valid">Couple login/mdp valide.</string>
+<string name="frontpage_bad_loginmdp">Le couple login/mdp n\'est pas bon. Veuillez les modifier ou vous inscrire sur le site</string>
+<string name="frontpage_preference_button">Preferences</string>
+<string name="frontpage_inscription_button">Inscription</string>
+<string name="frontpage_no_connection">Problème de connexion au serveur. Vérifiez que vous êtes connecté au réseau.</string>
</resources>
diff --git a/code/PtiClic/src/org/pticlic/FrontPage.java b/code/PtiClic/src/org/pticlic/FrontPage.java
@@ -41,11 +41,6 @@ public class FrontPage extends Activity implements OnClickListener{
protected void onStart() {
super.onStart();
- if (Network.isConnected(this))
- System.out.println("Connecter");
- else
- System.out.println("Non Connecter");
-
// On récupère le nom du joueur des préférences.
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
String loginPref = sp.getString("login", "joueur");
@@ -74,16 +69,16 @@ public class FrontPage extends Activity implements OnClickListener{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.app_name))
.setIcon(android.R.drawable.ic_dialog_alert)
- .setMessage("Le couple login/mdp n'est pas bon. Veuillez les modifier ou vous inscrire sur le site")
+ .setMessage(getString(R.string.frontpage_bad_loginmdp))
.setCancelable(false)
- .setNeutralButton("Inscription", new DialogInterface.OnClickListener() {
+ .setNeutralButton(getString(R.string.frontpage_inscription_button), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
// TODO : Essayer de trouver comment mettre l'url qui est dans les preferences.
startActivity(new Intent(Intent.ACTION_VIEW, uri));
}
})
- .setPositiveButton("Preferences", new DialogInterface.OnClickListener() {
+ .setPositiveButton(getString(R.string.frontpage_preference_button), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
startActivity(new Intent(getApplicationContext(), Preference.class));
@@ -96,7 +91,7 @@ public class FrontPage extends Activity implements OnClickListener{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.app_name))
.setIcon(android.R.drawable.ic_dialog_alert)
- .setMessage("Problème de connexion au serveur. Vérifiez que vous êtes connecté au réseau.")
+ .setMessage(getString(R.string.frontpage_no_connection))
.setCancelable(false)
.setNegativeButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
diff --git a/code/PtiClic/src/org/pticlic/Preference.java b/code/PtiClic/src/org/pticlic/Preference.java
@@ -30,7 +30,7 @@ public class Preference extends PreferenceActivity implements OnSharedPreference
if (Network.isConnected(this)) {
if (Network.isLoginCorrect(this)) {
Toast.makeText(this,
- "Couple login/mdp valide.",
+ getString(R.string.preferences_loginmdp_valid),
Toast.LENGTH_LONG).show();
SharedPreferences.Editor editor = sharedPreferences.edit();
@@ -38,7 +38,7 @@ public class Preference extends PreferenceActivity implements OnSharedPreference
editor.commit();
} else {
Toast.makeText(this,
- "Couple login/mdp non valide.",
+ getString(R.string.preferences_loginmdp_notvalid),
Toast.LENGTH_LONG).show();
SharedPreferences.Editor editor = sharedPreferences.edit();
@@ -47,7 +47,7 @@ public class Preference extends PreferenceActivity implements OnSharedPreference
}
} else {
Toast.makeText(this,
- "Pas connecter au reseau, verification du login/mdp impossible",
+ getString(R.string.preferences_nonetworks),
Toast.LENGTH_LONG).show();
}
}
diff --git a/code/PtiClic/src/org/pticlic/games/BaseGame.java b/code/PtiClic/src/org/pticlic/games/BaseGame.java
@@ -165,15 +165,18 @@ public class BaseGame extends Activity implements OnClickListener {
ImageView r4 = ((ImageView)findViewById(R.id.relation4));
- // Layout des relations
+ // TextView des relations
TextView rn1 = ((TextView)findViewById(R.id.relation1Name));
TextView rn2 = ((TextView)findViewById(R.id.relation2Name));
TextView rn3 = ((TextView)findViewById(R.id.relation3Name));
TextView rn4 = ((TextView)findViewById(R.id.relation4Name));
-
+
// Bouton d'aide
ImageView aide = ((ImageView)findViewById(R.id.aideBaseGame));
aide.setOnClickListener(this);
+
+ // On met set le nom du mot central
+ ((TextView)findViewById(R.id.mainWord)).setText(DownloadedBaseGame.getName(game.getCentre()));
Relation r = Relation.getInstance();
@@ -197,7 +200,7 @@ public class BaseGame extends Activity implements OnClickListener {
// TODO : A enlever lorsque l'on aura toutes les images des relations.
try {
r3.setOnClickListener(this);
- rn3.setText(r.getRelationName(game.getCat3()));
+ rn3.setText(String.format(r.getRelationName(game.getCat3()), ((TextView)findViewById(R.id.mainWord)).getText()));
r3.setImageResource(r.getRelationImage(game.getCat3()));
} catch (Exception e) {
r3.setImageResource(R.drawable.icon);
@@ -210,8 +213,7 @@ public class BaseGame extends Activity implements OnClickListener {
} catch (Exception e) {
r4.setImageResource(R.drawable.icon);
}
-
- ((TextView)findViewById(R.id.mainWord)).setText(DownloadedBaseGame.getName(game.getCentre()));
+
this.helpMode();
}
@@ -232,7 +234,7 @@ public class BaseGame extends Activity implements OnClickListener {
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
- //On recupere le centre de mainWord pour l'animation de translation.
+ // On recupere le centre de mainWord pour l'animation de translation.
TextView mainWord = (TextView)findViewById(R.id.mainWord);
currentWordTextView = (TextView)findViewById(R.id.currentWord);