Fixes in size and make game menu clearer

This commit is contained in:
Ruben 2017-03-29 15:16:47 +02:00
parent d10662757f
commit 741f8c83c8
4 changed files with 77 additions and 39 deletions

View file

@ -24,6 +24,7 @@
<activity
android:name=".GamingActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@style/FullscreenTheme">
@ -35,6 +36,8 @@
</activity>
<activity
android:name=".IntroActivity"
android:screenOrientation="portrait"
android:configChanges="orientation"
android:label="@string/app_name"
android:theme="@style/FullscreenTheme">
<intent-filter>
@ -49,6 +52,8 @@
<activity
android:name=".HighscoreActivity"
android:label="@string/title_activity_highscore"
android:screenOrientation="portrait"
android:configChanges="orientation"
android:parentActivityName=".ProgressActivity"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
@ -57,25 +62,35 @@
</activity>
<activity
android:name=".CreditsActivity"
android:screenOrientation="portrait"
android:configChanges="orientation"
android:theme="@style/FullscreenTheme" />
<activity
android:name=".ReviewActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:configChanges="orientation"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".MirrorMenuActivity" />
<activity
android:name=".ReviewAchievementsActivity"
android:screenOrientation="portrait"
android:configChanges="orientation"
android:theme="@style/AchievementTheme">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.rubenvandeven.emotionhero.ReviewActivity" />
</activity>
<activity android:name=".ProgressActivity">
<activity android:name=".ProgressActivity"
android:screenOrientation="portrait"
android:configChanges="orientation">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.rubenvandeven.emotionhero.MirrorMenuActivity" />
</activity>
<activity android:name=".EndingActivity"
android:screenOrientation="portrait"
android:configChanges="orientation"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"

View file

@ -114,52 +114,75 @@ public class ProgressActivity extends AppCompatActivity {
lvlLayout.addView(titleText);
TextView playText = new TextView(this);
String playString = hasAccess ? "play now!" : "locked";
playText.setText(playString);
playText.setTextSize(getResources().getDimensionPixelSize(R.dimen.highscore_textsize));
playText.setTextColor(getResources().getColor(hasAccess ? R.color.textPrimary : R.color.textSecondary));
RelativeLayout.LayoutParams playTextParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
playTextParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
playTextParams.addRule(RelativeLayout.BELOW, titleText.getId());
playText.setLayoutParams(playTextParams);
lvlLayout.addView(playText);
// score
if(highscoreGame != null)
{
TextView scoreText = new TextView(this);
String scoreString = (highscoreGame != null) ? String.format("%1$.2f", highscoreGame.score + highscoreGame.bonus) : (hasAccess ? "play now!" : "locked");
String scoreString = String.format("%1$.2f", highscoreGame.score + highscoreGame.bonus);
scoreText.setText(scoreString);
scoreText.setTextColor(getResources().getColor(hasAccess ? R.color.textPrimary : R.color.textSecondary));
scoreText.setTextColor(getResources().getColor(R.color.textPrimary));
scoreText.setTextSize(getResources().getDimensionPixelSize(R.dimen.highscore_textsize));
RelativeLayout.LayoutParams scoreTextParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
scoreTextParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
scoreTextParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
scoreTextParams.addRule(RelativeLayout.BELOW, titleText.getId());
scoreText.setId(R.id.scoreText);
scoreText.setLayoutParams(scoreTextParams);
lvlLayout.addView(scoreText);
View.OnClickListener toHighScoreClick = new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent;
// 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_RIGHT, RelativeLayout.TRUE);
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) {
lvlLayout.setOnClickListener(new View.OnClickListener() {
playText.setOnClickListener(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);
}
startActivity(intent);
}
});
}
levelsLayout.addView(lvlLayout);
si++;

View file

@ -55,7 +55,7 @@
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start"
android:text="Play now!"
android:id="@+id/startLvlButton"
android:layout_weight="1"
android:fontFamily="monospace"

View file

@ -4,8 +4,8 @@
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="appbar_padding_top">8dp</dimen>
<dimen name="highscore_textsize">8dp</dimen>
<dimen name="gametitle_textsize">5dp</dimen>
<dimen name="highscore_textsize">15sp</dimen>
<dimen name="gametitle_textsize">12sp</dimen>
<dimen name="scenario_scorevalue">20sp</dimen>
<dimen name="scenario_emolabel">12sp</dimen>