diff --git a/app/build.gradle b/app/build.gradle index e950aab..81afac8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "fr.ynerant.tarot" minSdkVersion 24 targetSdkVersion 29 - versionCode 2 - versionName "0.0.1" + versionCode 3 + versionName "0.1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/src/main/java/fr/ynerant/tarot/ui/newgame/NewGameFragment.java b/app/src/main/java/fr/ynerant/tarot/ui/newgame/NewGameFragment.java index 3f76692..0e7d3f9 100644 --- a/app/src/main/java/fr/ynerant/tarot/ui/newgame/NewGameFragment.java +++ b/app/src/main/java/fr/ynerant/tarot/ui/newgame/NewGameFragment.java @@ -133,6 +133,13 @@ public class NewGameFragment extends Fragment { final TextView points5 = root.findViewById(R.id.player5_points); final TextView points6 = root.findViewById(R.id.player6_points); final TextView[] points = new TextView[]{points1, points2, points3, points4, points5, points6}; + final TextView totalPoints1 = root.findViewById(R.id.player1_total_points); + final TextView totalPoints2 = root.findViewById(R.id.player2_total_points); + final TextView totalPoints3 = root.findViewById(R.id.player3_total_points); + final TextView totalPoints4 = root.findViewById(R.id.player4_total_points); + final TextView totalPoints5 = root.findViewById(R.id.player5_total_points); + final TextView totalPoints6 = root.findViewById(R.id.player6_total_points); + final TextView[] totalPoints = new TextView[]{totalPoints1, totalPoints2, totalPoints3, totalPoints4, totalPoints5, totalPoints6}; final TextView points1Text = root.findViewById(R.id.player1_points_text); final TextView points2Text = root.findViewById(R.id.player2_points_text); final TextView points3Text = root.findViewById(R.id.player3_points_text); @@ -203,6 +210,7 @@ public class NewGameFragment extends Fragment { miseryTexts[i].setText(((Player) spinners[i].getSelectedItem()).getName()); pointsText[i].setText(((Player) spinners[i].getSelectedItem()).getName()); handleTexts[i].setText(((Player) spinners[i].getSelectedItem()).getName()); + totalPoints[i].setText(String.valueOf(((Player) spinners[i].getSelectedItem()).getScore(Game.GameType.values()[nb_players.getProgress()]))); } updateScore.run(); @@ -267,6 +275,7 @@ public class NewGameFragment extends Fragment { misery4.setVisibility(View.GONE); points4Text.setVisibility(View.GONE); points4.setVisibility(View.GONE); + totalPoints4.setVisibility(View.GONE); player5_layout.setVisibility(View.GONE); handle5Text.setVisibility(View.GONE); handle5.setVisibility(View.GONE); @@ -274,6 +283,7 @@ public class NewGameFragment extends Fragment { misery5.setVisibility(View.GONE); points5Text.setVisibility(View.GONE); points5.setVisibility(View.GONE); + totalPoints5.setVisibility(View.GONE); player6_layout.setVisibility(View.GONE); handle6Text.setVisibility(View.GONE); handle6.setVisibility(View.GONE); @@ -281,6 +291,7 @@ public class NewGameFragment extends Fragment { misery6.setVisibility(View.GONE); points6Text.setVisibility(View.GONE); points6.setVisibility(View.GONE); + totalPoints6.setVisibility(View.GONE); follower_layout.setVisibility(View.GONE); switch (progress + 3) { @@ -292,6 +303,7 @@ public class NewGameFragment extends Fragment { misery6.setVisibility(View.VISIBLE); points6Text.setVisibility(View.VISIBLE); points6.setVisibility(View.VISIBLE); + totalPoints6.setVisibility(View.VISIBLE); case 5: player5_layout.setVisibility(View.VISIBLE); handle5Text.setVisibility(View.VISIBLE); @@ -300,6 +312,7 @@ public class NewGameFragment extends Fragment { misery5.setVisibility(View.VISIBLE); points5Text.setVisibility(View.VISIBLE); points5.setVisibility(View.VISIBLE); + totalPoints5.setVisibility(View.VISIBLE); follower_layout.setVisibility(View.VISIBLE); case 4: player4_layout.setVisibility(View.VISIBLE); @@ -309,11 +322,15 @@ public class NewGameFragment extends Fragment { misery4.setVisibility(View.VISIBLE); points4Text.setVisibility(View.VISIBLE); points4.setVisibility(View.VISIBLE); + totalPoints4.setVisibility(View.VISIBLE); } little_end.setMax(progress + 3); + for (int i = 0; i < 6; ++i) + totalPoints[i].setText(String.valueOf(((Player) spinners[i].getSelectedItem()).getScore(Game.GameType.values()[nb_players.getProgress()]))); + updatePlayers.onItemSelected(null, null, 0, 0); updateScore.run(); } @@ -490,7 +507,6 @@ public class NewGameFragment extends Fragment { co.setRequestProperty("json", g.toJson()); co.connect(); co.getResponseCode(); - System.out.println(IOUtils.readLines(co.getInputStream())); co.disconnect(); Game.updateGames(); diff --git a/app/src/main/res/layout/fragment_new_game.xml b/app/src/main/res/layout/fragment_new_game.xml index 769b833..71218bb 100644 --- a/app/src/main/res/layout/fragment_new_game.xml +++ b/app/src/main/res/layout/fragment_new_game.xml @@ -694,6 +694,49 @@ android:visibility="gone" /> + + + + + + + + + + + + + + +