Skip to content

Commit

Permalink
Add display for games with nonMovementPhaseLength.
Browse files Browse the repository at this point in the history
  • Loading branch information
tttppp committed May 2, 2020
1 parent 35a5985 commit fadafab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions app/src/main/java/se/oort/diplicity/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,11 @@ public static String minutesToDuration(int mins) {
return timeLabel.toString();
}

public static String makePhaseLengthString(int movementPhaseLength, int nonMovementPhaseLength) {
String phaseLengthString = minutesToDuration(movementPhaseLength);
if (nonMovementPhaseLength != 0 && nonMovementPhaseLength != movementPhaseLength) {
phaseLengthString += "/" + minutesToDuration(nonMovementPhaseLength);
}
return phaseLengthString;
}
}
4 changes: 3 additions & 1 deletion app/src/main/java/se/oort/diplicity/GamesAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,9 @@ public void bind(final SingleContainer<Game> game, final int pos) {

variant.setText(makeVariantText(game.Properties.Variant));

deadline.setText(App.minutesToDuration(game.Properties.PhaseLengthMinutes.intValue()));
Long nonMovementPhaseLengthLong = game.Properties.NonMovementPhaseLengthMinutes;
int nonMovementPhaseLength = (nonMovementPhaseLengthLong != null ? nonMovementPhaseLengthLong.intValue() : 0);
deadline.setText(App.makePhaseLengthString(game.Properties.PhaseLengthMinutes.intValue(), nonMovementPhaseLength));

if (
game.Properties.Started &&
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/se/oort/diplicity/apigen/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class Game implements java.io.Serializable {
public String Desc;
public String Variant;
public Long PhaseLengthMinutes;
public Long NonMovementPhaseLengthMinutes;
public Double MaxHated;
public Double MaxHater;
public Double MinRating;
Expand Down

1 comment on commit fadafab

@zond
Copy link
Owner

@zond zond commented on fadafab May 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woohoo! Thanks!

Please sign in to comment.