commit 52b91e4425eed130b3df6a441e7cc8b416391c43
parent d7f22d4569a522027608eb2a4bcd6145daa6fa86
Author: Bertrand BRUN <bertrand0brun@gmail.com>
Date: Mon, 31 Jan 2011 23:56:17 +0100
Modification dans la classe Information et dans l'affichage de celle-ci
Diffstat:
7 files changed, 104 insertions(+), 21 deletions(-)
diff --git a/code/PtiClic/.settings/org.eclipse.core.resources.prefs b/code/PtiClic/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Mon Jan 31 23:29:52 CET 2011
+eclipse.preferences.version=1
+encoding//res/raw/info.html=UTF-8
diff --git a/code/PtiClic/AndroidManifest.xml b/code/PtiClic/AndroidManifest.xml
@@ -1,20 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.pticlic"
- android:versionCode="1"
- android:versionName="1.0">
+ android:versionCode="1" android:versionName="@string/version">
<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar">
- <activity android:name=".Main">
+ <activity android:name=".Main" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
- <activity android:name=".Preference" android:label="Préférence"></activity>
- <activity android:name=".games.BaseGame"></activity>
- <activity android:name=".Info" android:label="Information"></activity>
- <activity android:name=".Score" android:label="Score"></activity>
+ <activity android:name=".Preference" android:label="Préférence" android:screenOrientation="portrait"></activity>
+ <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>
</application>
diff --git a/code/PtiClic/res/layout/info.xml b/code/PtiClic/res/layout/info.xml
@@ -1,8 +1,30 @@
<?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:layout_width="fill_parent" android:layout_height="fill_parent"
+ android:orientation="vertical"
+ android:background="#000">
+ <LinearLayout android:layout_height="wrap_content"
+ android:layout_width="fill_parent">
+
+ <ImageView android:layout_width="wrap_content"
+ android:layout_height="wrap_content" android:src="@drawable/icon"></ImageView>
+
+ <TextView android:layout_width="fill_parent"
+ android:textSize="30dip" android:text="@string/app_name"
+ android:layout_height="wrap_content" android:textStyle="bold"></TextView>
+
+ </LinearLayout>
+
+ <TextView android:text="@string/version" android:id="@+id/infoVersion"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:gravity="center"></TextView>
+
+ <WebView android:id="@+id/textContent"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="#000"></WebView>
</LinearLayout>
diff --git a/code/PtiClic/res/raw/info.html b/code/PtiClic/res/raw/info.html
@@ -0,0 +1,26 @@
+<html>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <style type="text/css">
+ body {
+
+ }
+ p {
+ color: grey;
+ }
+ </style>
+<body style="margin: 0; padding: 0" bgcolor="Black">
+<center>
+<p>
+PtiClic a ete concu et developpe par Mathieu Lafourcade (LIRMM - Universite Montpellier 3) et Virginie Zampa (LIDILEM - Universite Stendhal Grenoble 3)<br />
+</p><p>
+Merci en particulier a (en vrac) farfadet, mehdi (mym), alain joubert, gilles serasset (krado)...<br />
+</p><p>
+Pticlic n'est pas exempt de bugs - si vous en rencontrez un, pourriez-vous le signaler a l'administrateur ?<br />
+</p><p>
+Mathieu Lafourcade - Administrateur - <a mailto:"pticlic.android.beta@gmail.com">contact</a><br />
+</p><p>
+Derniere mise a jour : fevrier 2008
+</p>
+</center>
+</body>
+</html>
+\ No newline at end of file
diff --git a/code/PtiClic/res/values/strings.xml b/code/PtiClic/res/values/strings.xml
@@ -3,6 +3,6 @@
<string name="app_name">PtiClic</string>
<string name="prefs_name">Préférences</string>
<string name="play_label">Jouer</string>
- <string name="textInfo">Ce projet a été réalisé l</string>
- <color name="background">#FF0000</color>
+ <string name="textInfo"></string>
+<string name="version">0.1</string>
</resources>
diff --git a/code/PtiClic/src/org/pticlic/Information.java b/code/PtiClic/src/org/pticlic/Information.java
@@ -1,7 +1,47 @@
package org.pticlic;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
import android.app.Activity;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.webkit.WebView;
+import android.widget.TextView;
public class Information extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.info);
+
+ ((TextView)findViewById(R.id.infoVersion)).setText("version : " + getString(R.string.version));
+ InputStream in = getResources().openRawResource(R.raw.info);
+ WebView webview = (WebView)findViewById(R.id.textContent);
+ webview.setBackgroundColor(Color.BLACK);
+ webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
+
+ if (in != null) {
+
+ InputStreamReader tmp = new InputStreamReader(in);
+ BufferedReader reader = new BufferedReader(tmp);
+ String html;
+ StringBuffer buf = new StringBuffer();
+
+ try {
+ while ((html = reader.readLine()) != null) {
+ buf.append(html + "\n");
+ }
+
+ in.close();
+ webview.loadData(buf.toString(), "text/html", "UTF-8");
+
+ } catch (IOException e) {
+ //TODO : Ajouter un boite de dialog indiquant qu'une erreur est arrivee.
+ }
+ }
+ }
}
diff --git a/code/PtiClic/src/org/pticlic/Main.java b/code/PtiClic/src/org/pticlic/Main.java
@@ -10,6 +10,7 @@ import android.preference.PreferenceManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
+import android.widget.ImageView;
import android.widget.TextView;
public class Main extends Activity implements OnClickListener {
@@ -22,6 +23,7 @@ public class Main extends Activity implements OnClickListener {
// Écoute des clics sur les différents boutons
((Button)findViewById(R.id.prefs)).setOnClickListener(this);
((Button)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);
@@ -38,17 +40,7 @@ public class Main extends Activity implements OnClickListener {
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;
- }
- if (v.getId()==R.id.voirscore){
- // TODO: à supprimer
- /*
- Intent intent = new Intent(this, Score.class);
- intent.putExtra("corrects", 10);
- intent.putExtra("mauvais", 2);
- intent.putExtra("manquants", 1.5);
- intent.putExtra("total", 10); // WHERE??
- startActivity(intent);
- */
+ case (R.id.infoButton) : startActivity(new Intent(this, Information.class)); break;
}
}