Commit 5ae42c2c authored by Anuththara18's avatar Anuththara18

Selective Attention - Total Duration Recalculation

parent f2879e78
......@@ -114,11 +114,7 @@
android:name=".dividedattention.DividedAttentionGame1"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".sustained.SustainedAttentionGame1"
......@@ -181,7 +177,11 @@
android:name=".splashscreen.SplashActivity"
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
......
......@@ -105,7 +105,6 @@ public class DividedAttentionGame1 extends AppCompatActivity {
mDatabase = openOrCreateDatabase(DATABASE_NAME, MODE_PRIVATE, null);
totalCorrectResponses = 8;
AgeActivity.age = 4;
new Runnable() {
......
......@@ -87,6 +87,7 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
int age = AgeActivity.age;
int level = Map2Activity.level;
Random random;
long gameEnd;
MediaPlayer mp;
int clickCount = 0;
......@@ -114,6 +115,9 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
mp = MediaPlayer.create(getApplicationContext(), R.raw.selective);
mp.start();
long gameStart = System.currentTimeMillis();
Log.d("startTime", String.valueOf(gameStart));
//creating a database
mDatabase = openOrCreateDatabase(DATABASE_NAME, MODE_PRIVATE, null);
......@@ -395,22 +399,19 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
if ( clickCount == 0 ) {
try {
calendar = Calendar.getInstance();
simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
endDate = simpleDateFormat.parse(String.valueOf(simpleDateFormat.format(calendar.getTime())));
Log.d("endTime", String.valueOf(simpleDateFormat.format(calendar.getTime())));
} catch (ParseException parseException) {
gameEnd = System.currentTimeMillis();
Log.d("endTime", String.valueOf(gameEnd));
} catch (Exception parseException) {
parseException.printStackTrace();
}
completionTime = gameEnd - gameStart;
// missed clicks
noOfOmmissionErrors = totalCorrectResponses - noOfCorrectResponses;
Log.d("total", String.valueOf(totalCorrectResponses));
Log.d("correctResponses", String.valueOf(noOfCorrectResponses));
Log.d("omissionErrors", String.valueOf(totalCorrectResponses - noOfCorrectResponses));
Log.d("commissionErrors", String.valueOf(noOfCommissionErrors));
Log.d("duration", String.valueOf(getCompletionTime()));
completionTime = getCompletionTime();
Log.d("duration", String.valueOf(completionTime));
GVAdapter2 adapter = new GVAdapter2(getApplicationContext(), gridModelArrayList);
gridView.setAdapter(adapter);
......@@ -689,34 +690,6 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
/*************************************************************************************************/
public long getCompletionTime() {
long difference = 0;
try {
difference = endDate.getTime() - startDate.getTime();
if(difference<0)
{
Date dateMax = simpleDateFormat.parse("24:00:00");
Date dateMin = simpleDateFormat.parse("00:00:00");
difference=(dateMax.getTime() -startDate.getTime() )+(endDate.getTime()-dateMin.getTime());
}
int days = (int) (difference / (1000*60*60*24));
int hours = (int) ((difference - (1000*60*60*24*days)) / (1000*60*60));
int min = (int) (difference - (1000*60*60*24*days) - (1000*60*60*hours)) / (1000*60);
int sec = (int) (difference - (1000*60*60*24*days) - (1000*60*60*hours) - (1000*60*min)) / (1000);
Log.i("log_tag","Hours: "+hours+", Mins: "+min+", Secs: "+sec + "diff: " + difference);
completionTime = difference;
} catch (ParseException parseException) {
parseException.printStackTrace();
}
return difference;
}
/*************************************************************************************************/
private void saveDataToOnlineDB() {
String child = String.valueOf(GenderActivity.gender) + String.valueOf(AgeActivity.age) + String.valueOf(Map2Activity.level);
......
......@@ -24,7 +24,7 @@
<string name="birdselect">ඔබ වඩාත්ම කැමති චරිතය තෝරන්න</string>
<string name="focg1">වඳුරු පැටවා දිස්වන විට රතු බොත්තම ඔබන්න </string>
<string name="divg1">වර්ණ ගැලපෙන විට රතු බොත්තම ඔබන්න</string>
<string name="divg2">Press the red button when the animals match</string>
<string name="divg2">සතුන් ගැලපෙන විට රතු බොත්තම ඔබන්න</string>
<string name="susg1">කුරුල්ලා අත්ත මත වාඩි වූ විට රතු බොත්තම ඔබන්න</string>
<string name="altg1">සතා පෙනෙන පැත්තේ ඇති රතු බොත්තම ඔබන්න</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment