From fadafab14a587426fe9b137c241f4664cd022bfa Mon Sep 17 00:00:00 2001 From: tttppp Date: Sat, 2 May 2020 18:21:38 +0100 Subject: [PATCH] Add display for games with nonMovementPhaseLength. --- app/src/main/java/se/oort/diplicity/App.java | 7 +++++++ app/src/main/java/se/oort/diplicity/GamesAdapter.java | 4 +++- app/src/main/java/se/oort/diplicity/apigen/Game.java | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/se/oort/diplicity/App.java b/app/src/main/java/se/oort/diplicity/App.java index d2a780d..dcf0c45 100644 --- a/app/src/main/java/se/oort/diplicity/App.java +++ b/app/src/main/java/se/oort/diplicity/App.java @@ -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; + } } diff --git a/app/src/main/java/se/oort/diplicity/GamesAdapter.java b/app/src/main/java/se/oort/diplicity/GamesAdapter.java index a8c21e6..a872346 100644 --- a/app/src/main/java/se/oort/diplicity/GamesAdapter.java +++ b/app/src/main/java/se/oort/diplicity/GamesAdapter.java @@ -302,7 +302,9 @@ public void bind(final SingleContainer 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 && diff --git a/app/src/main/java/se/oort/diplicity/apigen/Game.java b/app/src/main/java/se/oort/diplicity/apigen/Game.java index 957b30c..b2e2ea5 100644 --- a/app/src/main/java/se/oort/diplicity/apigen/Game.java +++ b/app/src/main/java/se/oort/diplicity/apigen/Game.java @@ -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;