Commit 22a78ddd authored by rakam's avatar rakam

New design done for MatchSetupActivity

parent 146f0988
......@@ -14,7 +14,7 @@ import com.koushikdutta.ion.Ion;
import fr.istic.masteru.android.R;
import fr.istic.masteru.android.automate.Automate;
import fr.istic.masteru.android.automate.FileManager;
import fr.istic.masteru.android.model.Match;
import fr.istic.masteru.android.model.MatchInfo;
import fr.istic.masteru.android.model.PlayerInfo;
import fr.istic.masteru.android.model.TeamInfo;
import fr.istic.masteru.android.utils.API_URLS;
......@@ -103,7 +103,7 @@ public class HomeActivity extends Activity {
playerA2 = null;
playerB2 = null;
}
final Match match = new Match(automate.getIdMatch(), teamA, teamB, category, tableau);
final MatchInfo match = new MatchInfo(automate.getIdMatch(), teamA, teamB, category, tableau);
findViewById(R.id.resumeMatchButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
......
......@@ -27,7 +27,7 @@ import fr.istic.masteru.android.automate.Score;
import fr.istic.masteru.android.automate.SimplePoint;
import fr.istic.masteru.android.automate.Stats;
import fr.istic.masteru.android.listeners.OnSyncFinishListener;
import fr.istic.masteru.android.model.Match;
import fr.istic.masteru.android.model.MatchInfo;
import fr.istic.masteru.android.model.PlayerInfo;
import fr.istic.masteru.android.utils.ScoreSyncManager;
import fr.istic.masteru.android.utils.Utils;
......@@ -54,7 +54,7 @@ public abstract class MatchActivity extends Activity {
protected boolean isPlayerALeft;
protected MatchScoreView matchScoreView;
protected TextView scorePlayerA, scorePlayerB;
protected Match match;
protected MatchInfo match;
private ImageView serviceLeft, serviceRight;
private Button backButton;
private TextView gameTime;
......@@ -85,7 +85,7 @@ public abstract class MatchActivity extends Activity {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.match_activity);
match = (Match) getIntent().getSerializableExtra(MATCH);
match = (MatchInfo) getIntent().getSerializableExtra(MATCH);
matchScoreView = (MatchScoreView) findViewById(R.id.matchScoreView);
// Infos views
......
......@@ -29,7 +29,7 @@ import fr.istic.masteru.android.listeners.OnInitialSideChangeListener;
import fr.istic.masteru.android.listeners.OnMatchSelectedListener;
import fr.istic.masteru.android.listeners.OnRefereeingTypeChangeListener;
import fr.istic.masteru.android.listeners.OnSelectedCourtChangeListener;
import fr.istic.masteru.android.model.Match;
import fr.istic.masteru.android.model.MatchInfo;
import fr.istic.masteru.android.model.PlayerInfo;
import fr.istic.masteru.android.model.TeamInfo;
import fr.istic.masteru.android.utils.API_URLS;
......@@ -46,7 +46,7 @@ public class MatchSetupActivity extends Activity implements OnMatchSelectedListe
private ResultFragment resultFragment;
private SetupFragment currentSetupFragment;
private Match match;
private MatchInfo match;
private int refereeingType;
private PlayerInfo playerA1, playerA2, playerB1, playerB2;
private TeamInfo firstServerTeam;
......@@ -180,7 +180,7 @@ public class MatchSetupActivity extends Activity implements OnMatchSelectedListe
}
@Override
public void onMatchSelected(Match match) {
public void onMatchSelected(MatchInfo match) {
this.match = match;
resultFragment.setMatchInfos(match);
if (match != null && match.getCategory().contains("D")
......
......@@ -15,21 +15,21 @@ import java.util.List;
import fr.istic.masteru.android.R;
import fr.istic.masteru.android.listeners.OnMatchSelectedListener;
import fr.istic.masteru.android.model.Match;
import fr.istic.masteru.android.model.MatchInfo;
import fr.istic.masteru.android.utils.Utils;
public class MatchAdapter extends BaseAdapter {
private final LayoutInflater inflater;
private Context context;
private List<Match> matches;
private List<MatchInfo> matches;
private OnMatchSelectedListener onMatchSelectedListener;
private int selectedItem = -1;
private int normalTextColor;
private int selectedTextColor;
public MatchAdapter(Context context, List<Match> matches, OnMatchSelectedListener listener) {
public MatchAdapter(Context context, List<MatchInfo> matches, OnMatchSelectedListener listener) {
this.context = context;
this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.matches = matches;
......@@ -69,7 +69,7 @@ public class MatchAdapter extends BaseAdapter {
viewHolder._separator = (TextView) itemView.findViewById(R.id._separator);
itemView.setTag(viewHolder);
}
final Match match = matches.get(position);
final MatchInfo match = matches.get(position);
ViewHolder viewHolder = (ViewHolder) itemView.getTag();
Ion.with(viewHolder.drapeauA)
.load(match.getTeamA().getFlagUrl());
......@@ -77,10 +77,10 @@ public class MatchAdapter extends BaseAdapter {
.load(match.getTeamB().getFlagUrl());
viewHolder.paysA.setText(match.getTeamA().getName());
viewHolder.paysB.setText(match.getTeamB().getName());
if (match.getCategory().equals("SH")) {
if (match.getCategory().equals("SM")) {
int num = match.getId() % 7;
viewHolder.categorie.setText(Utils.getCategorieName(match.getCategory()) + " n°" + num);
} else if (match.getCategory().equals("SF")) {
} else if (match.getCategory().equals("SW")) {
int num = (match.getId() - 2) % 7;
viewHolder.categorie.setText(Utils.getCategorieName(match.getCategory()) + " n°" + num);
} else {
......
......@@ -69,7 +69,7 @@ public class PlayerAdapter extends BaseAdapter {
}
final PlayerInfo playerInfo = players.get(position);
final ViewHolder viewHolder = (ViewHolder) itemView.getTag();
Ion.with(viewHolder.photo).load(playerInfo.getPhotoUrl());
Ion.with(viewHolder.photo).fadeIn(false).load(playerInfo.getPhotoUrl());
viewHolder.name.setText(playerInfo.getName());
viewHolder.gender.setText(playerInfo.getGender() == PlayerInfo.MAN ? "(M)" : "(W)");
......
......@@ -14,7 +14,7 @@ import com.koushikdutta.ion.Ion;
import fr.istic.masteru.android.R;
import fr.istic.masteru.android.activities.MatchSetupActivity;
import fr.istic.masteru.android.model.Match;
import fr.istic.masteru.android.model.MatchInfo;
import fr.istic.masteru.android.model.PlayerInfo;
import fr.istic.masteru.android.model.TeamInfo;
import fr.istic.masteru.android.utils.Constants;
......@@ -64,7 +64,7 @@ public class ResultFragment extends Fragment {
return root;
}
public void setMatchInfos(Match match) {
public void setMatchInfos(MatchInfo match) {
if (match == null) {
categorieTV.setText(null);
tableauTV.setText(null);
......@@ -73,16 +73,15 @@ public class ResultFragment extends Fragment {
countryATV.setText(null);
countryBTV.setText(null);
} else {
if (match.getCategory().equals("SH")) {
if (match.getCategory().equals("SM")) {
int num = match.getId() % 7;
categorieTV.setText(Utils.getCategorieName(match.getCategory()) + " n°" + num);
} else if (match.getCategory().equals("SF")) {
} else if (match.getCategory().equals("SW")) {
int num = (match.getId() - 2) % 7;
categorieTV.setText(Utils.getCategorieName(match.getCategory()) + " n°" + num);
} else {
categorieTV.setText(Utils.getCategorieName(match.getCategory()));
}
categorieTV.setText(Utils.getCategorieName(match.getCategory()));
tableauTV.setText(Utils.getTableauName(match.getTableau()));
Ion.with(flagA)
.load(match.getTeamA().getFlagUrl());
......
......@@ -10,12 +10,12 @@ import android.widget.Button;
import fr.istic.masteru.android.R;
import fr.istic.masteru.android.activities.MatchSetupActivity;
import fr.istic.masteru.android.model.Match;
import fr.istic.masteru.android.model.MatchInfo;
public class SelectFirstServiceFragment extends SetupFragment {
MatchSetupActivity matchSetupActivity;
private Match match;
private MatchInfo match;
private int lightGrey;
@Override
......@@ -71,7 +71,7 @@ public class SelectFirstServiceFragment extends SetupFragment {
return root;
}
public void setMatch(Match match) {
public void setMatch(MatchInfo match) {
this.match = match;
}
......
......@@ -10,13 +10,13 @@ import android.widget.Button;
import fr.istic.masteru.android.R;
import fr.istic.masteru.android.activities.MatchSetupActivity;
import fr.istic.masteru.android.model.Match;
import fr.istic.masteru.android.model.MatchInfo;
import fr.istic.masteru.android.utils.Constants;
public class SelectInitialSideFragment extends SetupFragment {
MatchSetupActivity matchSetupActivity;
private Match match;
private MatchInfo match;
private int lightGrey;
@Override
......@@ -76,7 +76,7 @@ public class SelectInitialSideFragment extends SetupFragment {
return root;
}
public void setMatch(Match match) {
public void setMatch(MatchInfo match) {
this.match = match;
}
......
......@@ -22,14 +22,14 @@ import fr.istic.masteru.android.R;
import fr.istic.masteru.android.activities.MatchSetupActivity;
import fr.istic.masteru.android.adapters.MatchAdapter;
import fr.istic.masteru.android.listeners.OnMatchSelectedListener;
import fr.istic.masteru.android.model.Match;
import fr.istic.masteru.android.model.MatchInfo;
import fr.istic.masteru.android.model.TeamInfo;
import fr.istic.masteru.android.utils.API_URLS;
public class SelectMatchFragment extends SetupFragment implements OnMatchSelectedListener {
MatchSetupActivity matchSetupActivity;
private List<Match> matches = new ArrayList<Match>();
private List<MatchInfo> matches = new ArrayList<MatchInfo>();
private MatchAdapter matchAdapter;
private Button nextButton;
private View progressBar;
......@@ -102,18 +102,17 @@ public class SelectMatchFragment extends SetupFragment implements OnMatchSelecte
int idMatch = o.get("IdMatch").getAsInt();
String isoA = o.get("Team_A").getAsString();
String isoB = o.get("Team_B").getAsString();
// todo get flag and full team names
TeamInfo teamA = new TeamInfo(isoA, isoA, null);
TeamInfo teamB = new TeamInfo(isoB, isoB, null);
JsonElement playerAElement = o.get("Name_Complet_A");
String playerA = playerAElement.isJsonNull() ? null : playerAElement.getAsString();
JsonElement playerBElement = o.get("Name_Complet_B");
String playerB = playerBElement.isJsonNull() ? null : playerBElement.getAsString();
String teamNameA = o.get("NameTeam_A").getAsString();
String teamNameB = o.get("NameTeam_B").getAsString();
String flagA = o.get("UrlTeam_A").getAsString();
String flagB = o.get("UrlTeam_B").getAsString();
TeamInfo teamA = new TeamInfo(isoA, teamNameA, flagA);
TeamInfo teamB = new TeamInfo(isoB, teamNameB, flagB);
String category = o.get("Category").getAsString();
String tableau = o.get("Tableau").getAsString();
JsonElement courtElement = o.get("Court");
int court = courtElement.isJsonNull() ? -1 : courtElement.getAsInt();
matches.add(new Match(idMatch, teamA, teamB, category, tableau));
matches.add(new MatchInfo(idMatch, teamA, teamB, category, tableau));
}
if (matches.size() == 0) {
displayMessage(matchSetupActivity.getString(R.string.no_matchs_all_ended));
......@@ -140,7 +139,7 @@ public class SelectMatchFragment extends SetupFragment implements OnMatchSelecte
}
@Override
public void onMatchSelected(Match match) {
public void onMatchSelected(MatchInfo match) {
if (match == null) {
nextButton.setVisibility(View.INVISIBLE);
} else {
......
......@@ -24,7 +24,7 @@ import fr.istic.masteru.android.R;
import fr.istic.masteru.android.activities.MatchSetupActivity;
import fr.istic.masteru.android.adapters.PlayerAdapter;
import fr.istic.masteru.android.listeners.OnPlayerSelectedListener;
import fr.istic.masteru.android.model.Match;
import fr.istic.masteru.android.model.MatchInfo;
import fr.istic.masteru.android.model.PlayerInfo;
import fr.istic.masteru.android.utils.API_URLS;
......@@ -40,7 +40,7 @@ public class SelectPlayersFragment extends SetupFragment {
private Button nextButton;
private ProgressBar progressBar;
private PlayerInfo playerA1, playerA2, playerB1, playerB2;
private Match match;
private MatchInfo match;
private boolean isDouble;
private boolean isMixed;
......@@ -155,7 +155,7 @@ public class SelectPlayersFragment extends SetupFragment {
String name = o.get("Name").getAsString();
String firstName = o.get("FirstName").getAsString();
int gender = o.get("Sex").getAsString().equals("M") ? PlayerInfo.MAN : PlayerInfo.WOMAN;
PlayerInfo playerInfo = new PlayerInfo(playerId, gender, firstName + name, countryCode);
PlayerInfo playerInfo = new PlayerInfo(playerId, gender, firstName + " " + name, countryCode);
if (team == TEAM_A)
playersA.add(playerInfo);
else
......@@ -169,7 +169,7 @@ public class SelectPlayersFragment extends SetupFragment {
});
}
public void setMatch(Match match) {
public void setMatch(MatchInfo match) {
this.match = match;
isDouble = match.getCategory().contains("D");
isMixed = match.getCategory().equals("DX");
......
package fr.istic.masteru.android.listeners;
import fr.istic.masteru.android.model.Match;
import fr.istic.masteru.android.model.MatchInfo;
public interface OnMatchSelectedListener {
public void onMatchSelected(Match match);
public void onMatchSelected(MatchInfo match);
}
......@@ -2,14 +2,14 @@ package fr.istic.masteru.android.model;
import java.io.Serializable;
public class Match implements Serializable {
public class MatchInfo implements Serializable {
private int id;
private TeamInfo teamA, teamB;
private String category;
private String tableau;
public Match(int id, TeamInfo teamA, TeamInfo teamB, String category, String tableau) {
public MatchInfo(int id, TeamInfo teamA, TeamInfo teamB, String category, String tableau) {
this.id = id;
this.teamA = teamA;
this.teamB = teamB;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment