Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
Research-Project
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jayakody J.A.D.K.A - IT19114040
Research-Project
Commits
39ddc7eb
Commit
39ddc7eb
authored
May 07, 2022
by
Anuththara18
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding analysing factors - Focused Attention
parent
e06d96d6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
202 additions
and
70 deletions
+202
-70
app/src/main/java/com/anuththara18/attentionassessment/focused/FACompleteScreen.java
...thara18/attentionassessment/focused/FACompleteScreen.java
+18
-12
app/src/main/java/com/anuththara18/attentionassessment/focused/Focused.java
...com/anuththara18/attentionassessment/focused/Focused.java
+73
-1
app/src/main/java/com/anuththara18/attentionassessment/focused/FocusedAttentionGame1.java
...18/attentionassessment/focused/FocusedAttentionGame1.java
+95
-55
app/src/main/java/com/anuththara18/attentionassessment/focused/FocusedAttentionGame2.java
...18/attentionassessment/focused/FocusedAttentionGame2.java
+16
-2
No files found.
app/src/main/java/com/anuththara18/attentionassessment/focused/FACompleteScreen.java
View file @
39ddc7eb
...
...
@@ -80,6 +80,7 @@ public class FACompleteScreen extends AppCompatActivity {
String
stimulus
;
String
colour
;
String
responses
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -158,12 +159,16 @@ public class FACompleteScreen extends AppCompatActivity {
dataList
.
add
(
new
Focused
(
cursorEmployees
.
getInt
(
0
),
cursorEmployees
.
getInt
(
1
),
cursorEmployees
.
get
Int
(
2
),
cursorEmployees
.
get
Int
(
3
),
cursorEmployees
.
get
Int
(
4
),
cursorEmployees
.
get
String
(
2
),
cursorEmployees
.
get
String
(
3
),
cursorEmployees
.
get
String
(
4
),
cursorEmployees
.
getInt
(
5
),
cursorEmployees
.
getInt
(
6
),
cursorEmployees
.
getInt
(
7
)
cursorEmployees
.
getInt
(
7
),
cursorEmployees
.
getInt
(
8
),
cursorEmployees
.
getInt
(
9
),
cursorEmployees
.
getInt
(
10
),
cursorEmployees
.
getString
(
11
)
));
}
while
(
cursorEmployees
.
moveToNext
());
}
...
...
@@ -191,14 +196,17 @@ public class FACompleteScreen extends AppCompatActivity {
if
(
Map1Activity
.
level
==
1
||
Map1Activity
.
level
==
2
)
{
stimulus
=
"bear head"
;
colour
=
"brown"
;
responses
=
String
.
valueOf
(
FocusedAttentionGame2
.
sequence_of_responses
);
}
else
if
(
Map1Activity
.
level
==
2
||
Map1Activity
.
level
==
3
)
{
else
if
(
Map1Activity
.
level
==
3
||
Map1Activity
.
level
==
4
)
{
stimulus
=
FocusedAttentionGame1
.
stimulus
;
colour
=
FocusedAttentionGame1
.
colour
;
responses
=
String
.
valueOf
(
FocusedAttentionGame1
.
sequence_of_responses
);
}
else
if
(
Map1Activity
.
level
==
5
)
{
stimulus
=
FocusedAttentionGame1
.
stimulus
;
colour
=
FocusedAttentionGame1
.
colour
;
responses
=
String
.
valueOf
(
FocusedAttentionGame1
.
sequence_of_responses
);
}
for
(
int
i
=
0
;
i
<
dataList
.
size
();
i
++)
{
...
...
@@ -207,19 +215,17 @@ public class FACompleteScreen extends AppCompatActivity {
data
.
add
(
new
String
[]{
String
.
valueOf
(
gameData
.
getId
()),
String
.
valueOf
(
String
.
valueOf
(
gameData
.
getChildID
()).
charAt
(
0
)),
String
.
valueOf
(
String
.
valueOf
(
gameData
.
getChildID
()).
charAt
(
1
)),
String
.
valueOf
(
Map1Activity
.
level
),
String
.
valueOf
(
stimulus
),
String
.
valueOf
(
colour
),
String
.
valueOf
(
"null"
),
String
.
valueOf
(
String
.
valueOf
(
gameData
.
getChildID
()).
charAt
(
2
)),
String
.
valueOf
(
gameData
.
getStimulus
()),
String
.
valueOf
(
gameData
.
getColour
()),
String
.
valueOf
(
gameData
.
getSequence_of_responses
()),
String
.
valueOf
(
gameData
.
getTotalCorrectResponses
()),
String
.
valueOf
(
gameData
.
getNoOfCorrectResponses
()),
String
.
valueOf
(
gameData
.
getNoOfCommissionErrors
()),
String
.
valueOf
(
gameData
.
getNoOfOmmissionErrors
()),
String
.
valueOf
(
gameData
.
getMeanReactionTime
()),
String
.
valueOf
(
gameData
.
getTotalDuration
()),
String
.
valueOf
(
ParentDetailsActivity
.
diagnosis
)
String
.
valueOf
(
gameData
.
getDiagnosis
()
)
});
}
...
...
app/src/main/java/com/anuththara18/attentionassessment/focused/Focused.java
View file @
39ddc7eb
...
...
@@ -4,56 +4,128 @@ public class Focused {
private
int
id
;
private
int
childID
;
private
String
stimulus
;
private
String
colour
;
private
String
sequence_of_responses
;
private
int
totalCorrectResponses
;
private
int
noOfCorrectResponses
;
private
int
noOfCommissionErrors
;
private
int
noOfOmmissionErrors
;
private
int
meanReactionTime
;
private
int
totalDuration
;
private
String
diagnosis
;
public
Focused
(
int
id
,
int
childID
,
int
totalCorrectResponses
,
int
noOfCorrectResponses
,
int
noOfCommissionErrors
,
int
noOfOmmissionErrors
,
int
meanReactionTime
,
int
totalDuration
)
{
public
Focused
(
int
id
,
int
childID
,
String
stimulus
,
String
colour
,
String
sequence_of_responses
,
int
totalCorrectResponses
,
int
noOfCorrectResponses
,
int
noOfCommissionErrors
,
int
noOfOmmissionErrors
,
int
meanReactionTime
,
int
totalDuration
,
String
diagnosis
)
{
this
.
id
=
id
;
this
.
childID
=
childID
;
this
.
stimulus
=
stimulus
;
this
.
colour
=
colour
;
this
.
sequence_of_responses
=
sequence_of_responses
;
this
.
totalCorrectResponses
=
totalCorrectResponses
;
this
.
noOfCorrectResponses
=
noOfCorrectResponses
;
this
.
noOfCommissionErrors
=
noOfCommissionErrors
;
this
.
noOfOmmissionErrors
=
noOfOmmissionErrors
;
this
.
meanReactionTime
=
meanReactionTime
;
this
.
totalDuration
=
totalDuration
;
this
.
diagnosis
=
diagnosis
;
}
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
int
getChildID
()
{
return
childID
;
}
public
void
setChildID
(
int
childID
)
{
this
.
childID
=
childID
;
}
public
String
getStimulus
()
{
return
stimulus
;
}
public
void
setStimulus
(
String
stimulus
)
{
this
.
stimulus
=
stimulus
;
}
public
String
getColour
()
{
return
colour
;
}
public
void
setColour
(
String
colour
)
{
this
.
colour
=
colour
;
}
public
String
getSequence_of_responses
()
{
return
sequence_of_responses
;
}
public
void
setSequence_of_responses
(
String
sequence_of_responses
)
{
this
.
sequence_of_responses
=
sequence_of_responses
;
}
public
int
getTotalCorrectResponses
()
{
return
totalCorrectResponses
;
}
public
void
setTotalCorrectResponses
(
int
totalCorrectResponses
)
{
this
.
totalCorrectResponses
=
totalCorrectResponses
;
}
public
int
getNoOfCorrectResponses
()
{
return
noOfCorrectResponses
;
}
public
void
setNoOfCorrectResponses
(
int
noOfCorrectResponses
)
{
this
.
noOfCorrectResponses
=
noOfCorrectResponses
;
}
public
int
getNoOfCommissionErrors
()
{
return
noOfCommissionErrors
;
}
public
void
setNoOfCommissionErrors
(
int
noOfCommissionErrors
)
{
this
.
noOfCommissionErrors
=
noOfCommissionErrors
;
}
public
int
getNoOfOmmissionErrors
()
{
return
noOfOmmissionErrors
;
}
public
void
setNoOfOmmissionErrors
(
int
noOfOmmissionErrors
)
{
this
.
noOfOmmissionErrors
=
noOfOmmissionErrors
;
}
public
int
getMeanReactionTime
()
{
return
meanReactionTime
;
}
public
void
setMeanReactionTime
(
int
meanReactionTime
)
{
this
.
meanReactionTime
=
meanReactionTime
;
}
public
int
getTotalDuration
()
{
return
totalDuration
;
}
public
void
setTotalDuration
(
int
totalDuration
)
{
this
.
totalDuration
=
totalDuration
;
}
public
String
getDiagnosis
()
{
return
diagnosis
;
}
public
void
setDiagnosis
(
String
diagnosis
)
{
this
.
diagnosis
=
diagnosis
;
}
/*
CREATE TABLE sustainedAttention (
id int NOT NULL AUTO_INCREMENT,
...
...
app/src/main/java/com/anuththara18/attentionassessment/focused/FocusedAttentionGame1.java
View file @
39ddc7eb
...
...
@@ -31,6 +31,7 @@ import com.anuththara18.attentionassessment.R;
import
com.anuththara18.attentionassessment.age.AgeActivity
;
import
com.anuththara18.attentionassessment.db.Api
;
import
com.anuththara18.attentionassessment.db.RequestHandler
;
import
com.anuththara18.attentionassessment.details.ParentDetailsActivity
;
import
com.anuththara18.attentionassessment.gender.GenderActivity
;
import
com.anuththara18.attentionassessment.home.NavigationDrawerActivity
;
import
com.anuththara18.attentionassessment.language.LanguageSetter
;
...
...
@@ -66,12 +67,13 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
int
radomTimer
=
0
;
int
rand
=
0
;
public
static
String
stimulus
,
colour
,
sequence_of_responses
=
""
;
public
static
String
stimulus
,
colour
;
int
i
=
1
;
private
long
startTime
,
clickedTime
=
0
;
long
reactionTime
;
int
count
;
int
missed
=
0
;
int
totalCorrectResponses
=
0
;
int
noOfCorrectResponses
=
0
;
...
...
@@ -92,6 +94,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
Integer
[]
images
=
{
R
.
drawable
.
monkey
,
R
.
drawable
.
baby_zebra
,
R
.
drawable
.
elephant
,
R
.
drawable
.
pig
,
R
.
drawable
.
giraffe
,
R
.
drawable
.
cow
,
R
.
drawable
.
horse
,
R
.
drawable
.
dino
,
R
.
drawable
.
lion
,
R
.
drawable
.
dog
};
public
static
ArrayList
<
String
>
sequence_of_responses
;
MediaPlayer
mp
,
mp2
;
@Override
...
...
@@ -118,9 +122,14 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
textView
.
setText
(
LanguageSetter
.
getresources
().
getString
(
R
.
string
.
focg1
));
stimulus
=
""
;
colour
=
""
;
mp
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
focused
);
mp
.
start
();
sequence_of_responses
=
new
ArrayList
<>();
mp
.
setOnCompletionListener
(
new
MediaPlayer
.
OnCompletionListener
()
{
@Override
...
...
@@ -136,30 +145,27 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
//creating a database
mDatabase
=
openOrCreateDatabase
(
DATABASE_NAME
,
MODE_PRIVATE
,
null
);
if
(
AnimalChoosingActivity
.
birdSelected
==
0
)
{
if
(
Map1Activity
.
level
==
3
||
Map1Activity
.
level
==
4
)
{
if
(
AnimalChoosingActivity
.
birdSelected
==
0
)
{
stimulus
=
"monkey"
;
colour
=
"shades of brown"
;
}
else
if
(
AnimalChoosingActivity
.
birdSelected
==
1
)
{
}
else
if
(
AnimalChoosingActivity
.
birdSelected
==
1
)
{
stimulus
=
"zebra"
;
colour
=
"black & white"
;
}
else
if
(
AnimalChoosingActivity
.
birdSelected
==
4
)
{
}
else
if
(
AnimalChoosingActivity
.
birdSelected
==
4
)
{
stimulus
=
"giraffe"
;
colour
=
"yellow & brown"
;
}
else
if
(
AnimalChoosingActivity
.
birdSelected
==
9
)
{
}
else
if
(
AnimalChoosingActivity
.
birdSelected
==
9
)
{
stimulus
=
"dog"
;
colour
=
"brown orange"
;
}
else
if
(
AnimalChoosingActivity
.
birdSelected
==
5
)
{
}
else
if
(
AnimalChoosingActivity
.
birdSelected
==
5
)
{
stimulus
=
"cow"
;
colour
=
"black & white"
;
}
else
if
(
AnimalChoosingActivity
.
birdSelected
==
8
)
{
}
else
if
(
AnimalChoosingActivity
.
birdSelected
==
8
)
{
stimulus
=
"lion"
;
colour
=
"orange & brown"
;
}
}
List
<
Integer
>
unpickedNumbers
=
new
ArrayList
<
Integer
>();
unpickedNumbers
.
add
(
0
);
...
...
@@ -199,6 +205,11 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView5
.
setEnabled
(
true
);
imageView6
.
setEnabled
(
true
);
if
(
missed
==
0
)
{
sequence_of_responses
.
add
(
"M"
);
Log
.
d
(
"%%%%%%%%%%%%%%%%%%"
,
String
.
valueOf
(
sequence_of_responses
));
}
radomTimer
=
random
.
nextInt
(
5
);
updateInterval
=
isi
[
radomTimer
];
imageView
.
postDelayed
(
this
,
updateInterval
);
...
...
@@ -407,6 +418,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
}
missed
=
0
;
imageView
.
setEnabled
(
true
);
imageView2
.
setEnabled
(
true
);
imageView3
.
setEnabled
(
true
);
...
...
@@ -440,7 +453,11 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
Log
.
d
(
"commissionErrors"
,
String
.
valueOf
(
noOfCommissionErrors
));
Log
.
d
(
"meanReactionTime"
,
String
.
valueOf
(
meanReactionTime
));
Log
.
d
(
"duration"
,
String
.
valueOf
(
duration
));
saveDataToOnlineDB
();
Log
.
d
(
"stimulus"
,
String
.
valueOf
(
stimulus
));
Log
.
d
(
"colour"
,
String
.
valueOf
(
colour
));
sequence_of_responses
.
remove
(
0
);
Log
.
d
(
"responses"
,
String
.
valueOf
(
sequence_of_responses
));
//saveDataToOnlineDB();
createTable
();
saveDataToLocalDB
();
...
...
@@ -474,6 +491,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
public
void
onClick
(
View
view
)
{
mp2
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp2
.
start
();
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
blink
);
imageView
.
startAnimation
(
animZoomOut
);
// Your action here on button click
clickedTime
=
System
.
currentTimeMillis
();
reactionTime
=
(
clickedTime
-
startTime
);
...
...
@@ -482,6 +501,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
missed
=
1
;
sequence_of_responses
.
add
(
"C"
);
imageView
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
...
...
@@ -495,6 +516,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
public
void
onClick
(
View
view
)
{
mp2
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp2
.
start
();
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
blink
);
imageView2
.
startAnimation
(
animZoomOut
);
// Your action here on button click
clickedTime
=
System
.
currentTimeMillis
();
reactionTime
=
(
clickedTime
-
startTime
);
...
...
@@ -503,6 +526,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
missed
=
1
;
sequence_of_responses
.
add
(
"C"
);
imageView2
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
...
...
@@ -514,9 +539,10 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView3
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
mp2
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp2
.
start
();
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
blink
);
imageView3
.
startAnimation
(
animZoomOut
);
// Your action here on button click
clickedTime
=
System
.
currentTimeMillis
();
reactionTime
=
(
clickedTime
-
startTime
);
...
...
@@ -524,6 +550,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
missed
=
1
;
sequence_of_responses
.
add
(
"C"
);
imageView3
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
...
...
@@ -536,9 +564,10 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView4
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
mp2
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp2
.
start
();
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
blink
);
imageView4
.
startAnimation
(
animZoomOut
);
// Your action here on button click
clickedTime
=
System
.
currentTimeMillis
();
reactionTime
=
(
clickedTime
-
startTime
);
...
...
@@ -546,6 +575,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
missed
=
1
;
sequence_of_responses
.
add
(
"C"
);
imageView4
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
...
...
@@ -558,9 +589,10 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView5
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
mp2
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp2
.
start
();
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
blink
);
imageView5
.
startAnimation
(
animZoomOut
);
// Your action here on button click
clickedTime
=
System
.
currentTimeMillis
();
reactionTime
=
(
clickedTime
-
startTime
);
...
...
@@ -568,6 +600,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
missed
=
1
;
sequence_of_responses
.
add
(
"C"
);
imageView5
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
...
...
@@ -580,9 +614,10 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView6
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
mp2
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp2
.
start
();
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
blink
);
imageView6
.
startAnimation
(
animZoomOut
);
// Your action here on button click
clickedTime
=
System
.
currentTimeMillis
();
reactionTime
=
(
clickedTime
-
startTime
);
...
...
@@ -590,12 +625,13 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
missed
=
1
;
sequence_of_responses
.
add
(
"C"
);
imageView6
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCommissionErrors
++;
}
}
});
...
...
@@ -626,35 +662,35 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
public
void
getData
(){
if
(
rand
==
0
)
{
stimulus
=
stimulus
+
"
monkey, "
;
colour
=
colour
+
"
-
shades of brown, "
;
stimulus
=
stimulus
+
"monkey, "
;
colour
=
colour
+
"shades of brown, "
;
}
else
if
(
rand
==
1
)
{
stimulus
=
stimulus
+
"
zebra, "
;
colour
=
colour
+
"
-
black & white, "
;
stimulus
=
stimulus
+
"zebra, "
;
colour
=
colour
+
"black & white, "
;
}
else
if
(
rand
==
2
)
{
stimulus
=
stimulus
+
"
elephant, "
;
colour
=
colour
+
"
-
grey, "
;
stimulus
=
stimulus
+
"elephant, "
;
colour
=
colour
+
"grey, "
;
}
else
if
(
rand
==
3
)
{
stimulus
=
stimulus
+
"
pig, "
;
colour
=
colour
+
"
-
pink, "
;
stimulus
=
stimulus
+
"pig, "
;
colour
=
colour
+
"pink, "
;
}
else
if
(
rand
==
4
)
{
stimulus
=
stimulus
+
"
giraffe, "
;
colour
=
colour
+
"
-
yellow & brown, "
;
stimulus
=
stimulus
+
"giraffe, "
;
colour
=
colour
+
"yellow & brown, "
;
}
else
if
(
rand
==
5
)
{
stimulus
=
stimulus
+
"
cow, "
;
colour
=
colour
+
"
-
black & white, "
;
stimulus
=
stimulus
+
"cow, "
;
colour
=
colour
+
"black & white, "
;
}
else
if
(
rand
==
6
)
{
stimulus
=
stimulus
+
"
horse, "
;
colour
=
colour
+
"
-
shades of brown, "
;
stimulus
=
stimulus
+
"horse, "
;
colour
=
colour
+
"shades of brown, "
;
}
else
if
(
rand
==
7
)
{
stimulus
=
stimulus
+
"
dino, "
;
colour
=
colour
+
"
-
purple & red, "
;
stimulus
=
stimulus
+
"dino, "
;
colour
=
colour
+
"purple & red, "
;
}
else
if
(
rand
==
8
)
{
stimulus
=
stimulus
+
"
lion, "
;
colour
=
colour
+
"
-
orange & brown, "
;
stimulus
=
stimulus
+
"lion, "
;
colour
=
colour
+
"orange & brown, "
;
}
else
if
(
rand
==
9
)
{
stimulus
=
stimulus
+
"
dog, "
;
colour
=
colour
+
"
-
brown orange, "
;
stimulus
=
stimulus
+
"dog, "
;
colour
=
colour
+
"brown orange, "
;
}
}
...
...
@@ -827,16 +863,21 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
"CREATE TABLE IF NOT EXISTS focusedAttention (\n"
+
" id INTEGER PRIMARY KEY AUTOINCREMENT,\n"
+
" childID int NOT NULL,\n"
+
" stimulus text NOT NULL,\n"
+
" colour text NOT NULL,\n"
+
" sequence_of_responses text NOT NULL,\n"
+
" totalCorrectResponses int NOT NULL,\n"
+
" noOfCorrectResponses int NOT NULL,\n"
+
" noOfCommissionErrors int NOT NULL,\n"
+
" noOfOmmissionErrors int NOT NULL,\n"
+
" meanReactionTime int NOT NULL,\n"
+
" totalDuration int NOT NULL\n"
+
" totalDuration int NOT NULL,\n"
+
" diagnosis text NOT NULL\n"
+
");"
);
}
/*************************************************************************************************/
private
void
saveDataToLocalDB
()
{
...
...
@@ -851,12 +892,11 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
int
total_duration
=
duration
;
String
insertSQL
=
"INSERT INTO focusedAttention \n"
+
"(childID,
totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration
)\n"
+
"(childID,
stimulus, colour, sequence_of_responses, totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration, diagnosis
)\n"
+
"VALUES \n"
+
"(?, ?, ?, ?, ?, ?, ?);"
;
mDatabase
.
execSQL
(
insertSQL
,
new
Integer
[]{
child_ID
,
total_correct_responses
,
no_of_correct_responses
,
no_of_commission_errors
,
no_of_ommission_errors
,
mean_reaction_time
,
total_duration
});
"(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
;
mDatabase
.
execSQL
(
insertSQL
,
new
Object
[]{
child_ID
,
stimulus
,
colour
,
sequence_of_responses
,
total_correct_responses
,
no_of_correct_responses
,
no_of_commission_errors
,
no_of_ommission_errors
,
mean_reaction_time
,
total_duration
,
ParentDetailsActivity
.
diagnosis
});
//Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
}
...
...
app/src/main/java/com/anuththara18/attentionassessment/focused/FocusedAttentionGame2.java
View file @
39ddc7eb
...
...
@@ -32,6 +32,7 @@ import com.anuththara18.attentionassessment.map.Map1Activity;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
...
...
@@ -52,6 +53,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
Random
random
=
new
Random
();
int
radomTimer
=
0
;
int
rand
=
0
;
int
missed
=
0
;
int
i
=
1
;
private
long
startTime
,
clickedTime
=
0
;
...
...
@@ -71,11 +73,12 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
String
clicked
=
"null"
;
public
static
ArrayList
<
String
>
sequence_of_responses
;
Integer
[]
isi
=
{
3000
,
3500
,
4000
,
4500
,
5000
,
5500
,
6000
};
MediaPlayer
mp
,
mp2
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -103,6 +106,8 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
mp
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
focused
);
mp
.
start
();
sequence_of_responses
=
new
ArrayList
<>();
mp
.
setOnCompletionListener
(
new
MediaPlayer
.
OnCompletionListener
()
{
@Override
...
...
@@ -140,6 +145,11 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
bear3
.
setEnabled
(
true
);
bear4
.
setEnabled
(
true
);
if
(
missed
==
0
)
{
sequence_of_responses
.
add
(
"M"
);
Log
.
d
(
"%%%%%%%%%%%%%%%%%%"
,
String
.
valueOf
(
sequence_of_responses
));
}
radomTimer
=
random
.
nextInt
(
5
);
updateInterval
=
isi
[
radomTimer
];
bear1
.
postDelayed
(
this
,
updateInterval
);
...
...
@@ -221,7 +231,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
Log
.
d
(
"commissionErrors"
,
String
.
valueOf
(
noOfCommissionErrors
));
Log
.
d
(
"meanReactionTime"
,
String
.
valueOf
(
meanReactionTime
));
Log
.
d
(
"duration"
,
String
.
valueOf
(
duration
));
saveDataToOnlineDB
();
//
saveDataToOnlineDB();
createTable
();
saveDataToLocalDB
();
if
(
Map1Activity
.
level
==
1
){
...
...
@@ -256,6 +266,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
sequence_of_responses
.
add
(
"C"
);
bear1
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
...
...
@@ -277,6 +288,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
sequence_of_responses
.
add
(
"C"
);
bear2
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
...
...
@@ -298,6 +310,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
sequence_of_responses
.
add
(
"C"
);
bear3
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
...
...
@@ -320,6 +333,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
sequence_of_responses
.
add
(
"C"
);
bear4
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment