Commit 16966801 authored by rakam's avatar rakam
Browse files

New API (SelectMatchFragment)

parent 672d6b67
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/Resume.iml" filepath="$PROJECT_DIR$/Resume.iml" />
<module fileurl="file://$PROJECT_DIR$/android.iml" filepath="$PROJECT_DIR$/android.iml" /> <module fileurl="file://$PROJECT_DIR$/android.iml" filepath="$PROJECT_DIR$/android.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules> </modules>
......
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</configuration> </configuration>
</facet> </facet>
</component> </component>
<component name="NewModuleRootManager" inherit-compiler-output="false"> <component name="NewModuleRootManager" inherit-compiler-output="true">
<output url="file://$MODULE_DIR$/build/classes/main" /> <output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" /> <output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output /> <exclude-output />
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<facet type="android" name="Android"> <facet type="android" name="Android">
<configuration> <configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" /> <option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" /> <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" /> <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" /> <option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
</component> </component>
<component name="NewModuleRootManager" inherit-compiler-output="false"> <component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" /> <output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
...@@ -84,10 +86,10 @@ ...@@ -84,10 +86,10 @@
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" /> <orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" name="ion-1.4.1" level="project" />
<orderEntry type="library" exported="" name="androidasync-1.4.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" /> <orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="ion-2.0.5" level="project" />
<orderEntry type="library" exported="" name="gson-2.3" level="project" /> <orderEntry type="library" exported="" name="gson-2.3" level="project" />
<orderEntry type="library" exported="" name="androidasync-2.0.5" level="project" />
</component> </component>
</module> </module>
...@@ -21,6 +21,6 @@ android { ...@@ -21,6 +21,6 @@ android {
dependencies { dependencies {
compile fileTree(dir: 'libs', include: ['*.jar']) compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.koushikdutta.ion:ion:1.+' compile 'com.koushikdutta.ion:ion:2.+'
compile "com.android.support:support-v4:21.0.+" compile "com.android.support:support-v4:21.0.+"
} }
...@@ -31,7 +31,7 @@ public class HomeActivity extends Activity { ...@@ -31,7 +31,7 @@ public class HomeActivity extends Activity {
} }
}); });
findViewById(R.id.resumeMatchButton).setEnabled(false); findViewById(R.id.resumeMatchButton).setEnabled(false);
checkForSavedAutomate(); //checkForSavedAutomate();
} }
private void checkForSavedAutomate() { private void checkForSavedAutomate() {
......
...@@ -65,7 +65,7 @@ public abstract class MatchActivity extends Activity { ...@@ -65,7 +65,7 @@ public abstract class MatchActivity extends Activity {
serviceRight = (ImageView) findViewById(R.id.serviceRight); serviceRight = (ImageView) findViewById(R.id.serviceRight);
gameTime = (TextView) findViewById(R.id.gameTime); gameTime = (TextView) findViewById(R.id.gameTime);
backButton = (Button) findViewById(R.id.back); backButton = (Button) findViewById(R.id.back);
((TextView) findViewById(R.id.categorie)).setText(Util.getCategorieName(match.getCategorie())); ((TextView) findViewById(R.id.categorie)).setText(Util.getCategorieName(match.getCategory()));
findViewById(R.id.optionsButton).setOnClickListener(new View.OnClickListener() { findViewById(R.id.optionsButton).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
......
...@@ -127,7 +127,7 @@ public class MatchSetupActivity extends Activity implements OnMatchSelectedListe ...@@ -127,7 +127,7 @@ public class MatchSetupActivity extends Activity implements OnMatchSelectedListe
param.addProperty("idMatch", match.getId()); param.addProperty("idMatch", match.getId());
param.addProperty("idCourt", idCourt); param.addProperty("idCourt", idCourt);
param.addProperty("startDate", Util.getCurrentDateInMySQLFormat()); param.addProperty("startDate", Util.getCurrentDateInMySQLFormat());
param.addProperty("service", firstServiceCountryCode.equals(match.getPaysA()) ? 0 : 1); param.addProperty("service", firstServiceCountryCode.equals(match.getTeamA()) ? 0 : 1);
param.addProperty("idJoueurA_Eq1", playerA1.getId()); param.addProperty("idJoueurA_Eq1", playerA1.getId());
param.addProperty("idJoueurA_Eq2", playerB1.getId()); param.addProperty("idJoueurA_Eq2", playerB1.getId());
if (refereeingType == Constants.SIMPLE) { if (refereeingType == Constants.SIMPLE) {
...@@ -154,7 +154,7 @@ public class MatchSetupActivity extends Activity implements OnMatchSelectedListe ...@@ -154,7 +154,7 @@ public class MatchSetupActivity extends Activity implements OnMatchSelectedListe
Intent matchActivityIntent = new Intent(MatchSetupActivity.this, SingleMatchActivity.class); Intent matchActivityIntent = new Intent(MatchSetupActivity.this, SingleMatchActivity.class);
matchActivityIntent.putExtra(MatchActivity.MATCH, match); matchActivityIntent.putExtra(MatchActivity.MATCH, match);
matchActivityIntent.putExtra(MatchActivity.SIDE_LEFT_A, side == Constants.A_IS_LEFT); matchActivityIntent.putExtra(MatchActivity.SIDE_LEFT_A, side == Constants.A_IS_LEFT);
matchActivityIntent.putExtra(MatchActivity.SERVICE, firstServiceCountryCode.equals(match.getPaysA()) ? 0 : 1); matchActivityIntent.putExtra(MatchActivity.SERVICE, firstServiceCountryCode.equals(match.getTeamA()) ? 0 : 1);
matchActivityIntent.putExtra(MatchActivity.PLAYER_A1, playerA1); matchActivityIntent.putExtra(MatchActivity.PLAYER_A1, playerA1);
matchActivityIntent.putExtra(MatchActivity.PLAYER_B1, playerB1); matchActivityIntent.putExtra(MatchActivity.PLAYER_B1, playerB1);
startActivity(matchActivityIntent); startActivity(matchActivityIntent);
...@@ -162,7 +162,7 @@ public class MatchSetupActivity extends Activity implements OnMatchSelectedListe ...@@ -162,7 +162,7 @@ public class MatchSetupActivity extends Activity implements OnMatchSelectedListe
Intent matchActivityIntent = new Intent(MatchSetupActivity.this, DoubleMatchActivity.class); Intent matchActivityIntent = new Intent(MatchSetupActivity.this, DoubleMatchActivity.class);
matchActivityIntent.putExtra(MatchActivity.MATCH, match); matchActivityIntent.putExtra(MatchActivity.MATCH, match);
matchActivityIntent.putExtra(MatchActivity.SIDE_LEFT_A, side == Constants.A_IS_LEFT); matchActivityIntent.putExtra(MatchActivity.SIDE_LEFT_A, side == Constants.A_IS_LEFT);
matchActivityIntent.putExtra(MatchActivity.SERVICE, firstServiceCountryCode.equals(match.getPaysA()) ? 0 : 1); matchActivityIntent.putExtra(MatchActivity.SERVICE, firstServiceCountryCode.equals(match.getTeamA()) ? 0 : 1);
matchActivityIntent.putExtra(DoubleMatchActivity.REFEREEING_TYPE, refereeingType); matchActivityIntent.putExtra(DoubleMatchActivity.REFEREEING_TYPE, refereeingType);
matchActivityIntent.putExtra(MatchActivity.PLAYER_A1, playerA1); matchActivityIntent.putExtra(MatchActivity.PLAYER_A1, playerA1);
matchActivityIntent.putExtra(MatchActivity.PLAYER_A2, playerA2); matchActivityIntent.putExtra(MatchActivity.PLAYER_A2, playerA2);
...@@ -181,10 +181,10 @@ public class MatchSetupActivity extends Activity implements OnMatchSelectedListe ...@@ -181,10 +181,10 @@ public class MatchSetupActivity extends Activity implements OnMatchSelectedListe
public void onMatchSelected(Match match) { public void onMatchSelected(Match match) {
this.match = match; this.match = match;
resultFragment.setMatchInfos(match); resultFragment.setMatchInfos(match);
if (match != null && match.getCategorie().contains("D") if (match != null && match.getCategory().contains("D")
&& !flow.get(1).equals(RefereeingTypeFragment.class.getName())) { && !flow.get(1).equals(RefereeingTypeFragment.class.getName())) {
flow.add(1, RefereeingTypeFragment.class.getName()); flow.add(1, RefereeingTypeFragment.class.getName());
} else if (match != null && !match.getCategorie().contains("D") && } else if (match != null && !match.getCategory().contains("D") &&
flow.get(1).equals(RefereeingTypeFragment.class.getName())) { flow.get(1).equals(RefereeingTypeFragment.class.getName())) {
flow.remove(1); flow.remove(1);
} }
......
...@@ -45,12 +45,12 @@ public class SingleMatchActivity extends MatchActivity { ...@@ -45,12 +45,12 @@ public class SingleMatchActivity extends MatchActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (match.getCategorie().equals("SH")) { if (match.getCategory().equals("SH")) {
int num = match.getId() % 7; int num = match.getId() % 7;
((TextView) findViewById(R.id.categorie)).setText(Util.getCategorieName(match.getCategorie()) + " n°" + num); ((TextView) findViewById(R.id.categorie)).setText(Util.getCategorieName(match.getCategory()) + " n°" + num);
} else if (match.getCategorie().equals("SF")) { } else if (match.getCategory().equals("SF")) {
int num = (match.getId() - 2) % 7; int num = (match.getId() - 2) % 7;
((TextView) findViewById(R.id.categorie)).setText(Util.getCategorieName(match.getCategorie()) + " n°" + num); ((TextView) findViewById(R.id.categorie)).setText(Util.getCategorieName(match.getCategory()) + " n°" + num);
} }
matchScoreView.setPlayersNames(playerInfoA.getName(), playerInfoB.getName()); matchScoreView.setPlayersNames(playerInfoA.getName(), playerInfoB.getName());
} }
......
...@@ -64,18 +64,18 @@ public class MatchAdapter extends BaseAdapter { ...@@ -64,18 +64,18 @@ public class MatchAdapter extends BaseAdapter {
} }
final Match match = matches.get(position); final Match match = matches.get(position);
ViewHolder viewHolder = (ViewHolder) itemView.getTag(); ViewHolder viewHolder = (ViewHolder) itemView.getTag();
viewHolder.drapeauA.setImageResource(Util.getCountryFlag(match.getPaysA())); viewHolder.drapeauA.setImageResource(Util.getCountryFlag(match.getTeamA()));
viewHolder.drapeauB.setImageResource(Util.getCountryFlag(match.getPaysB())); viewHolder.drapeauB.setImageResource(Util.getCountryFlag(match.getTeamB()));
viewHolder.paysA.setText(Util.getCountryName(match.getPaysA())); viewHolder.paysA.setText(Util.getCountryName(match.getTeamA()));
viewHolder.paysB.setText(Util.getCountryName(match.getPaysB())); viewHolder.paysB.setText(Util.getCountryName(match.getTeamB()));
if (match.getCategorie().equals("SH")) { if (match.getCategory().equals("SH")) {
int num = match.getId() % 7; int num = match.getId() % 7;
viewHolder.categorie.setText(Util.getCategorieName(match.getCategorie()) + " n°" + num); viewHolder.categorie.setText(Util.getCategorieName(match.getCategory()) + " n°" + num);
} else if (match.getCategorie().equals("SF")) { } else if (match.getCategory().equals("SF")) {
int num = (match.getId() - 2) % 7; int num = (match.getId() - 2) % 7;
viewHolder.categorie.setText(Util.getCategorieName(match.getCategorie()) + " n°" + num); viewHolder.categorie.setText(Util.getCategorieName(match.getCategory()) + " n°" + num);
} else { } else {
viewHolder.categorie.setText(Util.getCategorieName(match.getCategorie())); viewHolder.categorie.setText(Util.getCategorieName(match.getCategory()));
} }
viewHolder.tableau.setText(Util.getTableauName(match.getTableau())); viewHolder.tableau.setText(Util.getTableauName(match.getTableau()));
final View finalItemView = itemView; final View finalItemView = itemView;
......
...@@ -50,14 +50,14 @@ public class FirstServiceFragment extends SetupFragment { ...@@ -50,14 +50,14 @@ public class FirstServiceFragment extends SetupFragment {
}); });
final Button countryAButton = (Button) root.findViewById(R.id.countryA); final Button countryAButton = (Button) root.findViewById(R.id.countryA);
final Button countryBButton = (Button) root.findViewById(R.id.countryB); final Button countryBButton = (Button) root.findViewById(R.id.countryB);
countryAButton.setText(Util.getCountryName(match.getPaysA())); countryAButton.setText(Util.getCountryName(match.getTeamA()));
countryBButton.setText(Util.getCountryName(match.getPaysB())); countryBButton.setText(Util.getCountryName(match.getTeamB()));
countryAButton.setOnClickListener(new View.OnClickListener() { countryAButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
countryAButton.setBackgroundColor(Color.RED); countryAButton.setBackgroundColor(Color.RED);
countryBButton.setBackgroundColor(lightGrey); countryBButton.setBackgroundColor(lightGrey);
matchSetupActivity.onFirstServiceChange(match.getPaysA()); matchSetupActivity.onFirstServiceChange(match.getTeamA());
nextButton.setVisibility(View.VISIBLE); nextButton.setVisibility(View.VISIBLE);
} }
}); });
...@@ -66,7 +66,7 @@ public class FirstServiceFragment extends SetupFragment { ...@@ -66,7 +66,7 @@ public class FirstServiceFragment extends SetupFragment {
public void onClick(View view) { public void onClick(View view) {
countryAButton.setBackgroundColor(lightGrey); countryAButton.setBackgroundColor(lightGrey);
countryBButton.setBackgroundColor(Color.RED); countryBButton.setBackgroundColor(Color.RED);
matchSetupActivity.onFirstServiceChange(match.getPaysB()); matchSetupActivity.onFirstServiceChange(match.getTeamB());
nextButton.setVisibility(View.VISIBLE); nextButton.setVisibility(View.VISIBLE);
} }
}); });
......
...@@ -55,8 +55,8 @@ public class InitialSideFragment extends SetupFragment { ...@@ -55,8 +55,8 @@ public class InitialSideFragment extends SetupFragment {
matchSetupActivity.next(); matchSetupActivity.next();
} }
}); });
countryAButton.setText(Util.getCountryName(match.getPaysA())); countryAButton.setText(Util.getCountryName(match.getTeamA()));
countryBButton.setText(Util.getCountryName(match.getPaysB())); countryBButton.setText(Util.getCountryName(match.getTeamB()));
countryAButton.setOnClickListener(new View.OnClickListener() { countryAButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
......
...@@ -70,21 +70,21 @@ public class ResultFragment extends Fragment { ...@@ -70,21 +70,21 @@ public class ResultFragment extends Fragment {
countryATV.setText(null); countryATV.setText(null);
countryBTV.setText(null); countryBTV.setText(null);
} else { } else {
if (match.getCategorie().equals("SH")) { if (match.getCategory().equals("SH")) {
int num = match.getId() % 7; int num = match.getId() % 7;
categorieTV.setText(Util.getCategorieName(match.getCategorie()) + " n°" + num); categorieTV.setText(Util.getCategorieName(match.getCategory()) + " n°" + num);
} else if (match.getCategorie().equals("SF")) { } else if (match.getCategory().equals("SF")) {
int num = (match.getId() - 2) % 7; int num = (match.getId() - 2) % 7;
categorieTV.setText(Util.getCategorieName(match.getCategorie()) + " n°" + num); categorieTV.setText(Util.getCategorieName(match.getCategory()) + " n°" + num);
} else { } else {
categorieTV.setText(Util.getCategorieName(match.getCategorie())); categorieTV.setText(Util.getCategorieName(match.getCategory()));
} }
categorieTV.setText(Util.getCategorieName(match.getCategorie())); categorieTV.setText(Util.getCategorieName(match.getCategory()));
tableauTV.setText(Util.getTableauName(match.getTableau())); tableauTV.setText(Util.getTableauName(match.getTableau()));
flagA.setImageResource(Util.getCountryFlag(match.getPaysA())); flagA.setImageResource(Util.getCountryFlag(match.getTeamA()));
flagB.setImageResource(Util.getCountryFlag(match.getPaysB())); flagB.setImageResource(Util.getCountryFlag(match.getTeamB()));
countryATV.setText(Util.getCountryName(match.getPaysA())); countryATV.setText(Util.getCountryName(match.getTeamA()));
countryBTV.setText(Util.getCountryName(match.getPaysB())); countryBTV.setText(Util.getCountryName(match.getTeamB()));
} }
} }
......
...@@ -87,33 +87,36 @@ public class SelectMatchFragment extends SetupFragment implements OnMatchSelecte ...@@ -87,33 +87,36 @@ public class SelectMatchFragment extends SetupFragment implements OnMatchSelecte
final JsonObject param = new JsonObject(); final JsonObject param = new JsonObject();
param.addProperty("tableau", tableau); param.addProperty("tableau", tableau);
Ion.with(matchSetupActivity) Ion.with(matchSetupActivity)
.load(API_URLS.MATCHS) .load("GET", API_URLS.MATCHS + "?round=1/4")
.setTimeout(1000 * 10) .setTimeout(1000 * 10)
.setJsonObjectBody(param) .setJsonObjectBody(param)
.asJsonArray() .asJsonObject()
.setCallback(new FutureCallback<JsonArray>() { .setCallback(new FutureCallback<JsonObject>() {
@Override @Override
public void onCompleted(Exception e, JsonArray result) { public void onCompleted(Exception e, JsonObject result) {
if (e != null) { if (e != null || result != null && result.get("code").getAsInt() != 0) {
loadMatches(); loadMatches();
return; return;
} }
JsonArray matchesArray = result.getAsJsonArray("matches");
progressBar.setVisibility(View.GONE); progressBar.setVisibility(View.GONE);
for (int i = 0; i < result.size(); i++) { for (int i = 0; i < matchesArray.size(); i++) {
JsonObject o = result.get(i).getAsJsonObject(); JsonObject o = matchesArray.get(i).getAsJsonObject();
String status = o.get("Statut").getAsString();
if (!status.equals("SOON")) // Display only the matches which can be played
continue;
int idMatch = o.get("IdMatch").getAsInt(); int idMatch = o.get("IdMatch").getAsInt();
String countryA = o.get("Nation_A").getAsString(); String teamA = o.get("Team_A").getAsString();
String countryB = o.get("Nation_B").getAsString(); String teamB = o.get("Team_B").getAsString();
JsonElement playerAElement = o.get("Nom_Complet_A"); JsonElement playerAElement = o.get("Name_Complet_A");
String playerA = playerAElement.isJsonNull() ? null : playerAElement.getAsString(); String playerA = playerAElement.isJsonNull() ? null : playerAElement.getAsString();
JsonElement playerBElement = o.get("Nom_Complet_B"); JsonElement playerBElement = o.get("Name_Complet_B");
String playerB = playerBElement.isJsonNull() ? null : playerBElement.getAsString(); String playerB = playerBElement.isJsonNull() ? null : playerBElement.getAsString();
String categorie = o.get("Categorie").getAsString(); String category = o.get("Category").getAsString();
String tableau = o.get("Tableau").getAsString(); String tableau = o.get("Tableau").getAsString();
String status = o.get("Statut").getAsString();
JsonElement courtElement = o.get("Court"); JsonElement courtElement = o.get("Court");
int court = courtElement.isJsonNull() ? -1 : courtElement.getAsInt(); int court = courtElement.isJsonNull() ? -1 : courtElement.getAsInt();
matches.add(new Match(idMatch, countryA, countryB, categorie, tableau)); matches.add(new Match(idMatch, teamA, teamB, category, tableau));
} }
if (matchAdapter != null) if (matchAdapter != null)
matchAdapter.notifyDataSetChanged(); matchAdapter.notifyDataSetChanged();
......
...@@ -73,8 +73,8 @@ public class SelectPlayersFragment extends SetupFragment { ...@@ -73,8 +73,8 @@ public class SelectPlayersFragment extends SetupFragment {
} }
}); });
((TextView) root.findViewById(R.id.countryA)).setText(Util.getCountryName(match.getPaysA())); ((TextView) root.findViewById(R.id.countryA)).setText(Util.getCountryName(match.getTeamA()));
((TextView) root.findViewById(R.id.countryB)).setText(Util.getCountryName(match.getPaysB())); ((TextView) root.findViewById(R.id.countryB)).setText(Util.getCountryName(match.getTeamB()));
ListView playerAList = (ListView) root.findViewById(R.id.playerAListView); ListView playerAList = (ListView) root.findViewById(R.id.playerAListView);
ListView playerBList = (ListView) root.findViewById(R.id.playerBListView); ListView playerBList = (ListView) root.findViewById(R.id.playerBListView);
...@@ -132,13 +132,11 @@ public class SelectPlayersFragment extends SetupFragment { ...@@ -132,13 +132,11 @@ public class SelectPlayersFragment extends SetupFragment {
private void loadPlayers(final int team) { private void loadPlayers(final int team) {
final JsonObject param = new JsonObject(); final JsonObject param = new JsonObject();
final String countryCode = team == TEAM_A ? match.getPaysA() : match.getPaysB(); final String countryCode = team == TEAM_A ? match.getTeamA() : match.getTeamB();
param.addProperty("nation", countryCode); String gender = match.getCategory().contains("M") ? "M" : match.getCategory().contains("W") ? "W" : "X";
String sexe = match.getCategorie().contains("H") ? "H" : match.getCategorie().contains("F") ? "F" : "M";
param.addProperty("sexe", sexe);
Ion.with(matchSetupActivity) Ion.with(matchSetupActivity)
.load(API_URLS.PLAYER_LIST) .load(API_URLS.TEAM_PLAYERS(countryCode, gender))
.setTimeout(1000 * 10) .setTimeout(1000 * 10)
.setJsonObjectBody(param) .setJsonObjectBody(param)
.asJsonArray() .asJsonArray()
...@@ -171,8 +169,8 @@ public class SelectPlayersFragment extends SetupFragment { ...@@ -171,8 +169,8 @@ public class SelectPlayersFragment extends SetupFragment {
public void setMatch(Match match) { public void setMatch(Match match) {
this.match = match; this.match = match;
isDouble = match.getCategorie().contains("D"); isDouble = match.getCategory().contains("D");
isMixed = match.getCategorie().equals("DM"); isMixed = match.getCategory().equals("DM");
} }
@Override @Override
......
...@@ -5,15 +5,15 @@ import java.io.Serializable; ...@@ -5,15 +5,15 @@ import java.io.Serializable;
public class Match implements Serializable { public class Match implements Serializable {
private int id; private int id;
private String paysA, paysB; private String teamA, teamB;
private String categorie; private String category;
private String tableau; private String tableau;
public Match(int id, String paysA, String paysB, String categorie, String tableau) { public Match(int id, String teamA, String teamB, String category, String tableau) {
this.id = id; this.id = id;
this.paysA = paysA; this.teamA = teamA;
this.paysB = paysB; this.teamB = teamB;
this.categorie = categorie; this.category = category;
this.tableau = tableau; this.tableau = tableau;
} }
...@@ -21,28 +21,28 @@ public class Match implements Serializable { ...@@ -21,28 +21,28 @@ public class Match implements Serializable {
return id; return id;
} }
public String getPaysA() { public String getTeamA() {
return paysA; return teamA;
} }
public void setPaysA(String paysA) { public void setTeamA(String teamA) {
this.paysA = paysA; this.teamA = teamA;
} }
public String getPaysB() { public String getTeamB() {
return paysB; return teamB;
} }
public void setPaysB(String paysB) { public void setTeamB(String teamB) {
this.paysB = paysB; this.teamB = teamB;
} }
public String getCategorie() { public String getCategory() {
return categorie; return category;
} }
public void setCategorie(String categorie) { public void setCategory(String category) {
this.categorie = categorie; this.category = category;
} }