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
6c3b6c11
Commit
6c3b6c11
authored
Mar 22, 2022
by
Anuththara18
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Focused Attention - Removing Buttons
parent
703be6af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
140 additions
and
32 deletions
+140
-32
app/src/main/java/com/anuththara18/attentionassessment/focused/FocusedAttentionGame1.java
...18/attentionassessment/focused/FocusedAttentionGame1.java
+138
-31
app/src/main/res/layout/activity_focused_attention_game1.xml
app/src/main/res/layout/activity_focused_attention_game1.xml
+2
-1
No files found.
app/src/main/java/com/anuththara18/attentionassessment/focused/FocusedAttentionGame1.java
View file @
6c3b6c11
...
@@ -149,7 +149,14 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
...
@@ -149,7 +149,14 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView5
.
setVisibility
(
View
.
INVISIBLE
);
imageView5
.
setVisibility
(
View
.
INVISIBLE
);
imageView6
.
setVisibility
(
View
.
INVISIBLE
);
imageView6
.
setVisibility
(
View
.
INVISIBLE
);
clicked
=
"null"
;
clicked
=
"null"
;
red_btn
.
setEnabled
(
true
);
imageView
.
setEnabled
(
true
);
imageView2
.
setEnabled
(
true
);
imageView3
.
setEnabled
(
true
);
imageView4
.
setEnabled
(
true
);
imageView5
.
setEnabled
(
true
);
imageView6
.
setEnabled
(
true
);
radomTimer
=
random
.
nextInt
(
5
);
radomTimer
=
random
.
nextInt
(
5
);
updateInterval
=
isi
[
radomTimer
];
updateInterval
=
isi
[
radomTimer
];
imageView
.
postDelayed
(
this
,
updateInterval
);
imageView
.
postDelayed
(
this
,
updateInterval
);
...
@@ -230,7 +237,12 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
...
@@ -230,7 +237,12 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView6
.
setImageResource
(
images
[
rand
]);
imageView6
.
setImageResource
(
images
[
rand
]);
}
}
red_btn
.
setEnabled
(
true
);
imageView
.
setEnabled
(
true
);
imageView2
.
setEnabled
(
true
);
imageView3
.
setEnabled
(
true
);
imageView4
.
setEnabled
(
true
);
imageView5
.
setEnabled
(
true
);
imageView6
.
setEnabled
(
true
);
clicked
=
"monkey"
;
clicked
=
"monkey"
;
startTime
=
System
.
currentTimeMillis
();
startTime
=
System
.
currentTimeMillis
();
imageView
.
postDelayed
(
this
,
3000
);
imageView
.
postDelayed
(
this
,
3000
);
...
@@ -270,42 +282,137 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
...
@@ -270,42 +282,137 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
}
}
}.
run
();
}.
run
();
red_btn
.
setOnTouchListener
(
new
View
.
OnTouch
Listener
()
{
imageView
.
setOnClickListener
(
new
View
.
OnClick
Listener
()
{
@Override
@Override
public
boolean
onTouch
(
View
view
,
MotionEvent
motionEvent
)
{
public
void
onClick
(
View
view
)
{
switch
(
motionEvent
.
getAction
())
{
mp2
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
case
MotionEvent
.
ACTION_DOWN
:
{
mp2
.
start
();
red_btn
.
getBackground
().
setColorFilter
(
0x77000000
,
PorterDuff
.
Mode
.
SRC_ATOP
);
// Your action here on button click
view
.
invalidate
();
clickedTime
=
System
.
currentTimeMillis
();
mp2
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
reactionTime
=
(
clickedTime
-
startTime
);
mp2
.
start
();
//if (clicked.equals("monkey")) {
break
;
if
(
i
-
1
==
2
||
i
-
1
==
14
||
i
-
1
==
26
||
i
-
1
==
38
)
{
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
imageView
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCommissionErrors
++;
}
}
case
MotionEvent
.
ACTION_UP
:
}
// Your action here on button click
});
clickedTime
=
System
.
currentTimeMillis
();
reactionTime
=
(
clickedTime
-
startTime
);
if
(
clicked
.
equals
(
"monkey"
))
{
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
red_btn
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCommissionErrors
++;
}
case
MotionEvent
.
ACTION_CANCEL
:
{
imageView2
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
red_btn
.
getBackground
().
clearColorFilter
();
@Override
view
.
invalidate
();
public
void
onClick
(
View
view
)
{
break
;
mp2
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp2
.
start
();
// Your action here on button click
clickedTime
=
System
.
currentTimeMillis
();
reactionTime
=
(
clickedTime
-
startTime
);
//if (clicked.equals("monkey")) {
if
(
i
-
1
==
4
||
i
-
1
==
16
||
i
-
1
==
28
||
i
-
1
==
40
)
{
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
imageView2
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCommissionErrors
++;
}
}
}
return
true
;
}
}
});
});
imageView3
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
mp2
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp2
.
start
();
// Your action here on button click
clickedTime
=
System
.
currentTimeMillis
();
reactionTime
=
(
clickedTime
-
startTime
);
if
(
i
-
1
==
6
||
i
-
1
==
18
||
i
-
1
==
30
)
{
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
imageView3
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCommissionErrors
++;
}
}
});
imageView4
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
mp2
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp2
.
start
();
// Your action here on button click
clickedTime
=
System
.
currentTimeMillis
();
reactionTime
=
(
clickedTime
-
startTime
);
if
(
i
-
1
==
8
||
i
-
1
==
20
||
i
-
1
==
32
)
{
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
imageView4
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCommissionErrors
++;
}
}
});
imageView5
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
mp2
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp2
.
start
();
// Your action here on button click
clickedTime
=
System
.
currentTimeMillis
();
reactionTime
=
(
clickedTime
-
startTime
);
if
(
i
-
1
==
10
||
i
-
1
==
22
||
i
-
1
==
34
)
{
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
imageView5
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCommissionErrors
++;
}
}
});
imageView6
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
mp2
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp2
.
start
();
// Your action here on button click
clickedTime
=
System
.
currentTimeMillis
();
reactionTime
=
(
clickedTime
-
startTime
);
if
(
i
-
1
==
12
||
i
-
1
==
24
||
i
-
1
==
36
)
{
totalReactionTime
=
totalReactionTime
+
reactionTime
;
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
imageView6
.
setEnabled
(
false
);
}
else
{
Log
.
d
(
"wrong"
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCommissionErrors
++;
}
}
});
cross_btn
.
setOnTouchListener
(
new
View
.
OnTouchListener
()
{
cross_btn
.
setOnTouchListener
(
new
View
.
OnTouchListener
()
{
@Override
@Override
public
boolean
onTouch
(
View
view
,
MotionEvent
motionEvent
)
{
public
boolean
onTouch
(
View
view
,
MotionEvent
motionEvent
)
{
...
...
app/src/main/res/layout/activity_focused_attention_game1.xml
View file @
6c3b6c11
...
@@ -108,6 +108,7 @@
...
@@ -108,6 +108,7 @@
app:layout_constraintHorizontal_bias=
"0.246"
app:layout_constraintHorizontal_bias=
"0.246"
app:layout_constraintStart_toStartOf=
"parent"
/>
app:layout_constraintStart_toStartOf=
"parent"
/>
<!--
<ImageButton
<ImageButton
android:id="@+id/red_btn"
android:id="@+id/red_btn"
android:layout_width="150dp"
android:layout_width="150dp"
...
@@ -117,7 +118,7 @@
...
@@ -117,7 +118,7 @@
android:background="@drawable/red_btn"
android:background="@drawable/red_btn"
android:elevation="80dp"
android:elevation="80dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf=
"parent"
/>
app:layout_constraintEnd_toEndOf="parent" />
-->
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
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