Merge branch 'master' of https://github.com/jsmaniac/2011-m1s2-ter
Conflicts: code/PtiClic/res/values/strings.xml
This commit is contained in:
commit
429fb92ec1
|
@ -12,7 +12,10 @@
|
|||
</activity>
|
||||
|
||||
<activity android:name=".Preference" android:label="Préférence"></activity>
|
||||
<activity android:name=".Game"></activity>
|
||||
<activity android:name=".Info" android:label="Information"></activity>
|
||||
<activity android:name=".Score" android:label="Score"></activity>
|
||||
</application>
|
||||
|
||||
|
||||
</manifest>
|
||||
</manifest>
|
||||
|
|
12
code/PtiClic/res/layout/game.xml
Normal file
12
code/PtiClic/res/layout/game.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<AbsoluteLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" android:orientation="vertical">
|
||||
<TextView android:id="@+id/mainWord" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="70" android:layout_gravity="center_horizontal" android:text="MainWord" android:layout_x="100px" android:layout_y="20px"></TextView>
|
||||
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/currentWord" android:layout_weight="10000" android:text="CurrentWord" android:layout_x="100px" android:layout_y="50px"></TextView>
|
||||
<Button android:id="@+id/relation1" android:layout_height="wrap_content" android:text="R1" android:layout_width="wrap_content" android:layout_y="100px" android:layout_x="10px"></Button>
|
||||
<Button android:id="@+id/relation2" android:layout_height="wrap_content" android:text="R2" android:layout_width="wrap_content" android:layout_y="100px" android:layout_x="70px"></Button>
|
||||
<Button android:id="@+id/relation3" android:layout_height="wrap_content" android:text="R3" android:layout_width="wrap_content" android:layout_y="100px" android:layout_x="130px"></Button>
|
||||
<Button android:id="@+id/relation4" android:layout_height="wrap_content" android:text="R4" android:layout_width="wrap_content" android:layout_x="190px" android:layout_y="100px"></Button>
|
||||
</AbsoluteLayout>
|
|
@ -11,17 +11,21 @@
|
|||
android:id="@+id/RelativeLayout01" android:layout_width="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal">
|
||||
|
||||
<Button android:layout_height="wrap_content" android:id="@+id/games"
|
||||
android:text="@string/games_name" android:layout_width="wrap_content"
|
||||
<Button android:layout_height="wrap_content" android:text="@string/play_label" android:layout_width="wrap_content"
|
||||
android:paddingLeft="60px" android:paddingRight="60px"
|
||||
android:enabled="false" />
|
||||
android:id="@+id/play"/>
|
||||
|
||||
<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" />
|
||||
|
||||
|
||||
android:text="@string/prefs_name" android:layout_below="@+id/play"
|
||||
android:layout_alignLeft="@+id/play" android:layout_alignRight="@+id/play" />
|
||||
<!-- A SUPPRIMER : -->
|
||||
<Button android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content" android:id="@+id/voirscore"
|
||||
android:text="Voir score" android:layout_below="@+id/prefs"
|
||||
android:layout_alignLeft="@+id/prefs"
|
||||
android:layout_alignRight="@+id/prefs" />
|
||||
<!-- FIN A SUPPRIMER -->
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/LinearLayout01"
|
||||
|
@ -32,8 +36,8 @@
|
|||
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>
|
||||
<ImageButton android:layout_height="wrap_content" android:id="@+id/infoButton"
|
||||
android:layout_width="wrap_content" android:src="@android:drawable/ic_dialog_info" android:layout_gravity="right" android:layout_weight="5"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
40
code/PtiClic/res/layout/score.xml
Normal file
40
code/PtiClic/res/layout/score.xml
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="fill_parent" android:orientation="vertical"
|
||||
android:layout_width="fill_parent" android:id="@+id/LinearLayout01">
|
||||
|
||||
|
||||
<TextView android:text="@+id/corrects" android:id="@+id/corrects" android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" android:textSize="20px"></TextView>
|
||||
|
||||
<TextView android:text="@+id/manquants" android:id="@+id/manquants" android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" android:textSize="20px"></TextView>
|
||||
|
||||
<TextView android:text="@+id/mauvais" android:id="@+id/mauvais" android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" android:textSize="20px"></TextView>
|
||||
|
||||
<TextView android:text="@+id/total" android:id="@+id/total" android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" android:textSize="25px"></TextView>
|
||||
|
||||
<TextView android:text="@+id/joueravec" android:id="@+id/joueravec" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:textSize="20px"></TextView>
|
||||
|
||||
<Button android:text="J'ai vu !" android:id="@+id/jaivu" android:layout_width="100px"
|
||||
android:layout_height="40px" android:layout_gravity="center_vertical|center_horizontal|center"></Button>
|
||||
|
||||
<TextView android:text="@+id/category1" android:id="@+id/category1" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:textSize="20px"></TextView>
|
||||
|
||||
<TextView android:text="@+id/category1words" android:id="@+id/category1words" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"></TextView>
|
||||
|
||||
<TextView android:text="@+id/category2" android:id="@+id/category2" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:textSize="20px"></TextView>
|
||||
|
||||
<TextView android:text="@+id/category2words" android:id="@+id/category2words" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"></TextView>
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -1,8 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">PtiClic</string>
|
||||
<string name="prefs_name">Préférences</string>
|
||||
<string name="games_name">Jouer</string>
|
||||
|
||||
<string name="app_name">PtiClic</string>
|
||||
<string name="prefs_name">Préférences</string>
|
||||
<string name="play_label">Jouer</string>
|
||||
</resources>
|
||||
|
|
62
code/PtiClic/src/model/GamePlayed.java
Normal file
62
code/PtiClic/src/model/GamePlayed.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
package model;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class GamePlayed {
|
||||
|
||||
private int id;
|
||||
private String centre;
|
||||
private String[] cloud;
|
||||
private String[] category;
|
||||
private static GamePlayed instance = null;
|
||||
|
||||
private GamePlayed(){
|
||||
this.id = -1;
|
||||
this.centre = "";
|
||||
this.cloud = null;
|
||||
this.category = null;
|
||||
}
|
||||
|
||||
private GamePlayed(int id, String centre, String[] cloud, String[] category) {
|
||||
this.id = id;
|
||||
this.centre = centre;
|
||||
this.cloud = cloud;
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public final static GamePlayed getInstance(){
|
||||
if(instance == null) instance = new GamePlayed();
|
||||
return instance;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getCentre() {
|
||||
return centre;
|
||||
}
|
||||
public void setCentre(String centre) {
|
||||
this.centre = centre;
|
||||
}
|
||||
public String[] getCloud() {
|
||||
return cloud;
|
||||
}
|
||||
public void setCloud(String[] cloud) {
|
||||
this.cloud = cloud;
|
||||
}
|
||||
public String[] getCategory() {
|
||||
return category;
|
||||
}
|
||||
public void setCategory(String[] category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GamePlayed [id=" + id + ", centre=" + centre + ", cloud="
|
||||
+ Arrays.toString(cloud) + ", category=" + category + "]";
|
||||
}
|
||||
}
|
42
code/PtiClic/src/org/pticlic/Game.java
Normal file
42
code/PtiClic/src/org/pticlic/Game.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package org.pticlic;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
|
||||
public class Game extends Activity implements OnClickListener {
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
int nbrel = 2;
|
||||
setContentView(R.layout.game);
|
||||
|
||||
// Boutons des relations
|
||||
Button r1 = ((Button)findViewById(R.id.relation1));
|
||||
Button r2 = ((Button)findViewById(R.id.relation2));
|
||||
Button r3 = ((Button)findViewById(R.id.relation3));
|
||||
Button r4 = ((Button)findViewById(R.id.relation4));
|
||||
|
||||
// Écoute des clics sur les relations
|
||||
r1.setOnClickListener(this);
|
||||
r2.setOnClickListener(this);
|
||||
r3.setOnClickListener(this);
|
||||
r4.setOnClickListener(this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.view.View.OnClickListener#onClick(android.view.View)
|
||||
*/
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case (R.id.relation1) : break;
|
||||
case (R.id.relation2) : break;
|
||||
case (R.id.relation3) : break;
|
||||
case (R.id.relation4) : break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,9 @@
|
|||
package org.pticlic;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
|
@ -8,28 +11,46 @@ import android.preference.PreferenceManager;
|
|||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class Main extends Activity implements OnClickListener {
|
||||
|
||||
/** 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");
|
||||
// On l'ajoute dans le TextView prévu à cet effet
|
||||
((TextView)findViewById(R.id.login)).setText("Login : " + loginPref);
|
||||
}
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
// Écoute des clics sur les différents boutons
|
||||
((Button)findViewById(R.id.prefs)).setOnClickListener(this);
|
||||
((Button)findViewById(R.id.play)).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");
|
||||
// On l'ajoute dans le TextView prévu à cet effet
|
||||
((TextView)findViewById(R.id.login)).setText("Login : " + loginPref);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.view.View.OnClickListener#onClick(android.view.View)
|
||||
*/
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId()==R.id.prefs) {
|
||||
startActivity(new Intent(this, Preference.class));
|
||||
switch (v.getId()) {
|
||||
case (R.id.prefs) : startActivity(new Intent(this, Preference.class)); break;
|
||||
case (R.id.play) : startActivity(new Intent(this, Game.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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user