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
56117cd3
Commit
56117cd3
authored
Mar 08, 2022
by
Anuththara18
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Shared Preferences for Language Selection & Removed Unwanted Toasts
parent
6511a378
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
83 additions
and
24 deletions
+83
-24
app/src/main/java/com/anuththara18/attentionassessment/age/AgeActivity.java
...com/anuththara18/attentionassessment/age/AgeActivity.java
+19
-5
app/src/main/java/com/anuththara18/attentionassessment/alternating/AACompleteScreen.java
...a18/attentionassessment/alternating/AACompleteScreen.java
+1
-1
app/src/main/java/com/anuththara18/attentionassessment/alternating/AlternatingAttentionGame1.java
...tionassessment/alternating/AlternatingAttentionGame1.java
+1
-1
app/src/main/java/com/anuththara18/attentionassessment/consentform/GetParentsConsentActivity.java
...tionassessment/consentform/GetParentsConsentActivity.java
+17
-2
app/src/main/java/com/anuththara18/attentionassessment/consentform/GetSignatureActivity.java
...attentionassessment/consentform/GetSignatureActivity.java
+1
-1
app/src/main/java/com/anuththara18/attentionassessment/dividedattention/DACompleteScreen.java
...ttentionassessment/dividedattention/DACompleteScreen.java
+1
-1
app/src/main/java/com/anuththara18/attentionassessment/dividedattention/DividedAttentionGame1.java
...ionassessment/dividedattention/DividedAttentionGame1.java
+1
-1
app/src/main/java/com/anuththara18/attentionassessment/focused/FACompleteScreen.java
...thara18/attentionassessment/focused/FACompleteScreen.java
+1
-1
app/src/main/java/com/anuththara18/attentionassessment/focused/FocusedAttentionGame1.java
...18/attentionassessment/focused/FocusedAttentionGame1.java
+1
-1
app/src/main/java/com/anuththara18/attentionassessment/language/LanguageActivity.java
...hara18/attentionassessment/language/LanguageActivity.java
+13
-3
app/src/main/java/com/anuththara18/attentionassessment/selective/SelectiveACompleteScreen.java
...tentionassessment/selective/SelectiveACompleteScreen.java
+1
-1
app/src/main/java/com/anuththara18/attentionassessment/selective/SelectiveAttentionGame1.java
...ttentionassessment/selective/SelectiveAttentionGame1.java
+1
-1
app/src/main/java/com/anuththara18/attentionassessment/splashscreen/SplashActivity.java
...ra18/attentionassessment/splashscreen/SplashActivity.java
+23
-3
app/src/main/java/com/anuththara18/attentionassessment/sustained/SA1CompleteScreen.java
...ra18/attentionassessment/sustained/SA1CompleteScreen.java
+1
-1
app/src/main/java/com/anuththara18/attentionassessment/sustained/SustainedAttentionGame1.java
...ttentionassessment/sustained/SustainedAttentionGame1.java
+1
-1
No files found.
app/src/main/java/com/anuththara18/attentionassessment/age/AgeActivity.java
View file @
56117cd3
...
...
@@ -4,6 +4,7 @@ import androidx.appcompat.app.AppCompatActivity;
import
androidx.constraintlayout.widget.ConstraintLayout
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.os.AsyncTask
;
import
android.os.Build
;
...
...
@@ -44,7 +45,8 @@ public class AgeActivity extends AppCompatActivity {
ImageView
bunny_img
;
TextView
age_txt
,
next
,
previous
,
selectAge
;
public
static
int
age
=
4
;
SharedPreferences
sharedPreferences
;
int
imageCheck
;
int
width
;
int
count
;
float
rightFromXDelta
,
rightToXDelta
,
leftFromXDelta
,
leftToXDelta
;
...
...
@@ -74,6 +76,8 @@ public class AgeActivity extends AppCompatActivity {
next
=
(
TextView
)
findViewById
(
R
.
id
.
next
);
previous
=
(
TextView
)
findViewById
(
R
.
id
.
previous
);
selectAge
=
(
TextView
)
findViewById
(
R
.
id
.
selectAge
);
sharedPreferences
=
getSharedPreferences
(
"ImageCheck"
,
MODE_PRIVATE
);
imageCheck
=
sharedPreferences
.
getInt
(
"ImageSet"
,
5
);
mDatabase
=
openOrCreateDatabase
(
DATABASE_NAME
,
MODE_PRIVATE
,
null
);
...
...
@@ -129,13 +133,23 @@ public class AgeActivity extends AppCompatActivity {
//saveDataToOnlineDB();
createTable
();
saveDataToLocalDB
();
if
(
LanguageActivity
.
text
.
equals
(
"English"
))
{
if
(
LanguageActivity
.
text
.
equals
(
"English"
))
{
startActivity
(
new
Intent
(
AgeActivity
.
this
,
ConsentFormActivity
.
class
));
}
else
{
}
else
{
startActivity
(
new
Intent
(
AgeActivity
.
this
,
SinhalaConsentFormActivity
.
class
));
}
/*if(imageCheck==1) {
Intent navInt = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
startActivity(navInt);
}
else{
}
*/
//startActivity(new Intent(AgeActivity.this, NavigationDrawerActivity.class));
}
});
...
...
@@ -338,7 +352,7 @@ public class AgeActivity extends AppCompatActivity {
mDatabase
.
execSQL
(
insertSQL
,
new
String
[]{
gender
,
age
,
name
,
email
,
contact
});
Toast
.
makeText
(
this
,
"Data Added Successfully"
,
Toast
.
LENGTH_SHORT
).
show
();
//
Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
}
/*************************************************************************************************/
...
...
app/src/main/java/com/anuththara18/attentionassessment/alternating/AACompleteScreen.java
View file @
56117cd3
...
...
@@ -337,7 +337,7 @@ public class AACompleteScreen extends AppCompatActivity {
// below line is to print toast message
// on completion of PDF generation.
Toast
.
makeText
(
getApplicationContext
(),
"PDF file generated successfully."
,
Toast
.
LENGTH_LONG
).
show
();
//
Toast.makeText(getApplicationContext(), "PDF file generated successfully.", Toast.LENGTH_LONG).show();
}
catch
(
IOException
e
)
{
// below line is used
...
...
app/src/main/java/com/anuththara18/attentionassessment/alternating/AlternatingAttentionGame1.java
View file @
56117cd3
...
...
@@ -475,7 +475,7 @@ public class AlternatingAttentionGame1 extends AppCompatActivity {
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
});
Toast
.
makeText
(
this
,
"Data Added Successfully"
,
Toast
.
LENGTH_SHORT
).
show
();
//
Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
}
/*************************************************************************************************/
...
...
app/src/main/java/com/anuththara18/attentionassessment/consentform/GetParentsConsentActivity.java
View file @
56117cd3
...
...
@@ -4,6 +4,7 @@ import android.Manifest;
import
android.content.ContentValues
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.pm.PackageManager
;
import
android.database.Cursor
;
import
android.database.sqlite.SQLiteDatabase
;
...
...
@@ -45,6 +46,8 @@ public class GetParentsConsentActivity extends AppCompatActivity {
Button
btnGetSignature
;
public
static
ImageView
fingerprintImageView
;
static
int
flag2
=
0
;
public
SharedPreferences
sharedPreferences
;
public
int
imageSet
=
0
;
// constant code for runtime permissions
private
static
final
int
PERMISSION_REQUEST_CODE
=
200
;
...
...
@@ -68,6 +71,7 @@ public class GetParentsConsentActivity extends AppCompatActivity {
next
=
(
TextView
)
findViewById
(
R
.
id
.
next
);
btnGetSignature
=
(
Button
)
findViewById
(
R
.
id
.
btnGetSignature
);
fingerprintImageView
=
(
ImageView
)
findViewById
(
R
.
id
.
fingerprintImageView
);
sharedPreferences
=
getSharedPreferences
(
"ImageSet"
,
MODE_PRIVATE
);
textView3
.
setText
(
LanguageSetter
.
getresources
().
getString
(
R
.
string
.
provideconsent
));
next
.
setText
(
LanguageSetter
.
getresources
().
getString
(
R
.
string
.
proceed
));
...
...
@@ -127,13 +131,17 @@ public class GetParentsConsentActivity extends AppCompatActivity {
try
{
sqLiteHelper
.
insertData
(
imageViewToByte
(
fingerprintImageView
));
Toast
.
makeText
(
getApplicationContext
(),
"Consent Saved Successfully!"
,
Toast
.
LENGTH_SHORT
).
show
();
imageSet
=
1
;
SharedPreferences
.
Editor
ed
=
sharedPreferences
.
edit
();
ed
.
putInt
(
"ImageSet"
,
imageSet
);
ed
.
apply
();
//Toast.makeText(getApplicationContext(), String.valueOf(imageSet), Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), "Consent Saved Successfully!", Toast.LENGTH_SHORT).show();
Intent
intent
=
new
Intent
(
getApplicationContext
(),
NavigationDrawerActivity
.
class
);
startActivity
(
intent
);
}
catch
(
Exception
e
){
Toast
.
makeText
(
getApplicationContext
(),
"Consent not Saved!"
,
Toast
.
LENGTH_SHORT
).
show
();
e
.
printStackTrace
();
}
...
...
@@ -190,6 +198,13 @@ public class GetParentsConsentActivity extends AppCompatActivity {
//Toast.makeText(this, "Permission Granted..", Toast.LENGTH_SHORT).show();
}
else
{
Toast
.
makeText
(
this
,
"Permission Denined."
,
Toast
.
LENGTH_SHORT
).
show
();
requestPermission
();
/*
if ( !checkPermission() ) {
Toast.makeText(this, "No Use.", Toast.LENGTH_SHORT).show();
System.exit(0);
}
*/
finish
();
}
}
...
...
app/src/main/java/com/anuththara18/attentionassessment/consentform/GetSignatureActivity.java
View file @
56117cd3
...
...
@@ -90,7 +90,7 @@ public class GetSignatureActivity extends AppCompatActivity {
GetParentsConsentActivity
.
fingerprintImageView
.
setImageBitmap
(
bitmap
);
GetParentsConsentActivity
.
flag2
=
1
;
Toast
.
makeText
(
getApplicationContext
(),
"Signature Recorded"
,
Toast
.
LENGTH_SHORT
).
show
();
//
Toast.makeText(getApplicationContext(), "Signature Recorded", Toast.LENGTH_SHORT).show();
finish
();
}
...
...
app/src/main/java/com/anuththara18/attentionassessment/dividedattention/DACompleteScreen.java
View file @
56117cd3
...
...
@@ -340,7 +340,7 @@ public class DACompleteScreen extends AppCompatActivity {
// below line is to print toast message
// on completion of PDF generation.
Toast
.
makeText
(
getApplicationContext
(),
"PDF file generated successfully."
,
Toast
.
LENGTH_LONG
).
show
();
//
Toast.makeText(getApplicationContext(), "PDF file generated successfully.", Toast.LENGTH_LONG).show();
}
catch
(
IOException
e
)
{
// below line is used
...
...
app/src/main/java/com/anuththara18/attentionassessment/dividedattention/DividedAttentionGame1.java
View file @
56117cd3
...
...
@@ -583,7 +583,7 @@ public class DividedAttentionGame1 extends AppCompatActivity {
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
});
Toast
.
makeText
(
this
,
"Data Added Successfully"
,
Toast
.
LENGTH_SHORT
).
show
();
//
Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
}
/*************************************************************************************************/
...
...
app/src/main/java/com/anuththara18/attentionassessment/focused/FACompleteScreen.java
View file @
56117cd3
...
...
@@ -323,7 +323,7 @@ public class FACompleteScreen extends AppCompatActivity {
// below line is to print toast message
// on completion of PDF generation.
Toast
.
makeText
(
getApplicationContext
(),
"PDF file generated successfully."
,
Toast
.
LENGTH_LONG
).
show
();
//
Toast.makeText(getApplicationContext(), "PDF file generated successfully.", Toast.LENGTH_LONG).show();
}
catch
(
IOException
e
)
{
// below line is used
...
...
app/src/main/java/com/anuththara18/attentionassessment/focused/FocusedAttentionGame1.java
View file @
56117cd3
...
...
@@ -507,7 +507,7 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
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
});
Toast
.
makeText
(
this
,
"Data Added Successfully"
,
Toast
.
LENGTH_SHORT
).
show
();
//
Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
}
/*************************************************************************************************/
...
...
app/src/main/java/com/anuththara18/attentionassessment/language/LanguageActivity.java
View file @
56117cd3
...
...
@@ -3,6 +3,7 @@ package com.anuththara18.attentionassessment.language;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.util.Log
;
...
...
@@ -21,8 +22,10 @@ public class LanguageActivity extends AppCompatActivity {
ImageButton
english_btn
,
sinhala_btn
,
sinhala_txt_btn
;
TextView
english_txt
;
public
static
String
text
=
null
;
public
static
String
text
=
""
;
public
static
final
String
sharedKey
=
"Language"
;
TextView
selectLanguage
,
next
;
public
static
SharedPreferences
sharedPref
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -42,6 +45,7 @@ public class LanguageActivity extends AppCompatActivity {
english_txt
=
(
TextView
)
findViewById
(
R
.
id
.
english_txt
);
selectLanguage
=
(
TextView
)
findViewById
(
R
.
id
.
selectLanguage
);
next
=
(
TextView
)
findViewById
(
R
.
id
.
next
);
sharedPref
=
getSharedPreferences
(
sharedKey
,
MODE_PRIVATE
);
english_btn
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
...
...
@@ -74,7 +78,7 @@ public class LanguageActivity extends AppCompatActivity {
next
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
if
(
text
==
null
)
{
if
(
text
.
isEmpty
()
)
{
Toast
.
makeText
(
getApplicationContext
(),
"Please select a language"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
...
...
@@ -98,6 +102,7 @@ public class LanguageActivity extends AppCompatActivity {
sinhala_txt_btn
.
getLayoutParams
().
width
=
394
;
sinhala_txt_btn
.
requestLayout
();
text
=
"English"
;
setLangPref
();
changeLanguage
();
}
...
...
@@ -114,6 +119,7 @@ public class LanguageActivity extends AppCompatActivity {
sinhala_txt_btn
.
getLayoutParams
().
width
=
410
;
sinhala_txt_btn
.
requestLayout
();
text
=
"සිංහල"
;
setLangPref
();
changeLanguage
();
}
...
...
@@ -122,7 +128,11 @@ public class LanguageActivity extends AppCompatActivity {
LanguageSetter
.
changeLanguage
(
text
,
LanguageActivity
.
this
);
next
.
setText
(
LanguageSetter
.
getresources
().
getString
(
R
.
string
.
next
));
selectLanguage
.
setText
(
LanguageSetter
.
getresources
().
getString
(
R
.
string
.
language
));
}
public
void
setLangPref
()
{
SharedPreferences
.
Editor
edit
=
sharedPref
.
edit
();
edit
.
putString
(
"Lang"
,
text
);
edit
.
apply
();
}
}
\ No newline at end of file
app/src/main/java/com/anuththara18/attentionassessment/selective/SelectiveACompleteScreen.java
View file @
56117cd3
...
...
@@ -274,7 +274,7 @@ public class SelectiveACompleteScreen extends AppCompatActivity {
try
{
pdfDocument
.
writeTo
(
new
FileOutputStream
(
file
));
Toast
.
makeText
(
getApplicationContext
(),
"PDF file generated successfully."
,
Toast
.
LENGTH_LONG
).
show
();
//
Toast.makeText(getApplicationContext(), "PDF file generated successfully.", Toast.LENGTH_LONG).show();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
...
...
app/src/main/java/com/anuththara18/attentionassessment/selective/SelectiveAttentionGame1.java
View file @
56117cd3
...
...
@@ -815,7 +815,7 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
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
});
Toast
.
makeText
(
this
,
"Data Added Successfully"
,
Toast
.
LENGTH_SHORT
).
show
();
//
Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
}
/*************************************************************************************************/
...
...
app/src/main/java/com/anuththara18/attentionassessment/splashscreen/SplashActivity.java
View file @
56117cd3
package
com.anuththara18.attentionassessment.splashscreen
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.view.View
;
import
android.view.WindowManager
;
import
android.widget.Toast
;
import
com.anuththara18.attentionassessment.R
;
import
com.anuththara18.attentionassessment.details.ParentDetailsActivity
;
import
com.anuththara18.attentionassessment.language.LanguageActivity
;
import
com.anuththara18.attentionassessment.language.LanguageSetter
;
public
class
SplashActivity
extends
AppCompatActivity
{
SharedPreferences
sharedPreferences
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
sharedPreferences
=
getSharedPreferences
(
"Language"
,
MODE_PRIVATE
);
SharedPreferences
.
Editor
ed
=
sharedPreferences
.
edit
();
String
lang
=
sharedPreferences
.
getString
(
"Lang"
,
""
);
//int check = sharedPreferences.getInt("ImageCheck", 5);
if
(
Build
.
VERSION
.
SDK_INT
<
16
)
{
getWindow
().
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_FULLSCREEN
,
WindowManager
.
LayoutParams
.
FLAG_FULLSCREEN
);
...
...
@@ -27,11 +38,20 @@ public class SplashActivity extends AppCompatActivity {
setContentView
(
R
.
layout
.
activity_splash
);
Handler
handler
=
new
Handler
();
//Toast.makeText(getApplicationContext(), String.valueOf(check), Toast.LENGTH_SHORT).show();
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
Intent
intent
=
new
Intent
(
SplashActivity
.
this
,
LanguageActivity
.
class
);
startActivity
(
intent
);
if
(
lang
.
isEmpty
()){
Intent
langAct
=
new
Intent
(
SplashActivity
.
this
,
LanguageActivity
.
class
);
startActivity
(
langAct
);
}
else
{
Intent
parentAct
=
new
Intent
(
SplashActivity
.
this
,
ParentDetailsActivity
.
class
);
startActivity
(
parentAct
);
LanguageSetter
.
setLanguage
(
lang
);
LanguageSetter
.
changeLanguage
(
lang
,
SplashActivity
.
this
);
}
finish
();
}
},
2000
);
...
...
app/src/main/java/com/anuththara18/attentionassessment/sustained/SA1CompleteScreen.java
View file @
56117cd3
...
...
@@ -338,7 +338,7 @@ public class SA1CompleteScreen extends AppCompatActivity {
// below line is to print toast message
// on completion of PDF generation.
Toast
.
makeText
(
getApplicationContext
(),
"PDF file generated successfully."
,
Toast
.
LENGTH_LONG
).
show
();
//
Toast.makeText(getApplicationContext(), "PDF file generated successfully.", Toast.LENGTH_LONG).show();
}
catch
(
IOException
e
)
{
// below line is used
...
...
app/src/main/java/com/anuththara18/attentionassessment/sustained/SustainedAttentionGame1.java
View file @
56117cd3
...
...
@@ -408,7 +408,7 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
mDatabase
.
execSQL
(
insertSQL
,
new
Integer
[]{
child_ID
,
total_correct_responses
,
no_of_correct_responses
,
no_of_ommission_errors
,
no_of_commission_errors
,
mean_reaction_time
,
total_duration
});
Toast
.
makeText
(
this
,
"Data Added Successfully"
,
Toast
.
LENGTH_SHORT
).
show
();
//
Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
}
...
...
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