Commit adf9eff9 authored by Anuththara18's avatar Anuththara18

Analysing factors added- Sustained Attention

parent 18dc766f
......@@ -97,18 +97,10 @@
android:name=".sustained.SA1CompleteScreen"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".sustained.SA2CompleteScreen"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".selective.SelectiveACompleteScreen"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".sustained.SustainedAttentionGame2"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".CompleteScreen2"
android:screenOrientation="portrait"
......
......@@ -156,12 +156,16 @@ public class SA1CompleteScreen extends AppCompatActivity {
dataList.add(new Sustained(
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());
}
......@@ -190,18 +194,16 @@ public class SA1CompleteScreen 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(SustainedAttentionGame1.stimulus),
String.valueOf(SustainedAttentionGame1.colour),
String.valueOf("null"),
String.valueOf(gameData.getColour()),
String.valueOf(gameData.getStimulus()),
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 Sustained {
private int id;
private int childID;
private String colour;
private String stimulus;
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 Sustained(int id, int childID, int totalCorrectResponses, int noOfCorrectResponses, int noOfCommissionErrors, int noOfOmmissionErrors, int meanReactionTime, int totalDuration) {
public Sustained(int id, int childID, String colour, String stimulus, 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.colour = colour;
this.stimulus = stimulus;
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 getColour() {
return colour;
}
public void setColour(String colour) {
this.colour = colour;
}
public String getStimulus() {
return stimulus;
}
public void setStimulus(String stimulus) {
this.stimulus = stimulus;
}
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,
......
......@@ -15,6 +15,8 @@ import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
......@@ -24,6 +26,7 @@ import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.age.AgeActivity;
import com.anuththara18.attentionassessment.db.Api;
import com.anuththara18.attentionassessment.db.RequestHandler;
import com.anuththara18.attentionassessment.details.ParentDetailsActivity;
import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import com.anuththara18.attentionassessment.language.LanguageSetter;
......@@ -31,6 +34,7 @@ import com.anuththara18.attentionassessment.language.LanguageSetter;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
......@@ -55,6 +59,9 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000, 1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000, 1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000, 1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000, 1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000, 1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000, 1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000, 1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000, 1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000, 1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000, 1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000, 1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000,
1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000, };
public static ArrayList<String> sequence_of_responses;
int missed = 0;
/*
Integer[] image = { R.drawable.red_bird_gif,
R.drawable.blue_bird_gif,
......@@ -67,7 +74,7 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
int correctImage, clickedImage;
public static String stimulus, colour, sequence_of_responses = "";
public static String stimulus, colour;
Random random = new Random();
......@@ -113,6 +120,8 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
mp = MediaPlayer.create(getApplicationContext(), R.raw.sustained);
mp.start();
sequence_of_responses = new ArrayList<>();
mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
......@@ -177,6 +186,11 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
colour = "pink";
}
if (missed == 0) {
sequence_of_responses.add("M");
Log.d("%%%%%%%%%%%%%%%%%%", String.valueOf(sequence_of_responses));
}
//gifImageView.setImageResource(image[randomImage]);
//clickedImage = image[randomImage];
updateInterval = isi[j];
......@@ -210,6 +224,8 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
clickedImage = R.drawable.woody_bird;
}
missed = 0;
bird.setVisibility(View.VISIBLE);
bird.setEnabled(true);
gifImageView.setVisibility(View.INVISIBLE);
......@@ -239,7 +255,7 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
Log.d("commissionErrors", String.valueOf(noOfCommissionErrors));
Log.d("meanReactionTime", String.valueOf(meanReactionTime));
Log.d("duration", String.valueOf(seconds));
saveDataToOnlineDB();
//saveDataToOnlineDB();
createTable();
saveDataToLocalDB();
Intent intent = new Intent(getApplicationContext(), SA1CompleteScreen.class);
......@@ -267,6 +283,8 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
red_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Animation animZoomOut = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.blink);
red_btn.startAnimation(animZoomOut);
long gameEnd = System.currentTimeMillis();
seconds = (gameEnd - gameStart);
if ( noOfCorrectResponses == 0 ) {
......@@ -284,7 +302,10 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
Log.d("commissionErrors", String.valueOf(noOfCommissionErrors));
Log.d("meanReactionTime", String.valueOf(meanReactionTime));
Log.d("duration", String.valueOf(seconds));
saveDataToOnlineDB();
sequence_of_responses.remove(0);
Log.d("responses", String.valueOf(sequence_of_responses));
//saveDataToOnlineDB();
createTable();
saveDataToLocalDB();
Intent intent = new Intent(getApplicationContext(), SA1CompleteScreen.class);
......@@ -297,6 +318,8 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
bird.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Animation animZoomOut = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.blink);
bird.startAnimation(animZoomOut);
clickedTime = System.currentTimeMillis();
reactionTime = ( clickedTime - startTime );
mp2 = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
......@@ -305,6 +328,9 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
totalReactionTime = (long) (totalReactionTime + reactionTime);
Log.d("correct " , startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++;
missed = 1;
sequence_of_responses.add("C");
Log.d("%%%%%%%%%%%%%%%%%%", String.valueOf(sequence_of_responses));
bird.setEnabled(false);
}
else {
......@@ -465,12 +491,16 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
"CREATE TABLE IF NOT EXISTS sustainedAttention (\n" +
" id INTEGER PRIMARY KEY AUTOINCREMENT,\n" +
" childID int NOT NULL,\n" +
" colour int NOT NULL,\n" +
" stimulus int NOT NULL,\n" +
" sequence_of_responses String NOT NULL,\n" +
" totalCorrectResponses int NOT NULL,\n" +
" noOfCorrectResponses int NOT NULL,\n" +
" noOfCommissionErrors int NOT NULL,\n" +
" noOfOmmissionErrors int NOT NULL,\n" +
" meanReactionTime int NOT NULL,\n" +
" totalDuration int NOT NULL\n" +
" totalDuration int NOT NULL,\n" +
" diagnosis int NOT NULL\n" +
");"
);
}
......@@ -489,11 +519,11 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
int total_duration = (int) seconds;
String insertSQL = "INSERT INTO sustainedAttention \n" +
"(childID, totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration)\n" +
"(childID, colour, stimulus, sequence_of_responses, totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration, diagnosis)\n" +
"VALUES \n" +
"(?, ?, ?, ?, ?, ?, ?);";
"(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
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});
mDatabase.execSQL(insertSQL, new Object[]{child_ID, colour, stimulus, sequence_of_responses, total_correct_responses, no_of_correct_responses, no_of_ommission_errors, no_of_commission_errors, mean_reaction_time, total_duration, ParentDetailsActivity.diagnosis});
//Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg4"
tools:context=".sustained.SustainedAttentionGame2">
<ImageButton
android:id="@+id/cross_btn"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="9dp"
android:layout_marginTop="14dp"
android:background="@drawable/cross_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/help_btn"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="14dp"
android:layout_marginEnd="9dp"
android:background="@drawable/question_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginTop="95dp"
android:layout_marginEnd="50dp"
android:fontFamily="@font/poppins_bold"
android:text="@string/susg1"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="24dp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/bird"
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/blue_bird"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.615" />
<ImageButton
android:id="@+id/red_btn"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginBottom="-20dp"
android:background="@drawable/red_btn"
android:elevation="80dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
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