From 4738fda93994e680d5ebec7ac4293bb6eb635102 Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 29 Mar 2017 15:16:47 +0200 Subject: [PATCH] Fixes in size and make game menu clearer --- app/src/main/AndroidManifest.xml | 17 +++- .../emotionhero/ProgressActivity.java | 93 ++++++++++++------- .../main/res/layout/fragment_highscore.xml | 2 +- app/src/main/res/values/dimens.xml | 4 +- 4 files changed, 77 insertions(+), 39 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 461073b..9c02eab 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -16,6 +16,7 @@ tools:replace="android:allowBackup,android:label"> @@ -27,6 +28,8 @@ @@ -38,6 +41,8 @@ - + 0) { - TextView achievementText = new TextView(this); - achievementText.setText(String.format("+%1$d achievements", playerAchievementCount)); - achievementText.setTextColor(getResources().getColor(R.color.textSecondary)); - RelativeLayout.LayoutParams achievementTextParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); - achievementTextParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE); - achievementTextParams.addRule(RelativeLayout.BELOW, scoreText.getId()); - achievementText.setLayoutParams(achievementTextParams); - lvlLayout.addView(achievementText); - } + lvlLayout.addView(scoreText); - if(hasAccess) { - lvlLayout.setOnClickListener(new View.OnClickListener() { + View.OnClickListener toHighScoreClick = new View.OnClickListener() { @Override public void onClick(View v) { Intent intent; - // TODO: is this behaviour confusing? - if(highscoreGame != null) { - // Clicking score -> highscores - intent = new Intent(ProgressActivity.this, HighscoreActivity.class); - intent.putExtra(HighscoreActivity.INTENT_EXTRA_LVL_ID, scenario.id); - } else { - // "PLAY NOW!" - showLoadingDialog(); - intent = new Intent(ProgressActivity.this, GamingActivity.class); - intent.putExtra(GamingActivity.INTENT_EXTRA_SCENARIO, scenario.id); - } + // Clicking score -> highscores + intent = new Intent(ProgressActivity.this, HighscoreActivity.class); + intent.putExtra(HighscoreActivity.INTENT_EXTRA_LVL_ID, scenario.id); + startActivity(intent); + } + }; + + scoreText.setOnClickListener(toHighScoreClick); + + // +3 achievements + if(playerAchievementCount > 0) { + TextView achievementText = new TextView(this); + achievementText.setText(String.format("+%1$d achievements", playerAchievementCount)); + achievementText.setTextColor(getResources().getColor(R.color.textSecondary)); + RelativeLayout.LayoutParams achievementTextParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); + achievementTextParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); + achievementTextParams.addRule(RelativeLayout.BELOW, scoreText.getId()); + achievementText.setLayoutParams(achievementTextParams); + achievementText.setOnClickListener(toHighScoreClick); + + lvlLayout.addView(achievementText); + } + } + + if(hasAccess) { + playText.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent; + // "PLAY NOW!" + showLoadingDialog(); + intent = new Intent(ProgressActivity.this, GamingActivity.class); + intent.putExtra(GamingActivity.INTENT_EXTRA_SCENARIO, scenario.id); startActivity(intent); } }); } - levelsLayout.addView(lvlLayout); si++; diff --git a/app/src/main/res/layout/fragment_highscore.xml b/app/src/main/res/layout/fragment_highscore.xml index 0212dc1..33c406b 100644 --- a/app/src/main/res/layout/fragment_highscore.xml +++ b/app/src/main/res/layout/fragment_highscore.xml @@ -55,7 +55,7 @@