From c7691639e4175941cf2c2888db78a91043562db1 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Tue, 3 Dec 2019 15:24:31 +0100 Subject: [PATCH] Statistiques personnelles (points) --- app/src/main/java/fr/ynerant/tarot/Game.java | 176 ++++++++++++++++-- .../java/fr/ynerant/tarot/MainActivity.java | 3 +- .../main/java/fr/ynerant/tarot/Player.java | 49 +++-- .../ynerant/tarot/ui/home/HomeFragment.java | 1 - .../ynerant/tarot/ui/home/HomeViewModel.java | 3 - .../tarot/ui/newgame/NewGameFragment.java | 63 ++++--- .../tarot/ui/newgame/NewGameViewModel.java | 3 - .../tarot/ui/stats/PersonalStatsFragment.java | 70 +++++++ .../ui/stats/PersonalStatsMenuFragment.java | 76 ++++++++ .../ui/stats/PersonalStatsMenuModel.java | 6 + .../tarot/ui/stats/PersonalStatsModel.java | 6 + .../res/layout/fragment_personal_stats.xml | 69 +++++++ .../layout/fragment_personal_stats_menu.xml | 12 ++ .../main/res/menu/activity_main_drawer.xml | 10 +- .../main/res/navigation/mobile_navigation.xml | 6 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 17 files changed, 477 insertions(+), 78 deletions(-) create mode 100644 app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsFragment.java create mode 100644 app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsMenuFragment.java create mode 100644 app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsMenuModel.java create mode 100644 app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsModel.java create mode 100644 app/src/main/res/layout/fragment_personal_stats.xml create mode 100644 app/src/main/res/layout/fragment_personal_stats_menu.xml diff --git a/app/src/main/java/fr/ynerant/tarot/Game.java b/app/src/main/java/fr/ynerant/tarot/Game.java index 1a33018..8d1e2ed 100644 --- a/app/src/main/java/fr/ynerant/tarot/Game.java +++ b/app/src/main/java/fr/ynerant/tarot/Game.java @@ -15,7 +15,11 @@ import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -25,20 +29,25 @@ public class Game { private static final Gson GSON; private static final SparseArray GAMES = new SparseArray<>(); - public int id; - public GameType gameType; - public List players; - public Bet bet; - public Player attacker; - public Player follower; - public int attackScore; -// public boolean little, twenty_one, excuse; - public int ends; - public int handle; - public List miseries; - public boolean littleForAttacker, littleForDefenser; - public boolean chelemAnnounced, chelemRealized; - public List points; + private int id; + private Date date; + private GameType gameType; + private Player player1, player2, player3, player4, player5, player6; + private List players; + private int nb_players; + private Bet bet; + private Player attacker; + private Player follower; + private int attackScore; +// private boolean little, twenty_one, excuse; + private int ends; + private int handle; + private boolean misery1, misery2, misery3, misery4, misery5, misery6; + private List miseries; + private boolean littleForAttacker, littleForDefender; + private boolean chelemAnnounced, chelemRealized; + private int score1, score2, score3, score4, score5, score6; + private List points; static { GSON = new GsonBuilder().registerTypeAdapter(Player.class, new TypeAdapter() { @@ -57,7 +66,12 @@ public class Game { return null; } - return Player.getPlayerById(in.nextInt()); + int id = in.nextInt(); + + if (id == 0) + return null; + + return Player.getPlayerById(id); } }).registerTypeAdapter(Game.GameType.class, new TypeAdapter() { @Override @@ -77,6 +91,26 @@ public class Game { return Game.GameType.values()[3 + in.nextInt()]; } + }).registerTypeAdapter(Date.class, new TypeAdapter() { + final DateFormat FORMAT = new SimpleDateFormat("yyyy-mm-dd HH:MM:ss"); + + @Override + public void write(JsonWriter out, Date value) throws IOException { + if (value == null) + out.nullValue(); + else + out.value(FORMAT.format(value)); + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + return FORMAT.parse(in.nextString()); + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + } }).create(); } @@ -84,58 +118,122 @@ public class Game { return id; } + public Date getDate() { + return date; + } + public GameType getGameType() { return gameType; } + public void setGameType(GameType gameType) { + this.gameType = gameType; + } + public List getPlayers() { return players; } + public void setPlayers(List players) { + this.players = players; + } + public Bet getBet() { return bet; } + public void setBet(Bet bet) { + this.bet = bet; + } + public Player getAttacker() { return attacker; } + public void setAttacker(Player attacker) { + this.attacker = attacker; + } + public Player getFollower() { return follower; } + public void setFollower(Player follower) { + this.follower = follower; + } + public int getAttackScore() { return attackScore; } + public void setAttackScore(int attackScore) { + this.attackScore = attackScore; + } + public int getEnds() { return ends; } + public void setEnds(int ends) { + this.ends = ends; + } + public int getHandle() { return handle; } + public void setHandle(int handle) { + this.handle = handle; + } + public List getMiseries() { return miseries; } + public void setMiseries(List miseries) { + this.miseries = miseries; + } + public boolean isLittleForAttacker() { return littleForAttacker; } - public boolean isLittleForDefenser() { - return littleForDefenser; + public void setLittleForAttacker(boolean littleForAttacker) { + this.littleForAttacker = littleForAttacker; + } + + public boolean isLittleForDefender() { + return littleForDefender; + } + + public void setLittleForDefender(boolean littleForDefender) { + this.littleForDefender = littleForDefender; } public boolean isChelemAnnounced() { return chelemAnnounced; } + public void setChelemAnnounced(boolean chelemAnnounced) { + this.chelemAnnounced = chelemAnnounced; + } + public boolean isChelemRealized() { return chelemRealized; } + public void setChelemRealized(boolean chelemRealized) { + this.chelemRealized = chelemRealized; + } + + public int getPoints(Player player) { + return points.get(players.indexOf(player)); + } + + public int getPoints(int i) { + return points.get(i); + } + public void calculateScores() { // int ends = (little ? 1 : 0) + (twenty_one ? 1 : 0) + (excuse ? 1 : 0); int bound = ends == 0 ? 56 : ends == 1 ? 51 : ends == 2 ? 41 : 36; @@ -154,7 +252,7 @@ public class Game { if (littleForAttacker) score += 10; - else if (littleForDefenser) + else if (littleForDefender) score -= 10; if (chelemAnnounced) { @@ -187,7 +285,6 @@ public class Game { } for (int i = 0; i < getGameType().getNbPlayers(); ++i) { - System.err.println(getMiseries()); if (getMiseries().get(i)) { //noinspection ConstantConditions scores.put(players.get(i), scores.get(players.get(i)) + 10 * (getGameType().getNbPlayers() - 1)); @@ -278,6 +375,47 @@ public class Game { GAMES.clear(); for (Game g : games) { GAMES.put(g.getId(), g); + + g.setGameType(GameType.values()[g.nb_players - 3]); + + g.players = new ArrayList<>(); + g.getPlayers().add(g.player1); + g.getPlayers().add(g.player2); + g.getPlayers().add(g.player3); + if (g.player4 != null) + g.getPlayers().add(g.player4); + if (g.player5 != null) + g.getPlayers().add(g.player5); + if (g.player6 != null) + g.getPlayers().add(g.player6); + + g.miseries = new ArrayList<>(); + g.getMiseries().add(g.misery1); + g.getMiseries().add(g.misery2); + g.getMiseries().add(g.misery3); + if (g.player4 != null) + g.getMiseries().add(g.misery4); + if (g.player5 != null) + g.getMiseries().add(g.misery5); + if (g.player6 != null) + g.getMiseries().add(g.misery6); + + g.points = new ArrayList<>(); + g.points.add(g.score1); + g.points.add(g.score2); + g.points.add(g.score3); + if (g.player4 != null) + g.points.add(g.score4); + if (g.player5 != null) + g.points.add(g.score5); + if (g.player6 != null) + g.points.add(g.score6); + + System.out.println(g.toJson()); + + for (Player p : g.getPlayers()) { + p.addScore(g.getGameType(), g.getPoints(p)); + } } } catch (IOException ex) { diff --git a/app/src/main/java/fr/ynerant/tarot/MainActivity.java b/app/src/main/java/fr/ynerant/tarot/MainActivity.java index be9c360..cd16c44 100644 --- a/app/src/main/java/fr/ynerant/tarot/MainActivity.java +++ b/app/src/main/java/fr/ynerant/tarot/MainActivity.java @@ -28,7 +28,6 @@ public class MainActivity extends AppCompatActivity { INSTANCE = this; Player.updatePlayers(); - Game.updateGames(); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); @@ -38,7 +37,7 @@ public class MainActivity extends AppCompatActivity { // Passing each menu ID as a set of Ids because each // menu should be considered as top level destinations. mAppBarConfiguration = new AppBarConfiguration.Builder( - R.id.nav_new_game) + R.id.nav_new_game, R.id.nav_personal_stats) .setDrawerLayout(drawer) .build(); NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); diff --git a/app/src/main/java/fr/ynerant/tarot/Player.java b/app/src/main/java/fr/ynerant/tarot/Player.java index fc53c25..32eb923 100644 --- a/app/src/main/java/fr/ynerant/tarot/Player.java +++ b/app/src/main/java/fr/ynerant/tarot/Player.java @@ -9,8 +9,6 @@ import androidx.annotation.NonNull; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import org.apache.commons.io.IOUtils; - import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; @@ -41,20 +39,40 @@ public class Player { return name; } - public int getScore3() { - return score3; + public int getScore(Game.GameType type) { + switch (type) { + case THREE_PLAYERS: + return score3; + case FOUR_PLAYERS: + return score4; + case FIVE_PLAYERS: + return score5; + case SIX_PLAYERS: + return score6; + default: + return 0; + } } - public int getScore4() { - return score4; + public void setScore(Game.GameType type, int score) { + switch (type) { + case THREE_PLAYERS: + score3 = score; + break; + case FOUR_PLAYERS: + score4 = score; + break; + case FIVE_PLAYERS: + score5 = score; + break; + case SIX_PLAYERS: + score6 = score; + break; + } } - public int getScore5() { - return score5; - } - - public int getScore6() { - return score6; + public void addScore(Game.GameType type, int score) { + setScore(type, getScore(type) + score); } @Override @@ -62,7 +80,8 @@ public class Player { return obj instanceof Player && ((Player) obj).getId() == getId(); } - public static void updatePlayers() { + public static void updatePlayers() { + System.err.println(getAllPlayers()); Executors.newSingleThreadExecutor().execute(new Runnable() { @Override public void run() { @@ -87,13 +106,15 @@ public class Player { Toast.makeText(MainActivity.INSTANCE, "Bienvenue " + THIS_PLAYER.getName() + " !", Toast.LENGTH_SHORT).show(); } }); + + Game.updateGames(); } catch (IOException ex) { ex.printStackTrace(); } } }); - } + } public static Collection getAllPlayers() { return PLAYERS.values(); diff --git a/app/src/main/java/fr/ynerant/tarot/ui/home/HomeFragment.java b/app/src/main/java/fr/ynerant/tarot/ui/home/HomeFragment.java index b7595fb..d9c2181 100644 --- a/app/src/main/java/fr/ynerant/tarot/ui/home/HomeFragment.java +++ b/app/src/main/java/fr/ynerant/tarot/ui/home/HomeFragment.java @@ -83,7 +83,6 @@ public class HomeFragment extends Fragment { int id = map.getOrDefault("id", 0); PreferenceManager.getDefaultSharedPreferences(root.getContext()).edit().putString("token", token.getText().toString()).putInt("user_id", id).apply(); Player.updatePlayers(); - Game.updateGames(); //noinspection ConstantConditions getFragmentManager().beginTransaction().replace(R.id.nav_host_fragment, new NewGameFragment(), "Nouvelle partie").commit(); } diff --git a/app/src/main/java/fr/ynerant/tarot/ui/home/HomeViewModel.java b/app/src/main/java/fr/ynerant/tarot/ui/home/HomeViewModel.java index ecb0388..7743eca 100644 --- a/app/src/main/java/fr/ynerant/tarot/ui/home/HomeViewModel.java +++ b/app/src/main/java/fr/ynerant/tarot/ui/home/HomeViewModel.java @@ -3,7 +3,4 @@ package fr.ynerant.tarot.ui.home; import androidx.lifecycle.ViewModel; public class HomeViewModel extends ViewModel { - - public HomeViewModel() { - } } \ No newline at end of file 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 bfafd19..2e239ad 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 @@ -132,29 +132,29 @@ public class NewGameFragment extends Fragment { Game game = getGame(); for (int i = 0; i < game.getGameType().getNbPlayers(); ++i) { - points[i].setText(String.valueOf(game.points.get(i))); + points[i].setText(String.valueOf(game.getPoints(i))); } } - public Game getGame() { + Game getGame() { Game game = new Game(); - game.gameType = Game.GameType.getGameType(nb_players.getProgress() + 3); - game.attacker = (Player) attacker.getSelectedItem(); + game.setGameType(Game.GameType.getGameType(nb_players.getProgress() + 3)); + game.setAttacker((Player) attacker.getSelectedItem()); if (game.getGameType().getNbPlayers() >= 5) - game.follower = (Player) follower.getSelectedItem(); - game.attackScore = attack_points.getProgress(); - game.players = players; - game.bet = Game.Bet.values()[bet.getProgress()]; - game.ends = nb_ends.getProgress(); - game.handle = handle.getProgress(); - game.chelemAnnounced = chelem_announced.isChecked(); - game.chelemRealized = chelem_realized.isChecked(); - game.littleForAttacker = little_end.getProgress() == 1; - game.littleForDefenser = little_end.getProgress() == 2; + game.setFollower((Player) follower.getSelectedItem()); + game.setAttackScore(attack_points.getProgress()); + game.setPlayers(players); + game.setBet(Game.Bet.values()[bet.getProgress()]); + game.setEnds(nb_ends.getProgress()); + game.setHandle(handle.getProgress()); + game.setChelemAnnounced(chelem_announced.isChecked()); + game.setChelemRealized(chelem_realized.isChecked()); + game.setLittleForAttacker(little_end.getProgress() == 1); + game.setLittleForDefender(little_end.getProgress() == 2); List miseriesList = new ArrayList<>(); for (int i = 0; i < game.getGameType().getNbPlayers(); ++i) miseriesList.add(miseries[i].isChecked()); - game.miseries = miseriesList; + game.setMiseries(miseriesList); game.calculateScores(); return game; @@ -490,9 +490,10 @@ public class NewGameFragment extends Fragment { co.setRequestProperty("token", PreferenceManager.getDefaultSharedPreferences(MainActivity.INSTANCE).getString("token", null)); co.setRequestProperty("json", g.toJson()); co.connect(); - System.out.println(g.toJson()); - System.err.println(IOUtils.readLines(co.getInputStream())); + co.getResponseCode(); co.disconnect(); + + Game.updateGames(); } catch (IOException ex) { ex.printStackTrace(); } @@ -501,25 +502,25 @@ public class NewGameFragment extends Fragment { } - public Game getGame() { + Game getGame() { Game game = new Game(); - game.gameType = Game.GameType.getGameType(nb_players.getProgress() + 3); - game.attacker = (Player) attacker.getSelectedItem(); + game.setGameType(Game.GameType.getGameType(nb_players.getProgress() + 3)); + game.setAttacker((Player) attacker.getSelectedItem()); if (game.getGameType().getNbPlayers() >= 5) - game.follower = (Player) follower.getSelectedItem(); - game.attackScore = attack_points.getProgress(); - game.players = players; - game.bet = Game.Bet.values()[bet.getProgress()]; - game.ends = nb_ends.getProgress(); - game.handle = handle.getProgress(); - game.chelemAnnounced = chelem_announced.isChecked(); - game.chelemRealized = chelem_realized.isChecked(); - game.littleForAttacker = little_end.getProgress() == 1; - game.littleForDefenser = little_end.getProgress() == 2; + game.setFollower((Player) follower.getSelectedItem()); + game.setAttackScore(attack_points.getProgress()); + game.setPlayers(players); + game.setBet(Game.Bet.values()[bet.getProgress()]); + game.setEnds(nb_ends.getProgress()); + game.setHandle(handle.getProgress()); + game.setChelemAnnounced(chelem_announced.isChecked()); + game.setChelemRealized(chelem_realized.isChecked()); + game.setLittleForAttacker(little_end.getProgress() == 1); + game.setLittleForDefender(little_end.getProgress() == 2); List miseriesList = new ArrayList<>(); for (int i = 0; i < game.getGameType().getNbPlayers(); ++i) miseriesList.add(miseries[i].isChecked()); - game.miseries = miseriesList; + game.setMiseries(miseriesList); game.calculateScores(); return game; diff --git a/app/src/main/java/fr/ynerant/tarot/ui/newgame/NewGameViewModel.java b/app/src/main/java/fr/ynerant/tarot/ui/newgame/NewGameViewModel.java index b55aba6..c3e0bab 100644 --- a/app/src/main/java/fr/ynerant/tarot/ui/newgame/NewGameViewModel.java +++ b/app/src/main/java/fr/ynerant/tarot/ui/newgame/NewGameViewModel.java @@ -3,7 +3,4 @@ package fr.ynerant.tarot.ui.newgame; import androidx.lifecycle.ViewModel; public class NewGameViewModel extends ViewModel { - - public NewGameViewModel() { - } } \ No newline at end of file diff --git a/app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsFragment.java b/app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsFragment.java new file mode 100644 index 0000000..813740e --- /dev/null +++ b/app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsFragment.java @@ -0,0 +1,70 @@ +package fr.ynerant.tarot.ui.stats; + +import android.os.Bundle; +import android.preference.PreferenceManager; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.CompoundButton; +import android.widget.LinearLayout; +import android.widget.ListAdapter; +import android.widget.ListView; +import android.widget.SeekBar; +import android.widget.Spinner; +import android.widget.Switch; +import android.widget.TextView; +import android.widget.Toast; +import android.widget.ToggleButton; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.lifecycle.ViewModelProviders; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.Executors; + +import fr.ynerant.tarot.Game; +import fr.ynerant.tarot.MainActivity; +import fr.ynerant.tarot.Player; +import fr.ynerant.tarot.R; +import fr.ynerant.tarot.ui.home.HomeFragment; + +public class PersonalStatsFragment extends Fragment { + + private PersonalStatsModel personalStatsModel; + + public View onCreateView(@NonNull LayoutInflater inflater, + ViewGroup container, final Bundle savedInstanceState) { + personalStatsModel = + ViewModelProviders.of(this).get(PersonalStatsModel.class); + final View root = inflater.inflate(R.layout.fragment_personal_stats, container, false); + + if (PreferenceManager.getDefaultSharedPreferences(MainActivity.INSTANCE).getString("token", null) == null) { + //noinspection ConstantConditions + getFragmentManager().beginTransaction().replace(R.id.nav_host_fragment, new HomeFragment(), "Se connecter").commit(); + return root; + } + + //noinspection ConstantConditions + Player player = Player.getPlayerById(getArguments().getInt("playerId")); + + TextView points3 = root.findViewById(R.id.points3); + TextView points4 = root.findViewById(R.id.points4); + TextView points5 = root.findViewById(R.id.points5); + TextView points6 = root.findViewById(R.id.points6); + + points3.setText(String.valueOf(player.getScore(Game.GameType.THREE_PLAYERS))); + points4.setText(String.valueOf(player.getScore(Game.GameType.FOUR_PLAYERS))); + points5.setText(String.valueOf(player.getScore(Game.GameType.FIVE_PLAYERS))); + points6.setText(String.valueOf(player.getScore(Game.GameType.SIX_PLAYERS))); + + return root; + } +} \ No newline at end of file diff --git a/app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsMenuFragment.java b/app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsMenuFragment.java new file mode 100644 index 0000000..331ae6c --- /dev/null +++ b/app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsMenuFragment.java @@ -0,0 +1,76 @@ +package fr.ynerant.tarot.ui.stats; + +import android.os.Bundle; +import android.preference.PreferenceManager; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.CompoundButton; +import android.widget.LinearLayout; +import android.widget.ListAdapter; +import android.widget.ListView; +import android.widget.SeekBar; +import android.widget.Spinner; +import android.widget.Switch; +import android.widget.TextView; +import android.widget.Toast; +import android.widget.ToggleButton; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.lifecycle.ViewModelProviders; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.Executors; + +import fr.ynerant.tarot.Game; +import fr.ynerant.tarot.MainActivity; +import fr.ynerant.tarot.Player; +import fr.ynerant.tarot.R; +import fr.ynerant.tarot.ui.home.HomeFragment; + +public class PersonalStatsMenuFragment extends Fragment { + + private PersonalStatsMenuModel personalStatsMenuModel; + + public View onCreateView(@NonNull LayoutInflater inflater, + ViewGroup container, final Bundle savedInstanceState) { + personalStatsMenuModel = + ViewModelProviders.of(this).get(PersonalStatsMenuModel.class); + final View root = inflater.inflate(R.layout.fragment_personal_stats_menu, container, false); + + if (PreferenceManager.getDefaultSharedPreferences(MainActivity.INSTANCE).getString("token", null) == null) { + //noinspection ConstantConditions + getFragmentManager().beginTransaction().replace(R.id.nav_host_fragment, new HomeFragment(), "Se connecter").commit(); + return root; + } + + ListView players = root.findViewById(R.id.players_stats); + //noinspection ConstantConditions + final ListAdapter adapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_expandable_list_item_1, new ArrayList<>(Player.getAllPlayers())); + players.setAdapter(adapter); + + players.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + Player player = (Player) adapter.getItem(position); + PersonalStatsFragment fragment = new PersonalStatsFragment(); + Bundle bundle = new Bundle(); + bundle.putInt("playerId", player.getId()); + fragment.setArguments(bundle); + //noinspection ConstantConditions + getFragmentManager().beginTransaction().replace(R.id.nav_host_fragment, fragment, "Statistiques individuelles de " + player.getName()) + .addToBackStack("Statistiques individuelles").commit(); + } + }); + + return root; + } +} \ No newline at end of file diff --git a/app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsMenuModel.java b/app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsMenuModel.java new file mode 100644 index 0000000..85ec5ac --- /dev/null +++ b/app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsMenuModel.java @@ -0,0 +1,6 @@ +package fr.ynerant.tarot.ui.stats; + +import androidx.lifecycle.ViewModel; + +public class PersonalStatsMenuModel extends ViewModel { +} \ No newline at end of file diff --git a/app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsModel.java b/app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsModel.java new file mode 100644 index 0000000..98d27e3 --- /dev/null +++ b/app/src/main/java/fr/ynerant/tarot/ui/stats/PersonalStatsModel.java @@ -0,0 +1,6 @@ +package fr.ynerant.tarot.ui.stats; + +import androidx.lifecycle.ViewModel; + +public class PersonalStatsModel extends ViewModel { +} diff --git a/app/src/main/res/layout/fragment_personal_stats.xml b/app/src/main/res/layout/fragment_personal_stats.xml new file mode 100644 index 0000000..ccb1cc7 --- /dev/null +++ b/app/src/main/res/layout/fragment_personal_stats.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_personal_stats_menu.xml b/app/src/main/res/layout/fragment_personal_stats_menu.xml new file mode 100644 index 0000000..ff3c030 --- /dev/null +++ b/app/src/main/res/layout/fragment_personal_stats_menu.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/activity_main_drawer.xml b/app/src/main/res/menu/activity_main_drawer.xml index 4f14d62..3b45163 100644 --- a/app/src/main/res/menu/activity_main_drawer.xml +++ b/app/src/main/res/menu/activity_main_drawer.xml @@ -4,15 +4,15 @@ tools:showIn="navigation_view"> - - + + diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml index d34a46b..150a749 100644 --- a/app/src/main/res/navigation/mobile_navigation.xml +++ b/app/src/main/res/navigation/mobile_navigation.xml @@ -16,4 +16,10 @@ android:name="fr.ynerant.tarot.ui.newgame.NewGameFragment" android:label="@string/menu_new_game" tools:layout="@layout/fragment_new_game" /> + + \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index c9505c8..7f316ed 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -35,4 +35,5 @@ 4 joueurs 5 joueurs 6 joueurs + Statistiques individuelles \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9c70bce..2ad3e46 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -35,4 +35,5 @@ 4 joueurs 5 joueurs 6 joueurs + Statistiques individuelles