www

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

commit 0602a6a81e02b3b2500f86f4fb34f05f779bd3be
parent bc667f95fe8295da8e73c561903c51e5b1358986
Author: Bertrand BRUN <bertrand0brun@gmail.com>
Date:   Thu, 20 Jan 2011 15:46:43 +0100

Ajout de la préférence « Serveur ».
Ajout d'une information sur l'identité du joueur dans la page de garde.
Changement du nom du bouton « Jeux » -> « Jouer »
Diffstat:
Mcode/PtiClic/res/layout/main.xml | 23++++++++++++++++++-----
Mcode/PtiClic/res/values/strings.xml | 2+-
Mcode/PtiClic/res/xml/prefs.xml | 10++++++++--
Mcode/PtiClic/src/org/pticlic/Main.java | 10+++++++++-
Mcode/PtiClic/src/org/pticlic/Preference.java | 2+-
5 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/code/PtiClic/res/layout/main.xml b/code/PtiClic/res/layout/main.xml @@ -14,14 +14,27 @@ <Button android:layout_height="wrap_content" android:id="@+id/games" android:text="@string/games_name" android:layout_width="wrap_content" android:paddingLeft="60px" android:paddingRight="60px" - android:enabled="false"></Button> + android:enabled="false" /> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/prefs" android:text="@string/prefs_name" android:layout_below="@+id/games" - android:layout_alignLeft="@+id/games" android:layout_alignRight="@+id/games"></Button> + android:layout_alignLeft="@+id/games" android:layout_alignRight="@+id/games" /> + + + </RelativeLayout> + + <LinearLayout android:id="@+id/LinearLayout01" + android:layout_height="wrap_content" android:layout_weight="1" + android:layout_width="fill_parent" android:orientation="vertical"> + + <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/info" + android:layout_width="wrap_content" android:src="@android:drawable/ic_dialog_info" android:layout_gravity="right" android:layout_weight="5"></ImageView> + + </LinearLayout> - -</RelativeLayout> -<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/info" android:layout_weight="1" android:src="@android:drawable/ic_dialog_info" android:layout_gravity="right"></ImageView> </LinearLayout> diff --git a/code/PtiClic/res/values/strings.xml b/code/PtiClic/res/values/strings.xml @@ -3,5 +3,5 @@ <string name="app_name">PtiClic</string> <string name="prefs_name">Préférences</string> -<string name="games_name">Jeux</string> +<string name="games_name">Jouer</string> </resources> diff --git a/code/PtiClic/res/xml/prefs.xml b/code/PtiClic/res/xml/prefs.xml @@ -3,8 +3,14 @@ <PreferenceCategory android:title="Connexion"> - <EditTextPreference android:title="Login" android:key="login"></EditTextPreference> - <EditTextPreference android:title="Mot de Passe" android:key="passwd"></EditTextPreference> + <EditTextPreference android:title="Login" android:key="login" android:summary=""/> + <EditTextPreference android:title="Mot de Passe" android:key="passwd"/> </PreferenceCategory> + <PreferenceCategory android:title="Debug"> + + <EditTextPreference android:title="Serveur" android:key="server"/> + + </PreferenceCategory> + </PreferenceScreen> \ No newline at end of file diff --git a/code/PtiClic/src/org/pticlic/Main.java b/code/PtiClic/src/org/pticlic/Main.java @@ -2,19 +2,27 @@ package org.pticlic; 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.Button; +import android.widget.TextView; public class Main extends Activity implements OnClickListener { - /** Called when the activity is first created. */ + + /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ((Button)findViewById(R.id.prefs)).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"); + ((TextView)findViewById(R.id.login)).setText("Login : " + loginPref); } @Override diff --git a/code/PtiClic/src/org/pticlic/Preference.java b/code/PtiClic/src/org/pticlic/Preference.java @@ -13,5 +13,5 @@ public class Preference extends PreferenceActivity { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.prefs); } - + }