Commit 9698d737 authored by rakam's avatar rakam

First Serve Fault

parent 6f77c339
......@@ -68,6 +68,7 @@ public abstract class MatchActivity extends Activity {
protected PlayerInfo playerInfoB1, playerInfoB2;
protected String nameA, nameB;
protected Button fsfButton;
protected View leftButtons, rightButtons;
protected SecureDelayButton leftPointButton, rightPointButton;
protected SecureDelayButton leftAceButton, rightAceButton;
......@@ -107,6 +108,7 @@ public abstract class MatchActivity extends Activity {
backButton = (Button) findViewById(R.id.back);
// Stats views
fsfButton = (Button) findViewById(R.id.fsfButton);
leftButtons = findViewById(R.id.leftButtons);
rightButtons = findViewById(R.id.rightButtons);
......@@ -120,6 +122,13 @@ public abstract class MatchActivity extends Activity {
animatedRightButtons.add(rightAceButton);
animatedRightButtons.add(rightPointButton);
fsfButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fsfButton.setSelected(!fsfButton.isSelected());
}
});
((TextView) findViewById(R.id.categorie)).setText(Utils.getCategorieName(match.getCategory()));
findViewById(R.id.optionsButton).setOnClickListener(new View.OnClickListener() {
@Override
......@@ -236,6 +245,7 @@ public abstract class MatchActivity extends Activity {
protected void updateUI(final Point point) {
fsfButton.setSelected(false);
Score score = point.getScore();
if (score.isSideLeftA() != isPlayerALeft && score.getVainqueur() == -1) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
......@@ -383,26 +393,26 @@ public abstract class MatchActivity extends Activity {
leftPointButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
updateUI(new Point(automate.point(leftPlayer), new Stats(Stats.Type.NONE, false, leftPlayer)));
updateUI(new Point(automate.point(leftPlayer), new Stats(Stats.Type.NONE, fsfButton.isSelected(), leftPlayer)));
}
});
leftAceButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
updateUI(new Point(automate.point(leftPlayer), new Stats(Stats.Type.ACE, false, leftPlayer)));
updateUI(new Point(automate.point(leftPlayer), new Stats(Stats.Type.ACE, fsfButton.isSelected(), leftPlayer)));
}
});
rightPointButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
updateUI(new Point(automate.point(rightPlayer), new Stats(Stats.Type.NONE, false, rightPlayer)));
updateUI(new Point(automate.point(rightPlayer), new Stats(Stats.Type.NONE, fsfButton.isSelected(), rightPlayer)));
}
});
rightAceButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
updateUI(new Point(automate.point(rightPlayer), new Stats(Stats.Type.ACE, false, rightPlayer)));
updateUI(new Point(automate.point(rightPlayer), new Stats(Stats.Type.ACE, fsfButton.isSelected(), rightPlayer)));
}
});
}
......
......@@ -55,7 +55,7 @@ public class ResultFragment extends Fragment {
playerA2TV = (TextView) root.findViewById(R.id.playerA2);
playerB1TV = (TextView) root.findViewById(R.id.playerB1);
playerB2TV = (TextView) root.findViewById(R.id.playerB2);
firstService = (TextView) root.findViewById(R.id.firstService);
firstService = (TextView) root.findViewById(R.id.fsfButton);
sideA = (TextView) root.findViewById(R.id.sideA);
sideB = (TextView) root.findViewById(R.id.sideB);
return root;
......
......@@ -116,7 +116,6 @@ public class SelectCourtFragment extends SetupFragment {
int courtId = courtsArray.get(i).getAsInt();
buttons.get(courtId - 1).setEnabled(true);
}
buttons.get(3).setEnabled(false);
}
});
}
......
......@@ -85,7 +85,7 @@ public class SelectMatchFragment extends SetupFragment implements OnMatchSelecte
tableau = "1/4";
Ion.with(matchSetupActivity)
.load("GET", API_URLS.MATCHS + "?round=1/4")
.load("GET", API_URLS.MATCHS + "?round=1/2")
.setTimeout(1000 * 10)
.asJsonObject()
.setCallback(new FutureCallback<JsonObject>() {
......
......@@ -159,7 +159,7 @@ public class ScoreSyncManager {
param.addProperty("server", score.getService());
param.addProperty("pointWinner", point.getStats().getWinner() == 0 ? "A" : "B");
param.addProperty("stats", point.getStats().getType().name());
param.addProperty("fsf", point.getStats().isFsf() ? "0" : "1");
param.addProperty("fsf", point.getStats().isFsf() ? "1" : "0");
Ion.with(context)
.load("POST", API_URLS.UPDATE_SCORE(idMatch, score.getId()))
......
......@@ -110,36 +110,42 @@
android:id="@+id/_scoreMiddle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/playerLeftNatTV"
android:layout_below="@id/categorie"
android:layout_above="@+id/fsfButton"
android:gravity="center_vertical"
android:layout_centerHorizontal="true"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:text="-"
android:textSize="28sp"
android:textSize="32sp"
android:textStyle="bold"/>
<TextView
android:id="@+id/scoreLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/playerLeftNatTV"
android:layout_below="@id/categorie"
android:layout_above="@+id/fsfButton"
android:gravity="center_vertical"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_toLeftOf="@id/_scoreMiddle"
android:text="0"
android:textSize="28sp"
android:textSize="32sp"
android:textStyle="bold"/>
<TextView
android:id="@+id/scoreRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/playerLeftNatTV"
android:layout_below="@id/categorie"
android:layout_above="@+id/fsfButton"
android:gravity="center_vertical"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_toRightOf="@id/_scoreMiddle"
android:text="0"
android:textSize="28sp"
android:textSize="32sp"
android:textStyle="bold"/>
<ImageView
......@@ -147,7 +153,9 @@
android:layout_width="26dp"
android:layout_height="0px"
android:layout_alignBottom="@id/_scoreMiddle"
android:layout_below="@id/playerLeftNatTV"
android:layout_below="@id/categorie"
android:layout_above="@+id/fsfButton"
android:gravity="center_vertical"
android:layout_toLeftOf="@id/scoreLeft"
android:src="@drawable/tennis_ball"/>
......@@ -156,28 +164,32 @@
android:layout_width="26dp"
android:layout_height="0px"
android:layout_alignBottom="@id/_scoreMiddle"
android:layout_below="@id/playerLeftNatTV"
android:layout_below="@id/categorie"
android:layout_above="@+id/fsfButton"
android:gravity="center_vertical"
android:layout_toRightOf="@id/scoreRight"
android:src="@drawable/tennis_ball"
android:visibility="gone"/>
<Button
android:id="@+id/firstService"
android:id="@+id/fsfButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@id/_scoreMiddle"
android:layout_below="@id/playerLeft1Photo"
android:background="@drawable/ac_button"
android:padding="22dp"
android:layout_margin="6dp"
android:text="Fault First Service"/>
android:text="@string/FIRST_SERVE_FAULT"
android:textColor="#444"
android:textStyle="bold"/>
<View
android:id="@+id/_separator"
android:layout_width="1px"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="@id/firstService"
android:layout_below="@id/fsfButton"
android:layout_centerHorizontal="true"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
......@@ -191,7 +203,7 @@
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/_separator"
android:layout_above="@+id/footer"
android:layout_below="@id/firstService"
android:layout_below="@id/fsfButton"
android:layout_marginLeft="6dp"
android:weightSum="60">
......@@ -264,7 +276,7 @@
android:layout_height="wrap_content"
android:layout_toRightOf="@id/_separator"
android:layout_above="@+id/footer"
android:layout_below="@id/firstService"
android:layout_below="@id/fsfButton"
android:layout_marginRight="6dp"
android:weightSum="60">
......
......@@ -43,7 +43,7 @@
android:visibility="gone"/>
<TextView
android:id="@+id/firstService"
android:id="@+id/fsfButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/refereeingType"
......
......@@ -33,5 +33,6 @@
<string name="test">Faute <sup>1er</sup> Service</string>
<string name="ace">ACE</string>
<string name="POINT">POINT</string>
<string name="FIRST_SERVE_FAULT">FIRST SERVE FAULT</string>
</resources>
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