Kiosk goes to main menu after 60s no face found during game
This commit is contained in:
parent
90c898db82
commit
8dc463c388
3 changed files with 24 additions and 7 deletions
|
@ -9,8 +9,8 @@ android {
|
||||||
applicationId 'com.rubenvandeven.emotion_hero.kiosk'
|
applicationId 'com.rubenvandeven.emotion_hero.kiosk'
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 24
|
targetSdkVersion 24
|
||||||
versionCode 7
|
versionCode 8
|
||||||
versionName '0.9'
|
versionName '1.0'
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
renderscriptTargetApi 16
|
renderscriptTargetApi 16
|
||||||
|
|
|
@ -28,11 +28,6 @@
|
||||||
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">
|
||||||
|
|
||||||
<!-- <intent-filter> -->
|
|
||||||
<!-- <action android:name="android.intent.action.MAIN" /> -->
|
|
||||||
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
|
|
||||||
<!-- </intent-filter> -->
|
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".IntroActivity"
|
android:name=".IntroActivity"
|
||||||
|
|
|
@ -35,6 +35,8 @@ import com.affectiva.android.affdex.sdk.detector.Face;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,6 +75,8 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
|
||||||
|
|
||||||
protected boolean isStarted = false;
|
protected boolean isStarted = false;
|
||||||
|
|
||||||
|
protected Timer timeoutTimer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -315,6 +319,11 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
|
||||||
setText("START!");
|
setText("START!");
|
||||||
currentScenario.lostFace = false;
|
currentScenario.lostFace = false;
|
||||||
|
|
||||||
|
// in kioskmode, if no face is found for 60s return to main screen
|
||||||
|
if(timeoutTimer != null) {
|
||||||
|
timeoutTimer.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
if(isStarted)
|
if(isStarted)
|
||||||
currentScenario.start();
|
currentScenario.start();
|
||||||
}
|
}
|
||||||
|
@ -324,6 +333,19 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
|
||||||
{
|
{
|
||||||
currentScenario.pause();
|
currentScenario.pause();
|
||||||
currentScenario.lostFace = true;
|
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)
|
public void setText(String text)
|
||||||
|
|
Loading…
Reference in a new issue