Compare commits

..

No commits in common. "4d491a411e250da15bccfd2c993ab05c26a31963" and "c96c735ca4a3d2c17125cfe4ad853cf9a1c8f614" have entirely different histories.

20 changed files with 21 additions and 528 deletions

View file

@ -6,7 +6,7 @@ android {
compileSdkVersion 24
buildToolsVersion '25.0.0'
defaultConfig {
applicationId 'com.rubenvandeven.emotion_hero.kiosk'
applicationId 'com.rubenvandeven.emotion_hero'
minSdkVersion 16
targetSdkVersion 24
versionCode 11
@ -33,7 +33,7 @@ dependencies {
})
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:support-v4:24.2.0'
compile 'com.affectiva.android:affdexsdk:3.2'
compile 'com.affectiva.android:affdexsdk:3.1.2'
compile 'com.google.code.gson:gson:2.4'
compile 'com.android.support:design:24.2.0'
compile 'com.loopj.android:android-async-http:1.4.9'

View file

@ -6,31 +6,25 @@
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<!--Kiosk Mode-->
<uses-permission android:name="android.permission.REORDER_TASKS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_LOGS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:name=".AppContext"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:keepScreenOn="true"
tools:replace="android:allowBackup,android:label">
<activity
android:name=".GamingActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@style/FullscreenTheme">
<!-- <intent-filter> -->
<!-- <action android:name="android.intent.action.MAIN" /> -->
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
<!-- </intent-filter> -->
</activity>
<activity
android:name=".IntroActivity"
@ -40,11 +34,8 @@
android:theme="@style/FullscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
@ -97,11 +88,6 @@
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.rubenvandeven.emotionhero.ProgressActivity" /></activity>
<receiver android:name=".BootReceiver">
<intent-filter >
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
</application>
</manifest>

View file

@ -2,6 +2,7 @@ package com.rubenvandeven.emotionhero;
import android.graphics.Bitmap;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
/**
* Created by ruben on 10/09/16.

View file

@ -41,7 +41,7 @@ import cz.msebera.android.httpclient.entity.StringEntity;
*/
public class ApiRestClient {
private static final String BASE_URL = "https://api.emotionhero.com";
private static final String BASE_URL = "https://api.emotionhero.com"; // TODO: https!
/**
* For some reason validation of SSL certificate needs to be disabled (using true).

View file

@ -1,61 +0,0 @@
package com.rubenvandeven.emotionhero;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.PowerManager;
/**
* For kioskmode only!
* See http://www.andreas-schrade.de/2015/02/16/android-tutorial-how-to-create-a-kiosk-mode-in-android/
*/
@ReportsCrashes(
buildConfigClass=BuildConfig.class,
formUri="http://crashes.rubenvandeven.com/api",
formUriBasicAuthLogin="com.rubenvandeven.emotion_hero.kiosk",
formUriBasicAuthPassword="4fkpp89Q+VKdbVj3VIbBFKTT",
mode=ReportingInteractionMode.TOAST,
resToastText=R.string.crash_toast_text)
public class AppContext extends Application {
private AppContext instance;
private PowerManager.WakeLock wakeLock;
private OnScreenOffReceiver onScreenOffReceiver;
@Override
public void onCreate() {
super.onCreate();
instance = this;
if (!ACRA.isACRASenderServiceProcess()) {
registerKioskModeScreenOffReceiver();
startKioskService();
}
}
private void registerKioskModeScreenOffReceiver() {
// register screen off receiver
final IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_OFF);
onScreenOffReceiver = new OnScreenOffReceiver();
registerReceiver(onScreenOffReceiver, filter);
}
protected void attachBaseContext(Context paramContext)
{
super.attachBaseContext(paramContext);
ACRA.init(this, new ConfigurationBuilder(this).setReportField(ReportField.USER_COMMENT, false), true);
}
public PowerManager.WakeLock getWakeLock() {
if(wakeLock == null) {
// lazy loading: first call, create wakeLock via PowerManager.
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "wakeup");
}
return wakeLock;
}
private void startKioskService() {
startService(new Intent(this, KioskService.class));
}
}

