Debut de la parti reseau
This commit is contained in:
parent
9faee26dff
commit
2b1d8b859e
|
@ -3,5 +3,6 @@
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="src" path="gen"/>
|
<classpathentry kind="src" path="gen"/>
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||||
|
<classpathentry kind="lib" path="lib/gson-1.6.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="app_name">PtiClic</string>
|
<string name="app_name">PtiClic</string>
|
||||||
<string name="prefs_name">Préférences</string>
|
<string name="prefs_name">Préférences</string>
|
||||||
<string name="games_name">Jouer</string>
|
<string name="games_name">Jouer</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
5
code/PtiClic/src/org/pticlic/model/Constant.java
Normal file
5
code/PtiClic/src/org/pticlic/model/Constant.java
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
package org.pticlic.model;
|
||||||
|
|
||||||
|
public class Constant {
|
||||||
|
public static final String SERVER_URL = "SERVER_URL";
|
||||||
|
}
|
5
code/PtiClic/src/org/pticlic/model/GamePlayed.java
Normal file
5
code/PtiClic/src/org/pticlic/model/GamePlayed.java
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
package org.pticlic.model;
|
||||||
|
|
||||||
|
public class GamePlayed {
|
||||||
|
|
||||||
|
}
|
57
code/PtiClic/src/org/pticlic/model/Network.java
Normal file
57
code/PtiClic/src/org/pticlic/model/Network.java
Normal file
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,7 +38,7 @@ Outils :
|
||||||
|
|
||||||
Durée du projet 4 mois (4 itérations de 4 semaines)
|
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.
|
Code (noms de variables, etc.) en anglais, commentaires en français, javadoc en français.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user