From daec6ee8149001c87c54e536d43221396f8e5a76 Mon Sep 17 00:00:00 2001 From: Oskar Wiksten Date: Sat, 6 Jul 2013 11:02:13 +0200 Subject: [PATCH] Basic UI styling for game statistics --- .../res/drawable/ui_headerbackground.xml | 4 + AndorsTrail/res/layout/heroinfo_stats.xml | 78 ++++++------------- .../res/layout/heroinfo_stats_gamestats.xml | 53 +++++++++++++ AndorsTrail/res/values/strings.xml | 10 +-- AndorsTrail/res/values/styles.xml | 6 ++ AndorsTrail/res/values/ui_styles.xml | 7 ++ .../fragment/HeroinfoActivity_Stats.java | 21 +++-- 7 files changed, 114 insertions(+), 65 deletions(-) create mode 100644 AndorsTrail/res/drawable/ui_headerbackground.xml create mode 100644 AndorsTrail/res/layout/heroinfo_stats_gamestats.xml create mode 100644 AndorsTrail/res/values/styles.xml diff --git a/AndorsTrail/res/drawable/ui_headerbackground.xml b/AndorsTrail/res/drawable/ui_headerbackground.xml new file mode 100644 index 000000000..db308381b --- /dev/null +++ b/AndorsTrail/res/drawable/ui_headerbackground.xml @@ -0,0 +1,4 @@ + + + + diff --git a/AndorsTrail/res/layout/heroinfo_stats.xml b/AndorsTrail/res/layout/heroinfo_stats.xml index 760b16f1b..cc0844fc2 100644 --- a/AndorsTrail/res/layout/heroinfo_stats.xml +++ b/AndorsTrail/res/layout/heroinfo_stats.xml @@ -58,8 +58,14 @@ + android:text="@string/actorinfo_currenttraits" + style="@style/actorinfo_sectionheader" + /> + + style="@style/actorinfo_sectionheader" + /> + style="@style/actorinfo_sectionheader" + /> + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/AndorsTrail/res/layout/heroinfo_stats_gamestats.xml b/AndorsTrail/res/layout/heroinfo_stats_gamestats.xml new file mode 100644 index 000000000..982c1ba33 --- /dev/null +++ b/AndorsTrail/res/layout/heroinfo_stats_gamestats.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AndorsTrail/res/values/strings.xml b/AndorsTrail/res/values/strings.xml index 441f5048e..a09f53e62 100644 --- a/AndorsTrail/res/values/strings.xml +++ b/AndorsTrail/res/values/strings.xml @@ -652,14 +652,14 @@ Every skill level increases the attack chance of weapons with %1$d %% of their o This is a development version of Andor\'s Trail. Savegames produced by this version are incompatible with the release version. This is a prerelease version of Andor\'s Trail. Savegames produced by this version might not be compatible with the release version. Game statistics - Number of completed quests + Completed quests Times fallen unconscious Gold spent in shops - Number of Bonemeal potions used - Number of items used - Number of places visited + Bonemeal potions used + Items used + Places visited Most commonly used item - Number of monsters killed + Monsters killed Most powerful monster killed Most commonly killed monsters %1$s (%2$d) diff --git a/AndorsTrail/res/values/styles.xml b/AndorsTrail/res/values/styles.xml new file mode 100644 index 000000000..a50055dbb --- /dev/null +++ b/AndorsTrail/res/values/styles.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/AndorsTrail/res/values/ui_styles.xml b/AndorsTrail/res/values/ui_styles.xml index 277a1c20a..287b6faa9 100644 --- a/AndorsTrail/res/values/ui_styles.xml +++ b/AndorsTrail/res/values/ui_styles.xml @@ -44,4 +44,11 @@ + + + + \ No newline at end of file diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/fragment/HeroinfoActivity_Stats.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/fragment/HeroinfoActivity_Stats.java index 2c4038429..a632f9c48 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/fragment/HeroinfoActivity_Stats.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/fragment/HeroinfoActivity_Stats.java @@ -174,24 +174,31 @@ public final class HeroinfoActivity_Stats extends Fragment { updateStatsTableRow(world.model.statistics.getNumberOfUsedItems(), R.id.heroinfo_gamestats_num_used_items, R.id.heroinfo_gamestats_num_used_items_row); updateStatsTableRow(world.model.statistics.getNumberOfUsedBonemealPotions(), R.id.heroinfo_gamestats_bonemeals, R.id.heroinfo_gamestats_bonemeals_row); updateStatsTableRow(world.model.statistics.getNumberOfKilledMonsters(), R.id.heroinfo_gamestats_num_killed_monsters, R.id.heroinfo_gamestats_num_killed_monsters_row); - updateStatsTableRow(world.model.statistics.getMostCommonlyUsedItem(world, res), R.id.heroinfo_gamestats_fav_item, R.id.heroinfo_gamestats_fav_item_row); - updateStatsTableRow(world.model.statistics.getMostPowerfulKilledMonster(world), R.id.heroinfo_gamestats_top_boss, R.id.heroinfo_gamestats_top_boss_row); - updateStatsTableRow(world.model.statistics.getTop5MostCommonlyKilledMonsters(world, res), R.id.heroinfo_gamestats_fav_monsters, R.id.heroinfo_gamestats_fav_monsters_row); + updateStatsTableRow(world.model.statistics.getMostCommonlyUsedItem(world, res), R.id.heroinfo_gamestats_fav_item, R.id.heroinfo_gamestats_fav_item_row1, R.id.heroinfo_gamestats_fav_item_row2); + updateStatsTableRow(world.model.statistics.getMostPowerfulKilledMonster(world), R.id.heroinfo_gamestats_top_boss, R.id.heroinfo_gamestats_top_boss_row1, R.id.heroinfo_gamestats_top_boss_row2); + updateStatsTableRow(world.model.statistics.getTop5MostCommonlyKilledMonsters(world, res), R.id.heroinfo_gamestats_fav_monsters, R.id.heroinfo_gamestats_fav_monsters_row1, R.id.heroinfo_gamestats_fav_monsters_row2); } private void updateStatsTableRow(int value, int textView, int tableRow) { String s = (value > 0) ? Integer.toString(value) : null; - updateStatsTableRow(s, textView, tableRow); + updateStatsTableRow(s, textView, tableRow, 0); } private void updateStatsTableRow(String value, int textView, int tableRow) { + updateStatsTableRow(value, textView, tableRow, 0); + } + private void updateStatsTableRow(String value, int textView, int tableRow1, int tableRow2) { TextView tv = (TextView) view.findViewById(textView); - TableRow tr = (TableRow) view.findViewById(tableRow); + TableRow tr1 = (TableRow) view.findViewById(tableRow1); + TableRow tr2 = null; + if (tableRow2 != 0) tr2 = (TableRow) view.findViewById(tableRow2); if (value != null) { tv.setText(value); - tr.setVisibility(View.VISIBLE); + tr1.setVisibility(View.VISIBLE); + if (tr2 != null) tr2.setVisibility(View.VISIBLE); } else { - tr.setVisibility(View.GONE); + tr1.setVisibility(View.GONE); + if (tr2 != null) tr2.setVisibility(View.GONE); } } }