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,
......
...@@ -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