Commit 39ddc7eb authored by Anuththara18's avatar Anuththara18

Adding analysing factors - Focused Attention

parent e06d96d6
......@@ -80,6 +80,7 @@ public class FACompleteScreen extends AppCompatActivity {
String stimulus;
String colour;
String responses;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -158,12 +159,16 @@ public class FACompleteScreen extends AppCompatActivity {
dataList.add(new Focused(
cursorEmployees.getInt(0),
cursorEmployees.getInt(1),
cursorEmployees.getInt(2),
cursorEmployees.getInt(3),
cursorEmployees.getInt(4),
cursorEmployees.getString(2),
cursorEmployees.getString(3),
cursorEmployees.getString(4),
cursorEmployees.getInt(5),
cursorEmployees.getInt(6),
cursorEmployees.getInt(7)
cursorEmployees.getInt(7),
cursorEmployees.getInt(8),
cursorEmployees.getInt(9),
cursorEmployees.getInt(10),
cursorEmployees.getString(11)
));
} while (cursorEmployees.moveToNext());
}
......@@ -191,14 +196,17 @@ public class FACompleteScreen extends AppCompatActivity {
if (Map1Activity.level == 1 || Map1Activity.level == 2) {
stimulus = "bear head";
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;
colour = FocusedAttentionGame1.colour;
responses = String.valueOf(FocusedAttentionGame1.sequence_of_responses);
}
else if (Map1Activity.level == 5) {
stimulus = FocusedAttentionGame1.stimulus;
colour = FocusedAttentionGame1.colour;
responses = String.valueOf(FocusedAttentionGame1.sequence_of_responses);
}
for (int i = 0; i < dataList.size(); i++) {
......@@ -207,19 +215,17 @@ public class FACompleteScreen extends AppCompatActivity {
data.add(new String[]{ String.valueOf(gameData.getId()),
String.valueOf(String.valueOf(gameData.getChildID()).charAt(0)),
String.valueOf(String.valueOf(gameData.getChildID()).charAt(1)),
String.valueOf(Map1Activity.level),
String.valueOf(stimulus),
String.valueOf(colour),
String.valueOf("null"),
String.valueOf(String.valueOf(gameData.getChildID()).charAt(2)),
String.valueOf(gameData.getStimulus()),
String.valueOf(gameData.getColour()),
String.valueOf(gameData.getSequence_of_responses()),
String.valueOf(gameData.getTotalCorrectResponses()),
String.valueOf(gameData.getNoOfCorrectResponses()),
String.valueOf(gameData.getNoOfCommissionErrors()),
String.valueOf(gameData.getNoOfOmmissionErrors()),
String.valueOf(gameData.getMeanReactionTime()),
String.valueOf(gameData.getTotalDuration()),
String.valueOf(ParentDetailsActivity.diagnosis)
String.valueOf(gameData.getDiagnosis())
});
}
......
......@@ -4,56 +4,128 @@ public class Focused {
private int id;
private int childID;
private String stimulus;
private String colour;
private String sequence_of_responses;
private int totalCorrectResponses;
private int noOfCorrectResponses;
private int noOfCommissionErrors;
private int noOfOmmissionErrors;
private int meanReactionTime;
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.childID = childID;
this.stimulus = stimulus;
this.colour = colour;
this.sequence_of_responses = sequence_of_responses;
this.totalCorrectResponses = totalCorrectResponses;
this.noOfCorrectResponses = noOfCorrectResponses;
this.noOfCommissionErrors = noOfCommissionErrors;
this.noOfOmmissionErrors = noOfOmmissionErrors;
this.meanReactionTime = meanReactionTime;
this.totalDuration = totalDuration;
this.diagnosis = diagnosis;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getChildID() {
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() {
return totalCorrectResponses;
}
public void setTotalCorrectResponses(int totalCorrectResponses) {
this.totalCorrectResponses = totalCorrectResponses;
}
public int getNoOfCorrectResponses() {
return noOfCorrectResponses;
}
public void setNoOfCorrectResponses(int noOfCorrectResponses) {
this.noOfCorrectResponses = noOfCorrectResponses;
}
public int getNoOfCommissionErrors() {
return noOfCommissionErrors;
}
public void setNoOfCommissionErrors(int noOfCommissionErrors) {
this.noOfCommissionErrors = noOfCommissionErrors;
}
public int getNoOfOmmissionErrors() {
return noOfOmmissionErrors;
}
public void setNoOfOmmissionErrors(int noOfOmmissionErrors) {
this.noOfOmmissionErrors = noOfOmmissionErrors;
}
public int getMeanReactionTime() {
return meanReactionTime;
}
public void setMeanReactionTime(int meanReactionTime) {
this.meanReactionTime = meanReactionTime;
}
public int getTotalDuration() {
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 (
id int NOT NULL AUTO_INCREMENT,
......
......@@ -32,6 +32,7 @@ import com.anuththara18.attentionassessment.map.Map1Activity;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
......@@ -52,6 +53,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
Random random = new Random();
int radomTimer = 0;
int rand = 0;
int missed = 0;
int i = 1;
private long startTime, clickedTime = 0;
......@@ -71,11 +73,12 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
String clicked = "null";
public static ArrayList<String> sequence_of_responses;
Integer[] isi = { 3000, 3500, 4000, 4500, 5000, 5500, 6000 };
MediaPlayer mp, mp2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -103,6 +106,8 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
mp = MediaPlayer.create(getApplicationContext(), R.raw.focused);
mp.start();
sequence_of_responses = new ArrayList<>();
mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
......@@ -140,6 +145,11 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
bear3.setEnabled(true);
bear4.setEnabled(true);
if (missed == 0) {
sequence_of_responses.add("M");
Log.d("%%%%%%%%%%%%%%%%%%", String.valueOf(sequence_of_responses));
}
radomTimer = random.nextInt(5);
updateInterval = isi[radomTimer];
bear1.postDelayed(this, updateInterval);
......@@ -221,7 +231,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
Log.d("commissionErrors", String.valueOf(noOfCommissionErrors));
Log.d("meanReactionTime", String.valueOf(meanReactionTime));
Log.d("duration", String.valueOf(duration));
saveDataToOnlineDB();
//saveDataToOnlineDB();
createTable();
saveDataToLocalDB();
if (Map1Activity.level == 1){
......@@ -256,6 +266,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++;
sequence_of_responses.add("C");
bear1.setEnabled(false);
} else {
Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime);
......@@ -277,6 +288,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++;
sequence_of_responses.add("C");
bear2.setEnabled(false);
} else {
Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime);
......@@ -298,6 +310,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++;
sequence_of_responses.add("C");
bear3.setEnabled(false);
} else {
Log.d("wrong", startTime + " " + clickedTime + " " + reactionTime);
......@@ -320,6 +333,7 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct ", startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++;
sequence_of_responses.add("C");
bear4.setEnabled(false);
} else {
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