diff --git a/code/PtiClic/.classpath b/code/PtiClic/.classpath index 609aa00..f9bbbf0 100644 --- a/code/PtiClic/.classpath +++ b/code/PtiClic/.classpath @@ -3,5 +3,6 @@ + diff --git a/code/lib/gson-1.6.jar b/code/PtiClic/lib/gson-1.6.jar similarity index 100% rename from code/lib/gson-1.6.jar rename to code/PtiClic/lib/gson-1.6.jar diff --git a/code/PtiClic/res/values/strings.xml b/code/PtiClic/res/values/strings.xml index 5f5a518..cd38a71 100644 --- a/code/PtiClic/res/values/strings.xml +++ b/code/PtiClic/res/values/strings.xml @@ -1,7 +1,8 @@ - - PtiClic -Préférences -Jouer + + PtiClic + Préférences + Jouer + diff --git a/code/PtiClic/src/org/pticlic/model/Constant.java b/code/PtiClic/src/org/pticlic/model/Constant.java new file mode 100644 index 0000000..69a7e62 --- /dev/null +++ b/code/PtiClic/src/org/pticlic/model/Constant.java @@ -0,0 +1,5 @@ +package org.pticlic.model; + +public class Constant { + public static final String SERVER_URL = "SERVER_URL"; +} diff --git a/code/PtiClic/src/org/pticlic/model/GamePlayed.java b/code/PtiClic/src/org/pticlic/model/GamePlayed.java new file mode 100644 index 0000000..73f0ba1 --- /dev/null +++ b/code/PtiClic/src/org/pticlic/model/GamePlayed.java @@ -0,0 +1,5 @@ +package org.pticlic.model; + +public class GamePlayed { + +} diff --git a/code/PtiClic/src/org/pticlic/model/Network.java b/code/PtiClic/src/org/pticlic/model/Network.java new file mode 100644 index 0000000..e8cd7f4 --- /dev/null +++ b/code/PtiClic/src/org/pticlic/model/Network.java @@ -0,0 +1,57 @@ +package org.pticlic.model; + +import java.net.URI; +import java.net.URISyntaxException; + +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.DefaultHttpClient; + +import android.content.Context; +import android.content.SharedPreferences; +import android.preference.PreferenceManager; + +public class Network { + + public enum Action { + GET_GAMES + } + + public enum Mode { + SIMPLE_GAME + } + + private Mode mode; + private Context context; + + public Network(Context context, Mode mode) { + this.mode = mode; + this.context = context; + } + + + // TODO : faire se qui est la +// http://developer.android.com/reference/java/net/URLConnection.html#addRequestProperty%28java.lang.String,%20java.lang.String%29 + + public GamePlayed getGames(int nbGames) { + DefaultHttpClient httpClient = new DefaultHttpClient(); + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); + String serverUrl = sp.getString(Constant.SERVER_URL, "http://serveur/pticlic.php"); + + try { + HttpResponse res; + URI uri = new URI(serverUrl); + HttpPost methodPost = new HttpPost(uri); + //methodPost.setEntity(new StringEntity(s, charset)); + } catch (URISyntaxException e) { + return null; + } + + return null; + } + + public boolean sendGame(GamePlayed game) { + throw new UnsupportedOperationException(); + } +} diff --git a/rapport/rapport.tex b/rapport/rapport.tex index aa99266..3f5691d 100644 --- a/rapport/rapport.tex +++ b/rapport/rapport.tex @@ -38,7 +38,7 @@ Outils : Durée du projet 4 mois (4 itérations de 4 semaines) -Conventions de code : http://java.sun.com/docs/codeconv/html/CodeConventions.doc6.html +Conventions de code : \url{http://java.sun.com/docs/codeconv/html/CodeConventions.doc6.html} Code (noms de variables, etc.) en anglais, commentaires en français, javadoc en français.