parent
907e9005af
commit
c91f7cbc21
19 changed files with 278 additions and 46 deletions
|
@ -37,7 +37,7 @@
|
|||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
android:theme="@style/FullscreenTheme" />
|
||||
<activity
|
||||
android:name=".ReviewActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity android:name=".MirrorMenuActivity" />
|
||||
<activity
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.rubenvandeven.emotionhero;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
/**
|
||||
|
@ -30,6 +31,6 @@ public class Achievement {
|
|||
|
||||
public interface AchievementListener {
|
||||
boolean hasGotAchievement(Player player, Game game);
|
||||
void setDescription(Player player, Game game, RelativeLayout layout);
|
||||
void setDescription(Player player, Game game, LinearLayout layout);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.content.Intent;
|
|||
import android.net.Uri;
|
||||
import android.support.v7.widget.AppCompatTextView;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -38,7 +39,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("Do you have something to hide? You are not showing all requested emotions intense enough. A microexpression is a brief, involuntary facial expression shown on the face of humans according to emotions experienced.");
|
||||
|
@ -69,7 +70,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("There is no sign of deceit itself. There is no gesture, facial expression, nor muscle twitch that itself indicates that a person is lying. There are only clues that the person is poorly prepared and that the clues of emotions do not fit what the person is saying. These are what provide clues of leakage or deception. (Wikipedia)");
|
||||
|
@ -97,7 +98,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, final RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, final LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("You improved your performance after a retry! The 'data double' is a term coined by Mina Ruckenstein to describe how our gathered information is be figuratively reassembled for the purposes of personal reflection and interaction.");
|
||||
|
@ -139,7 +140,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("\"We do not have names for all the possible combinations of " +
|
||||
|
@ -165,7 +166,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("You are HYSTERICAL!!! Augustine is one of Jean-Martin Charcot's proofs cases for hysteria. Read 'The Invention Of Hysteria' by George Didi-Huberman on how Charcot contributed to her performance of hysteria.");
|
||||
|
@ -189,7 +190,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("...");
|
||||
|
@ -221,7 +222,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("Have you been on drugs? You're making a mess of things!");
|
||||
|
@ -252,7 +253,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("You would be a great CEO! You'll be able to convice shareholders, even if the company is in chaos!");
|
||||
|
@ -275,7 +276,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("...");
|
||||
|
@ -294,7 +295,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("...");
|
||||
|
@ -327,7 +328,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("...");
|
||||
|
@ -360,7 +361,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("...");
|
||||
|
@ -379,7 +380,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("...");
|
||||
|
@ -401,7 +402,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("\"CV Dazzle explores how fashion can be used as camouflage from face-detection technology, the first step in automated face recognition. ");
|
||||
|
@ -431,7 +432,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("In the beginning of the 20th century filmmaker Lev Kuleshov did an experiment\n" +
|
||||
|
@ -456,7 +457,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("...");
|
||||
|
@ -484,7 +485,7 @@ public class AchievementCollection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(Player player, Game game, RelativeLayout descriptionLayout) {
|
||||
public void setDescription(Player player, Game game, LinearLayout descriptionLayout) {
|
||||
Context c = descriptionLayout.getContext();
|
||||
AppCompatTextView textView = new AppCompatTextView(c);
|
||||
textView.setText("You are remarkably good at posing, just like this guy:");
|
||||
|
|
|
@ -42,14 +42,14 @@ public class IntroActivity extends AppCompatActivity {
|
|||
|
||||
View introView = findViewById(R.id.activity_intro);
|
||||
|
||||
if(!player.isNew()) {
|
||||
// if(!player.isNew()) {
|
||||
introView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
continueToMenu();
|
||||
}
|
||||
});
|
||||
}
|
||||
// }
|
||||
|
||||
final ImageView logoV2 = (ImageView) findViewById(R.id.logoV2);
|
||||
final ImageView logoArquivo = (ImageView) findViewById(R.id.logoArquivo);
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.app.ProgressDialog;
|
|||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v8.renderscript.RenderScript;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
|
@ -56,6 +57,7 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
|
|||
TextView readyButton;
|
||||
TextView text1;
|
||||
TextView text2;
|
||||
ImageView logoEmotionHero;
|
||||
|
||||
boolean has_camera_permission = false;
|
||||
|
||||
|
@ -64,6 +66,7 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
|
|||
RenderScript rs;
|
||||
|
||||
Player player;
|
||||
Animation anim;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -77,11 +80,12 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
|
|||
player = Player.getInstance(this);
|
||||
|
||||
RelativeLayout videoContentLayout = (RelativeLayout) findViewById(R.id.videoContent);
|
||||
ImageView logoEmotionHero = (ImageView) findViewById(R.id.logoEmotionHero);
|
||||
logoEmotionHero = (ImageView) findViewById(R.id.logoEmotionHero);
|
||||
messageText = (TextView) findViewById(R.id.messageText);
|
||||
final TextView startButton = (TextView) findViewById(R.id.startButton);
|
||||
TextView highscoresButton = (TextView) findViewById(R.id.highscoresButton);
|
||||
TextView creditsButton = (TextView) findViewById(R.id.creditsButton);
|
||||
TextView settingsButton = (TextView) findViewById(R.id.settingsButton);
|
||||
mainMenu = (LinearLayout) findViewById(R.id.mainMenu);
|
||||
nextButton = (TextView) findViewById(R.id.nextButton);
|
||||
readyButton = (TextView) findViewById(R.id.readyButton);
|
||||
|
@ -92,6 +96,7 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
|
|||
startButton .setTypeface(font);
|
||||
highscoresButton .setTypeface(font);
|
||||
creditsButton .setTypeface(font);
|
||||
settingsButton.setTypeface(font);
|
||||
messageText.setTypeface(font);
|
||||
nextButton.setTypeface(font);
|
||||
readyButton.setTypeface(font);
|
||||
|
@ -153,7 +158,7 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
|
|||
scenarioView.drawOverlay = true;
|
||||
scenarioView.noFace = true;
|
||||
|
||||
Animation anim = new AlphaAnimation(0.0f, 1.0f);
|
||||
anim = new AlphaAnimation(0.0f, 1.0f);
|
||||
anim.setDuration(1000); //You can manage the blinking time with this parameter
|
||||
anim.setStartOffset(20);
|
||||
anim.setRepeatMode(Animation.REVERSE);
|
||||
|
@ -180,15 +185,17 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
|
|||
|
||||
|
||||
// merge with 'start button'
|
||||
|
||||
|
||||
// highscoresButton.setVisibility(View.GONE);
|
||||
if(!player.getPlayerInfo().canContinueLevel()) {
|
||||
highscoresButton.setVisibility(View.GONE);
|
||||
} else {
|
||||
startButton.setText("Introduction");
|
||||
highscoresButton.setText("Start");
|
||||
highscoresButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(MirrorMenuActivity.this, ProgressActivity.class);
|
||||
// intent.putExtra(HighscoreActivity.INTENT_EXTRA_LEVEL, player.getPlayerInfo().reachedLevelId);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
@ -202,6 +209,13 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
|
|||
}
|
||||
});
|
||||
|
||||
settingsButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showSettings();
|
||||
}
|
||||
});
|
||||
|
||||
rs = RenderScript.create(this);
|
||||
|
||||
|
||||
|
@ -231,6 +245,10 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
|
|||
}
|
||||
});
|
||||
|
||||
if(!player.hasSetSnapshotConfirm()) {
|
||||
showSettings();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// all setup, see wheter we immediately continue to intro:
|
||||
|
@ -241,11 +259,21 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
|
|||
}
|
||||
|
||||
protected void gotoIntro() {
|
||||
if(anim != null) {
|
||||
anim.cancel();
|
||||
}
|
||||
logoEmotionHero.setVisibility(View.GONE);
|
||||
logoEmotionHero.setAlpha(0f);
|
||||
nextButton.setVisibility(View.VISIBLE);
|
||||
text1.setVisibility(View.VISIBLE);
|
||||
mainMenu.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void showSettings() {
|
||||
DialogFragment newFragment = SnapshotDialogFragment.newInstance();
|
||||
newFragment.show(getSupportFragmentManager(), "dialog");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
|
|
@ -63,6 +63,23 @@ public class Player {
|
|||
editor.commit();
|
||||
}
|
||||
|
||||
public boolean hasSetSnapshotConfirm() {
|
||||
SharedPreferences settings = c.getSharedPreferences(PREFS_NAME, 0);
|
||||
return settings.contains("snapshot_confirm");
|
||||
}
|
||||
|
||||
public boolean allowsSnapshots() {
|
||||
SharedPreferences settings = c.getSharedPreferences(PREFS_NAME, 0);
|
||||
return settings.getBoolean("snapshot_confirm", false);
|
||||
}
|
||||
|
||||
public void setAllowsSnapshots(boolean allows) {
|
||||
SharedPreferences settings = c.getSharedPreferences(PREFS_NAME, 0);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putBoolean("snapshot_confirm", allows);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the JWT as it is used on the API
|
||||
* @return
|
||||
|
|
|
@ -73,7 +73,8 @@ public class ReviewAchievementsActivity extends AppCompatActivity {
|
|||
public void addAchievement(Achievement achievement) {
|
||||
AppCompatTextView titleText = new AppCompatTextView(this);
|
||||
AppCompatTextView descriptionText = new AppCompatTextView(this);
|
||||
RelativeLayout descriptionLayout = new RelativeLayout(this);
|
||||
LinearLayout descriptionLayout = new LinearLayout(this);
|
||||
descriptionLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
// ImageView imageView = new ImageView(this);
|
||||
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
|
|
|
@ -121,6 +121,7 @@ public class Scenario {
|
|||
protected boolean lostFace = false;
|
||||
|
||||
public static int MAX_SNAPSHOTS = 5;
|
||||
public boolean takeSnapshots;
|
||||
/**
|
||||
* Which targets to capture an image of
|
||||
*/
|
||||
|
@ -180,6 +181,8 @@ public class Scenario {
|
|||
// determine before start which targets will be stored and send
|
||||
// only do it randomly so we don't need to do ALL and yet have spread across the level.
|
||||
snapTargets = pickNRandom(targets, MAX_SNAPSHOTS);
|
||||
|
||||
takeSnapshots = _activity.player.allowsSnapshots();
|
||||
}
|
||||
|
||||
public static List<Target> pickNRandom(List<Target> lst, int n) {
|
||||
|
@ -229,7 +232,7 @@ public class Scenario {
|
|||
|
||||
|
||||
Bitmap outputBitmap = null;
|
||||
if(currentFrame != null && snapTargets.contains(target) ) {
|
||||
if(currentFrame != null && takeSnapshots && snapTargets.contains(target) ) {
|
||||
// convert NV21 byteArrayFrame from camera to RGB bitmap.
|
||||
Frame.ByteArrayFrame byteArrayFrame = (Frame.ByteArrayFrame) currentFrame;
|
||||
outputBitmap = Nv21Image.nv21ToBitmap(rs, byteArrayFrame.getByteArray(), byteArrayFrame.getWidth(), byteArrayFrame.getHeight());
|
||||
|
|
|
@ -29,6 +29,9 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
|
|||
|
||||
private Scenario _scenario;
|
||||
|
||||
// bottom at 60%;
|
||||
public static float BAR_POSITION = 0.7f;
|
||||
|
||||
/**
|
||||
* The scorres in this moment, as to draw them on the screen.
|
||||
* Indexes are Emotion ordinals
|
||||
|
@ -46,7 +49,6 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
|
|||
private Paint missedPaint = new Paint();
|
||||
private Paint scorePaint = new Paint();
|
||||
private Paint bonusScorePaint = new Paint();
|
||||
private Paint scoreFinishedPaint = new Paint();
|
||||
private Paint bonusBarPaint = new Paint();
|
||||
|
||||
private Point mLeftTop;
|
||||
|
@ -107,7 +109,7 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
|
|||
Typeface font = Typeface.createFromAsset(context.getAssets(), "unifont-9.0.02.ttf");
|
||||
|
||||
scorePaint.setColor(Color.YELLOW);
|
||||
scorePaint.setTextSize(40);
|
||||
scorePaint.setTextSize(getResources().getDimensionPixelSize(R.dimen.scenario_scorevalue));
|
||||
scorePaint.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
|
||||
bonusScorePaint.setColor(Color.rgb(132, 0, 255));
|
||||
|
@ -116,10 +118,6 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
|
|||
|
||||
bonusBarPaint.setColor(Color.rgb(132, 0, 255));
|
||||
|
||||
scoreFinishedPaint.setColor(Color.YELLOW);
|
||||
scoreFinishedPaint.setTextSize(100);
|
||||
scoreFinishedPaint.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
|
||||
|
||||
//setup paints for drawing
|
||||
mainPaint.setColor(Color.GRAY);
|
||||
|
@ -134,7 +132,7 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
|
|||
|
||||
for(Emotion emotion: Emotion.values()) {
|
||||
Paint emoPaint = new Paint();
|
||||
emoPaint.setTextSize(22);
|
||||
emoPaint.setTextSize(getResources().getDimensionPixelSize(R.dimen.scenario_emolabel));
|
||||
// emoPaint.setTypeface(font);//gets ugly when transformed
|
||||
emoPaint.setColor(emotion.getColor());
|
||||
// emoPaint.setShadowLayer(10,0,0,Color.BLACK);
|
||||
|
@ -156,7 +154,7 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
|
|||
int emoLightenedColor = Color.rgb(red, green, blue);
|
||||
|
||||
emoScoredPaint.setColor(emoLightenedColor);
|
||||
emoScoredPaint.setTextSize(20);
|
||||
emoScoredPaint.setTextSize(getResources().getDimensionPixelSize(R.dimen.scenario_emolabel));
|
||||
emoScoredPaint.setStrokeWidth(2);
|
||||
emoScoredPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
// emoScoredPaint.setShadowLayer(10,0,0,Color.BLACK);
|
||||
|
@ -189,12 +187,12 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
|
|||
float height = canvas.getHeight();
|
||||
float width = canvas.getWidth();
|
||||
|
||||
// bottom at 80%;
|
||||
float bottomline_height = height * (float) 0.8;
|
||||
// bottom at 60%;
|
||||
float bottomline_height = height * BAR_POSITION;
|
||||
|
||||
|
||||
// draw current hits:
|
||||
float used_width = (float) 0.8; // 0.7: only use center
|
||||
float used_width = (float) 0.9; // 0.7: only use center
|
||||
float padding_left = canvas.getWidth() * (1-used_width) / 2;
|
||||
float step_y = (canvas.getWidth() * used_width) / Emotion.values().length;
|
||||
float max_ball_radius = step_y * (float) 0.8 / 2;
|
||||
|
@ -269,19 +267,20 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
|
|||
float hitWidth = width*(_scenario.getHitPercentage()/100);
|
||||
float misWidth = width*(_scenario.getMissedPercentage()/100);
|
||||
float bonusWidth = width*(_scenario.getBonusPercentage()/100);
|
||||
float bonus =_scenario.getBonusTotalValue();
|
||||
|
||||
String scoreText = String.format("%1$.0f", _scenario.getHitTotalValue());
|
||||
String scoreText = String.format("%1$.0f", _scenario.getHitTotalValue() + bonus);
|
||||
Rect scoreTextBounds = new Rect();
|
||||
scorePaint.getTextBounds(scoreText, 0, scoreText.length(), scoreTextBounds);
|
||||
canvas.drawText(scoreText, hitWidth, height*0.95f-scoreTextBounds.height(), scorePaint);
|
||||
|
||||
float bonus =_scenario.getBonusTotalValue();
|
||||
if(bonus > 0) {
|
||||
|
||||
/*if(bonus > 0) {
|
||||
String bonusText = String.format("+ %1$.0f", bonus);
|
||||
Rect bonusTextBounds = new Rect();
|
||||
bonusScorePaint.getTextBounds(bonusText, 0, bonusText.length(), bonusTextBounds);
|
||||
canvas.drawText(bonusText, hitWidth+scoreTextBounds.width()+3, height*0.95f-bonusTextBounds.height()-10, bonusScorePaint);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
canvas.drawRect(0, height*0.95f, width, height, mainPaint);
|
||||
|
@ -292,7 +291,7 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
|
|||
canvas.drawRect(0, height*0.95f, hitWidth, height, emoPaints.get(Emotion.JOY)); // paint: yellow
|
||||
canvas.drawRect(hitWidth, height*0.95f, hitWidth+misWidth, height, missedPaint);
|
||||
|
||||
canvas.drawRect(0, height*0.95f, bonusWidth, height*0.975f, bonusBarPaint);
|
||||
// canvas.drawRect(0, height*0.95f, bonusWidth, height*0.975f, bonusBarPaint);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
package com.rubenvandeven.emotionhero;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.widget.TextViewCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* Created by ruben on 21/09/16.
|
||||
*/
|
||||
|
||||
public class SnapshotDialogFragment extends DialogFragment {
|
||||
|
||||
Player player;
|
||||
|
||||
public static SnapshotDialogFragment newInstance() {
|
||||
SnapshotDialogFragment frag = new SnapshotDialogFragment();
|
||||
return frag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
player = Player.getInstance(getContext());
|
||||
|
||||
View v = getActivity().getLayoutInflater().inflate(R.layout.snapshot_check, null);
|
||||
|
||||
if(player.hasSetSnapshotConfirm()) {
|
||||
String statusString = player.allowsSnapshots() ? "share" : "not share";
|
||||
TextView statusText = new TextView(getContext());
|
||||
statusText.setText("You have currently set to "+statusString+" the snapshots.");
|
||||
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.addRule(RelativeLayout.BELOW, R.id.lastText);
|
||||
int margin = getResources().getDimensionPixelSize(R.dimen.fab_margin);
|
||||
params.setMargins(margin, margin/2, margin, 0);
|
||||
((RelativeLayout) v.findViewById(R.id.snapshotLayout)).addView(statusText,params);
|
||||
}
|
||||
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
// .setIcon(R.drawable.alert_dialog_icon)
|
||||
.setTitle("Contribute")
|
||||
.setView(v)
|
||||
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialogInterface) {
|
||||
// Set nothing, load website (triggers thing the next time
|
||||
}
|
||||
})
|
||||
.setPositiveButton("Yes!",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
// ((FragmentAlertDialog)getActivity()).doPositiveClick();
|
||||
player.setAllowsSnapshots(true);
|
||||
Toast.makeText(getContext(), "Thanks!", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
)
|
||||
.setNeutralButton("See website",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
// Set nothing, load website (triggers thing the next time
|
||||
Intent i = new Intent(Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse("https://emotionhero.com/faces"));
|
||||
startActivity(i);
|
||||
}
|
||||
}
|
||||
)
|
||||
.setNegativeButton("Nope",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
// ((FragmentAlertDialog)getActivity()).doNegativeClick();
|
||||
player.setAllowsSnapshots(false);
|
||||
Toast.makeText(getContext(), "Don't worry, we get it!", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
)
|
||||
.create();
|
||||
}
|
||||
|
||||
|
||||
}
|
BIN
app/src/main/res/drawable/example_brow.jpg
Normal file
BIN
app/src/main/res/drawable/example_brow.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
BIN
app/src/main/res/drawable/example_mouth.jpg
Normal file
BIN
app/src/main/res/drawable/example_mouth.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
app/src/main/res/drawable/example_nose.jpg
Normal file
BIN
app/src/main/res/drawable/example_nose.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
|
@ -57,6 +57,17 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:id="@+id/creditsButton"
|
||||
android:fontFamily="sans-serif" />
|
||||
<TextView
|
||||
android:textAlignment="center"
|
||||
android:textSize="30dp"
|
||||
android:textColor="@color/textPrimary"
|
||||
android:textAllCaps="true"
|
||||
android:layout_marginBottom="@dimen/fab_margin"
|
||||
android:text="@string/settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/settingsButton"
|
||||
android:fontFamily="sans-serif" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -72,7 +83,7 @@
|
|||
android:textColor="@color/textSecondary"
|
||||
android:textSize="30sp"
|
||||
android:textStyle="bold"
|
||||
android:paddingBottom="60dp"
|
||||
android:paddingBottom="100dp"
|
||||
android:shadowColor="@android:color/black"
|
||||
android:shadowDx="0"
|
||||
android:shadowDy="0"
|
||||
|
@ -81,7 +92,6 @@
|
|||
android:typeface="normal"
|
||||
android:fontFamily="sans-serif-condensed" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -105,6 +115,7 @@
|
|||
android:layout_below="@+id/logoEmotionHero"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
android:paddingTop="@dimen/fab_margin"
|
||||
android:id="@+id/introText1"
|
||||
android:text="@string/game_intro_text"
|
||||
android:textColor="@color/textPrimary"
|
||||
|
@ -129,6 +140,7 @@
|
|||
android:layout_below="@+id/logoEmotionHero"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
android:paddingTop="@dimen/fab_margin"
|
||||
android:id="@+id/introText2"
|
||||
android:text="@string/game_intro_text2"
|
||||
android:textColor="@color/textPrimary"
|
||||
|
|
74
app/src/main/res/layout/snapshot_check.xml
Normal file
74
app/src/main/res/layout/snapshot_check.xml
Normal file
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:elevation="1dp"
|
||||
android:id="@+id/snapshotLayout">
|
||||
|
||||
<TextView
|
||||
android:text="While using this game, you can contribute snapshots of certain facial features to a central piece.\nNote that solely the following features are shared:"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:id="@+id/textView3"
|
||||
android:layout_marginLeft="@dimen/fab_margin"
|
||||
android:layout_marginRight="@dimen/fab_margin" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/textView3"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:id="@+id/imageGrid">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="@drawable/example_mouth"
|
||||
android:id="@+id/imageView4"
|
||||
android:layout_weight="1"
|
||||
android:adjustViewBounds="true" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:srcCompat="@drawable/example_brow"
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_weight="1"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_marginTop="@dimen/appbar_padding_top" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="match_parent"
|
||||
app:srcCompat="@drawable/example_nose"
|
||||
android:id="@+id/imageView3"
|
||||
android:layout_weight="1"
|
||||
android:adjustViewBounds="false" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:text="For more information see emotionhero.com.\nYou can always change these settings later."
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/imageGrid"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginLeft="@dimen/fab_margin"
|
||||
android:layout_marginRight="@dimen/fab_margin"
|
||||
android:id="@+id/lastText" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -6,4 +6,7 @@
|
|||
<dimen name="appbar_padding_top">8dp</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>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<string name="continueBtn">Continue</string>
|
||||
<string name="highscores">Progress</string>
|
||||
<string name="credits">Credits</string>
|
||||
<string name="settings">Settings</string>
|
||||
<string name="title_activity_highscore">HighscoreActivity</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="section_format">Hello World from section: %1$d</string>
|
||||
|
|
|
@ -5,7 +5,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.2.0-rc2'
|
||||
classpath 'com.android.tools.build:gradle:2.2.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|
Loading…
Reference in a new issue