Fixes in size and make game menu clearer

This commit is contained in:
Ruben 2017-03-29 15:16:47 +02:00
parent 6b1547c231
commit 4738fda939
4 changed files with 77 additions and 39 deletions

View file

@ -16,6 +16,7 @@
tools:replace="android:allowBackup,android:label"> tools:replace="android:allowBackup,android:label">
<activity <activity
android:name=".GamingActivity" android:name=".GamingActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden|screenSize" android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/FullscreenTheme"> android:theme="@style/FullscreenTheme">
@ -27,6 +28,8 @@
</activity> </activity>
<activity <activity
android:name=".IntroActivity" android:name=".IntroActivity"
android:screenOrientation="portrait"
android:configChanges="orientation"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/FullscreenTheme"> android:theme="@style/FullscreenTheme">
<intent-filter> <intent-filter>
@ -38,6 +41,8 @@
<activity <activity
android:name=".HighscoreActivity" android:name=".HighscoreActivity"
android:label="@string/title_activity_highscore" android:label="@string/title_activity_highscore"
android:screenOrientation="portrait"
android:configChanges="orientation"
android:parentActivityName=".ProgressActivity" android:parentActivityName=".ProgressActivity"
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">
<meta-data <meta-data
@ -46,25 +51,35 @@
</activity> </activity>
<activity <activity
android:name=".CreditsActivity" android:name=".CreditsActivity"
android:screenOrientation="portrait"
android:configChanges="orientation"
android:theme="@style/FullscreenTheme" /> android:theme="@style/FullscreenTheme" />
<activity <activity
android:name=".ReviewActivity" android:name=".ReviewActivity"
android:launchMode="singleTop" android:launchMode="singleTop"
android:screenOrientation="portrait"
android:configChanges="orientation"
android:theme="@style/AppTheme.NoActionBar" /> android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".MirrorMenuActivity" /> <activity android:name=".MirrorMenuActivity" />
<activity <activity
android:name=".ReviewAchievementsActivity" android:name=".ReviewAchievementsActivity"
android:screenOrientation="portrait"
android:configChanges="orientation"
android:theme="@style/AchievementTheme"> android:theme="@style/AchievementTheme">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value="com.rubenvandeven.emotionhero.ReviewActivity" /> android:value="com.rubenvandeven.emotionhero.ReviewActivity" />
</activity> </activity>
<activity android:name=".ProgressActivity"> <activity android:name=".ProgressActivity"
android:screenOrientation="portrait"
android:configChanges="orientation">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value="com.rubenvandeven.emotionhero.MirrorMenuActivity" /> android:value="com.rubenvandeven.emotionhero.MirrorMenuActivity" />
</activity> </activity>
<activity android:name=".EndingActivity" <activity android:name=".EndingActivity"
android:screenOrientation="portrait"
android:configChanges="orientation"
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"

View file

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

View file

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

View file

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