Commit d060ffdc authored by Anuththara18's avatar Anuththara18

Focused Attention - Getting stimulus & colour

parent 7116bc49
...@@ -177,7 +177,10 @@ public class DACompleteScreen extends AppCompatActivity { ...@@ -177,7 +177,10 @@ public class DACompleteScreen extends AppCompatActivity {
try { try {
writer = new CSVWriter(new FileWriter(csv)); writer = new CSVWriter(new FileWriter(csv));
String[] entries = {"id","child_gender","child_age","total_correct_responses","correct_responses","commission_errors","omission_errors","mean_reaction_time","total_duration","diagnosis"}; String[] entries = {"id","child_gender","child_age", "sequence_of_responses",
"total_correct_responses","correct_responses",
"commission_errors","omission_errors","mean_reaction_time",
"total_duration","diagnosis"};
writer.writeNext(entries); writer.writeNext(entries);
List<String[]> data = new ArrayList<String[]>(); List<String[]> data = new ArrayList<String[]>();
...@@ -188,6 +191,7 @@ public class DACompleteScreen extends AppCompatActivity { ...@@ -188,6 +191,7 @@ public class DACompleteScreen 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("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()),
......
...@@ -35,6 +35,7 @@ import com.anuththara18.attentionassessment.consentform.ParentsConsentDatabaseHe ...@@ -35,6 +35,7 @@ import com.anuththara18.attentionassessment.consentform.ParentsConsentDatabaseHe
import com.anuththara18.attentionassessment.details.ParentDetailsActivity; 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.map.Map1Activity;
import com.anuththara18.attentionassessment.selective.Selective; import com.anuththara18.attentionassessment.selective.Selective;
import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseAuth;
...@@ -77,6 +78,8 @@ public class FACompleteScreen extends AppCompatActivity { ...@@ -77,6 +78,8 @@ public class FACompleteScreen extends AppCompatActivity {
// constant code for runtime permissions // constant code for runtime permissions
private static final int PERMISSION_REQUEST_CODE = 200; private static final int PERMISSION_REQUEST_CODE = 200;
String stimulus;
String colour;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -176,18 +179,40 @@ public class FACompleteScreen extends AppCompatActivity { ...@@ -176,18 +179,40 @@ public class FACompleteScreen extends AppCompatActivity {
try { try {
writer = new CSVWriter(new FileWriter(csv)); writer = new CSVWriter(new FileWriter(csv));
String[] entries = {"id","child_gender","child_age","total_correct_responses","correct_responses","commission_errors","omission_errors","mean_reaction_time","total_duration","diagnosis"}; String[] entries = {"id","child_gender","child_age", "level",
"stimulus", "colour", "sequence_of_responses",
"total_correct_responses","correct_responses",
"commission_errors","omission_errors",
"mean_reaction_time","total_duration","diagnosis"};
writer.writeNext(entries); writer.writeNext(entries);
List<String[]> data = new ArrayList<String[]>(); List<String[]> data = new ArrayList<String[]>();
if (Map1Activity.level == 1 || Map1Activity.level == 2) {
stimulus = "bear head";
colour = "brown";
}
else if (Map1Activity.level == 2 || Map1Activity.level == 3) {
stimulus = FocusedAttentionGame1.stimulus;
colour = FocusedAttentionGame1.colour;
}
else if (Map1Activity.level == 5) {
stimulus = FocusedAttentionGame1.stimulus;
colour = FocusedAttentionGame1.colour;
}
for (int i = 0; i < dataList.size(); i++) { for (int i = 0; i < dataList.size(); i++) {
Focused gameData = dataList.get(i); Focused gameData = dataList.get(i);
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(stimulus),
String.valueOf(colour),
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()),
......
...@@ -66,6 +66,8 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -66,6 +66,8 @@ 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 = "";
int i = 1; int i = 1;
private long startTime, clickedTime = 0; private long startTime, clickedTime = 0;
long reactionTime; long reactionTime;
...@@ -134,6 +136,31 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -134,6 +136,31 @@ 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) {
stimulus = "monkey";
colour = "shades of brown";
}
else if(AnimalChoosingActivity.birdSelected == 1) {
stimulus = "zebra";
colour = "black & white";
}
else if(AnimalChoosingActivity.birdSelected == 4) {
stimulus = "giraffe";
colour = "yellow & brown";
}
else if(AnimalChoosingActivity.birdSelected == 9) {
stimulus = "dog";
colour = "brown orange";
}
else if(AnimalChoosingActivity.birdSelected == 5) {
stimulus = "cow";
colour = "black & white";
}
else if(AnimalChoosingActivity.birdSelected == 8) {
stimulus = "lion";
colour = "orange & brown";
}
List<Integer> unpickedNumbers = new ArrayList<Integer>(); List<Integer> unpickedNumbers = new ArrayList<Integer>();
unpickedNumbers.add(0); unpickedNumbers.add(0);
unpickedNumbers.add(1); unpickedNumbers.add(1);
...@@ -325,6 +352,7 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -325,6 +352,7 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView5.setVisibility(View.INVISIBLE); imageView5.setVisibility(View.INVISIBLE);
imageView6.setVisibility(View.INVISIBLE); imageView6.setVisibility(View.INVISIBLE);
imageView.setImageResource(images[rand]); imageView.setImageResource(images[rand]);
getData();
} }
else if ( i == 4 || i == 16 || i == 28 || i == 40 ) { else if ( i == 4 || i == 16 || i == 28 || i == 40 ) {
imageView2.setVisibility(View.VISIBLE); imageView2.setVisibility(View.VISIBLE);
...@@ -334,6 +362,7 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -334,6 +362,7 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView5.setVisibility(View.INVISIBLE); imageView5.setVisibility(View.INVISIBLE);
imageView6.setVisibility(View.INVISIBLE); imageView6.setVisibility(View.INVISIBLE);
imageView2.setImageResource(images[rand]); imageView2.setImageResource(images[rand]);
getData();
} }
else if ( i == 6 || i == 18 || i == 30 ) { else if ( i == 6 || i == 18 || i == 30 ) {
imageView3.setVisibility(View.VISIBLE); imageView3.setVisibility(View.VISIBLE);
...@@ -343,6 +372,7 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -343,6 +372,7 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView5.setVisibility(View.INVISIBLE); imageView5.setVisibility(View.INVISIBLE);
imageView6.setVisibility(View.INVISIBLE); imageView6.setVisibility(View.INVISIBLE);
imageView3.setImageResource(images[rand]); imageView3.setImageResource(images[rand]);
getData();
} }
else if ( i == 8 || i == 20 || i == 32 ) { else if ( i == 8 || i == 20 || i == 32 ) {
imageView4.setVisibility(View.VISIBLE); imageView4.setVisibility(View.VISIBLE);
...@@ -352,6 +382,7 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -352,6 +382,7 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView5.setVisibility(View.INVISIBLE); imageView5.setVisibility(View.INVISIBLE);
imageView6.setVisibility(View.INVISIBLE); imageView6.setVisibility(View.INVISIBLE);
imageView4.setImageResource(images[rand]); imageView4.setImageResource(images[rand]);
getData();
} }
else if ( i == 10 || i == 22 || i == 34 ) { else if ( i == 10 || i == 22 || i == 34 ) {
imageView5.setVisibility(View.VISIBLE); imageView5.setVisibility(View.VISIBLE);
...@@ -361,6 +392,7 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -361,6 +392,7 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView.setVisibility(View.INVISIBLE); imageView.setVisibility(View.INVISIBLE);
imageView6.setVisibility(View.INVISIBLE); imageView6.setVisibility(View.INVISIBLE);
imageView5.setImageResource(images[rand]); imageView5.setImageResource(images[rand]);
getData();
} }
else if ( i == 12 || i == 24 || i == 36 ) { else if ( i == 12 || i == 24 || i == 36 ) {
imageView6.setVisibility(View.VISIBLE); imageView6.setVisibility(View.VISIBLE);
...@@ -370,6 +402,7 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -370,6 +402,7 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
imageView5.setVisibility(View.INVISIBLE); imageView5.setVisibility(View.INVISIBLE);
imageView.setVisibility(View.INVISIBLE); imageView.setVisibility(View.INVISIBLE);
imageView6.setImageResource(images[rand]); imageView6.setImageResource(images[rand]);
getData();
} }
} }
...@@ -591,6 +624,41 @@ public class FocusedAttentionGame1 extends AppCompatActivity { ...@@ -591,6 +624,41 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
} }
public void getData(){
if (rand == 0) {
stimulus = stimulus + " monkey, ";
colour = colour + " - shades of brown, ";
}else if (rand == 1) {
stimulus = stimulus + " zebra, ";
colour = colour + " - black & white, ";
}else if (rand == 2) {
stimulus = stimulus + " elephant, ";
colour = colour + " - grey, ";
}else if (rand == 3) {
stimulus = stimulus + " pig, ";
colour = colour + " - pink, ";
}else if (rand == 4) {
stimulus = stimulus + " giraffe, ";
colour = colour + " - yellow & brown, ";
}else if (rand == 5) {
stimulus = stimulus + " cow, ";
colour = colour + " - black & white, ";
}else if (rand == 6) {
stimulus = stimulus + " horse, ";
colour = colour + " - shades of brown, ";
}else if (rand == 7) {
stimulus = stimulus + " dino, ";
colour = colour + " - purple & red, ";
}else if (rand == 8) {
stimulus = stimulus + " lion, ";
colour = colour + " - orange & brown, ";
}else if (rand == 9) {
stimulus = stimulus + " dog, ";
colour = colour + " - brown orange, ";
}
}
private void getCount() { private void getCount() {
if (AgeActivity.age == 4 ) { if (AgeActivity.age == 4 ) {
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
android:fontFamily="@font/poppins_bold" android:fontFamily="@font/poppins_bold"
android:text="@string/altg1" android:text="@string/altg1"
android:textAlignment="center" android:textAlignment="center"
android:textColor="@color/white" android:textColor="@color/black"
android:textSize="22dp" android:textSize="22dp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
...@@ -58,9 +58,10 @@ ...@@ -58,9 +58,10 @@
android:src="@drawable/walking_unicorn" android:src="@drawable/walking_unicorn"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/imageView6" app:layout_constraintEnd_toStartOf="@+id/imageView6"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintHorizontal_bias="0.762"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.838" />
<pl.droidsonroids.gif.GifImageView <pl.droidsonroids.gif.GifImageView
android:id="@+id/imageView2" android:id="@+id/imageView2"
...@@ -69,9 +70,10 @@ ...@@ -69,9 +70,10 @@
android:src="@drawable/brown_octopus" android:src="@drawable/brown_octopus"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintHorizontal_bias="0.556"
app:layout_constraintStart_toEndOf="@+id/imageView6" app:layout_constraintStart_toEndOf="@+id/imageView6"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.497" />
<!-- <!--
<ImageButton <ImageButton
......
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