Commit 39ddc7eb authored by Anuththara18's avatar Anuththara18

Adding analysing factors - Focused Attention

parent e06d96d6
...@@ -80,6 +80,7 @@ public class FACompleteScreen extends AppCompatActivity { ...@@ -80,6 +80,7 @@ public class FACompleteScreen extends AppCompatActivity {
String stimulus; String stimulus;
String colour; String colour;
String responses;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -158,12 +159,16 @@ public class FACompleteScreen extends AppCompatActivity { ...@@ -158,12 +159,16 @@ public class FACompleteScreen extends AppCompatActivity {
dataList.add(new Focused( dataList.add(new Focused(
cursorEmployees.getInt(0), cursorEmployees.getInt(0),
cursorEmployees.getInt(1), cursorEmployees.getInt(1),
cursorEmployees.getInt(2), cursorEmployees.getString(2),
cursorEmployees.getInt(3), cursorEmployees.getString(3),
cursorEmployees.getInt(4), cursorEmployees.getString(4),
cursorEmployees.getInt(5), cursorEmployees.getInt(5),
cursorEmployees.getInt(6), cursorEmployees.getInt(6),
cursorEmployees.getInt(7) cursorEmployees.getInt(7),
cursorEmployees.getInt(8),
cursorEmployees.getInt(9),
cursorEmployees.getInt(10),
cursorEmployees.getString(11)
)); ));
} while (cursorEmployees.moveToNext()); } while (cursorEmployees.moveToNext());
} }
...@@ -191,14 +196,17 @@ public class FACompleteScreen extends AppCompatActivity { ...@@ -191,14 +196,17 @@ public class FACompleteScreen extends AppCompatActivity {
if (Map1Activity.level == 1 || Map1Activity.level == 2) { if (Map1Activity.level == 1 || Map1Activity.level == 2) {
stimulus = "bear head"; stimulus = "bear head";
colour = "brown"; 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; stimulus = FocusedAttentionGame1.stimulus;
colour = FocusedAttentionGame1.colour; colour = FocusedAttentionGame1.colour;
responses = String.valueOf(FocusedAttentionGame1.sequence_of_responses);
} }
else if (Map1Activity.level == 5) { else if (Map1Activity.level == 5) {
stimulus = FocusedAttentionGame1.stimulus; stimulus = FocusedAttentionGame1.stimulus;
colour = FocusedAttentionGame1.colour; colour = FocusedAttentionGame1.colour;
responses = String.valueOf(FocusedAttentionGame1.sequence_of_responses);
} }
for (int i = 0; i < dataList.size(); i++) { for (int i = 0; i < dataList.size(); i++) {
...@@ -207,19 +215,17 @@ public class FACompleteScreen extends AppCompatActivity { ...@@ -207,19 +215,17 @@ public class FACompleteScreen extends AppCompatActivity {
data.add(new String[]{ String.valueOf(gameData.getId()), data.add(new String[]{ String.valueOf(gameData.getId()),
String.valueOf(String.valueOf(gameData.getChildID()).charAt(0)), String.valueOf(String.valueOf(gameData.getChildID()).charAt(0)),
String.valueOf(String.valueOf(gameData.getChildID()).charAt(1)), String.valueOf(String.valueOf(gameData.getChildID()).charAt(1)),
String.valueOf(Map1Activity.level), String.valueOf(String.valueOf(gameData.getChildID()).charAt(2)),
String.valueOf(gameData.getStimulus()),
String.valueOf(stimulus), String.valueOf(gameData.getColour()),
String.valueOf(colour), String.valueOf(gameData.getSequence_of_responses()),
String.valueOf("null"),
String.valueOf(gameData.getTotalCorrectResponses()), String.valueOf(gameData.getTotalCorrectResponses()),
String.valueOf(gameData.getNoOfCorrectResponses()), String.valueOf(gameData.getNoOfCorrectResponses()),
String.valueOf(gameData.getNoOfCommissionErrors()), String.valueOf(gameData.getNoOfCommissionErrors()),
String.valueOf(gameData.getNoOfOmmissionErrors()), String.valueOf(gameData.getNoOfOmmissionErrors()),
String.valueOf(gameData.getMeanReactionTime()), String.valueOf(gameData.getMeanReactionTime()),
String.valueOf(gameData.getTotalDuration()), String.valueOf(gameData.getTotalDuration()),
String.valueOf(ParentDetailsActivity.diagnosis) String.valueOf(gameData.getDiagnosis())
}); });
} }
......
...@@ -4,56 +4,128 @@ public class Focused { ...@@ -4,56 +4,128 @@ public class Focused {
private int id; private int id;
private int childID; private int childID;
private String stimulus;
private String colour;
private String sequence_of_responses;
private int totalCorrectResponses; private int totalCorrectResponses;
private int noOfCorrectResponses; private int noOfCorrectResponses;
private int noOfCommissionErrors; private int noOfCommissionErrors;
private int noOfOmmissionErrors; private int noOfOmmissionErrors;
private int meanReactionTime; private int meanReactionTime;
private int totalDuration; 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.id = id;
this.childID = childID; this.childID = childID;
this.stimulus = stimulus;
this.colour = colour;
this.sequence_of_responses = sequence_of_responses;
this.totalCorrectResponses = totalCorrectResponses; this.totalCorrectResponses = totalCorrectResponses;
this.noOfCorrectResponses = noOfCorrectResponses; this.noOfCorrectResponses = noOfCorrectResponses;
this.noOfCommissionErrors = noOfCommissionErrors; this.noOfCommissionErrors = noOfCommissionErrors;
this.noOfOmmissionErrors = noOfOmmissionErrors; this.noOfOmmissionErrors = noOfOmmissionErrors;
this.meanReactionTime = meanReactionTime; this.meanReactionTime = meanReactionTime;
this.totalDuration = totalDuration; this.totalDuration = totalDuration;
this.diagnosis = diagnosis;
} }
public int getId() { public int getId() {
return id; return id;
} }
public void setId(int id) {
this.id = id;
}
public int getChildID() { public int getChildID() {
return childID; 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() { public int getTotalCorrectResponses() {
return totalCorrectResponses; return totalCorrectResponses;
} }
public void setTotalCorrectResponses(int totalCorrectResponses) {
this.totalCorrectResponses = totalCorrectResponses;
}
public int getNoOfCorrectResponses() { public int getNoOfCorrectResponses() {
return noOfCorrectResponses; return noOfCorrectResponses;
} }
public void setNoOfCorrectResponses(int noOfCorrectResponses) {
this.noOfCorrectResponses = noOfCorrectResponses;
}
public int getNoOfCommissionErrors() { public int getNoOfCommissionErrors() {
return noOfCommissionErrors; return noOfCommissionErrors;
} }
public void setNoOfCommissionErrors(int noOfCommissionErrors) {
this.noOfCommissionErrors = noOfCommissionErrors;
}
public int getNoOfOmmissionErrors() { public int getNoOfOmmissionErrors() {
return noOfOmmissionErrors; return noOfOmmissionErrors;
} }
public void setNoOfOmmissionErrors(int noOfOmmissionErrors) {
this.noOfOmmissionErrors = noOfOmmissionErrors;
}
public int getMeanReactionTime() { public int getMeanReactionTime() {
return meanReactionTime; return meanReactionTime;
} }
public void setMeanReactionTime(int meanReactionTime) {
this.meanReactionTime = meanReactionTime;
}
public int getTotalDuration() { public int getTotalDuration() {
return totalDuration; 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 ( CREATE TABLE sustainedAttention (
id int NOT NULL AUTO_INCREMENT, id int NOT NULL AUTO_INCREMENT,
......
...@@ -31,6 +31,7 @@ import com.anuththara18.attentionassessment.R; ...@@ -31,6 +31,7 @@ import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.age.AgeActivity; import com.anuththara18.attentionassessment.age.AgeActivity;
import com.anuththara18.attentionassessment.db.Api; import com.anuththara18.attentionassessment.db.Api;
import com.anuththara18.attentionassessment.db.RequestHandler; import com.anuththara18.attentionassessment.db.RequestHandler;
import com.anuththara18.attentionassessment.details.ParentDetailsActivity;
import com.anuththara18.attentionassessment.gender.GenderActivity; import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity; import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import com.anuththara18.attentionassessment.language.LanguageSetter; import com.anuththara18.attentionassessment.language.LanguageSetter;
...@@ -66,12 +67,13 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -66,12 +67,13 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
int radomTimer = 0; int radomTimer = 0;
int rand = 0; int rand = 0;
public static String stimulus, colour, sequence_of_responses = ""; public static String stimulus, colour;
int i = 1; int i = 1;
private long startTime, clickedTime = 0; private long startTime, clickedTime = 0;
long reactionTime; long reactionTime;
int count; int count;
int missed = 0;
int totalCorrectResponses = 0; int totalCorrectResponses = 0;
int noOfCorrectResponses = 0; int noOfCorrectResponses = 0;
...@@ -92,6 +94,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -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, 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}; 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; MediaPlayer mp, mp2;
@Override @Override
...@@ -118,9 +122,14 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -118,9 +122,14 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
textView.setText(LanguageSetter.getresources().getString(R.string.focg1)); textView.setText(LanguageSetter.getresources().getString(R.string.focg1));
stimulus = "";
colour = "";
mp = MediaPlayer.create(getApplicationContext(), R.raw.focused); mp = MediaPlayer.create(getApplicationContext(), R.raw.focused);
mp.start(); mp.start();
sequence_of_responses = new ArrayList<>();
mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override @Override
...@@ -136,30 +145,27 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -136,30 +145,27 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
//creating a database //creating a database
mDatabase = openOrCreateDatabase(DATABASE_NAME, MODE_PRIVATE, null); mDatabase = openOrCreateDatabase(DATABASE_NAME, MODE_PRIVATE, null);
if(AnimalChoosingActivity.birdSelected == 0) { if ( Map1Activity.level == 3 || Map1Activity.level == 4 ) {
if (AnimalChoosingActivity.birdSelected == 0) {
stimulus = "monkey"; stimulus = "monkey";
colour = "shades of brown"; colour = "shades of brown";
} } else if (AnimalChoosingActivity.birdSelected == 1) {
else if(AnimalChoosingActivity.birdSelected == 1) {
stimulus = "zebra"; stimulus = "zebra";
colour = "black & white"; colour = "black & white";
} } else if (AnimalChoosingActivity.birdSelected == 4) {
else if(AnimalChoosingActivity.birdSelected == 4) {
stimulus = "giraffe"; stimulus = "giraffe";
colour = "yellow & brown"; colour = "yellow & brown";
} } else if (AnimalChoosingActivity.birdSelected == 9) {
else if(AnimalChoosingActivity.birdSelected == 9) {
stimulus = "dog"; stimulus = "dog";
colour = "brown orange"; colour = "brown orange";
} } else if (AnimalChoosingActivity.birdSelected == 5) {
else if(AnimalChoosingActivity.birdSelected == 5) {
stimulus = "cow"; stimulus = "cow";
colour = "black & white"; colour = "black & white";
} } else if (AnimalChoosingActivity.birdSelected == 8) {
else if(AnimalChoosingActivity.birdSelected == 8) {
stimulus = "lion"; stimulus = "lion";
colour = "orange & brown"; colour = "orange & brown";
} }
}
List<Integer> unpickedNumbers = new ArrayList<Integer>(); List<Integer> unpickedNumbers = new ArrayList<Integer>();
unpickedNumbers.add(0); unpickedNumbers.add(0);
...@@ -199,6 +205,11 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -199,6 +205,11 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView5.setEnabled(true); imageView5.setEnabled(true);
imageView6.setEnabled(true); imageView6.setEnabled(true);
if (missed == 0) {
sequence_of_responses.add("M");
Log.d("%%%%%%%%%%%%%%%%%%", String.valueOf(sequence_of_responses));
}
radomTimer = random.nextInt(5); radomTimer = random.nextInt(5);
updateInterval = isi[radomTimer]; updateInterval = isi[radomTimer];
imageView.postDelayed(this, updateInterval); imageView.postDelayed(this, updateInterval);
...@@ -407,6 +418,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -407,6 +418,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
} }
missed = 0;
imageView.setEnabled(true); imageView.setEnabled(true);
imageView2.setEnabled(true); imageView2.setEnabled(true);
imageView3.setEnabled(true); imageView3.setEnabled(true);
...@@ -440,7 +453,11 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -440,7 +453,11 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
Log.d("commissionErrors", String.valueOf(noOfCommissionErrors)); Log.d("commissionErrors", String.valueOf(noOfCommissionErrors));
Log.d("meanReactionTime", String.valueOf(meanReactionTime)); Log.d("meanReactionTime", String.valueOf(meanReactionTime));
Log.d("duration", String.valueOf(duration)); 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(); createTable();
saveDataToLocalDB(); saveDataToLocalDB();
...@@ -474,6 +491,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -474,6 +491,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
public void onClick(View view) { public void onClick(View view) {
mp2 = MediaPlayer.create(getApplicationContext(), R.raw.button_click); mp2 = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp2.start(); mp2.start();
Animation animZoomOut = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.blink);
imageView.startAnimation(animZoomOut);
// Your action here on button click // Your action here on button click
clickedTime = System.currentTimeMillis(); clickedTime = System.currentTimeMillis();
reactionTime = (clickedTime - startTime); reactionTime = (clickedTime - startTime);
...@@ -482,6 +501,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -482,6 +501,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime; totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime); Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++; noOfCorrectResponses++;
missed = 1;
sequence_of_responses.add("C");
imageView.setEnabled(false); imageView.setEnabled(false);
} else { } else {
Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime); Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime);
...@@ -495,6 +516,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -495,6 +516,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
public void onClick(View view) { public void onClick(View view) {
mp2 = MediaPlayer.create(getApplicationContext(), R.raw.button_click); mp2 = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp2.start(); mp2.start();
Animation animZoomOut = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.blink);
imageView2.startAnimation(animZoomOut);
// Your action here on button click // Your action here on button click
clickedTime = System.currentTimeMillis(); clickedTime = System.currentTimeMillis();
reactionTime = (clickedTime - startTime); reactionTime = (clickedTime - startTime);
...@@ -503,6 +526,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -503,6 +526,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime; totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime); Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++; noOfCorrectResponses++;
missed = 1;
sequence_of_responses.add("C");
imageView2.setEnabled(false); imageView2.setEnabled(false);
} else { } else {
Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime); Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime);
...@@ -514,9 +539,10 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -514,9 +539,10 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView3.setOnClickListener(new View.OnClickListener() { imageView3.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
mp2 = MediaPlayer.create(getApplicationContext(), R.raw.button_click); mp2 = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp2.start(); mp2.start();
Animation animZoomOut = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.blink);
imageView3.startAnimation(animZoomOut);
// Your action here on button click // Your action here on button click
clickedTime = System.currentTimeMillis(); clickedTime = System.currentTimeMillis();
reactionTime = (clickedTime - startTime); reactionTime = (clickedTime - startTime);
...@@ -524,6 +550,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -524,6 +550,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime; totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime); Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++; noOfCorrectResponses++;
missed = 1;
sequence_of_responses.add("C");
imageView3.setEnabled(false); imageView3.setEnabled(false);
} else { } else {
Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime); Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime);
...@@ -536,9 +564,10 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -536,9 +564,10 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView4.setOnClickListener(new View.OnClickListener() { imageView4.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
mp2 = MediaPlayer.create(getApplicationContext(), R.raw.button_click); mp2 = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp2.start(); mp2.start();
Animation animZoomOut = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.blink);
imageView4.startAnimation(animZoomOut);
// Your action here on button click // Your action here on button click
clickedTime = System.currentTimeMillis(); clickedTime = System.currentTimeMillis();
reactionTime = (clickedTime - startTime); reactionTime = (clickedTime - startTime);
...@@ -546,6 +575,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -546,6 +575,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime; totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime); Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++; noOfCorrectResponses++;
missed = 1;
sequence_of_responses.add("C");
imageView4.setEnabled(false); imageView4.setEnabled(false);
} else { } else {
Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime); Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime);
...@@ -558,9 +589,10 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -558,9 +589,10 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView5.setOnClickListener(new View.OnClickListener() { imageView5.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
mp2 = MediaPlayer.create(getApplicationContext(), R.raw.button_click); mp2 = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp2.start(); mp2.start();
Animation animZoomOut = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.blink);
imageView5.startAnimation(animZoomOut);
// Your action here on button click // Your action here on button click
clickedTime = System.currentTimeMillis(); clickedTime = System.currentTimeMillis();
reactionTime = (clickedTime - startTime); reactionTime = (clickedTime - startTime);
...@@ -568,6 +600,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -568,6 +600,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime; totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime); Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++; noOfCorrectResponses++;
missed = 1;
sequence_of_responses.add("C");
imageView5.setEnabled(false); imageView5.setEnabled(false);
} else { } else {
Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime); Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime);
...@@ -580,9 +614,10 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -580,9 +614,10 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView6.setOnClickListener(new View.OnClickListener() { imageView6.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
mp2 = MediaPlayer.create(getApplicationContext(), R.raw.button_click); mp2 = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp2.start(); mp2.start();
Animation animZoomOut = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.blink);
imageView6.startAnimation(animZoomOut);
// Your action here on button click // Your action here on button click
clickedTime = System.currentTimeMillis(); clickedTime = System.currentTimeMillis();
reactionTime = (clickedTime - startTime); reactionTime = (clickedTime - startTime);
...@@ -590,12 +625,13 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -590,12 +625,13 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime; totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime); Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++; noOfCorrectResponses++;
missed = 1;
sequence_of_responses.add("C");
imageView6.setEnabled(false); imageView6.setEnabled(false);
} else { } else {
Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime); Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime);
noOfCommissionErrors++; noOfCommissionErrors++;
} }
} }
}); });
...@@ -626,35 +662,35 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -626,35 +662,35 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
public void getData(){ public void getData(){
if (rand == 0) { if (rand == 0) {
stimulus = stimulus + " monkey, "; stimulus = stimulus + "monkey, ";
colour = colour + " - shades of brown, "; colour = colour + "shades of brown, ";
}else if (rand == 1) { }else if (rand == 1) {
stimulus = stimulus + " zebra, "; stimulus = stimulus + "zebra, ";
colour = colour + " - black & white, "; colour = colour + "black & white, ";
}else if (rand == 2) { }else if (rand == 2) {
stimulus = stimulus + " elephant, "; stimulus = stimulus + "elephant, ";
colour = colour + " - grey, "; colour = colour + "grey, ";
}else if (rand == 3) { }else if (rand == 3) {
stimulus = stimulus + " pig, "; stimulus = stimulus + "pig, ";
colour = colour + " - pink, "; colour = colour + "pink, ";
}else if (rand == 4) { }else if (rand == 4) {
stimulus = stimulus + " giraffe, "; stimulus = stimulus + "giraffe, ";
colour = colour + " - yellow & brown, "; colour = colour + "yellow & brown, ";
}else if (rand == 5) { }else if (rand == 5) {
stimulus = stimulus + " cow, "; stimulus = stimulus + "cow, ";
colour = colour + " - black & white, "; colour = colour + "black & white, ";
}else if (rand == 6) { }else if (rand == 6) {
stimulus = stimulus + " horse, "; stimulus = stimulus + "horse, ";
colour = colour + " - shades of brown, "; colour = colour + "shades of brown, ";
}else if (rand == 7) { }else if (rand == 7) {
stimulus = stimulus + " dino, "; stimulus = stimulus + "dino, ";
colour = colour + " - purple & red, "; colour = colour + "purple & red, ";
}else if (rand == 8) { }else if (rand == 8) {
stimulus = stimulus + " lion, "; stimulus = stimulus + "lion, ";
colour = colour + " - orange & brown, "; colour = colour + "orange & brown, ";
}else if (rand == 9) { }else if (rand == 9) {
stimulus = stimulus + " dog, "; stimulus = stimulus + "dog, ";
colour = colour + " - brown orange, "; colour = colour + "brown orange, ";
} }
} }
...@@ -827,16 +863,21 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -827,16 +863,21 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
"CREATE TABLE IF NOT EXISTS focusedAttention (\n" + "CREATE TABLE IF NOT EXISTS focusedAttention (\n" +
" id INTEGER PRIMARY KEY AUTOINCREMENT,\n" + " id INTEGER PRIMARY KEY AUTOINCREMENT,\n" +
" childID int NOT NULL,\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" + " totalCorrectResponses int NOT NULL,\n" +
" noOfCorrectResponses int NOT NULL,\n" + " noOfCorrectResponses int NOT NULL,\n" +
" noOfCommissionErrors int NOT NULL,\n" + " noOfCommissionErrors int NOT NULL,\n" +
" noOfOmmissionErrors int NOT NULL,\n" + " noOfOmmissionErrors int NOT NULL,\n" +
" meanReactionTime 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() { private void saveDataToLocalDB() {
...@@ -851,12 +892,11 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -851,12 +892,11 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
int total_duration = duration; int total_duration = duration;
String insertSQL = "INSERT INTO focusedAttention \n" + 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" + "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(); //Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
} }
......
...@@ -32,6 +32,7 @@ import com.anuththara18.attentionassessment.map.Map1Activity; ...@@ -32,6 +32,7 @@ import com.anuththara18.attentionassessment.map.Map1Activity;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
...@@ -52,6 +53,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity { ...@@ -52,6 +53,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
Random random = new Random(); Random random = new Random();
int radomTimer = 0; int radomTimer = 0;
int rand = 0; int rand = 0;
int missed = 0;
int i = 1; int i = 1;
private long startTime, clickedTime = 0; private long startTime, clickedTime = 0;
...@@ -71,11 +73,12 @@ public class FocusedAttentionGame2 extends AppCompatActivity { ...@@ -71,11 +73,12 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
String clicked = "null"; String clicked = "null";
public static ArrayList<String> sequence_of_responses;
Integer[] isi = { 3000, 3500, 4000, 4500, 5000, 5500, 6000 }; Integer[] isi = { 3000, 3500, 4000, 4500, 5000, 5500, 6000 };
MediaPlayer mp, mp2; MediaPlayer mp, mp2;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -103,6 +106,8 @@ public class FocusedAttentionGame2 extends AppCompatActivity { ...@@ -103,6 +106,8 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
mp = MediaPlayer.create(getApplicationContext(), R.raw.focused); mp = MediaPlayer.create(getApplicationContext(), R.raw.focused);
mp.start(); mp.start();
sequence_of_responses = new ArrayList<>();
mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override @Override
...@@ -140,6 +145,11 @@ public class FocusedAttentionGame2 extends AppCompatActivity { ...@@ -140,6 +145,11 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
bear3.setEnabled(true); bear3.setEnabled(true);
bear4.setEnabled(true); bear4.setEnabled(true);
if (missed == 0) {
sequence_of_responses.add("M");
Log.d("%%%%%%%%%%%%%%%%%%", String.valueOf(sequence_of_responses));
}
radomTimer = random.nextInt(5); radomTimer = random.nextInt(5);
updateInterval = isi[radomTimer]; updateInterval = isi[radomTimer];
bear1.postDelayed(this, updateInterval); bear1.postDelayed(this, updateInterval);
...@@ -221,7 +231,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity { ...@@ -221,7 +231,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
Log.d("commissionErrors", String.valueOf(noOfCommissionErrors)); Log.d("commissionErrors", String.valueOf(noOfCommissionErrors));
Log.d("meanReactionTime", String.valueOf(meanReactionTime)); Log.d("meanReactionTime", String.valueOf(meanReactionTime));
Log.d("duration", String.valueOf(duration)); Log.d("duration", String.valueOf(duration));
saveDataToOnlineDB(); //saveDataToOnlineDB();
createTable(); createTable();
saveDataToLocalDB(); saveDataToLocalDB();
if (Map1Activity.level == 1){ if (Map1Activity.level == 1){
...@@ -256,6 +266,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity { ...@@ -256,6 +266,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime; totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime); Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++; noOfCorrectResponses++;
sequence_of_responses.add("C");
bear1.setEnabled(false); bear1.setEnabled(false);
} else { } else {
Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime); Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime);
...@@ -277,6 +288,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity { ...@@ -277,6 +288,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime; totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime); Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++; noOfCorrectResponses++;
sequence_of_responses.add("C");
bear2.setEnabled(false); bear2.setEnabled(false);
} else { } else {
Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime); Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime);
...@@ -298,6 +310,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity { ...@@ -298,6 +310,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime; totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime); Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++; noOfCorrectResponses++;
sequence_of_responses.add("C");
bear3.setEnabled(false); bear3.setEnabled(false);
} else { } else {
Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime); Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime);
...@@ -320,6 +333,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity { ...@@ -320,6 +333,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime; totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime); Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++; noOfCorrectResponses++;
sequence_of_responses.add("C");
bear4.setEnabled(false); bear4.setEnabled(false);
} else { } else {
Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime); Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime);
......
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