View file

@ -1,18 +0,0 @@
package com.rubenvandeven.emotionhero;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
/**
* For kioskmode only!
* See http://www.andreas-schrade.de/2015/02/16/android-tutorial-how-to-create-a-kiosk-mode-in-android/
*/
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Intent myIntent = new Intent(context, IntroActivity.class);
myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myIntent);
}
}

View file

@ -1,7 +1,5 @@
package com.rubenvandeven.emotionhero;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Typeface;
import android.net.Uri;
@ -41,7 +39,6 @@ public class CreditsActivity extends AppCompatActivity {
moreInfo.setTypeface(font);
mySite.setTypeface(font);
/* BLOCK FOR KIOSK-MODE
findViewById(R.id.logoArquivo).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -87,31 +84,6 @@ public class CreditsActivity extends AppCompatActivity {
i.setData(Uri.parse(url));
startActivity(i);
}
});*/
}
/**
* For kioskmode
* @param hasFocus
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if(!hasFocus) {
// Close every kind of system dialog
Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(closeDialog);
});
}
}
@Override
protected void onPause() {
super.onPause();
ActivityManager activityManager = (ActivityManager) getApplicationContext()
.getSystemService(Context.ACTIVITY_SERVICE);
activityManager.moveTaskToFront(getTaskId(), 0);
}
}

View file

@ -1,8 +1,5 @@
package com.rubenvandeven.emotionhero;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
@ -91,29 +88,4 @@ public class EndingActivity extends AppCompatActivity {
this.rank.setVisibility(View.VISIBLE);
this.textRank.setVisibility(View.VISIBLE);
}
/**
* For kioskmode
* @param hasFocus
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if(!hasFocus) {
// Close every kind of system dialog
Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(closeDialog);
}
}
@Override
protected void onPause() {
super.onPause();
ActivityManager activityManager = (ActivityManager) getApplicationContext()
.getSystemService(Context.ACTIVITY_SERVICE);
activityManager.moveTaskToFront(getTaskId(), 0);
}
}

View file

@ -2,9 +2,7 @@ package com.rubenvandeven.emotionhero;
import android.Manifest;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
@ -35,8 +33,6 @@ import com.affectiva.android.affdex.sdk.detector.Face;
import java.util.HashMap;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
/**
@ -75,13 +71,10 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
protected boolean isStarted = false;
protected Timer timeoutTimer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); // kiosk mode
if(getSupportActionBar() != null) {
getSupportActionBar().hide();
}
@ -194,11 +187,6 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
super.onPause();
stopDetector();
currentScenario.pause();
ActivityManager activityManager = (ActivityManager) getApplicationContext()
.getSystemService(Context.ACTIVITY_SERVICE);
activityManager.moveTaskToFront(getTaskId(), 0);
}
void startDetector() {
@ -319,11 +307,6 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
setText("START!");
currentScenario.lostFace = false;
// in kioskmode, if no face is found for 60s return to main screen
if(timeoutTimer != null) {
timeoutTimer.cancel();
}
if(isStarted)
currentScenario.start();
}
@ -333,19 +316,6 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
{
currentScenario.pause();
currentScenario.lostFace = true;
// in kioskmode, if no face is found for 60s return to main screen
timeoutTimer = new Timer();
TimerTask timeoutTimerTask = new TimerTask() {
@Override
public void run() {
Intent intent = new Intent(GamingActivity.this, MirrorMenuActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
}
};
timeoutTimer.schedule(timeoutTimerTask, 60*1000);
}
public void setText(String text)
@ -436,18 +406,4 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
startActivity(intent);
finish();
}
/**
* For kioskmode
* @param hasFocus
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if(!hasFocus) {
// Close every kind of system dialog
Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(closeDialog);
}
}
}

View file

@ -1,8 +1,6 @@
package com.rubenvandeven.emotionhero;
import android.app.ActivityManager;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
@ -426,28 +424,4 @@ public class HighscoreActivity extends AppCompatActivity {
return mViewPager;
}
/**
* For kioskmode
* @param hasFocus
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if(!hasFocus) {
// Close every kind of system dialog
Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(closeDialog);
}
}
@Override
protected void onPause() {
super.onPause();
ActivityManager activityManager = (ActivityManager) getApplicationContext()
.getSystemService(Context.ACTIVITY_SERVICE);
activityManager.moveTaskToFront(getTaskId(), 0);
}
}

View file

@ -2,8 +2,6 @@ package com.rubenvandeven.emotionhero;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
@ -30,7 +28,6 @@ public class IntroActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); // kiosk mode
if(getSupportActionBar() != null) {
getSupportActionBar().hide();
}
@ -98,28 +95,4 @@ public class IntroActivity extends AppCompatActivity {
IntroActivity.this.overridePendingTransition(0, 0);
finish();
}
/**
* For kioskmode
* @param hasFocus
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if(!hasFocus) {
// Close every kind of system dialog
Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(closeDialog);
}
}
@Override
protected void onPause() {
super.onPause();
ActivityManager activityManager = (ActivityManager) getApplicationContext()
.getSystemService(Context.ACTIVITY_SERVICE);
activityManager.moveTaskToFront(getTaskId(), 0);
}
}

View file

@ -1,95 +0,0 @@
package com.rubenvandeven.emotionhero;
import android.app.ActivityManager;
import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* Created by ruben on 05/10/16.
*/
public class KioskService extends Service {
private static final long INTERVAL = TimeUnit.SECONDS.toMillis(2); // periodic interval to check in seconds -> 2 seconds
private static final String TAG = KioskService.class.getSimpleName();
private static final String PREF_KIOSK_MODE = "pref_kiosk_mode";
private Thread t = null;
private Context ctx = null;
private boolean running = false;
@Override
public void onDestroy() {
Log.i(TAG, "Stopping service 'KioskService'");
running =false;
super.onDestroy();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.i(TAG, "Starting service 'KioskService'");
running = true;
ctx = this;
// start a thread that periodically checks if your app is in the foreground
t = new Thread(new Runnable() {
@Override
public void run() {
do {
handleKioskMode();
try {
Thread.sleep(INTERVAL);
} catch (InterruptedException e) {
Log.i(TAG, "Thread interrupted: 'KioskService'");
}
}while(running);
stopSelf();
}
});
t.start();
return Service.START_NOT_STICKY;
}
private void handleKioskMode() {
// is Kiosk Mode active?
if(true) {
// is App in background?
if(isInBackground()) {
restoreApp(); // restore!
}
}
}
private boolean isInBackground() {
ActivityManager am = (ActivityManager) ctx.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> taskInfo = am.getRunningTasks(1);
ComponentName componentInfo = taskInfo.get(0).topActivity;
return (!ctx.getApplicationContext().getPackageName().equals(componentInfo.getPackageName()));
}
private void restoreApp() {
// Restart activity
Intent i = new Intent(ctx, IntroActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(i);
}
public boolean isKioskModeActive(final Context context) {
return true;
// SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
// return sp.getBoolean(PREF_KIOSK_MODE, false);
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
}

View file

@ -3,9 +3,7 @@ package com.rubenvandeven.emotionhero;
import android.Manifest;
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.app.ActivityManager;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
@ -74,7 +72,6 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); // kiosk mode
if(getSupportActionBar() != null) {
getSupportActionBar().hide();
}
@ -100,7 +97,6 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
highscoresButton .setTypeface(font);
creditsButton .setTypeface(font);
settingsButton.setTypeface(font);
settingsButton.setVisibility(View.INVISIBLE); // kiosk mode doesn't have settings
messageText.setTypeface(font);
nextButton.setTypeface(font);
readyButton.setTypeface(font);
@ -115,7 +111,6 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
int maxHeight = MirrorMenuActivity.this.getWindow().getDecorView().getHeight();
int width;
int height;
Log.i(LOG_TAG, "Change the camera preview: " + previewWidth + " + " + measureWidth);
if (previewHeight == 0 || previewWidth == 0) {
width = measureWidth;
height = measureHeight;
@ -147,13 +142,13 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
setMeasuredDimension(width,height);
}
};
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
// RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(1,1);
params.addRule(RelativeLayout.CENTER_IN_PARENT,RelativeLayout.TRUE);
// 10% margin:
// params.leftMargin = (int) 120;
// params.rightMargin = params.leftMargin;
cameraPreview.setLayoutParams(params);
cameraPreview.setWillNotDraw(false);
videoContentLayout.addView(cameraPreview,0);
scenarioView = new ScenarioView(this, null);
@ -202,7 +197,6 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
public void onClick(View v) {
Intent intent = new Intent(MirrorMenuActivity.this, ProgressActivity.class);
startActivity(intent);
stopDetector();
}
});
}
@ -212,7 +206,6 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
public void onClick(View v) {
Intent intent = new Intent(MirrorMenuActivity.this, CreditsActivity.class);
startActivity(intent);
stopDetector();
}
});
@ -292,12 +285,7 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
@Override
protected void onPause() {
super.onPause();
// stopDetector(); // kiosk mode should never pause ...
ActivityManager activityManager = (ActivityManager) getApplicationContext()
.getSystemService(Context.ACTIVITY_SERVICE);
activityManager.moveTaskToFront(getTaskId(), 0);
stopDetector();
}
void startDetector() {
@ -322,7 +310,7 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
// SurfaceView surfaceView = (SurfaceView) findViewById(R.id.surfaceView);
detector = new CameraDetector(this, CameraDetector.CameraType.CAMERA_FRONT, cameraPreview, 1, Detector.FaceDetectorMode.LARGE_FACES);
// detector.setLicensePath("emotionhero_dev.license");
detector.setLicensePath("emotionhero_dev.license");
detector.setDetectAllEmotions(true);
detector.setDetectAllAppearances(false);
@ -376,7 +364,6 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
previewHeight = height;
previewWidth = width;
}
Log.i(LOG_TAG, "onCameraSize "+previewWidth +"x"+previewHeight);
cameraPreview.requestLayout();
}
@ -427,26 +414,4 @@ public class MirrorMenuActivity extends AppCompatActivity implements Detector.Im
messageText.setVisibility(View.GONE);
}
/**
* For kiosk mode only
*/
@Override
public void onBackPressed() {
// nothing to do here
// really
}
/**
* For kioskmode
* @param hasFocus
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if(!hasFocus) {
// Close every kind of system dialog
Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(closeDialog);
}
}
}

View file

@ -1,47 +0,0 @@
package com.rubenvandeven.emotionhero;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.PowerManager;
import android.preference.PreferenceManager;
import android.util.Log;
/**
* For kioskmode only!
* See http://www.andreas-schrade.de/2015/02/16/android-tutorial-how-to-create-a-kiosk-mode-in-android/
*/
public class OnScreenOffReceiver extends BroadcastReceiver {
private static final String PREF_KIOSK_MODE = "pref_kiosk_mode";
@Override
public void onReceive(Context context, Intent intent) {
if(Intent.ACTION_SCREEN_OFF.equals(intent.getAction())){
AppContext ctx = (AppContext) context.getApplicationContext();
// is Kiosk Mode active?
if(isKioskModeActive(ctx)) {
wakeUpDevice(ctx);
}
}
}
private void wakeUpDevice(AppContext context) {
PowerManager.WakeLock wakeLock = context.getWakeLock(); // get WakeLock reference via AppContext
if (wakeLock.isHeld()) {
wakeLock.release(); // release old wake lock
}
// create a new wake lock...
wakeLock.acquire();
// ... and release again
wakeLock.release();
}
private boolean isKioskModeActive(final Context context) {
return true;
// SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
// return sp.getBoolean(PREF_KIOSK_MODE, false);
}
}

