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
1835a808
Commit
1835a808
authored
May 03, 2022
by
Anuththara18
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Game Map UI Modification, Adding Shared Preferences, Firebase Bux Fix
parent
e525e5f3
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
331 additions
and
21 deletions
+331
-21
app/src/main/java/com/anuththara18/attentionassessment/consentform/GetSignatureActivity.java
...attentionassessment/consentform/GetSignatureActivity.java
+10
-0
app/src/main/java/com/anuththara18/attentionassessment/focused/FocusedAttentionGame1.java
...18/attentionassessment/focused/FocusedAttentionGame1.java
+10
-0
app/src/main/java/com/anuththara18/attentionassessment/focused/FocusedAttentionGame2.java
...18/attentionassessment/focused/FocusedAttentionGame2.java
+6
-1
app/src/main/java/com/anuththara18/attentionassessment/language/LanguageActivity.java
...hara18/attentionassessment/language/LanguageActivity.java
+18
-0
app/src/main/java/com/anuththara18/attentionassessment/map/Map1Activity.java
...om/anuththara18/attentionassessment/map/Map1Activity.java
+125
-1
app/src/main/java/com/anuththara18/attentionassessment/map/Map2Activity.java
...om/anuththara18/attentionassessment/map/Map2Activity.java
+126
-1
app/src/main/java/com/anuththara18/attentionassessment/selective/SelectiveACompleteScreen.java
...tentionassessment/selective/SelectiveACompleteScreen.java
+2
-3
app/src/main/java/com/anuththara18/attentionassessment/selective/SelectiveAttentionGame1.java
...ttentionassessment/selective/SelectiveAttentionGame1.java
+18
-1
app/src/main/res/layout/activity_consent_form.xml
app/src/main/res/layout/activity_consent_form.xml
+1
-1
app/src/main/res/layout/activity_map1.xml
app/src/main/res/layout/activity_map1.xml
+1
-0
app/src/main/res/layout/activity_map2.xml
app/src/main/res/layout/activity_map2.xml
+14
-13
No files found.
app/src/main/java/com/anuththara18/attentionassessment/consentform/GetSignatureActivity.java
View file @
1835a808
package
com.anuththara18.attentionassessment.consentform
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.graphics.Bitmap
;
import
android.graphics.Canvas
;
import
android.graphics.Color
;
...
...
@@ -40,6 +41,9 @@ public class GetSignatureActivity extends AppCompatActivity {
private
signature
mSignature
;
public
static
Bitmap
bitmap
;
public
static
SharedPreferences
sharedPreferences
;
public
static
SharedPreferences
.
Editor
myEdit
;
// Creating Separate Directory for saving Generated Images
String
DIRECTORY
=
Environment
.
getExternalStorageDirectory
().
getPath
()
+
"/Signature/"
;
String
pic_name
=
new
SimpleDateFormat
(
"yyyyMMdd_HHmmss"
,
Locale
.
getDefault
()).
format
(
new
Date
());
...
...
@@ -68,6 +72,12 @@ public class GetSignatureActivity extends AppCompatActivity {
btnClear
.
setText
(
LanguageSetter
.
getresources
().
getString
(
R
.
string
.
clear
));
btnSave
.
setText
(
LanguageSetter
.
getresources
().
getString
(
R
.
string
.
save
));
// Storing data into SharedPreferences
sharedPreferences
=
getSharedPreferences
(
"MySharedPref"
,
MODE_PRIVATE
);
// Creating an Editor object to edit(write to the file)
myEdit
=
sharedPreferences
.
edit
();
view
=
canvasLL
;
btnClear
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
...
...
app/src/main/java/com/anuththara18/attentionassessment/focused/FocusedAttentionGame1.java
View file @
1835a808
...
...
@@ -35,6 +35,7 @@ import com.anuththara18.attentionassessment.gender.GenderActivity;
import
com.anuththara18.attentionassessment.home.NavigationDrawerActivity
;
import
com.anuththara18.attentionassessment.language.LanguageSetter
;
import
com.anuththara18.attentionassessment.map.Map1Activity
;
import
com.anuththara18.attentionassessment.map.Map2Activity
;
import
com.anuththara18.attentionassessment.sustained.SustainedAttentionGame1
;
import
org.json.JSONException
;
...
...
@@ -49,6 +50,7 @@ import java.util.List;
import
java.util.Random
;
import
java.util.Set
;
import
static
com
.
anuththara18
.
attentionassessment
.
consentform
.
GetSignatureActivity
.
myEdit
;
import
static
com
.
anuththara18
.
attentionassessment
.
map
.
Map1Activity
.
comp1
;
import
static
com
.
anuththara18
.
attentionassessment
.
map
.
Map1Activity
.
comp2
;
...
...
@@ -408,14 +410,22 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
saveDataToOnlineDB
();
createTable
();
saveDataToLocalDB
();
if
(
Map1Activity
.
level
==
3
){
Map1Activity
.
comp3
=
1
;
myEdit
.
putInt
(
"fal3"
,
Map1Activity
.
comp3
);
myEdit
.
commit
();
}
else
if
(
Map1Activity
.
level
==
4
){
Map1Activity
.
comp4
=
1
;
myEdit
.
putInt
(
"fal4"
,
Map1Activity
.
comp4
);
myEdit
.
commit
();
}
else
if
(
Map1Activity
.
level
==
5
){
Map1Activity
.
comp5
=
1
;
myEdit
.
putInt
(
"fal5"
,
Map1Activity
.
comp5
);
myEdit
.
commit
();
}
Intent
intent
=
new
Intent
(
getApplicationContext
(),
FACompleteScreen
.
class
);
finish
();
...
...
app/src/main/java/com/anuththara18/attentionassessment/focused/FocusedAttentionGame2.java
View file @
1835a808
...
...
@@ -37,6 +37,7 @@ import java.util.Iterator;
import
java.util.List
;
import
java.util.Random
;
import
static
com
.
anuththara18
.
attentionassessment
.
consentform
.
GetSignatureActivity
.
myEdit
;
import
static
com
.
anuththara18
.
attentionassessment
.
map
.
Map1Activity
.
comp1
;
import
static
com
.
anuththara18
.
attentionassessment
.
map
.
Map1Activity
.
comp2
;
...
...
@@ -148,7 +149,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
}
// appearance - 1s * 20 times
else
{
if
(
Map1Activity
.
level
==
1
)
{
if
(
Map1Activity
.
level
==
1
||
Map1Activity
.
level
==
2
)
{
if
(
i
==
2
||
i
==
14
||
i
==
26
||
i
==
38
)
{
bear1
.
setVisibility
(
View
.
VISIBLE
);
...
...
@@ -225,9 +226,13 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
saveDataToLocalDB
();
if
(
Map1Activity
.
level
==
1
){
comp1
=
1
;
myEdit
.
putInt
(
"fal1"
,
Map1Activity
.
comp1
);
myEdit
.
commit
();
}
else
if
(
Map1Activity
.
level
==
2
){
comp2
=
1
;
myEdit
.
putInt
(
"fal2"
,
Map1Activity
.
comp2
);
myEdit
.
commit
();
}
Intent
intent
=
new
Intent
(
getApplicationContext
(),
FACompleteScreen
.
class
);
finish
();
...
...
app/src/main/java/com/anuththara18/attentionassessment/language/LanguageActivity.java
View file @
1835a808
package
com.anuththara18.attentionassessment.language
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.content.Intent
;
...
...
@@ -23,6 +24,10 @@ import android.widget.Toast;
import
com.anuththara18.attentionassessment.R
;
import
com.anuththara18.attentionassessment.details.ParentDetailsActivity
;
import
com.anuththara18.attentionassessment.gender.GenderActivity
;
import
com.google.android.gms.tasks.OnCompleteListener
;
import
com.google.android.gms.tasks.Task
;
import
com.google.firebase.auth.AuthResult
;
import
com.google.firebase.auth.FirebaseAuth
;
import
pl.droidsonroids.gif.GifImageView
;
...
...
@@ -31,6 +36,7 @@ public class LanguageActivity extends AppCompatActivity {
ImageView
english_btn
,
sinhala_btn
;
TextView
english_txt
;
public
static
String
text
=
""
;
public
static
String
uid
=
""
;
public
static
final
String
sharedKey
=
"Language"
;
TextView
selectLanguage
;
ImageButton
next
,
sinhala_txt_btn
;
...
...
@@ -62,6 +68,18 @@ public class LanguageActivity extends AppCompatActivity {
sharedPref
=
getSharedPreferences
(
sharedKey
,
MODE_PRIVATE
);
FirebaseAuth
auth
=
FirebaseAuth
.
getInstance
();
if
(
auth
.
getCurrentUser
()
==
null
)
{
auth
.
signInAnonymously
().
addOnCompleteListener
(
this
,
new
OnCompleteListener
<
AuthResult
>()
{
@Override
public
void
onComplete
(
@NonNull
Task
<
AuthResult
>
task
)
{
Log
.
i
(
"**********************************************test user"
,
String
.
valueOf
(
task
.
isSuccessful
()));
Log
.
i
(
"**********************************************test user2"
,
String
.
valueOf
(
auth
.
getCurrentUser
().
getUid
()));
uid
=
auth
.
getCurrentUser
().
getUid
();
}
});
}
int
bt_notes_blink
=
0
;
if
(
text
.
equals
(
"English"
)){
...
...
app/src/main/java/com/anuththara18/attentionassessment/map/Map1Activity.java
View file @
1835a808
...
...
@@ -3,8 +3,14 @@ package com.anuththara18.attentionassessment.map;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.media.MediaPlayer
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.animation.Animation
;
import
android.view.animation.AnimationUtils
;
import
android.widget.ImageButton
;
import
com.anuththara18.attentionassessment.R
;
...
...
@@ -20,10 +26,12 @@ public class Map1Activity extends AppCompatActivity {
ImageButton
imageButton1
,
imageButton2
,
imageButton3
,
imageButton4
,
imageButton5
;
ImageButton
star1
,
star2
,
star3
,
star4
,
star5
;
public
static
int
comp1
,
comp2
,
comp3
,
comp4
,
comp5
=
0
;
public
static
int
comp1
=
0
,
comp2
=
0
,
comp3
=
0
,
comp4
=
0
,
comp5
=
0
;
public
static
int
level
=
1
;
MediaPlayer
mp
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -46,26 +54,134 @@ public class Map1Activity extends AppCompatActivity {
star4
.
setVisibility
(
View
.
INVISIBLE
);
star5
.
setVisibility
(
View
.
INVISIBLE
);
// Retrieving the value using its keys the file name
// must be same in both saving and retrieving the data
SharedPreferences
sh
=
getSharedPreferences
(
"MySharedPref"
,
MODE_PRIVATE
);
// The value will be default as empty string because for
// the very first time when the app is opened, there is nothing to show
comp1
=
sh
.
getInt
(
"fal1"
,
0
);
comp2
=
sh
.
getInt
(
"fal2"
,
0
);
comp3
=
sh
.
getInt
(
"fal3"
,
0
);
comp4
=
sh
.
getInt
(
"fal4"
,
0
);
comp5
=
sh
.
getInt
(
"fal5"
,
0
);
Log
.
d
(
"@@@@@@@@@@@@@@@@@@@@@@@@"
,
String
.
valueOf
(
comp1
));
Log
.
d
(
"@@@@@@@@@@@@@@@@@@@@@@@@"
,
String
.
valueOf
(
comp2
));
Log
.
d
(
"@@@@@@@@@@@@@@@@@@@@@@@@"
,
String
.
valueOf
(
comp3
));
Log
.
d
(
"@@@@@@@@@@@@@@@@@@@@@@@@"
,
String
.
valueOf
(
comp4
));
Log
.
d
(
"@@@@@@@@@@@@@@@@@@@@@@@@"
,
String
.
valueOf
(
comp5
));
if
(
comp1
==
1
)
{
star1
.
setVisibility
(
View
.
VISIBLE
);
star1
.
bringToFront
();
}
if
(
comp2
==
1
){
star2
.
setVisibility
(
View
.
VISIBLE
);
star2
.
bringToFront
();
}
if
(
comp3
==
1
){
star3
.
setVisibility
(
View
.
VISIBLE
);
star3
.
bringToFront
();
}
if
(
comp4
==
1
){
star4
.
setVisibility
(
View
.
VISIBLE
);
star4
.
bringToFront
();
}
if
(
comp5
==
1
){
star5
.
setVisibility
(
View
.
VISIBLE
);
star5
.
bringToFront
();
}
if
(
comp1
==
0
)
{
final
Handler
handler
=
new
Handler
();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
zoom_out
);
imageButton1
.
startAnimation
(
animZoomOut
);
handler
.
postDelayed
(
this
,
750
);
}
});
}
},
0
);
}
else
if
(
comp2
==
0
){
final
Handler
handler
=
new
Handler
();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
zoom_out
);
imageButton2
.
startAnimation
(
animZoomOut
);
handler
.
postDelayed
(
this
,
750
);
}
});
}
},
0
);
}
else
if
(
comp3
==
0
){
final
Handler
handler
=
new
Handler
();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
zoom_out
);
imageButton3
.
startAnimation
(
animZoomOut
);
handler
.
postDelayed
(
this
,
750
);
}
});
}
},
0
);
}
else
if
(
comp4
==
0
){
final
Handler
handler
=
new
Handler
();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
zoom_out
);
imageButton4
.
startAnimation
(
animZoomOut
);
handler
.
postDelayed
(
this
,
750
);
}
});
}
},
0
);
}
else
if
(
comp5
==
0
){
final
Handler
handler
=
new
Handler
();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
zoom_out
);
imageButton5
.
startAnimation
(
animZoomOut
);
handler
.
postDelayed
(
this
,
750
);
}
});
}
},
0
);
}
imageButton1
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
level
=
1
;
mp
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp
.
start
();
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
zoom_out
);
imageButton5
.
startAnimation
(
animZoomOut
);
Intent
intent
=
new
Intent
(
getApplicationContext
(),
IntroductoryVideoLandscapeActivity
.
class
);
finish
();
startActivity
(
intent
);
...
...
@@ -76,6 +192,8 @@ public class Map1Activity extends AppCompatActivity {
@Override
public
void
onClick
(
View
view
)
{
level
=
2
;
mp
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp
.
start
();
Intent
intent
=
new
Intent
(
getApplicationContext
(),
IntroductoryVideoLandscapeActivity
.
class
);
finish
();
startActivity
(
intent
);
...
...
@@ -86,6 +204,8 @@ public class Map1Activity extends AppCompatActivity {
@Override
public
void
onClick
(
View
view
)
{
level
=
3
;
mp
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp
.
start
();
Intent
intent
=
new
Intent
(
getApplicationContext
(),
IntroductoryVideoPortraitActivity
.
class
);
finish
();
startActivity
(
intent
);
...
...
@@ -96,6 +216,8 @@ public class Map1Activity extends AppCompatActivity {
@Override
public
void
onClick
(
View
view
)
{
level
=
4
;
mp
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp
.
start
();
Intent
intent
=
new
Intent
(
getApplicationContext
(),
IntroductoryVideoPortraitActivity
.
class
);
finish
();
startActivity
(
intent
);
...
...
@@ -106,6 +228,8 @@ public class Map1Activity extends AppCompatActivity {
@Override
public
void
onClick
(
View
view
)
{
level
=
5
;
mp
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp
.
start
();
Intent
intent
=
new
Intent
(
getApplicationContext
(),
IntroductoryVideoLandscapeActivity
.
class
);
finish
();
startActivity
(
intent
);
...
...
app/src/main/java/com/anuththara18/attentionassessment/map/Map2Activity.java
View file @
1835a808
...
...
@@ -3,10 +3,16 @@ package com.anuththara18.attentionassessment.map;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.media.MediaPlayer
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.WindowManager
;
import
android.view.animation.Animation
;
import
android.view.animation.AnimationUtils
;
import
android.widget.ImageButton
;
import
com.anuththara18.attentionassessment.R
;
...
...
@@ -19,10 +25,13 @@ public class Map2Activity extends AppCompatActivity {
ImageButton
imageButton1
,
imageButton2
,
imageButton3
,
imageButton4
,
imageButton5
;
ImageButton
star1
,
star2
,
star3
,
star4
,
star5
;
public
static
int
comp1
,
comp2
,
comp3
,
comp4
,
comp5
=
0
;
public
static
int
comp1
=
0
,
comp2
=
0
,
comp3
=
0
,
comp4
=
0
,
comp5
=
0
;
public
static
int
level
=
1
;
MediaPlayer
mp
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -53,26 +62,134 @@ public class Map2Activity extends AppCompatActivity {
star4
.
setVisibility
(
View
.
INVISIBLE
);
star5
.
setVisibility
(
View
.
INVISIBLE
);
// Retrieving the value using its keys the file name
// must be same in both saving and retrieving the data
SharedPreferences
sh
=
getSharedPreferences
(
"MySharedPref"
,
MODE_PRIVATE
);
// The value will be default as empty string because for
// the very first time when the app is opened, there is nothing to show
comp1
=
sh
.
getInt
(
"sel1"
,
0
);
comp2
=
sh
.
getInt
(
"sel2"
,
0
);
comp3
=
sh
.
getInt
(
"sel3"
,
0
);
comp4
=
sh
.
getInt
(
"sel4"
,
0
);
comp5
=
sh
.
getInt
(
"sel5"
,
0
);
Log
.
d
(
"@@@@@@@@@@@@@@@@@@@@@@@@"
,
String
.
valueOf
(
comp1
));
Log
.
d
(
"@@@@@@@@@@@@@@@@@@@@@@@@"
,
String
.
valueOf
(
comp2
));
Log
.
d
(
"@@@@@@@@@@@@@@@@@@@@@@@@"
,
String
.
valueOf
(
comp3
));
Log
.
d
(
"@@@@@@@@@@@@@@@@@@@@@@@@"
,
String
.
valueOf
(
comp4
));
Log
.
d
(
"@@@@@@@@@@@@@@@@@@@@@@@@"
,
String
.
valueOf
(
comp5
));
if
(
comp1
==
1
)
{
star1
.
setVisibility
(
View
.
VISIBLE
);
star1
.
bringToFront
();
}
if
(
comp2
==
1
){
star2
.
setVisibility
(
View
.
VISIBLE
);
star2
.
bringToFront
();
}
if
(
comp3
==
1
){
star3
.
setVisibility
(
View
.
VISIBLE
);
star3
.
bringToFront
();
}
if
(
comp4
==
1
){
star4
.
setVisibility
(
View
.
VISIBLE
);
star4
.
bringToFront
();
}
if
(
comp5
==
1
){
star5
.
setVisibility
(
View
.
VISIBLE
);
star5
.
bringToFront
();
}
if
(
comp1
==
0
)
{
final
Handler
handler
=
new
Handler
();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
zoom_out
);
imageButton1
.
startAnimation
(
animZoomOut
);
handler
.
postDelayed
(
this
,
750
);
}
});
}
},
0
);
}
else
if
(
comp2
==
0
){
final
Handler
handler
=
new
Handler
();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
zoom_out
);
imageButton2
.
startAnimation
(
animZoomOut
);
handler
.
postDelayed
(
this
,
750
);
}
});
}
},
0
);
}
else
if
(
comp3
==
0
){
final
Handler
handler
=
new
Handler
();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
zoom_out
);
imageButton3
.
startAnimation
(
animZoomOut
);
handler
.
postDelayed
(
this
,
750
);
}
});
}
},
0
);
}
else
if
(
comp4
==
0
){
final
Handler
handler
=
new
Handler
();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
zoom_out
);
imageButton4
.
startAnimation
(
animZoomOut
);
handler
.
postDelayed
(
this
,
750
);
}
});
}
},
0
);
}
else
if
(
comp5
==
0
){
final
Handler
handler
=
new
Handler
();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
zoom_out
);
imageButton5
.
startAnimation
(
animZoomOut
);
handler
.
postDelayed
(
this
,
750
);
}
});
}
},
0
);
}
imageButton1
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
level
=
1
;
mp
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp
.
start
();
Animation
animZoomOut
=
AnimationUtils
.
loadAnimation
(
getApplicationContext
(),
R
.
anim
.
zoom_out
);
imageButton5
.
startAnimation
(
animZoomOut
);
Intent
intent
=
new
Intent
(
getApplicationContext
(),
IntroductoryVideoPortraitActivity
.
class
);
finish
();
startActivity
(
intent
);
...
...
@@ -83,6 +200,8 @@ public class Map2Activity extends AppCompatActivity {
@Override
public
void
onClick
(
View
view
)
{
level
=
2
;
mp
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp
.
start
();
Intent
intent
=
new
Intent
(
getApplicationContext
(),
IntroductoryVideoPortraitActivity
.
class
);
finish
();
startActivity
(
intent
);
...
...
@@ -93,6 +212,8 @@ public class Map2Activity extends AppCompatActivity {
@Override
public
void
onClick
(
View
view
)
{
level
=
3
;
mp
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp
.
start
();
Intent
intent
=
new
Intent
(
getApplicationContext
(),
IntroductoryVideoPortraitActivity
.
class
);
finish
();
startActivity
(
intent
);
...
...
@@ -103,6 +224,8 @@ public class Map2Activity extends AppCompatActivity {
@Override
public
void
onClick
(
View
view
)
{
level
=
4
;
mp
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp
.
start
();
Intent
intent
=
new
Intent
(
getApplicationContext
(),
IntroductoryVideoPortraitActivity
.
class
);
finish
();
startActivity
(
intent
);
...
...
@@ -113,6 +236,8 @@ public class Map2Activity extends AppCompatActivity {
@Override
public
void
onClick
(
View
view
)
{
level
=
5
;
mp
=
MediaPlayer
.
create
(
getApplicationContext
(),
R
.
raw
.
button_click
);
mp
.
start
();
Intent
intent
=
new
Intent
(
getApplicationContext
(),
IntroductoryVideoPortraitActivity
.
class
);
finish
();
startActivity
(
intent
);
...
...
app/src/main/java/com/anuththara18/attentionassessment/selective/SelectiveACompleteScreen.java
View file @
1835a808
...
...
@@ -318,7 +318,6 @@ public class SelectiveACompleteScreen extends AppCompatActivity {
super
.
onRequestPermissionsResult
(
requestCode
,
permissions
,
grantResults
);
if
(
requestCode
==
PERMISSION_REQUEST_CODE
)
{
if
(
grantResults
.
length
>
0
)
{
// after requesting permissions we are showing
// users a toast message of permission granted.
boolean
writeStorage
=
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
;
...
...
@@ -361,7 +360,8 @@ public class SelectiveACompleteScreen extends AppCompatActivity {
auth
.
signInAnonymously
().
addOnCompleteListener
(
this
,
new
OnCompleteListener
<
AuthResult
>()
{
@Override
public
void
onComplete
(
@NonNull
Task
<
AuthResult
>
task
)
{
Log
.
i
(
"test user"
,
String
.
valueOf
(
task
.
isSuccessful
()));
Log
.
i
(
"**********************************************test user"
,
String
.
valueOf
(
task
.
isSuccessful
()));
Log
.
i
(
"**********************************************test user"
,
String
.
valueOf
(
auth
.
getCurrentUser
().
getUid
()));
}
});
}
...
...
@@ -376,7 +376,6 @@ public class SelectiveACompleteScreen extends AppCompatActivity {
@Override
public
void
onProgress
(
@NonNull
UploadTask
.
TaskSnapshot
snapshot
)
{
//Toast.makeText(getApplicationContext(), "Upload Filed", Toast.LENGTH_SHORT).show();
}
}).
addOnSuccessListener
(
new
OnSuccessListener
<
UploadTask
.
TaskSnapshot
>()
{
@Override
...
...
app/src/main/java/com/anuththara18/attentionassessment/selective/SelectiveAttentionGame1.java
View file @
1835a808
...
...
@@ -5,6 +5,7 @@ import androidx.appcompat.app.AppCompatActivity;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.graphics.PorterDuff
;
import
android.media.MediaPlayer
;
...
...
@@ -46,6 +47,7 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.Random
;
import
static
com
.
anuththara18
.
attentionassessment
.
consentform
.
GetSignatureActivity
.
myEdit
;
import
static
com
.
anuththara18
.
attentionassessment
.
map
.
Map1Activity
.
comp1
;
import
static
com
.
anuththara18
.
attentionassessment
.
map
.
Map1Activity
.
comp2
;
...
...
@@ -431,21 +433,36 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
gridView
.
setAdapter
(
adapter
);
gridView
.
setEnabled
(
false
);
if
(
Map2Activity
.
level
==
1
){
Map2Activity
.
comp1
=
1
;
// Storing the key and its value as the data fetched from edittext
myEdit
.
putInt
(
"sel1"
,
Integer
.
parseInt
(
String
.
valueOf
(
Map2Activity
.
comp1
)));
// Once the changes have been made,
// we need to commit to apply those changes made,
// otherwise, it will throw an error
myEdit
.
commit
();
}
else
if
(
Map2Activity
.
level
==
2
){
Map2Activity
.
comp2
=
1
;
Log
.
d
(
"***************"
,
"level 2 done"
);
myEdit
.
putInt
(
"sel2"
,
Map2Activity
.
comp2
);
myEdit
.
commit
();
}
else
if
(
Map2Activity
.
level
==
3
){
Map2Activity
.
comp3
=
1
;
myEdit
.
putInt
(
"sel3"
,
Map2Activity
.
comp3
);
myEdit
.
commit
();
}
else
if
(
Map2Activity
.
level
==
4
){
Map2Activity
.
comp4
=
1
;
myEdit
.
putInt
(
"sel4"
,
Map2Activity
.
comp4
);
myEdit
.
commit
();
}
else
if
(
Map2Activity
.
level
==
5
){
Map2Activity
.
comp5
=
1
;
myEdit
.
putInt
(
"sel5"
,
Map2Activity
.
comp5
);
myEdit
.
commit
();
}
saveDataToOnlineDB
();
...
...
app/src/main/res/layout/activity_consent_form.xml
View file @
1835a808
...
...
@@ -31,7 +31,7 @@
android:text=
"@string/consentForm"
android:textAlignment=
"center"
android:textColor=
"@color/black"
android:textSize=
"
20
dp"
android:textSize=
"
18
dp"
android:textStyle=
"bold"
android:gravity=
"center_horizontal"
/>
...
...
app/src/main/res/layout/activity_map1.xml
View file @
1835a808
...
...
@@ -12,6 +12,7 @@
android:layout_width=
"90dp"
android:layout_height=
"81.95dp"
android:background=
"@drawable/num1"
android:elevation=
"20dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.464"
...
...
app/src/main/res/layout/activity_map2.xml
View file @
1835a808
...
...
@@ -19,19 +19,6 @@
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.038"
/>
<ImageButton
android:id=
"@+id/star1"
android:layout_width=
"110dp"
android:layout_height=
"101.95dp"
android:background=
"@drawable/stars"
android:visibility=
"invisible"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_marginTop=
"-20dp"
app:layout_constraintHorizontal_bias=
"0.472"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.000"
/>
<ImageButton
android:id=
"@+id/imageButton2"
...
...
@@ -138,4 +125,18 @@
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.800"
/>
<ImageButton
android:id=
"@+id/star1"
android:layout_width=
"110dp"
android:layout_height=
"101.95dp"
android:background=
"@drawable/stars"
android:visibility=
"invisible"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_marginTop=
"-20dp"
app:layout_constraintHorizontal_bias=
"0.472"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.000"
/>
</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