View file

@ -64,15 +64,13 @@ public class Player {
}
public boolean hasSetSnapshotConfirm() {
return true; // this is kioskmode, always snapshot!
// SharedPreferences settings = c.getSharedPreferences(PREFS_NAME, 0);
// return settings.contains("snapshot_confirm");
SharedPreferences settings = c.getSharedPreferences(PREFS_NAME, 0);
return settings.contains("snapshot_confirm");
}
public boolean allowsSnapshots() {
return true; // this is kioskmode: always snapshot!
// SharedPreferences settings = c.getSharedPreferences(PREFS_NAME, 0);
// return settings.getBoolean("snapshot_confirm", false);
SharedPreferences settings = c.getSharedPreferences(PREFS_NAME, 0);
return settings.getBoolean("snapshot_confirm", false);
}
public void setAllowsSnapshots(boolean allows) {

View file

@ -1,8 +1,6 @@
package com.rubenvandeven.emotionhero;
import android.app.ActivityManager;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Typeface;
import android.support.v7.app.AppCompatActivity;
@ -214,28 +212,4 @@ public class ProgressActivity extends AppCompatActivity {
levelsLayout.addView(outroText);
}
@Override
protected void onPause() {
super.onPause();
ActivityManager activityManager = (ActivityManager) getApplicationContext()
.getSystemService(Context.ACTIVITY_SERVICE);
activityManager.moveTaskToFront(getTaskId(), 0);
}
/**
* For kioskmode
* @param hasFocus
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if(!hasFocus) {
// Close every kind of system dialog
Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(closeDialog);
}
}
}

View file

@ -1,8 +1,5 @@
package com.rubenvandeven.emotionhero;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.AppCompatTextView;
@ -97,27 +94,4 @@ public class ReviewAchievementsActivity extends AppCompatActivity {
achievementsLayout.addView(titleText);
achievementsLayout.addView(descriptionLayout);
}
/**
* For kioskmode
* @param hasFocus
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if(!hasFocus) {
// Close every kind of system dialog
Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(closeDialog);
}
}
@Override
protected void onPause() {
super.onPause();
ActivityManager activityManager = (ActivityManager) getApplicationContext()
.getSystemService(Context.ACTIVITY_SERVICE);
activityManager.moveTaskToFront(getTaskId(), 0);
}
}

View file

@ -1,8 +1,6 @@
package com.rubenvandeven.emotionhero;
import android.app.ActivityManager;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Handler;
@ -356,29 +354,4 @@ public class ReviewActivity extends AppCompatActivity {
return super.onOptionsItemSelected(menuItem);
}
}
/**
* For kioskmode
* @param hasFocus
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if(!hasFocus) {
// Close every kind of system dialog
Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(closeDialog);
}
}
@Override
protected void onPause() {
super.onPause();
ActivityManager activityManager = (ActivityManager) getApplicationContext()
.getSystemService(Context.ACTIVITY_SERVICE);
activityManager.moveTaskToFront(getTaskId(), 0);
}
}

View file

@ -147,8 +147,6 @@ public class ScenarioView extends SurfaceView implements SurfaceHolder.Callback
float height = canvas.getHeight();
float width = canvas.getWidth();
Log.i("ScenarioView", "onDraw "+ width+" x " +height);
if(_scenario != null)
{

View file

@ -1,5 +1,5 @@
<resources>
<string name="app_name">Emotion Hero - Exhibition Edition</string>
<string name="app_name">Emotion Hero</string>
<string name="dummy_button">Dummy Button</string>
<string name="dummy_content">initialising&#8230;</string>
@ -23,6 +23,4 @@
<string name="permission_yes">Sure!</string>
<string name="ending_winner">You are the one and only <i>Emotion Hero</i>!</string>
<string name="ending_loser">You have finished all steps in the training, and many peers have done the same. It is too bad that many scored better than you. Try smiling better next time!</string>
<string name="crash_toast_text">Sorry, Emotion Hero just crashed.</string>
</resources>