Commit a3b78743 authored by Anuththara18's avatar Anuththara18

initial commit

parent 4540c4e6
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="disableWrapperSourceDistributionNotification" value="true" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="1.8" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
# Attention Analysis of Children
| Supervisors | Name |
| ------ | ------ |
| Supervisor | Dr. Pradeepa Samarasinghe |
| Co-Supervisor | Ms. Madhuka Nadeeshani |
| External Supervisor | Dr. Dulangi Dahanayaka and Ms. Vidushani Dhanawansa |
### Research Team:
* ##### IT19110530 - Pramodini A.A.D.A
* ##### IT19114040 - Jayakody J.A.D.K.A
* ##### IT19165226 - Arachchige I.D
* ##### IT19177106 - Wasala W.L.M.K.S
### Main Objective: Attention Analysis Of Children
### Main Research questions:
##### Inattention which is identified as the lack of concentration and focus, forgetfulness, poor completion of tasks, and distractibility, have a negative influence on the health and education of the child. The ability of a child to deal with the social, physical, and educational demands of everyday life is crucially dependent on the development of the child’s attention. With abundant evidence that early diagnosis and intervention improves results, there is a compelling need to address the gap between need and access to treatment and also between research and practical application. Therefore the group of 4 researchers are developing a mobile application which covers numerous tasks such as, identifying behavioral patterns on gaze following task, screen-based set of tasks for attention impairments in young children and facilitate interventions, Analysis of response to name calling, Developing a model to analyze children’s attention details on a screen-based game.
### Individual Research Questions
##### IT19110530: Pramodini A.A.D.A
###### Since Sri Lanka is still a developing country in the world, there are very few tools and technologies to detect attention of young children based on joint-attention and gaze following tasks. And moreover, Sri Lankan parents are not very aware of the disorders and impairments of young children. Lack of knowledge, cultural barriers, and tools to diagnose their children's attention is one major problem in Sri Lanka. So, our main objective is to implement a fully functional culturally sensitive mobile based attention analysis framework that diagnoses and analyses the attention of Sri Lankan children.
* Individual Main Objective: The main objective of this research is to Identify different behavioral patterns on joint-attention and gaze following tasks of Sri Lankan children through video recording and extracting video frames from the captured videos.
* Individual Sub Objectives:
• Design set of tasks to evaluate the joint attention of children.
• Design set of tasks to evaluate the gaze following task for children
• Design and develop head pose estimation model for children and evaluate the head pose estimation on children
• Develop a model to analyze gaze following and joint-attention task and evaluate gaze following and joint-attention task of children through the model
##### IT19114040 - Jayakody J. A. D. K. A.
###### Sri Lanka lacks an interactive tool for assessing and training all the five major aspects of visual attention (focused attention, selective attention, divided attention, sustained attention, alternating attention). The proposed mobile component addresses this gap.
* Individual Research Question: Development of a mobile application to screen for attention impairments in young children and facilitate interventions
* Individual Sub Objectives:
• Identifying a series of gaming activities and tasks to train the different aspects of visual attention in young children based on their age.
• Development of a model to assess the attention of the child through the series of selected gaming activities.
• Assessing the visual attention of young children using the developed model.
• Providing awareness about attention disorders and preliminary guidance via the mobile application.
##### IT19165226: Arachchige I.D
###### Currently there are no specific details(time taken to respond, amount of eye contact given, time spent being focused) about the response a child makes to when their name is being called which is affected by various reasons: how interested they are, the amount of urgency in the caller's tone and relationship to caller.
* Individual Main Objective: The main objective of this research is to develop a model to analyse behavioral patterns in children aged 1 to 3 years for response to their name being called.
* Individual Sub Objectives:
• Identifying and designing an experiment to cater the different factors that affect the response to name calling in the age group 1-3.
• Development of a speech recognition model to identify when the child’s name was called.
• Development of a model to analyze head pose estimation of a child.
• Development of a framework to understand behavioral patterns in toddlers when their name has been called.
##### IT19177106: Wasala W.L.M.K.S
###### With the advancement of the medical field there are many attention related disorders have been identified.It is critical to identify these disorders as early as possible to start treatments.Early detection of those disorders it allowed to early intervention.But, in countries like Sri Lanka, there is no such practice to screen and diagnose these disorders at such early ages.There are some ways to tracking someone’s gaze on a computer screen using a camera. But these are not specially targeted for children.
* Individual Main Objective: The Main objective is developing a model to analyze children’s attention details on a screen-based task.
* Individual Sub Objectives:
• Identifying a model to map a child’s eye gaze to the observing screen.
• Developing a series of screen-based tasks to assess the child’s attention based on the mapping developed in the model.
• Evaluate the attention of the child using the developed screen-based task and the model that used to map child gaze to the observing screen.
\ No newline at end of file
/build
\ No newline at end of file
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.anuththara18.attentionassessment"
minSdkVersion 24
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "androidx.cardview:cardview:1.0.0"
// giff images
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.17'
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.anuththara18.attentionassessment;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.anuththara18.attentionassessment", appContext.getPackageName());
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.anuththara18.attentionassessment">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AttentionAssessment"
android:usesCleartextTraffic="true">
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
<activity android:name=".details.ParentDetailsActivity"
android:screenOrientation="landscape"
android:windowSoftInputMode="adjustPan|stateHidden"
android:theme="@style/Theme.AppCompat.NoActionBar">
</activity>
<activity
android:name=".consentform.ConsentFormActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar"></activity>
<activity
android:name=".consentform.GetParentsConsentActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar"></activity>
<activity
android:name=".consentform.GetSignatureActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar"></activity>
<activity
android:name=".alternating.AlternatingAttentionGame1"
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.NoActionBar"></activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<activity
android:name=".selective.BirdChoosingActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".dividedattention.DACompleteScreen"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".focused.FACompleteScreen"
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".alternating.AACompleteScreen"
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
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"
android:theme="@style/Theme.AppCompat.NoActionBar" >
</activity>
<activity
android:name=".CompleteScreen"
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.NoActionBar" >
</activity>
<activity
android:name=".dividedattention.DividedAttentionGame1"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".sustained.SustainedAttentionGame1"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".focused.FocusedAttentionGame2"
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".map.Map2Activity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".map.Map1Activity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".home.NavigationDrawerActivity"
android:label="@string/heading"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".focused.FocusedAttentionGame1"
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".loginregistration.RegistrationActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".loginregistration.LoginActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".language.LanguageActivity"
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".age.AgeActivity"
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".gender.GenderActivity"
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".selective.SelectiveAttentionGame1"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".splashscreen.SplashActivity"
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package com.anuththara18.attentionassessment;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import com.anuththara18.attentionassessment.focused.FACompleteScreen;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
public class CompleteScreen extends AppCompatActivity {
ImageView complete, gifImageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_complete_screen);
complete = findViewById(R.id.complete);
gifImageView = findViewById(R.id.gifImageView);
/*
new Runnable() {
@Override
public void run() {
gifImageView.postDelayed(this, 3000);
complete.setVisibility(View.VISIBLE);
}
}.run();
*/
complete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
finish();
startActivity(intent);
}
});
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
public class CompleteScreen2 extends AppCompatActivity {
ImageView complete;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_complete_screen2);
complete = findViewById(R.id.complete);
complete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
finish();
startActivity(intent);
}
});
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.age;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.TranslateAnimation;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import com.anuththara18.attentionassessment.language.LanguageActivity;
import com.anuththara18.attentionassessment.language.LanguageSetter;
import com.anuththara18.attentionassessment.selective.SelectiveAttentionGame1;
public class AgeActivity extends AppCompatActivity {
ImageButton right_btn, left_btn;
ImageView bunny_img;
TextView age_txt, next, previous, selectAge;
public static int age = 4;
int width;
int count;
float rightFromXDelta, rightToXDelta, leftFromXDelta, leftToXDelta;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_age);
right_btn = (ImageButton)findViewById(R.id.right_btn);
left_btn = (ImageButton)findViewById(R.id.left_btn);
bunny_img = (ImageView)findViewById(R.id.bunny_img);
age_txt = (TextView)findViewById(R.id.age_txt);
next = (TextView)findViewById(R.id.next);
previous = (TextView)findViewById(R.id.previous);
selectAge = (TextView)findViewById(R.id.selectAge);
next.setText(LanguageSetter.getresources().getString(R.string.next));
previous.setText(LanguageSetter.getresources().getString(R.string.previous));
selectAge.setText(LanguageSetter.getresources().getString(R.string.age));
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int height = displayMetrics.heightPixels;
width = displayMetrics.widthPixels;
count = 1;
right_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if ( count < 4 ) {
getDimensions();
TranslateAnimation animate = new TranslateAnimation(rightFromXDelta, rightToXDelta, 0, 0);
animate.setDuration(500);
animate.setFillAfter(true);
bunny_img.startAnimation(animate);
age_txt.startAnimation(animate);
count++;
Log.d("tag", String.valueOf(count));
setAge();
}
}
});
left_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if ( count > 1 ) {
getDimensions();
TranslateAnimation animate = new TranslateAnimation(leftFromXDelta, leftToXDelta, 0, 0);
animate.setDuration(500);
animate.setFillAfter(true);
bunny_img.startAnimation(animate);
age_txt.startAnimation(animate);
count--;
Log.d("tag", String.valueOf(count));
setAge();
}
}
});
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(AgeActivity.this, NavigationDrawerActivity.class);
startActivity(intent);
}
});
previous.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(AgeActivity.this, GenderActivity.class);
startActivity(intent);
}
});
}
public void getDimensions() {
if ( count == 1 ) {
leftFromXDelta = 0;
leftToXDelta = 0;
rightFromXDelta = 0;
rightToXDelta = width / 5.5f;
}
else if ( count == 2 ) {
rightToXDelta = 2 * (width / 5.5f);
rightFromXDelta = 1 * (width / 5.5f);
leftFromXDelta = 1 * (width / 5.5f);
leftToXDelta = 0;
}
else if ( count == 3 ) {
rightToXDelta = 3 * (width / 5.5f);
rightFromXDelta = 2 * (width / 5.5f);
leftFromXDelta = 2 * (width / 5.5f);
leftToXDelta = 1 * (width / 5.5f);
}
else if ( count == 4 ) {
leftFromXDelta = 3 * (width / 5.5f);
leftToXDelta = 2 * (width / 5.5f);
}
}
public void setAge() {
if ( count == 1 ) {
age = 4;
age_txt.setText("4");
age_txt.setPadding(0, 0, 0,0 );
Log.d("age", String.valueOf(age));
}
else if ( count == 2 ) {
age = 5;
age_txt.setText("5");
age_txt.setPadding(10, 0, 0,0 );
Log.d("age", String.valueOf(age));
}
else if ( count == 3 ) {
age = 6;
age_txt.setText("6");
age_txt.setPadding(15, 0, 0,0 );
Log.d("age", String.valueOf(age));
}
else if ( count == 4 ) {
age = 7;
age_txt.setText("7");
age_txt.setPadding(25, 0, 0,0 );
Log.d("age", String.valueOf(age));
}
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.alternating;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.pdf.PdfDocument;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.age.AgeActivity;
import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static android.Manifest.permission.MANAGE_EXTERNAL_STORAGE;
import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
;
public class AACompleteScreen extends AppCompatActivity {
ImageView complete;
List<Alternating> dataList;
SQLiteDatabase mDatabase;
// declaring width and height
// for our PDF file.
int pageHeight = 1120;
int pagewidth = 792;
// creating a bitmap variable
// for storing our images
Bitmap bmp, scaledbmp;
// constant code for runtime permissions
private static final int PERMISSION_REQUEST_CODE = 200;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_complete_screen2);
complete = findViewById(R.id.complete);
complete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
finish();
startActivity(intent);
}
});
dataList = new ArrayList<>();
//opening the database
mDatabase = openOrCreateDatabase(AlternatingAttentionGame1.DATABASE_NAME, MODE_PRIVATE, null);
/*******************************************************************************************/
// initializing our variables.
bmp = BitmapFactory.decodeResource(getResources(), R.drawable.focused);
scaledbmp = Bitmap.createScaledBitmap(bmp, 140, 140, false);
// below code is used for
// checking our permissions.
if (checkPermission()) {
//Toast.makeText(this, "Permission Granted", Toast.LENGTH_SHORT).show();
} else {
requestPermission();
}
/*******************************************************************************************/
//this part will display the data in the list
//we used rawQuery(sql, selectionargs) for fetching all the employees
Cursor cursorEmployees = mDatabase.rawQuery("SELECT * FROM alternatingAttention", null);
//if the cursor has some data
if (cursorEmployees.moveToFirst()) {
//looping through all the records
do {
//pushing each record in the employee list
dataList.add(new Alternating(
cursorEmployees.getInt(0),
cursorEmployees.getInt(1),
cursorEmployees.getInt(2),
cursorEmployees.getInt(3),
cursorEmployees.getInt(4),
cursorEmployees.getInt(5),
cursorEmployees.getInt(6),
cursorEmployees.getInt(7)
));
} while (cursorEmployees.moveToNext());
}
//closing the cursor
cursorEmployees.close();
/*******************************************************************************************/
// generate our PDF file.
// creating an object variable
// for our PDF document.
PdfDocument pdfDocument = new PdfDocument();
// two variables for paint "paint" is used
// for drawing shapes and we will use "title"
// for adding text in our PDF file.
Paint paint = new Paint();
Paint title = new Paint();
// we are adding page info to our PDF file
// in which we will be passing our pageWidth,
// pageHeight and number of pages and after that
// we are calling it to create our PDF.
PdfDocument.PageInfo mypageInfo = new PdfDocument.PageInfo.Builder(pagewidth, pageHeight, 1).create();
// below line is used for setting
// start page for our PDF file.
PdfDocument.Page myPage = pdfDocument.startPage(mypageInfo);
// creating a variable for canvas
// from our page of PDF.
Canvas canvas = myPage.getCanvas();
// below line is used to draw our image on our PDF file.
// the first parameter of our drawbitmap method is
// our bitmap
// second parameter is position from left
// third parameter is position from top and last
// one is our variable for paint.
canvas.drawBitmap(scaledbmp, 56, 40, paint);
// below line is used for adding typeface for
// our text which we will be adding in our PDF file.
title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
// below line is used for setting text size
// which we will be displaying in our PDF file.
title.setTextSize(20);
// below line is sued for setting color
// of our text inside our PDF file.
title.setColor(ContextCompat.getColor(this, R.color.purple));
// below line is used to draw text in our PDF file.
// the first parameter is our text, second parameter
// is position from start, third parameter is position from top
// and then we are passing our variable of paint which is title.
canvas.drawText("Alternating Attention", 250, 80, title);
title.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
title.setColor(ContextCompat.getColor(this, R.color.black));
title.setTextSize(15);
canvas.drawText("Age : " + AgeActivity.age, 150, 250, title);
String gender;
if (GenderActivity.gender == 0) {
gender = "Male";
}
else {
gender = "Female";
}
canvas.drawText("Gender: " + gender, 150, 300, title);
/*
canvas.drawText("Child Name: " + gender, 150, 350, title);
canvas.drawText("Parent Name: " + gender, 150, 400, title);
canvas.drawText("Contact No: " + gender, 150, 450, title);
canvas.drawText("Email: " + gender, 150, 500, title);
*/
// similarly we are creating another text and in this
// we are aligning this text to center of our PDF file.
title.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
title.setColor(ContextCompat.getColor(this, R.color.black));
title.setTextSize(15);
// below line is used for setting
// our text to center of PDF.
//title.setTextAlign(Paint.Align.CENTER);
int space = 0;
// Printing elements one by one
for (int i = 0; i < dataList.size(); i++) {
//getting employee of the specified position
Alternating data = dataList.get(i);
Log.d("********************************", "ID : " + String.valueOf(data.getId()) + ", \t" +
"C: " + String.valueOf(data.getChildID()) + ", \t" +
"TCR: " + String.valueOf(data.getTotalCorrectResponses()) + ", \t" +
"CR: " + String.valueOf(data.getNoOfCorrectResponses()) + ", \t" +
"CE: " + String.valueOf(data.getNoOfCommissionErrors()) + ", \t" +
"OE: " + String.valueOf(data.getNoOfOmmissionErrors()) + ", \t" +
"MRT: " + String.valueOf(data.getMeanReactionTime()) + ", \t" +
"TD: " + String.valueOf(data.getTotalDuration()) );
canvas.drawText("ID : " + String.valueOf(data.getId()) + ", \t" +
"C: " + String.valueOf(data.getChildID()) + ", \t" +
"TCR: " + String.valueOf(data.getTotalCorrectResponses()) + ", \t" +
"CR: " + String.valueOf(data.getNoOfCorrectResponses()) + ", \t" +
"CE: " + String.valueOf(data.getNoOfCommissionErrors()) + ", \t" +
"OE: " + String.valueOf(data.getNoOfOmmissionErrors()) + ", \t" +
"MRT: " + String.valueOf(data.getMeanReactionTime()) + ", \t" +
"TD: " + String.valueOf(data.getTotalDuration()) + " ", 150, 350 + space, title);
space = space + 50;
}
// after adding all attributes to our
// PDF file we will be finishing our page.
pdfDocument.finishPage(myPage);
// below line is used to set the name of
// our PDF file and its path.
File file = new File(Environment.getExternalStorageDirectory(), "AlternatingAttention.pdf");
try {
// after creating a file name we will
// write our PDF file to that location.
pdfDocument.writeTo(new FileOutputStream(file));
/*
// Uri path = Uri.fromFile(file);
Uri path = FileProvider.getUriForFile(FACompleteScreen.this, BuildConfig.APPLICATION_ID + ".provider", file);
Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
pdfIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
pdfIntent.setDataAndType(path, "application/pdf");
pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try{
startActivity(pdfIntent);
}catch(ActivityNotFoundException e){
Toast.makeText(getApplicationContext(), "No Application available to view PDF", Toast.LENGTH_SHORT).show();
}
*/
// below line is to print toast message
// on completion of PDF generation.
Toast.makeText(getApplicationContext(), "PDF file generated successfully.", Toast.LENGTH_LONG).show();
} catch (IOException e) {
// below line is used
// to handle error
e.printStackTrace();
}
// after storing our pdf to that
// location we are closing our PDF file.
pdfDocument.close();
}
/**************************************************************************************************/
private boolean checkPermission() {
// checking of permissions.
int permission1 = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);
int permission2 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);
int permission3 = ContextCompat.checkSelfPermission(getApplicationContext(), MANAGE_EXTERNAL_STORAGE);
return permission1 == PackageManager.PERMISSION_GRANTED && permission2 == PackageManager.PERMISSION_GRANTED && permission3 == PackageManager.PERMISSION_GRANTED;
}
/**************************************************************************************************/
private void requestPermission() {
// requesting permissions if not provided.
ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE, MANAGE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == PERMISSION_REQUEST_CODE) {
if (grantResults.length > 0) {
/*
Intent intent = new Intent();
intent.setAction(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
Uri uri = Uri.fromParts("package", this.getPackageName(), null);
intent.setData(uri);
startActivity(intent);
*/
// after requesting permissions we are showing
// users a toast message of permission granted.
boolean writeStorage = grantResults[0] == PackageManager.PERMISSION_GRANTED;
boolean readStorage = grantResults[1] == PackageManager.PERMISSION_GRANTED;
if (writeStorage && readStorage) {
//Toast.makeText(this, "Permission Granted..", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "Permission Denined.", Toast.LENGTH_SHORT).show();
finish();
}
}
}
}
/**************************************************************************************************/
}
package com.anuththara18.attentionassessment.alternating;
public class Alternating {
private int id;
private int childID;
private int totalCorrectResponses;
private int noOfCorrectResponses;
private int noOfCommissionErrors;
private int noOfOmmissionErrors;
private int meanReactionTime;
private int totalDuration;
public Alternating(int id, int childID, int totalCorrectResponses, int noOfCorrectResponses, int noOfCommissionErrors, int noOfOmmissionErrors, int meanReactionTime, int totalDuration) {
this.id = id;
this.childID = childID;
this.totalCorrectResponses = totalCorrectResponses;
this.noOfCorrectResponses = noOfCorrectResponses;
this.noOfCommissionErrors = noOfCommissionErrors;
this.noOfOmmissionErrors = noOfOmmissionErrors;
this.meanReactionTime = meanReactionTime;
this.totalDuration = totalDuration;
}
public int getId() {
return id;
}
public int getChildID() {
return childID;
}
public int getTotalCorrectResponses() {
return totalCorrectResponses;
}
public int getNoOfCorrectResponses() {
return noOfCorrectResponses;
}
public int getNoOfCommissionErrors() {
return noOfCommissionErrors;
}
public int getNoOfOmmissionErrors() {
return noOfOmmissionErrors;
}
public int getMeanReactionTime() {
return meanReactionTime;
}
public int getTotalDuration() {
return totalDuration;
}
/*
CREATE TABLE sustainedAttention (
id int NOT NULL AUTO_INCREMENT,
childID int NOT NULL,
totalCorrectResponses int NOT NULL,
noOfCorrectResponses int NOT NULL,
noOfCommissionErrors int NOT NULL,
noOfOmmissionErrors int NOT NULL,
meanReactionTime int NOT NULL,
totalDuration int NOT NULL,
CONSTRAINT sustainedAttention_pk PRIMARY KEY (id)
);
*/
}
package com.anuththara18.attentionassessment.alternating;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.PorterDuff;
import android.media.MediaPlayer;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
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.focused.FACompleteScreen;
import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import com.anuththara18.attentionassessment.language.LanguageSetter;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Random;
public class AlternatingAttentionGame1 extends AppCompatActivity {
private static final int CODE_GET_REQUEST = 1024;
private static final int CODE_POST_REQUEST = 1025;
public static final String DATABASE_NAME = "alternatingAttention";
SQLiteDatabase mDatabase;
ImageView imageView1, imageView2, cross_btn;
ImageButton red_btn_left, red_btn_right;
TextView textView;
Random random = new Random();
int radomImage = 0;
int randomSide;
String side;
int i = 1;
private long startTime, clickedTime = 0;
long reactionTime;
String clickedSide;
int totalCorrectResponses = 0;
int noOfCorrectResponses = 0;
int noOfCommissionErrors = 0;
int noOfOmmissionErrors = 0;
long totalReactionTime = 0;
int meanReactionTime = 0;
int duration = 0;
int leftcount, rightcount = 0;
Integer[] left_images = { R.drawable.dancing_bunny,
R.drawable.motor_piggy,
R.drawable.waving_dog,
R.drawable.dancing_cat,
R.drawable.blue_bird2_gif,
R.drawable.yellow_bird_gif};
Integer[] right_images = { R.drawable.dancing_star,
R.drawable.blowing_crab,
R.drawable.swimming_fish,
R.drawable.blue_fishy,
R.drawable.blue_bird2_gif,
R.drawable.yellow_bird_gif};
//Integer[] sequence1 = { 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0};
MediaPlayer mp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_alternating_attention_game1);
imageView1 = findViewById(R.id.imageView1);
imageView2 = findViewById(R.id.imageView2);
red_btn_left = findViewById(R.id.red_btn_left);
red_btn_right = findViewById(R.id.red_btn_right);
textView = findViewById(R.id.textView);
cross_btn = (ImageView) findViewById(R.id.cross_btn);
textView.setText(LanguageSetter.getresources().getString(R.string.altg1));
mp = MediaPlayer.create(getApplicationContext(), R.raw.alternating);
mp.start();
long gameStart = System.currentTimeMillis();
//creating a database
mDatabase = openOrCreateDatabase(DATABASE_NAME, MODE_PRIVATE, null);
new Runnable() {
@Override
public void run() {
randomSide = random.nextInt(100);
if ( i < 20 ) { // 20 times
if ( randomSide >= 0 && randomSide <= 10) {
side ="left";
} else if ( randomSide > 10 && randomSide <= 20) {
side = "right";
} else if ( randomSide > 20 && randomSide <= 30) {
side ="left";
} else if ( randomSide > 30 && randomSide <= 40) {
side ="right";
} else if ( randomSide > 40 && randomSide <= 50) {
side ="left";
} else if ( randomSide > 50 && randomSide <= 60) {
side ="right";
} else if ( randomSide > 60 && randomSide <= 70) {
side ="left";
} else if ( randomSide > 70 && randomSide <= 80) {
side ="right";
} else if ( randomSide > 80 && randomSide <= 90) {
side ="left";
} else if ( randomSide > 90 && randomSide <= 100) {
side ="right";
}
if( side.equals("left")) {
radomImage = random.nextInt(4);
imageView2.setVisibility(View.INVISIBLE);
imageView1.setVisibility(View.VISIBLE);
if (leftcount > 3 ){
leftcount = 0;
}
imageView1.setImageResource(left_images[leftcount]);
leftcount++;
startTime = System.currentTimeMillis();
clickedSide = "left";
imageView1.postDelayed(this, 3000);
totalCorrectResponses++;
Log.d("***************radomTimer******************", String.valueOf(i + " " + side));
duration = duration + 3000;
i++;
}
// appearance - 1s * 20 times
else {
radomImage = random.nextInt(4);
imageView1.setVisibility(View.INVISIBLE);
imageView2.setVisibility(View.VISIBLE);
if (rightcount > 3 ){
rightcount = 0;
}
imageView2.setImageResource(right_images[rightcount]);
rightcount++;
startTime = System.currentTimeMillis();
clickedSide = "right";
imageView2.postDelayed(this, 3000);
totalCorrectResponses++;
Log.d("***************radomTimer******************", String.valueOf(i + " " + side ));
duration = duration + 3000;
i++;
}
}
else {
long gameEnd = System.currentTimeMillis();
long seconds = (gameEnd - gameStart) / 1000;
if ( noOfCorrectResponses == 0 ) {
meanReactionTime = 0;
}
else {
meanReactionTime = (int) (totalReactionTime / noOfCorrectResponses); // ms
}
Log.d("****************************************************", "****************************************************");
Log.d("Game Time", String.valueOf(seconds));
Log.d("total", String.valueOf(totalCorrectResponses));
Log.d("correctResponses", String.valueOf(noOfCorrectResponses));
noOfOmmissionErrors = totalCorrectResponses - noOfCorrectResponses;
Log.d("omissionErrors", String.valueOf(totalCorrectResponses - noOfCorrectResponses));
Log.d("commissionErrors", String.valueOf(noOfCommissionErrors));
Log.d("meanReactionTime", String.valueOf(meanReactionTime));
Log.d("duration", String.valueOf(duration));
saveDataToOnlineDB();
createTable();
saveDataToLocalDB();
Intent intent = new Intent(getApplicationContext(), AACompleteScreen.class);
finish();
mp.pause();
startActivity(intent);
}
}
}.run();
red_btn_left.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN: {
red_btn_left.getBackground().setColorFilter(0x77000000, PorterDuff.Mode.SRC_ATOP);
view.invalidate();
break;
}
case MotionEvent.ACTION_UP:
// Your action here on button click
clickedTime = System.currentTimeMillis();
reactionTime = ( clickedTime - startTime );
if (clickedSide.equals("left")) {
totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct " , startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++;
}
else {
Log.d( "wrong" , startTime + " " + clickedTime + " " + reactionTime);
noOfCommissionErrors++;
}
case MotionEvent.ACTION_CANCEL: {
red_btn_left.getBackground().clearColorFilter();
view.invalidate();
break;
}
}
return true;
}
});
red_btn_right.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN: {
red_btn_right.getBackground().setColorFilter(0x77000000, PorterDuff.Mode.SRC_ATOP);
view.invalidate();
break;
}
case MotionEvent.ACTION_UP:
// Your action here on button click
clickedTime = System.currentTimeMillis();
reactionTime = ( clickedTime - startTime );
if (clickedSide.equals("right")) {
totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct " , startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++;
}
else {
Log.d( "wrong" , startTime + " " + clickedTime + " " + reactionTime);
noOfCommissionErrors++;
}
case MotionEvent.ACTION_CANCEL: {
red_btn_right.getBackground().clearColorFilter();
view.invalidate();
break;
}
}
return true;
}
});
cross_btn.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN: {
cross_btn.getBackground().setColorFilter(0x77000000, PorterDuff.Mode.SRC_ATOP);
view.invalidate();
break;
}
case MotionEvent.ACTION_UP:
alert();
mp.pause();
case MotionEvent.ACTION_CANCEL: {
cross_btn.getBackground().clearColorFilter();
view.invalidate();
break;
}
}
return true;
}
});
}
/*************************************************************************************************/
@Override
public void onBackPressed() {
super.onBackPressed();
mp.pause();
}
/*************************************************************************************************/
private void alert() {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setMessage("Do you really want to quit the game?");
alertDialogBuilder.setPositiveButton("yes",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
Intent intent = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
finish();
startActivity(intent);
//Toast.makeText(FocusedAttentionGame1.this,"You clicked yes button",Toast.LENGTH_LONG).show();
}
});
alertDialogBuilder.setNegativeButton("No",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//finish();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
/*************************************************************************************************/
private void saveDataToOnlineDB() {
String child = String.valueOf(GenderActivity.gender) + String.valueOf(AgeActivity.age);
int child_ID = Integer.parseInt(child);
int total_correct_responses = totalCorrectResponses;
int no_of_correct_responses = noOfCorrectResponses;
int no_of_ommission_errors = noOfOmmissionErrors;
int no_of_commission_errors = noOfCommissionErrors;
int mean_reaction_time = (int) meanReactionTime;
int total_duration = duration;
HashMap<String, Integer> params = new HashMap<>();
params.put("childID", child_ID);
params.put("totalCorrectResponses", total_correct_responses);
params.put("noOfCorrectResponses", no_of_correct_responses);
params.put("noOfCommissionErrors", no_of_commission_errors);
params.put("noOfOmmissionErrors", no_of_ommission_errors);
params.put("meanReactionTime", mean_reaction_time);
params.put("totalDuration", total_duration);
//Calling the create hero API
PerformNetworkRequest request = new PerformNetworkRequest(Api.URL_FOCUSED_ATTENTION, params, CODE_POST_REQUEST);
request.execute();
}
/*************************************************************************************************/
//inner class to perform network request extending an AsyncTask
private class PerformNetworkRequest extends AsyncTask<Void, Void, String> {
//the url where we need to send the request
String url;
//the parameters
HashMap<String, Integer> params;
//the request code to define whether it is a GET or POST
int requestCode;
//constructor to initialize values
PerformNetworkRequest(String url, HashMap<String, Integer> params, int requestCode) {
this.url = url;
this.params = params;
this.requestCode = requestCode;
}
//when the task started displaying a progressbar
@Override
protected void onPreExecute() {
super.onPreExecute();
}
//this method will give the response from the request
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
try {
JSONObject object = new JSONObject(s);
if (!object.getBoolean("error")) {
Toast.makeText(getApplicationContext(), object.getString("message"), Toast.LENGTH_SHORT).show();
//refreshing the herolist after every operation
//so we get an updated list
//we will create this method right now it is commented
//because we haven't created it yet
//refreshHeroList(object.getJSONArray("heroes"));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
//the network operation will be performed in background
@Override
protected String doInBackground(Void... voids) {
RequestHandler requestHandler = new RequestHandler();
if (requestCode == CODE_POST_REQUEST)
return requestHandler.sendPostRequest(url, params);
if (requestCode == CODE_GET_REQUEST)
return requestHandler.sendGetRequest(url);
return null;
}
}
/*************************************************************************************************/
private void createTable() {
mDatabase.execSQL(
"CREATE TABLE IF NOT EXISTS alternatingAttention (\n" +
" id INTEGER PRIMARY KEY AUTOINCREMENT,\n" +
" childID int 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" +
");"
);
}
/*************************************************************************************************/
private void saveDataToLocalDB() {
String child = String.valueOf(GenderActivity.gender) + String.valueOf(AgeActivity.age);
int child_ID = Integer.parseInt(child);
int total_correct_responses = totalCorrectResponses;
int no_of_correct_responses = noOfCorrectResponses;
int no_of_ommission_errors = noOfOmmissionErrors;
int no_of_commission_errors = noOfCommissionErrors;
int mean_reaction_time = (int) meanReactionTime;
int total_duration = duration;
String insertSQL = "INSERT INTO alternatingAttention \n" +
"(childID, totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration)\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});
Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
}
/*************************************************************************************************/
}
\ No newline at end of file
package com.anuththara18.attentionassessment.consentform;
public class ConsentForm {
private String title;
private String description;
private boolean expanded;
public ConsentForm(String title, String description) {
this.title = title;
this.description = description;
this.expanded = false;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isExpanded() {
return expanded;
}
public void setExpanded(boolean expanded) {
this.expanded = expanded;
}
@Override
public String toString() {
return "ConsentForm{" +
"title='" + title + '\'' +
", description='" + description + '\'' +
", expanded=" + expanded +
'}';
}
}
package com.anuththara18.attentionassessment.consentform;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.anuththara18.attentionassessment.R;
import java.util.ArrayList;
import java.util.List;
public class ConsentFormActivity extends AppCompatActivity {
RecyclerView recyclerView;
List<ConsentForm> consentFormList;
private Boolean[] chkArr;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_consent_form);
recyclerView = findViewById(R.id.recyclerView);
initData();
initRecyclerView();
TextView next = findViewById(R.id.next);
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), GetParentsConsentActivity.class);
startActivity(intent);
}
});
}
private void initRecyclerView() {
ConsentFormAdapter consentFormAdapter = new ConsentFormAdapter(consentFormList);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(consentFormAdapter);
}
private void initData() {
consentFormList = new ArrayList<>();
consentFormList.add(new ConsentForm("Introduction", "Your child is being asked to participate in a research study. This research is being conducted to observe the behaviour of your child in order to develop an automated tool for screening attention impairments in young children. When you are invited to participate in research, you have the right to be informed about the study procedures so that you can decide whether you want to consent to participation. This form may contain words that you do not know. Please ask the researcher to explain any words or information that you do not understand. \n\n" +
"You have the right to know what you will be asked to do so that you can decide whether or not to be in the study. Your participation is voluntary . Your participation is not mandatory. You may refuse to be in the study, and it is your right. If you do not want to continue to be in the study, you may withdraw at any time without penalty or loss of benefits to which you are otherwise entitled."));
consentFormList.add(new ConsentForm("Why is this study being done?", "The purpose of this research is to observe the behaviour of children with the same condition as your child in order to help children who are not yet diagnosed in order to develop an automated screening tool for children with attention impairments. The child’s attention will be monitored through attention analysis."));
consentFormList.add(new ConsentForm("How many people will be in the study?", "**The Doctor at LRH and a research assistant outside the consultation room will be at LRH for data collection during the child’s sessions with the Doctor."));
consentFormList.add(new ConsentForm("What am I being asked to do?", "You will be asked to provide consent in order to collect data related to the attention of your child. The child will not be interfered at any stage where the Doctor is in session. This assessments will not interfere the Doctor’s engagement with the child. Furthermore, your data will be confidential, and it will not be shared with anyone else and your child’s identity will not be revealed at any cost."));
consentFormList.add(new ConsentForm("How long will I be in the study?", "This study will take the duration where the doctor examines the child during your regular LRH visits. You can stop participating at any time without penalty. This will not affect the consultation time the doctor attends to your child."));
consentFormList.add(new ConsentForm("What are the benefits of being in the study?", "Your participation will benefit the country since this is the first time a technology-based solution is proposed and developed in Sri Lanka for children with attention impairments."));
consentFormList.add(new ConsentForm("What are the risks of being in the study?", "There are no risks involved to the child when participating to this research."));
consentFormList.add(new ConsentForm("What are the costs of being in the study?", "There is no cost to you."));
consentFormList.add(new ConsentForm("Confidentiality", "The data collected will be stored securely in a dedicated storage device at Sri Lanka Institute of Information Technology. Only the research team has the access to data. The researchers will ensure the confidentiality of the information collected where the child’s identity will not be revealed at any instance and the data will be used only for research purposes and will be destroyed in a secure manner once the research is complete."));
consentFormList.add(new ConsentForm("Will I be compensated for participating in the study?", "You will receive no payment for taking part in this study."));
consentFormList.add(new ConsentForm("What are my rights as a participant?", "Participation in this study is voluntary. Your participation is not mandatory. You will also be informed of any new information discovered during the course of this study that might influence your child’s health, welfare, or willingness to be in this study."));
consentFormList.add(new ConsentForm("Who do I contact if I have questions, concerns, or complaints?", "Please contact your Doctor or the research assistant if you have questions about the research. Additionally, you may ask questions, voice concerns or complaints to the research team."));
consentFormList.add(new ConsentForm("Whom do I call if I have questions or problems?", "If you have any questions regarding your rights as a participant in this research and/or concerns about the study, or if you feel under any pressure to enroll or to continue to participate in this study, you may contact the Dr Pradeepa Samarasinghe, Principle Investigator at Sri Lanka Institute of Information Technology at 0723537952 or pradeepa.s@sliit.lk . A copy of this Informed Consent form will be given to you before you participate in the research."));
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.consentform;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;
import com.anuththara18.attentionassessment.R;
import java.util.List;
public class ConsentFormAdapter extends RecyclerView.Adapter<ConsentFormAdapter.ConsentFormVH> {
private static final String TAG = "ConsentFormAdapter";
List<ConsentForm> consentFormList;
/**********************************************************************************************************/
public ConsentFormAdapter(List<ConsentForm> consentFormList) {
this.consentFormList = consentFormList;
}
/**********************************************************************************************************/
@NonNull
@Override
public ConsentFormVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.consent_form_data_rows, parent, false);
return new ConsentFormVH(view);
}
/**********************************************************************************************************/
@Override
public void onBindViewHolder(@NonNull ConsentFormVH holder, int position) {
ConsentForm movie = consentFormList.get(position);
holder.titleTextView.setText(movie.getTitle());
holder.descriptions.setText(movie.getDescription());
boolean isExpanded = consentFormList.get(position).isExpanded();
holder.expandableLayout.setVisibility(isExpanded ? View.VISIBLE : View.GONE);
}
/**********************************************************************************************************/
@Override
public int getItemCount() {
return consentFormList.size();
}
/**********************************************************************************************************/
class ConsentFormVH extends RecyclerView.ViewHolder {
private static final String TAG = "ConsentFormVH";
ConstraintLayout expandableLayout;
TextView titleTextView, descriptions;
public ConsentFormVH(@NonNull final View itemView) {
super(itemView);
titleTextView = itemView.findViewById(R.id.titleTextView);
descriptions = itemView.findViewById(R.id.descriptions);
expandableLayout = itemView.findViewById(R.id.expandableLayout);
titleTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ConsentForm consentForm = consentFormList.get(getAdapterPosition());
consentForm.setExpanded(!consentForm.isExpanded());
notifyItemChanged(getAdapterPosition());
}
});
}
}
}
package com.anuththara18.attentionassessment.consentform;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.language.LanguageSetter;
import java.io.ByteArrayOutputStream;
public class GetParentsConsentActivity extends AppCompatActivity {
TextView textView3, next;
Button btnGetSignature;
public static ImageView fingerprintImageView;
static int flag2 = 0;
private static final int STORAGE_PERMISSION_CODE = 101;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_get_parents_consent);
textView3 = (TextView) findViewById(R.id.textView3);
next = (TextView) findViewById(R.id.next);
btnGetSignature = (Button)findViewById(R.id.btnGetSignature);
fingerprintImageView = (ImageView)findViewById(R.id.fingerprintImageView);
//textView3.setText(LanguageSetter.getresources().getString(R.string.provideConsent));
//btnSaveFingerPrint.setText(LanguageSetter.getresources().getString(R.string.startTest));
//btnGetSignature.setText(LanguageSetter.getresources().getString(R.string.getSignature));
checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, STORAGE_PERMISSION_CODE);
/************************************************************************************/
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if ( flag2 == 1) {
saveImage();
//Intent intent = new Intent(getApplicationContext(), QuestionnaireMainScreen.class);
//startActivity(intent);
}
else if ( flag2 == 0 ){
Toast.makeText(getApplicationContext(), "Please Provide your Signature", Toast.LENGTH_SHORT).show();
}
}
});
/************************************************************************************/
btnGetSignature.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), GetSignatureActivity.class);
startActivity(intent);
flag2 = 1;
}
});
}
/************************************************************************************/
public void saveImage() {
try{
/************************************************
* **********************************************
* **********************************************
*/
Toast.makeText(getApplicationContext(), "Consent Saved Successfully!", Toast.LENGTH_SHORT).show();
}
catch (Exception e){
Toast.makeText(getApplicationContext(), "Consent not Saved!", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
/************************************************************************************/
public static byte[] imageViewToByte(ImageView image) {
Bitmap bitmap = ((BitmapDrawable)image.getDrawable()).getBitmap();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
return byteArray;
}
/************************************************************************************/
// Function to check and request permission.
public void checkPermission(String permission, int requestCode)
{
if (ContextCompat.checkSelfPermission(com.anuththara18.attentionassessment.consentform.GetParentsConsentActivity.this, permission) == PackageManager.PERMISSION_DENIED) {
// Requesting the permission
ActivityCompat.requestPermissions(com.anuththara18.attentionassessment.consentform.GetParentsConsentActivity.this, new String[] { permission }, requestCode);
}
else {
//Toast.makeText(GetParentsConsentActivity.this, "Permission already granted", Toast.LENGTH_SHORT).show();
}
}
// This function is called when the user accepts or decline the permission.
// Request Code is used to check which permission called this function.
// This request code is provided when the user is prompt for permission.
@Override
public void onRequestPermissionsResult(int requestCode,
@NonNull String[] permissions,
@NonNull int[] grantResults)
{
super.onRequestPermissionsResult(requestCode,
permissions,
grantResults);
if (requestCode == STORAGE_PERMISSION_CODE) {
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(com.anuththara18.attentionassessment.consentform.GetParentsConsentActivity.this, "Storage Permission Granted", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(com.anuththara18.attentionassessment.consentform.GetParentsConsentActivity.this, "Storage Permission Denied", Toast.LENGTH_SHORT).show();
}
}
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.consentform;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.os.Bundle;
import android.os.Environment;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.anuththara18.attentionassessment.R;
import java.io.File;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class GetSignatureActivity extends AppCompatActivity {
private Button btnClear, btnSave;
private File file;
private LinearLayout canvasLL;
private View view;
private signature mSignature;
public static Bitmap bitmap;
// Creating Separate Directory for saving Generated Images
String DIRECTORY = Environment.getExternalStorageDirectory().getPath() + "/Signature/";
String pic_name = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date());
String StoredPath = DIRECTORY + pic_name + ".png";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_get_signature);
canvasLL = (LinearLayout) findViewById(R.id.canvasLL);
mSignature = new signature(getApplicationContext(), null);
mSignature.setBackgroundColor(Color.WHITE);
// Dynamically generating Layout through java code
canvasLL.addView(mSignature, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
btnClear = (Button) findViewById(R.id.btnclear);
btnSave = (Button) findViewById(R.id.btnsave);
view = canvasLL;
btnClear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mSignature.clear();
}
});
btnSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
view.setDrawingCacheEnabled(true);
mSignature.save(view,StoredPath);
//InputStream inputStream = getContentResolver().openInputStream(StoredPath);
//Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
GetParentsConsentActivity.fingerprintImageView.setImageBitmap(bitmap);
GetParentsConsentActivity.flag2 = 1;
Toast.makeText(getApplicationContext(), "Signature Recorded", Toast.LENGTH_SHORT).show();
finish();
}
});
// Method to create Directory, if the Directory doesn't exists
file = new File(DIRECTORY);
if (!file.exists()) {
file.mkdir();
}
}
public class signature extends View {
private static final float STROKE_WIDTH = 5f;
private static final float HALF_STROKE_WIDTH = STROKE_WIDTH / 2;
private Paint paint = new Paint();
private Path path = new Path();
private float lastTouchX;
private float lastTouchY;
private final RectF dirtyRect = new RectF();
public signature(Context context, AttributeSet attrs) {
super(context, attrs);
paint.setAntiAlias(true);
paint.setColor(Color.BLACK);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeJoin(Paint.Join.ROUND);
paint.setStrokeWidth(STROKE_WIDTH);
}
public void save(View v, String StoredPath) {
Log.v("log_tag", "Width: " + v.getWidth());
Log.v("log_tag", "Height: " + v.getHeight());
if (bitmap == null) {
bitmap = Bitmap.createBitmap(canvasLL.getWidth(), canvasLL.getHeight(), Bitmap.Config.RGB_565);
}
Canvas canvas = new Canvas(bitmap);
try {
// Output the file
FileOutputStream mFileOutStream = new FileOutputStream(StoredPath);
v.draw(canvas);
// Convert the output file to Image such as .png
bitmap.compress(Bitmap.CompressFormat.PNG, 90, mFileOutStream);
mFileOutStream.flush();
mFileOutStream.close();
} catch (Exception e) {
Log.v("log_tag", e.toString());
}
}
public void clear() {
path.reset();
invalidate();
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawPath(path, paint);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
float eventX = event.getX();
float eventY = event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
path.moveTo(eventX, eventY);
lastTouchX = eventX;
lastTouchY = eventY;
return true;
case MotionEvent.ACTION_MOVE:
case MotionEvent.ACTION_UP:
resetDirtyRect(eventX, eventY);
int historySize = event.getHistorySize();
for (int i = 0; i < historySize; i++) {
float historicalX = event.getHistoricalX(i);
float historicalY = event.getHistoricalY(i);
expandDirtyRect(historicalX, historicalY);
path.lineTo(historicalX, historicalY);
}
path.lineTo(eventX, eventY);
break;
default:
debug("Ignored touch event: " + event.toString());
return false;
}
invalidate((int) (dirtyRect.left - HALF_STROKE_WIDTH),
(int) (dirtyRect.top - HALF_STROKE_WIDTH),
(int) (dirtyRect.right + HALF_STROKE_WIDTH),
(int) (dirtyRect.bottom + HALF_STROKE_WIDTH));
lastTouchX = eventX;
lastTouchY = eventY;
return true;
}
private void debug(String string) {
Log.v("log_tag", string);
}
private void expandDirtyRect(float historicalX, float historicalY) {
if (historicalX < dirtyRect.left) {
dirtyRect.left = historicalX;
} else if (historicalX > dirtyRect.right) {
dirtyRect.right = historicalX;
}
if (historicalY < dirtyRect.top) {
dirtyRect.top = historicalY;
} else if (historicalY > dirtyRect.bottom) {
dirtyRect.bottom = historicalY;
}
}
private void resetDirtyRect(float eventX, float eventY) {
dirtyRect.left = Math.min(lastTouchX, eventX);
dirtyRect.right = Math.max(lastTouchX, eventX);
dirtyRect.top = Math.min(lastTouchY, eventY);
dirtyRect.bottom = Math.max(lastTouchY, eventY);
}
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.db;
public class Api {
private static final String ROOT_URL = "http://192.168.43.104/AttentionAssessment/SustainedAttention/v1/Api.php?apicall=";
private static final String ROOT_URL2 = "http://192.168.43.104/AttentionAssessment/FocusedAttention/v1/Api.php?apicall=";
private static final String ROOT_URL3 = "http://192.168.43.104/AttentionAssessment/DividedAttention/v1/Api.php?apicall=";
private static final String ROOT_URL4 = "http://192.168.43.104/AttentionAssessment/SelectiveAttention/v1/Api.php?apicall=";
public static final String URL_SUSTAINED_ATTENTION = ROOT_URL + "insertdata";
public static final String URL_FOCUSED_ATTENTION = ROOT_URL2 + "insertdata";
public static final String URL_DIVIDED_ATTENTION = ROOT_URL3 + "insertdata";
public static final String URL_SELECTIVE_ATTENTION = ROOT_URL4 + "insertdata";
}
package com.anuththara18.attentionassessment.db;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
public class RequestHandler {
//Method to send httpPostRequest
//This method is taking two arguments
//First argument is the URL of the script to which we will send the request
//Other is an HashMap with name value pairs containing the data to be send with the request
public String sendPostRequest(String requestURL,
HashMap<String, Integer> postDataParams) {
//Creating a URL
URL url;
//StringBuilder object to store the message retrieved from the server
StringBuilder sb = new StringBuilder();
try {
//Initializing Url
url = new URL(requestURL);
//Creating an httmlurl connection
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
//Configuring connection properties
conn.setReadTimeout(20000);
conn.setConnectTimeout(20000);
conn.setRequestMethod("POST");
conn.setDoInput(true);
conn.setDoOutput(true);
//Creating an output stream
OutputStream os = conn.getOutputStream();
//Writing parameters to the request
//We are using a method getPostDataString which is defined below
BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(os, "UTF-8"));
writer.write(getPostDataString(postDataParams));
writer.flush();
writer.close();
os.close();
int responseCode = conn.getResponseCode();
if (responseCode == HttpsURLConnection.HTTP_OK) {
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
sb = new StringBuilder();
String response;
//Reading server response
while ((response = br.readLine()) != null) {
sb.append(response);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return sb.toString();
}
public String sendGetRequest(String requestURL) {
StringBuilder sb = new StringBuilder();
try {
URL url = new URL(requestURL);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(con.getInputStream()));
String s;
while ((s = bufferedReader.readLine()) != null) {
sb.append(s + "\n");
}
} catch (Exception e) {
}
return sb.toString();
}
private String getPostDataString(HashMap<String, Integer> params) throws UnsupportedEncodingException {
StringBuilder result = new StringBuilder();
boolean first = true;
for (Map.Entry<String, Integer> entry : params.entrySet()) {
if (first)
first = false;
else
result.append("&");
result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
result.append("=");
result.append(URLEncoder.encode(String.valueOf(entry.getValue()), "UTF-8"));
}
return result.toString();
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.details;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.age.AgeActivity;
import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.language.LanguageActivity;
import com.anuththara18.attentionassessment.language.LanguageSetter;
public class ParentDetailsActivity extends AppCompatActivity {
TextView name, email, contact, next, previous;
EditText childName, parentEmail, parentContact;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_parent_details);
name = findViewById(R.id.name);
email = findViewById(R.id.email);
contact = findViewById(R.id.contact);
next = findViewById(R.id.next);
previous = findViewById(R.id.previous);
childName = findViewById(R.id.childName);
parentEmail = findViewById(R.id.parentEmail);
parentContact = findViewById(R.id.parentContact);
next.setText(LanguageSetter.getresources().getString(R.string.next));
previous.setText(LanguageSetter.getresources().getString(R.string.previous));
name.setText(LanguageSetter.getresources().getString(R.string.childName));
email.setText(LanguageSetter.getresources().getString(R.string.parentEmail));
contact.setText(LanguageSetter.getresources().getString(R.string.parentContact));
previous.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(ParentDetailsActivity.this, LanguageActivity.class);
startActivity(intent);
}
});
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if ( name == null ) {
Toast.makeText(getApplicationContext(), "Please select a language", Toast.LENGTH_SHORT).show();
}
else {
Intent intent = new Intent(ParentDetailsActivity.this, GenderActivity.class);
startActivity(intent);
}
}
});
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.dividedattention;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.pdf.PdfDocument;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import com.anuththara18.attentionassessment.BuildConfig;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.age.AgeActivity;
import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static android.Manifest.permission.MANAGE_EXTERNAL_STORAGE;
import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
public class DACompleteScreen extends AppCompatActivity {
ImageView complete;
List<Divided> dataList;
SQLiteDatabase mDatabase;
// declaring width and height
// for our PDF file.
int pageHeight = 1120;
int pagewidth = 792;
// creating a bitmap variable
// for storing our images
Bitmap bmp, scaledbmp;
// constant code for runtime permissions
private static final int PERMISSION_REQUEST_CODE = 200;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_complete_screen2);
complete = findViewById(R.id.complete);
complete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
finish();
startActivity(intent);
}
});
dataList = new ArrayList<>();
//opening the database
mDatabase = openOrCreateDatabase(DividedAttentionGame1.DATABASE_NAME, MODE_PRIVATE, null);
/*******************************************************************************************/
// initializing our variables.
bmp = BitmapFactory.decodeResource(getResources(), R.drawable.divided);
scaledbmp = Bitmap.createScaledBitmap(bmp, 140, 140, false);
// below code is used for
// checking our permissions.
if (checkPermission()) {
//Toast.makeText(this, "Permission Granted", Toast.LENGTH_SHORT).show();
} else {
requestPermission();
}
/*******************************************************************************************/
//this part will display the data in the list
//we used rawQuery(sql, selectionargs) for fetching all the employees
Cursor cursorEmployees = mDatabase.rawQuery("SELECT * FROM dividedAttention", null);
//if the cursor has some data
if (cursorEmployees.moveToFirst()) {
//looping through all the records
do {
//pushing each record in the employee list
dataList.add(new Divided(
cursorEmployees.getInt(0),
cursorEmployees.getInt(1),
cursorEmployees.getInt(2),
cursorEmployees.getInt(3),
cursorEmployees.getInt(4),
cursorEmployees.getInt(5),
cursorEmployees.getInt(6),
cursorEmployees.getInt(7)
));
} while (cursorEmployees.moveToNext());
}
//closing the cursor
cursorEmployees.close();
/*******************************************************************************************/
// generate our PDF file.
// creating an object variable
// for our PDF document.
PdfDocument pdfDocument = new PdfDocument();
// two variables for paint "paint" is used
// for drawing shapes and we will use "title"
// for adding text in our PDF file.
Paint paint = new Paint();
Paint title = new Paint();
// we are adding page info to our PDF file
// in which we will be passing our pageWidth,
// pageHeight and number of pages and after that
// we are calling it to create our PDF.
PdfDocument.PageInfo mypageInfo = new PdfDocument.PageInfo.Builder(pagewidth, pageHeight, 1).create();
// below line is used for setting
// start page for our PDF file.
PdfDocument.Page myPage = pdfDocument.startPage(mypageInfo);
// creating a variable for canvas
// from our page of PDF.
Canvas canvas = myPage.getCanvas();
// below line is used to draw our image on our PDF file.
// the first parameter of our drawbitmap method is
// our bitmap
// second parameter is position from left
// third parameter is position from top and last
// one is our variable for paint.
canvas.drawBitmap(scaledbmp, 56, 40, paint);
// below line is used for adding typeface for
// our text which we will be adding in our PDF file.
title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
// below line is used for setting text size
// which we will be displaying in our PDF file.
title.setTextSize(20);
// below line is sued for setting color
// of our text inside our PDF file.
title.setColor(ContextCompat.getColor(this, R.color.orange));
// below line is used to draw text in our PDF file.
// the first parameter is our text, second parameter
// is position from start, third parameter is position from top
// and then we are passing our variable of paint which is title.
canvas.drawText("Divided Attention", 250, 80, title);
title.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
title.setColor(ContextCompat.getColor(this, R.color.black));
title.setTextSize(15);
canvas.drawText("Age : " + AgeActivity.age, 150, 250, title);
String gender;
if (GenderActivity.gender == 0) {
gender = "Male";
}
else {
gender = "Female";
}
canvas.drawText("Gender: " + gender, 150, 300, title);
/*
canvas.drawText("Child Name: " + gender, 150, 350, title);
canvas.drawText("Parent Name: " + gender, 150, 400, title);
canvas.drawText("Contact No: " + gender, 150, 450, title);
canvas.drawText("Email: " + gender, 150, 500, title);
*/
// similarly we are creating another text and in this
// we are aligning this text to center of our PDF file.
title.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
title.setColor(ContextCompat.getColor(this, R.color.black));
title.setTextSize(15);
// below line is used for setting
// our text to center of PDF.
//title.setTextAlign(Paint.Align.CENTER);
int space = 0;
// Printing elements one by one
for (int i = 0; i < dataList.size(); i++) {
//getting employee of the specified position
Divided data = dataList.get(i);
Log.d("********************************", "ID : " + String.valueOf(data.getId()) + ", \t" +
"C: " + String.valueOf(data.getChildID()) + ", \t" +
"TCR: " + String.valueOf(data.getTotalCorrectResponses()) + ", \t" +
"CR: " + String.valueOf(data.getNoOfCorrectResponses()) + ", \t" +
"CE: " + String.valueOf(data.getNoOfCommissionErrors()) + ", \t" +
"OE: " + String.valueOf(data.getNoOfOmmissionErrors()) + ", \t" +
"MRT: " + String.valueOf(data.getMeanReactionTime()) + ", \t" +
"TD: " + String.valueOf(data.getTotalDuration()) );
canvas.drawText("ID : " + String.valueOf(data.getId()) + ", \t" +
"C: " + String.valueOf(data.getChildID()) + ", \t" +
"TCR: " + String.valueOf(data.getTotalCorrectResponses()) + ", \t" +
"CR: " + String.valueOf(data.getNoOfCorrectResponses()) + ", \t" +
"CE: " + String.valueOf(data.getNoOfCommissionErrors()) + ", \t" +
"OE: " + String.valueOf(data.getNoOfOmmissionErrors()) + ", \t" +
"MRT: " + String.valueOf(data.getMeanReactionTime()) + ", \t" +
"TD: " + String.valueOf(data.getTotalDuration()) + " ", 150, 350 + space, title);
space = space + 50;
}
// after adding all attributes to our
// PDF file we will be finishing our page.
pdfDocument.finishPage(myPage);
// below line is used to set the name of
// our PDF file and its path.
File file = new File(Environment.getExternalStorageDirectory(), "DividedAttention.pdf");
try {
// after creating a file name we will
// write our PDF file to that location.
pdfDocument.writeTo(new FileOutputStream(file));
/*
// Uri path = Uri.fromFile(file);
Uri path = FileProvider.getUriForFile(DACompleteScreen.this, BuildConfig.APPLICATION_ID + ".provider", file);
Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
pdfIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
pdfIntent.setDataAndType(path, "application/pdf");
pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try{
startActivity(pdfIntent);
}catch(ActivityNotFoundException e){
Toast.makeText(getApplicationContext(), "No Application available to view PDF", Toast.LENGTH_SHORT).show();
}
*/
// below line is to print toast message
// on completion of PDF generation.
Toast.makeText(getApplicationContext(), "PDF file generated successfully.", Toast.LENGTH_LONG).show();
} catch (IOException e) {
// below line is used
// to handle error
e.printStackTrace();
}
// after storing our pdf to that
// location we are closing our PDF file.
pdfDocument.close();
}
/**************************************************************************************************/
private boolean checkPermission() {
// checking of permissions.
int permission1 = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);
int permission2 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);
int permission3 = ContextCompat.checkSelfPermission(getApplicationContext(), MANAGE_EXTERNAL_STORAGE);
return permission1 == PackageManager.PERMISSION_GRANTED && permission2 == PackageManager.PERMISSION_GRANTED && permission3 == PackageManager.PERMISSION_GRANTED;
}
/**************************************************************************************************/
private void requestPermission() {
// requesting permissions if not provided.
ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE, MANAGE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == PERMISSION_REQUEST_CODE) {
if (grantResults.length > 0) {
/*
Intent intent = new Intent();
intent.setAction(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
Uri uri = Uri.fromParts("package", this.getPackageName(), null);
intent.setData(uri);
startActivity(intent);
*/
// after requesting permissions we are showing
// users a toast message of permission granted.
boolean writeStorage = grantResults[0] == PackageManager.PERMISSION_GRANTED;
boolean readStorage = grantResults[1] == PackageManager.PERMISSION_GRANTED;
if (writeStorage && readStorage) {
//Toast.makeText(this, "Permission Granted..", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "Permission Denined.", Toast.LENGTH_SHORT).show();
finish();
}
}
}
}
/**************************************************************************************************/
}
package com.anuththara18.attentionassessment.dividedattention;
public class Divided {
private int id;
private int childID;
private int totalCorrectResponses;
private int noOfCorrectResponses;
private int noOfCommissionErrors;
private int noOfOmmissionErrors;
private int meanReactionTime;
private int totalDuration;
public Divided(int id, int childID, int totalCorrectResponses, int noOfCorrectResponses, int noOfCommissionErrors, int noOfOmmissionErrors, int meanReactionTime, int totalDuration) {
this.id = id;
this.childID = childID;
this.totalCorrectResponses = totalCorrectResponses;
this.noOfCorrectResponses = noOfCorrectResponses;
this.noOfCommissionErrors = noOfCommissionErrors;
this.noOfOmmissionErrors = noOfOmmissionErrors;
this.meanReactionTime = meanReactionTime;
this.totalDuration = totalDuration;
}
public int getId() {
return id;
}
public int getChildID() {
return childID;
}
public int getTotalCorrectResponses() {
return totalCorrectResponses;
}
public int getNoOfCorrectResponses() {
return noOfCorrectResponses;
}
public int getNoOfCommissionErrors() {
return noOfCommissionErrors;
}
public int getNoOfOmmissionErrors() {
return noOfOmmissionErrors;
}
public int getMeanReactionTime() {
return meanReactionTime;
}
public int getTotalDuration() {
return totalDuration;
}
/*
CREATE TABLE sustainedAttention (
id int NOT NULL AUTO_INCREMENT,
childID int NOT NULL,
totalCorrectResponses int NOT NULL,
noOfCorrectResponses int NOT NULL,
noOfCommissionErrors int NOT NULL,
noOfOmmissionErrors int NOT NULL,
meanReactionTime int NOT NULL,
totalDuration int NOT NULL,
CONSTRAINT sustainedAttention_pk PRIMARY KEY (id)
);
*/
}
package com.anuththara18.attentionassessment.dividedattention;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.PorterDuff;
import android.media.MediaPlayer;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.anuththara18.attentionassessment.CompleteScreen;
import com.anuththara18.attentionassessment.CompleteScreen2;
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.focused.FocusedAttentionGame1;
import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import com.anuththara18.attentionassessment.language.LanguageSetter;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
public class DividedAttentionGame1 extends AppCompatActivity {
private static final int CODE_GET_REQUEST = 1024;
private static final int CODE_POST_REQUEST = 1025;
ImageView sq1, sq2;
ImageButton red_btn, cross_btn;
TextView textView2;
int i = 0;
int correctImage, clickedImage;
private long startTime, clickedTime = 0;
long reactionTime;
int totalCorrectResponses = 0;
int noOfCorrectResponses = 0;
int noOfCommissionErrors = 0;
int noOfOmmissionErrors = 0;
long meanReactionTime = 0; // total reaction time
long totalReactionTime = 0;
int duration = 0;
public static final String DATABASE_NAME = "dividedAttention";
SQLiteDatabase mDatabase;
Integer[] image = { R.color.red, R.color.blue, R.color.yellow,
R.color.green, R.color.pink, R.color.purple,
R.color.orange, R.color.teal};
MediaPlayer mp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_divided_attention_game1);
sq1 = (ImageView) findViewById(R.id.sq1);
sq2 = (ImageView) findViewById(R.id.sq2);
cross_btn = (ImageButton) findViewById(R.id.cross_btn);
red_btn = (ImageButton) findViewById(R.id.red_btn);
textView2 = (TextView) findViewById(R.id.textView2);
textView2.setText(LanguageSetter.getresources().getString(R.string.divg1));
mp = MediaPlayer.create(getApplicationContext(), R.raw.divided);
mp.start();
long gameStart = System.currentTimeMillis();
//creating a database
mDatabase = openOrCreateDatabase(DATABASE_NAME, MODE_PRIVATE, null);
totalCorrectResponses = 5;
new Runnable() {
@Override
public void run() {
if ( i < 40 ) { // 40 times
if ( i >=0 && i < 8 ) {
sq1.setImageResource(R.color.pink);
correctImage = R.color.pink;
}
else if ( i >= 8 && i < 16 ) {
sq1.setImageResource(R.color.blue);
correctImage = R.color.blue;
}
else if ( i >= 16 && i < 24 ) {
sq1.setImageResource(R.color.yellow);
correctImage = R.color.yellow;
}
else if ( i >= 24 && i < 32 ) {
sq1.setImageResource(R.color.green);
correctImage = R.color.green;
}
else if ( i >= 32 && i < 40 ) {
sq1.setImageResource(R.color.orange);
correctImage = R.color.orange;
}
String j = String.valueOf(i);
if ( j.equals("0") || j.equals("8") || j.equals("16") || j.equals("24") || j.equals("32") || j.equals("40") ) {
sq2.setImageResource(image[0]);
sq2.setTag(image[0]);
}
else if ( j.equals("1") || j.equals("9") || j.equals("17") || j.equals("25") || j.equals("33") || j.equals("41") ) {
sq2.setImageResource(image[1]);
sq2.setTag(image[1]);
}
else if ( j.equals("2") || j.equals("10") || j.equals("18") || j.equals("26") || j.equals("34") || j.equals("42") ) {
sq2.setImageResource(image[2]);
sq2.setTag(image[2]);
}
else if ( j.equals("3") || j.equals("11") || j.equals("19") || j.equals("27") || j.equals("35") || j.equals("43") ) {
sq2.setImageResource(image[3]);
sq2.setTag(image[3]);
}
else if ( j.equals("4") || j.equals("12") || j.equals("20") || j.equals("28") || j.equals("36") || j.equals("44") ) {
sq2.setImageResource(image[4]);
sq2.setTag(image[4]);
}
else if ( j.equals("5") || j.equals("13") || j.equals("21") || j.equals("29") || j.equals("37") || j.equals("45") ) {
sq2.setImageResource(image[5]);
sq2.setTag(image[5]);
}
else if ( j.equals("6") || j.equals("14") || j.equals("22") || j.equals("30") || j.equals("38") || j.equals("46") ) {
sq2.setImageResource(image[6]);
sq2.setTag(image[6]);
}
else if ( j.equals("7") || j.equals("15") || j.equals("23") || j.equals("31") || j.equals("39") || j.equals("47") ) {
sq2.setImageResource(image[7]);
sq2.setTag(image[7]);
}
startTime = System.currentTimeMillis();
sq2.postDelayed(this, 3000);
Log.d("int", String.valueOf(i));
duration = duration + 3000;
i++;
}
else {
long gameEnd = System.currentTimeMillis();
long seconds = (gameEnd - gameStart) / 1000;
//meanReactionTime = totalReactionTime / noOfCorrectResponses;
meanReactionTime = totalReactionTime;
Log.d("****************************************************", "****************************************************");
Log.d("Game Time", String.valueOf(seconds));
Log.d("total", String.valueOf(totalCorrectResponses));
Log.d("correctResponses", String.valueOf(noOfCorrectResponses));
noOfOmmissionErrors = totalCorrectResponses - noOfCorrectResponses;
Log.d("omissionErrors", String.valueOf(totalCorrectResponses - noOfCorrectResponses));
Log.d("commissionErrors", String.valueOf(noOfCommissionErrors));
Log.d("meanReactionTime", String.valueOf(meanReactionTime));
Log.d("duration", String.valueOf(duration));
saveDataToOnlineDB();
createTable();
saveDataToLocalDB();
Intent intent = new Intent(getApplicationContext(), DACompleteScreen.class);
finish();
mp.pause();
startActivity(intent);
}
}
}.run();
red_btn.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN: {
red_btn.getBackground().setColorFilter(0x77000000, PorterDuff.Mode.SRC_ATOP);
view.invalidate();
break;
}
case MotionEvent.ACTION_UP:
clickedTime = System.currentTimeMillis();
reactionTime = ( clickedTime - startTime );
clickedImage = (int) sq2.getTag();
if (correctImage == clickedImage) {
totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct " , startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++;
}
else {
Log.d( "wrong" , startTime + " " + clickedTime + " " + reactionTime);
noOfCommissionErrors++;
}
case MotionEvent.ACTION_CANCEL: {
red_btn.getBackground().clearColorFilter();
view.invalidate();
break;
}
}
return true;
}
});
cross_btn.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN: {
cross_btn.getBackground().setColorFilter(0x77000000, PorterDuff.Mode.SRC_ATOP);
view.invalidate();
break;
}
case MotionEvent.ACTION_UP:
alert();
mp.pause();
case MotionEvent.ACTION_CANCEL: {
cross_btn.getBackground().clearColorFilter();
view.invalidate();
break;
}
}
return true;
}
});
}
/*************************************************************************************************/
@Override
public void onBackPressed() {
super.onBackPressed();
mp.pause();
}
/*************************************************************************************************/
private void alert() {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setMessage("Do you really want to quit the game?");
alertDialogBuilder.setPositiveButton("yes",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
Intent intent = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
finish();
startActivity(intent);
//Toast.makeText(FocusedAttentionGame1.this,"You clicked yes button",Toast.LENGTH_LONG).show();
}
});
alertDialogBuilder.setNegativeButton("No",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//finish();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
/*************************************************************************************************/
private void saveDataToOnlineDB() {
String child = String.valueOf(GenderActivity.gender) + String.valueOf(AgeActivity.age);
int child_ID = Integer.parseInt(child);
int total_correct_responses = totalCorrectResponses;
int no_of_correct_responses = noOfCorrectResponses;
int no_of_ommission_errors = noOfOmmissionErrors;
int no_of_commission_errors = noOfCommissionErrors;
int mean_reaction_time = (int) meanReactionTime;
int total_duration = duration;
HashMap<String, Integer> params = new HashMap<>();
params.put("childID", child_ID);
params.put("totalCorrectResponses", total_correct_responses);
params.put("noOfCorrectResponses", no_of_correct_responses);
params.put("noOfCommissionErrors", no_of_commission_errors);
params.put("noOfOmmissionErrors", no_of_ommission_errors);
params.put("meanReactionTime", mean_reaction_time);
params.put("totalDuration", total_duration);
//Calling the create hero API
PerformNetworkRequest request = new PerformNetworkRequest(Api.URL_DIVIDED_ATTENTION, params, CODE_POST_REQUEST);
request.execute();
}
/*************************************************************************************************/
//inner class to perform network request extending an AsyncTask
private class PerformNetworkRequest extends AsyncTask<Void, Void, String> {
//the url where we need to send the request
String url;
//the parameters
HashMap<String, Integer> params;
//the request code to define whether it is a GET or POST
int requestCode;
//constructor to initialize values
PerformNetworkRequest(String url, HashMap<String, Integer> params, int requestCode) {
this.url = url;
this.params = params;
this.requestCode = requestCode;
}
//when the task started displaying a progressbar
@Override
protected void onPreExecute() {
super.onPreExecute();
}
//this method will give the response from the request
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
try {
Log.d("######################################################### anyText", s);
JSONObject object = new JSONObject(s);
if (!object.getBoolean("error")) {
Toast.makeText(getApplicationContext(), object.getString("message"), Toast.LENGTH_SHORT).show();
//refreshing the herolist after every operation
//so we get an updated list
//we will create this method right now it is commented
//because we haven't created it yet
//refreshHeroList(object.getJSONArray("heroes"));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
//the network operation will be performed in background
@Override
protected String doInBackground(Void... voids) {
RequestHandler requestHandler = new RequestHandler();
if (requestCode == CODE_POST_REQUEST)
return requestHandler.sendPostRequest(url, params);
if (requestCode == CODE_GET_REQUEST)
return requestHandler.sendGetRequest(url);
return null;
}
}
/*************************************************************************************************/
private void createTable() {
mDatabase.execSQL(
"CREATE TABLE IF NOT EXISTS dividedAttention (\n" +
" id INTEGER PRIMARY KEY AUTOINCREMENT,\n" +
" childID int 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" +
");"
);
}
/*************************************************************************************************/
private void saveDataToLocalDB() {
String child = String.valueOf(GenderActivity.gender) + String.valueOf(AgeActivity.age);
int child_ID = Integer.parseInt(child);
int total_correct_responses = totalCorrectResponses;
int no_of_correct_responses = noOfCorrectResponses;
int no_of_ommission_errors = noOfOmmissionErrors;
int no_of_commission_errors = noOfCommissionErrors;
int mean_reaction_time = (int) meanReactionTime;
int total_duration = duration;
String insertSQL = "INSERT INTO dividedAttention \n" +
"(childID, totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration)\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});
Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
}
/*************************************************************************************************/
}
\ No newline at end of file
package com.anuththara18.attentionassessment.focused;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.pdf.PdfDocument;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import com.anuththara18.attentionassessment.BuildConfig;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.age.AgeActivity;;
import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static android.Manifest.permission.MANAGE_EXTERNAL_STORAGE;
import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
public class FACompleteScreen extends AppCompatActivity {
ImageView complete;
List<Focused> dataList;
SQLiteDatabase mDatabase;
// declaring width and height
// for our PDF file.
int pageHeight = 1120;
int pagewidth = 792;
// creating a bitmap variable
// for storing our images
Bitmap bmp, scaledbmp;
// constant code for runtime permissions
private static final int PERMISSION_REQUEST_CODE = 200;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_complete_screen2);
complete = findViewById(R.id.complete);
complete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
finish();
startActivity(intent);
}
});
dataList = new ArrayList<>();
//opening the database
mDatabase = openOrCreateDatabase(FocusedAttentionGame1.DATABASE_NAME, MODE_PRIVATE, null);
/*******************************************************************************************/
// initializing our variables.
bmp = BitmapFactory.decodeResource(getResources(), R.drawable.focused);
scaledbmp = Bitmap.createScaledBitmap(bmp, 140, 140, false);
// below code is used for
// checking our permissions.
if (checkPermission()) {
//Toast.makeText(this, "Permission Granted", Toast.LENGTH_SHORT).show();
} else {
requestPermission();
}
/*******************************************************************************************/
//this part will display the data in the list
//we used rawQuery(sql, selectionargs) for fetching all the employees
Cursor cursorEmployees = mDatabase.rawQuery("SELECT * FROM focusedAttention", null);
//if the cursor has some data
if (cursorEmployees.moveToFirst()) {
//looping through all the records
do {
//pushing each record in the employee list
dataList.add(new Focused(
cursorEmployees.getInt(0),
cursorEmployees.getInt(1),
cursorEmployees.getInt(2),
cursorEmployees.getInt(3),
cursorEmployees.getInt(4),
cursorEmployees.getInt(5),
cursorEmployees.getInt(6),
cursorEmployees.getInt(7)
));
} while (cursorEmployees.moveToNext());
}
//closing the cursor
cursorEmployees.close();
/*******************************************************************************************/
// generate our PDF file.
// creating an object variable
// for our PDF document.
PdfDocument pdfDocument = new PdfDocument();
// two variables for paint "paint" is used
// for drawing shapes and we will use "title"
// for adding text in our PDF file.
Paint paint = new Paint();
Paint title = new Paint();
// we are adding page info to our PDF file
// in which we will be passing our pageWidth,
// pageHeight and number of pages and after that
// we are calling it to create our PDF.
PdfDocument.PageInfo mypageInfo = new PdfDocument.PageInfo.Builder(pagewidth, pageHeight, 1).create();
// below line is used for setting
// start page for our PDF file.
PdfDocument.Page myPage = pdfDocument.startPage(mypageInfo);
// creating a variable for canvas
// from our page of PDF.
Canvas canvas = myPage.getCanvas();
// below line is used to draw our image on our PDF file.
// the first parameter of our drawbitmap method is
// our bitmap
// second parameter is position from left
// third parameter is position from top and last
// one is our variable for paint.
canvas.drawBitmap(scaledbmp, 56, 40, paint);
// below line is used for adding typeface for
// our text which we will be adding in our PDF file.
title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
// below line is used for setting text size
// which we will be displaying in our PDF file.
title.setTextSize(20);
// below line is sued for setting color
// of our text inside our PDF file.
title.setColor(ContextCompat.getColor(this, R.color.orange));
// below line is used to draw text in our PDF file.
// the first parameter is our text, second parameter
// is position from start, third parameter is position from top
// and then we are passing our variable of paint which is title.
canvas.drawText("Focused Attention", 250, 80, title);
title.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
title.setColor(ContextCompat.getColor(this, R.color.black));
title.setTextSize(15);
canvas.drawText("Age : " + AgeActivity.age, 150, 250, title);
String gender;
if (GenderActivity.gender == 0) {
gender = "Male";
}
else {
gender = "Female";
}
canvas.drawText("Gender: " + gender, 150, 300, title);
/*
canvas.drawText("Child Name: " + gender, 150, 350, title);
canvas.drawText("Parent Name: " + gender, 150, 400, title);
canvas.drawText("Contact No: " + gender, 150, 450, title);
canvas.drawText("Email: " + gender, 150, 500, title);
*/
// similarly we are creating another text and in this
// we are aligning this text to center of our PDF file.
title.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
title.setColor(ContextCompat.getColor(this, R.color.black));
title.setTextSize(15);
// below line is used for setting
// our text to center of PDF.
//title.setTextAlign(Paint.Align.CENTER);
int space = 0;
// Printing elements one by one
for (int i = 0; i < dataList.size(); i++) {
//getting employee of the specified position
Focused data = dataList.get(i);
Log.d("********************************", "ID : " + String.valueOf(data.getId()) + ", \t" +
"C: " + String.valueOf(data.getChildID()) + ", \t" +
"TCR: " + String.valueOf(data.getTotalCorrectResponses()) + ", \t" +
"CR: " + String.valueOf(data.getNoOfCorrectResponses()) + ", \t" +
"CE: " + String.valueOf(data.getNoOfCommissionErrors()) + ", \t" +
"OE: " + String.valueOf(data.getNoOfOmmissionErrors()) + ", \t" +
"MRT: " + String.valueOf(data.getMeanReactionTime()) + ", \t" +
"TD: " + String.valueOf(data.getTotalDuration()) );
canvas.drawText("ID : " + String.valueOf(data.getId()) + ", \t" +
"C: " + String.valueOf(data.getChildID()) + ", \t" +
"TCR: " + String.valueOf(data.getTotalCorrectResponses()) + ", \t" +
"CR: " + String.valueOf(data.getNoOfCorrectResponses()) + ", \t" +
"CE: " + String.valueOf(data.getNoOfCommissionErrors()) + ", \t" +
"OE: " + String.valueOf(data.getNoOfOmmissionErrors()) + ", \t" +
"MRT: " + String.valueOf(data.getMeanReactionTime()) + ", \t" +
"TD: " + String.valueOf(data.getTotalDuration()) + " ", 150, 350 + space, title);
space = space + 50;
}
// after adding all attributes to our
// PDF file we will be finishing our page.
pdfDocument.finishPage(myPage);
// below line is used to set the name of
// our PDF file and its path.
File file = new File(Environment.getExternalStorageDirectory(), "FocusedAttention.pdf");
try {
// after creating a file name we will
// write our PDF file to that location.
pdfDocument.writeTo(new FileOutputStream(file));
/*
// Uri path = Uri.fromFile(file);
Uri path = FileProvider.getUriForFile(FACompleteScreen.this, BuildConfig.APPLICATION_ID + ".provider", file);
Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
pdfIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
pdfIntent.setDataAndType(path, "application/pdf");
pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try{
startActivity(pdfIntent);
}catch(ActivityNotFoundException e){
Toast.makeText(getApplicationContext(), "No Application available to view PDF", Toast.LENGTH_SHORT).show();
}
*/
// below line is to print toast message
// on completion of PDF generation.
Toast.makeText(getApplicationContext(), "PDF file generated successfully.", Toast.LENGTH_LONG).show();
} catch (IOException e) {
// below line is used
// to handle error
e.printStackTrace();
}
// after storing our pdf to that
// location we are closing our PDF file.
pdfDocument.close();
}
/**************************************************************************************************/
private boolean checkPermission() {
// checking of permissions.
int permission1 = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);
int permission2 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);
int permission3 = ContextCompat.checkSelfPermission(getApplicationContext(), MANAGE_EXTERNAL_STORAGE);
return permission1 == PackageManager.PERMISSION_GRANTED && permission2 == PackageManager.PERMISSION_GRANTED && permission3 == PackageManager.PERMISSION_GRANTED;
}
/**************************************************************************************************/
private void requestPermission() {
// requesting permissions if not provided.
ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE, MANAGE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == PERMISSION_REQUEST_CODE) {
if (grantResults.length > 0) {
/*
Intent intent = new Intent();
intent.setAction(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
Uri uri = Uri.fromParts("package", this.getPackageName(), null);
intent.setData(uri);
startActivity(intent);
*/
// after requesting permissions we are showing
// users a toast message of permission granted.
boolean writeStorage = grantResults[0] == PackageManager.PERMISSION_GRANTED;
boolean readStorage = grantResults[1] == PackageManager.PERMISSION_GRANTED;
if (writeStorage && readStorage) {
//Toast.makeText(this, "Permission Granted..", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "Permission Denined.", Toast.LENGTH_SHORT).show();
finish();
}
}
}
}
/**************************************************************************************************/
}
package com.anuththara18.attentionassessment.focused;
public class Focused {
private int id;
private int childID;
private int totalCorrectResponses;
private int noOfCorrectResponses;
private int noOfCommissionErrors;
private int noOfOmmissionErrors;
private int meanReactionTime;
private int totalDuration;
public Focused(int id, int childID, int totalCorrectResponses, int noOfCorrectResponses, int noOfCommissionErrors, int noOfOmmissionErrors, int meanReactionTime, int totalDuration) {
this.id = id;
this.childID = childID;
this.totalCorrectResponses = totalCorrectResponses;
this.noOfCorrectResponses = noOfCorrectResponses;
this.noOfCommissionErrors = noOfCommissionErrors;
this.noOfOmmissionErrors = noOfOmmissionErrors;
this.meanReactionTime = meanReactionTime;
this.totalDuration = totalDuration;
}
public int getId() {
return id;
}
public int getChildID() {
return childID;
}
public int getTotalCorrectResponses() {
return totalCorrectResponses;
}
public int getNoOfCorrectResponses() {
return noOfCorrectResponses;
}
public int getNoOfCommissionErrors() {
return noOfCommissionErrors;
}
public int getNoOfOmmissionErrors() {
return noOfOmmissionErrors;
}
public int getMeanReactionTime() {
return meanReactionTime;
}
public int getTotalDuration() {
return totalDuration;
}
/*
CREATE TABLE sustainedAttention (
id int NOT NULL AUTO_INCREMENT,
childID int NOT NULL,
totalCorrectResponses int NOT NULL,
noOfCorrectResponses int NOT NULL,
noOfCommissionErrors int NOT NULL,
noOfOmmissionErrors int NOT NULL,
meanReactionTime int NOT NULL,
totalDuration int NOT NULL,
CONSTRAINT sustainedAttention_pk PRIMARY KEY (id)
);
*/
}
package com.anuththara18.attentionassessment.focused;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.app.ActionBar;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.PorterDuff;
import android.graphics.drawable.AnimationDrawable;
import android.media.MediaPlayer;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
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;
import android.widget.Toast;
import com.anuththara18.attentionassessment.CompleteScreen;
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.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import com.anuththara18.attentionassessment.language.LanguageSetter;
import com.anuththara18.attentionassessment.sustained.SustainedAttentionGame1;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Random;
public class FocusedAttentionGame1 extends AppCompatActivity {
private static final int CODE_GET_REQUEST = 1024;
private static final int CODE_POST_REQUEST = 1025;
public static final String DATABASE_NAME = "focusedAttention";
SQLiteDatabase mDatabase;
Random random = new Random();
int radomTimer = 0;
int i = 1;
private long startTime, clickedTime = 0;
long reactionTime;
int totalCorrectResponses = 0;
int noOfCorrectResponses = 0;
int noOfCommissionErrors = 0;
int noOfOmmissionErrors = 0;
long totalReactionTime = 0;
int meanReactionTime = 0;
int duration = 0;
ImageView imageView, cross_btn;
ImageButton red_btn;
TextView textView;
Integer[] isi = { 3000, 3500, 4000, 4500, 5000, 5500, 6000 };
MediaPlayer mp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_focused_attention_game1);
imageView = (ImageView) findViewById(R.id.imageView);
cross_btn = (ImageView) findViewById(R.id.cross_btn);
red_btn = (ImageButton) findViewById(R.id.red_btn);
textView = (TextView) findViewById(R.id.textView);
textView.setText(LanguageSetter.getresources().getString(R.string.focg1));
mp = MediaPlayer.create(getApplicationContext(), R.raw.focused);
mp.start();
long gameStart = System.currentTimeMillis();
//creating a database
mDatabase = openOrCreateDatabase(DATABASE_NAME, MODE_PRIVATE, null);
new Runnable() {
int updateInterval;
@Override
public void run() {
if ( i <= 41 ) { // 41 times
if ( i % 2 != 0 ) {
imageView.setVisibility(View.INVISIBLE);
radomTimer = random.nextInt(5);
updateInterval = isi[radomTimer];
imageView.postDelayed(this, updateInterval);
Log.d("***************radomTimer******************", String.valueOf(i + " " + updateInterval));
duration = duration + updateInterval;
i++;
}
// appearance - 1s * 20 times
else {
Log.d("***************radomTimer******************", String.valueOf(i + " 1000" ));
imageView.setVisibility(View.VISIBLE);
imageView.setImageResource(R.drawable.monkey);
startTime = System.currentTimeMillis();
imageView.postDelayed(this, 1000);
totalCorrectResponses++;
duration = duration + 1000;
i++;
}
}
else {
long gameEnd = System.currentTimeMillis();
long seconds = (gameEnd - gameStart) / 1000;
if ( noOfCorrectResponses == 0 ) {
meanReactionTime = 0;
}
else {
meanReactionTime = (int) Math.ceil(totalReactionTime / noOfCorrectResponses); // ms
}
Log.d("****************************************************", "****************************************************");
Log.d("Game Time", String.valueOf(seconds));
Log.d("total", String.valueOf(totalCorrectResponses));
Log.d("correctResponses", String.valueOf(noOfCorrectResponses));
noOfOmmissionErrors = totalCorrectResponses - noOfCorrectResponses;
Log.d("omissionErrors", String.valueOf(totalCorrectResponses - noOfCorrectResponses));
Log.d("commissionErrors", String.valueOf(noOfCommissionErrors));
Log.d("meanReactionTime", String.valueOf(meanReactionTime));
Log.d("duration", String.valueOf(duration));
saveDataToOnlineDB();
createTable();
saveDataToLocalDB();
Intent intent = new Intent(getApplicationContext(), FACompleteScreen.class);
finish();
mp.pause();
startActivity(intent);
}
}
}.run();
red_btn.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN: {
red_btn.getBackground().setColorFilter(0x77000000, PorterDuff.Mode.SRC_ATOP);
view.invalidate();
break;
}
case MotionEvent.ACTION_UP:
// Your action here on button click
clickedTime = System.currentTimeMillis();
reactionTime = ( clickedTime - startTime );
if (reactionTime < 4000) {
totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct " , startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++;
}
else {
Log.d( "wrong" , startTime + " " + clickedTime + " " + reactionTime);
noOfCommissionErrors++;
}
case MotionEvent.ACTION_CANCEL: {
red_btn.getBackground().clearColorFilter();
view.invalidate();
break;
}
}
return true;
}
});
cross_btn.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN: {
cross_btn.getBackground().setColorFilter(0x77000000, PorterDuff.Mode.SRC_ATOP);
view.invalidate();
break;
}
case MotionEvent.ACTION_UP:
alert();
mp.pause();
case MotionEvent.ACTION_CANCEL: {
cross_btn.getBackground().clearColorFilter();
view.invalidate();
break;
}
}
return true;
}
});
}
/*************************************************************************************************/
@Override
public void onBackPressed() {
super.onBackPressed();
mp.pause();
}
/*************************************************************************************************/
private void alert() {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setMessage("Do you really want to quit the game?");
alertDialogBuilder.setPositiveButton("yes",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
Intent intent = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
finish();
startActivity(intent);
//Toast.makeText(FocusedAttentionGame1.this,"You clicked yes button",Toast.LENGTH_LONG).show();
}
});
alertDialogBuilder.setNegativeButton("No",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//finish();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
/*************************************************************************************************/
private void saveDataToOnlineDB() {
String child = String.valueOf(GenderActivity.gender) + String.valueOf(AgeActivity.age);
int child_ID = Integer.parseInt(child);
int total_correct_responses = totalCorrectResponses;
int no_of_correct_responses = noOfCorrectResponses;
int no_of_ommission_errors = noOfOmmissionErrors;
int no_of_commission_errors = noOfCommissionErrors;
int mean_reaction_time = (int) meanReactionTime;
int total_duration = duration;
HashMap<String, Integer> params = new HashMap<>();
params.put("childID", child_ID);
params.put("totalCorrectResponses", total_correct_responses);
params.put("noOfCorrectResponses", no_of_correct_responses);
params.put("noOfCommissionErrors", no_of_commission_errors);
params.put("noOfOmmissionErrors", no_of_ommission_errors);
params.put("meanReactionTime", mean_reaction_time);
params.put("totalDuration", total_duration);
//Calling the create hero API
PerformNetworkRequest request = new PerformNetworkRequest(Api.URL_FOCUSED_ATTENTION, params, CODE_POST_REQUEST);
request.execute();
}
/*************************************************************************************************/
//inner class to perform network request extending an AsyncTask
private class PerformNetworkRequest extends AsyncTask<Void, Void, String> {
//the url where we need to send the request
String url;
//the parameters
HashMap<String, Integer> params;
//the request code to define whether it is a GET or POST
int requestCode;
//constructor to initialize values
PerformNetworkRequest(String url, HashMap<String, Integer> params, int requestCode) {
this.url = url;
this.params = params;
this.requestCode = requestCode;
}
//when the task started displaying a progressbar
@Override
protected void onPreExecute() {
super.onPreExecute();
}
//this method will give the response from the request
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
try {
JSONObject object = new JSONObject(s);
if (!object.getBoolean("error")) {
Toast.makeText(getApplicationContext(), object.getString("message"), Toast.LENGTH_SHORT).show();
//refreshing the herolist after every operation
//so we get an updated list
//we will create this method right now it is commented
//because we haven't created it yet
//refreshHeroList(object.getJSONArray("heroes"));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
//the network operation will be performed in background
@Override
protected String doInBackground(Void... voids) {
RequestHandler requestHandler = new RequestHandler();
if (requestCode == CODE_POST_REQUEST)
return requestHandler.sendPostRequest(url, params);
if (requestCode == CODE_GET_REQUEST)
return requestHandler.sendGetRequest(url);
return null;
}
}
/*************************************************************************************************/
private void createTable() {
mDatabase.execSQL(
"CREATE TABLE IF NOT EXISTS focusedAttention (\n" +
" id INTEGER PRIMARY KEY AUTOINCREMENT,\n" +
" childID int 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" +
");"
);
}
/*************************************************************************************************/
private void saveDataToLocalDB() {
String child = String.valueOf(GenderActivity.gender) + String.valueOf(AgeActivity.age);
int child_ID = Integer.parseInt(child);
int total_correct_responses = totalCorrectResponses;
int no_of_correct_responses = noOfCorrectResponses;
int no_of_ommission_errors = noOfOmmissionErrors;
int no_of_commission_errors = noOfCommissionErrors;
int mean_reaction_time = (int) meanReactionTime;
int total_duration = duration;
String insertSQL = "INSERT INTO focusedAttention \n" +
"(childID, totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration)\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});
Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
}
/*************************************************************************************************/
}
/****************************************************************************************************************
if ( age >= 4 && age <= 5 ) {
if (level == 1) {
radomMainImage = random.nextInt(1);
}
else if (level == 2) {
radomMainImage = random.nextInt(4);
}
else if (level == 3) {
radomMainImage = random.nextInt(8);
}
else if (level == 4) {
radomMainImage = random.nextInt(12);
}
else if (level == 5) {
radomMainImage = random.nextInt(16);
}
}
if ( age >= 6 && age <= 7 ) {
if (level == 1) {
radomMainImage = random.nextInt(1);
}
else if (level == 2) {
radomMainImage = random.nextInt(4);
}
else if (level == 3) {
radomMainImage = random.nextInt(8);
}
else if (level == 4) {
radomMainImage = random.nextInt(12);
}
else if (level == 5) {
radomMainImage = random.nextInt(16);
}
}
imageView_q.setImageResource(image[radomMainImage]);
correctImage = image[radomMainImage];
****************************************************************************************************************/
/*
if ( age >= 4 && age <= 5 ) {
if (level == 1) {
radomTimer = random.nextInt(4);
radomImage = random.nextInt(1);
imax = 10;
}
else if (level == 2) {
radomTimer = random.nextInt(max - min + 1) + min;
radomImage = random.nextInt(4);
imax = 15;
}
else if (level == 3) {
radomImage = random.nextInt(8);
imax = 20;
}
else if (level == 4) {
radomImage = random.nextInt(12);
imax = 25;
}
else if (level == 5) {
radomImage = random.nextInt(16);
imax = 30;
}
}
if ( age >= 6 && age <= 7 ) {
if (level == 1) {
radomImage = random.nextInt(1);
imax = 15;
}
else if (level == 2) {
radomImage = random.nextInt(4);
imax = 20;
}
else if (level == 3) {
radomImage = random.nextInt(8);
imax = 25;
}
else if (level == 4) {
radomImage = random.nextInt(12);
imax = 30;
}
else if (level == 5) {
radomImage = random.nextInt(16);
imax = 35;
}
}
*/
//int finalRadomImage = radomImage;
//int finalImax = imax;
/*Integer[] image = { R.drawable.pink_pig, R.drawable.orange_tiger,R.drawable.green_dino, R.drawable.yellow_leapoard,
R.drawable.white_cow, R.drawable.brown_donkey, R.drawable.grey_goat, R.drawable.blue_elephant,
R.drawable.brown_ox, R.drawable.white_zebra, R.drawable.green_snake, R.drawable.blue_hippo,
R.drawable.blue_peacock, R.drawable.yellow_girraffe};
*/
package com.anuththara18.attentionassessment.focused;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import com.anuththara18.attentionassessment.R;
public class FocusedAttentionGame2 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
else {
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}
setContentView(R.layout.activity_focused_attention_game2);
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.gender;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.age.AgeActivity;
import com.anuththara18.attentionassessment.details.ParentDetailsActivity;
import com.anuththara18.attentionassessment.language.LanguageActivity;
import com.anuththara18.attentionassessment.language.LanguageSetter;
public class GenderActivity extends AppCompatActivity {
ImageButton toggle_btn;
ImageView girl_img, boy_img;
TextView boy_txt, girl_txt, next, previous, selectGender;
public static int gender = 0;
int click = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_gender);
toggle_btn = (ImageButton)findViewById(R.id.toggle_btn);
girl_img = (ImageView)findViewById(R.id.girl_img);
boy_img = (ImageView)findViewById(R.id.boy_img);
girl_txt = (TextView)findViewById(R.id.girl_txt);
boy_txt = (TextView)findViewById(R.id.boy_txt);
next = (TextView)findViewById(R.id.next);
previous = (TextView)findViewById(R.id.previous);
selectGender = (TextView)findViewById(R.id.selectGender);
girl_txt.setText(LanguageSetter.getresources().getString(R.string.girl));
boy_txt.setText(LanguageSetter.getresources().getString(R.string.boy));
next.setText(LanguageSetter.getresources().getString(R.string.next));
previous.setText(LanguageSetter.getresources().getString(R.string.previous));
selectGender.setText(LanguageSetter.getresources().getString(R.string.gender));
// initially
girl_img.setImageAlpha(127);
girl_txt.setAlpha(0.5f);
boy_img.setImageAlpha(255);
boy_txt.setAlpha(1f);
toggle_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
click++;
if(click % 2 == 0) {
toggle_btn.setBackgroundResource(R.drawable.toggle_right);
//deg = toggle_btn.getRotation() + 180F;
//toggle_btn.animate().rotation(deg).setInterpolator(new AccelerateDecelerateInterpolator());
boy_img.setImageAlpha(127);
boy_txt.setAlpha(0.5f);
girl_img.setImageAlpha(255);
girl_txt.setAlpha(1f);
gender = 1; // girl
Log.d("gender", String.valueOf(gender));
}
else {
toggle_btn.setBackgroundResource(R.drawable.toggle_left);
//deg = toggle_btn.getRotation() + 180F;
//toggle_btn.animate().rotation(deg).setInterpolator(new AccelerateDecelerateInterpolator());
girl_img.setImageAlpha(127);
girl_txt.setAlpha(0.5f);
boy_img.setImageAlpha(255);
boy_txt.setAlpha(1f);
gender = 0; // boy
Log.d("gender", String.valueOf(gender));
}
}
});
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(GenderActivity.this, AgeActivity.class);
startActivity(intent);
}
});
previous.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(GenderActivity.this, ParentDetailsActivity.class);
startActivity(intent);
}
});
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.home;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import androidx.fragment.app.Fragment;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.alternating.AlternatingAttentionGame1;
import com.anuththara18.attentionassessment.dividedattention.DividedAttentionGame1;
import com.anuththara18.attentionassessment.focused.FocusedAttentionGame1;
import com.anuththara18.attentionassessment.map.Map2Activity;
import com.anuththara18.attentionassessment.selective.BirdChoosingActivity;
import com.anuththara18.attentionassessment.selective.SelectiveAttentionGame1;
import com.anuththara18.attentionassessment.sustained.SustainedAttentionGame1;
import com.anuththara18.attentionassessment.sustained.SustainedAttentionGame2;
@SuppressLint("ValidFragment")
public class MainFragment extends Fragment {
CardView focusedAttention, selectiveAttention, dividedAttention, sustainedAttention, alternatingAttention, alternatingAttention2;
public static com.anuththara18.attentionassessment.home.MainFragment newInstance() {
return (new com.anuththara18.attentionassessment.home.MainFragment());
}
public MainFragment() {
// Required empty public constructor
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.fragment_main, container, false);
focusedAttention = view.findViewById(R.id.focusedAttention);
selectiveAttention = view.findViewById(R.id.selectiveAttention);
dividedAttention = view.findViewById(R.id.dividedAttention);
sustainedAttention = view.findViewById(R.id.sustainedAttention);
alternatingAttention = view.findViewById(R.id.alternatingAttention);
alternatingAttention2 = view.findViewById(R.id.alternatingAttention2);
final MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.button1);
focusedAttention.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mp.start();
Intent intent = new Intent(getContext(), FocusedAttentionGame1.class);
startActivity(intent);
}
});
sustainedAttention.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mp.start();
Intent intent = new Intent(getContext(), BirdChoosingActivity.class);
startActivity(intent);
}
});
selectiveAttention.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mp.start();
Intent intent = new Intent(getContext(), Map2Activity.class);
startActivity(intent);
}
});
dividedAttention.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mp.start();
Intent intent = new Intent(getContext(), DividedAttentionGame1.class);
startActivity(intent);
}
});
alternatingAttention.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mp.start();
Intent intent = new Intent(getContext(), SustainedAttentionGame2.class);
startActivity(intent);
}
});
alternatingAttention2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mp.start();
Intent intent = new Intent(getContext(), AlternatingAttentionGame1.class);
startActivity(intent);
}
});
return view;
}
}
/*
public class FirstFragment extends Fragment {
TextView textView;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment, container, false);
textView = view.findViewById(R.id.text);
textView.setText("first");
return view;
}
}*/
package com.anuththara18.attentionassessment.home;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.ImageView;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.consentform.ConsentFormActivity;
import com.google.android.material.navigation.NavigationView;
public class NavigationDrawerActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{
//FOR DESIGN
private Toolbar toolbar;
private DrawerLayout drawerLayout;
private NavigationView navigationView;
ImageView i;
//FOR FRAGMENTS
private Fragment fragmentMainDashboard;
//FOR DATAS
private static final int FRAGMENT_MAINDASHBOARD = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_navigation_drawer);
// Configure all views
this.configureToolBar();
this.configureDrawerLayout();
this.configureNavigationView();
// Show First Fragment
this.showFirstFragment();
}
@Override
public void onBackPressed() {
//Handle back click to close menu
if (this.drawerLayout.isDrawerOpen(GravityCompat.START)) {
this.drawerLayout.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onNavigationItemSelected(MenuItem item) {
//Handle Navigation Item Click
int id = item.getItemId();
switch (id){
case R.id.dashboard:
this.showFragment(FRAGMENT_MAINDASHBOARD);
break;
case R.id.parents:
Intent intent1 = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
startActivity(intent1);
break;
case R.id.healthProfessional:
Intent intent2 = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
startActivity(intent2);
break;
case R.id.doctor:
Intent intent3 = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
startActivity(intent3);
break;
case R.id.admin:
Intent intent4 = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
startActivity(intent4);
break;
case R.id.termsAndConditions:
Intent intent6 = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
startActivity(intent6);
break;
case R.id.consentForm:
Intent intent7 = new Intent(getApplicationContext(), ConsentFormActivity.class);
startActivity(intent7);
break;
case R.id.aboutUs:
Intent intent8 = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
startActivity(intent8);
break;
case R.id.logOut:
logout();
break;
default:
break;
}
this.drawerLayout.closeDrawer(GravityCompat.START);
return true;
}
private void logout() {
//closing activity
finish();
//starting login activity
startActivity(new Intent(getApplicationContext(), MainFragment.class));
}
// ---------------------
// CONFIGURATION
// ---------------------
// Configure Toolbar
private void configureToolBar(){
this.toolbar = (Toolbar) findViewById(R.id.activity_main_toolbar);
setSupportActionBar(toolbar);
}
//Configure Drawer Layout
private void configureDrawerLayout(){
this.drawerLayout = (DrawerLayout) findViewById(R.id.activity_main_drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawerLayout.addDrawerListener(toggle);
toggle.syncState();
}
//Configure NavigationView
private void configureNavigationView(){
this.navigationView = (NavigationView) findViewById(R.id.activity_main_nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
// ---------------------
// FRAGMENTS
// ---------------------
// Show first fragment when activity is created
private void showFirstFragment(){
Fragment visibleFragment = getSupportFragmentManager().findFragmentById(R.id.activity_main_frame_layout);
if (visibleFragment == null){
// Show main dashboard Fragment
this.showFragment(FRAGMENT_MAINDASHBOARD);
// Mark as selected the menu item corresponding to NewsFragment
this.navigationView.getMenu().getItem(0).setChecked(true);
}
}
// Show fragment according an Identifier
private void showFragment(int fragmentIdentifier){
switch (fragmentIdentifier){
case FRAGMENT_MAINDASHBOARD :
this.showMainDashboardFragment();
break;
/*
case FRAGMENT_CATEGORIES :
this.showCategoriesFragment();
break;
case FRAGMENT_SMSINTEGRATION:
this.showSMSIntegrationFragment();
break;
case FRAGMENT_PAYABLESANDRECEIVABLES:
this.showPayablesAndReceivablesFragment();
break;
*/
default:
break;
}
}
// ---
// Create each fragment page and show it
private void showMainDashboardFragment(){
if (this.fragmentMainDashboard == null) this.fragmentMainDashboard = MainFragment.newInstance();
this.startTransactionFragment(this.fragmentMainDashboard);
}
// ---
// Generic method that will replace and show a fragment inside the MainActivity Frame Layout
private void startTransactionFragment(Fragment fragment){
if (!fragment.isVisible()){
getSupportFragmentManager().beginTransaction()
.replace(R.id.activity_main_frame_layout, fragment).commit();
}
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.language;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.AbsoluteLayout;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.details.ParentDetailsActivity;
import com.anuththara18.attentionassessment.gender.GenderActivity;
public class LanguageActivity extends AppCompatActivity {
ImageButton english_btn, sinhala_btn, sinhala_txt_btn;
TextView english_txt;
String text = null;
TextView selectLanguage, next;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_language);
english_btn = (ImageButton)findViewById(R.id.english_btn);
sinhala_btn = (ImageButton)findViewById(R.id.sinhala_btn);
sinhala_txt_btn = (ImageButton)findViewById(R.id.sinhala_txt_btn);
english_txt = (TextView) findViewById(R.id.english_txt);
selectLanguage = (TextView) findViewById(R.id.selectLanguage);
next = (TextView) findViewById(R.id.next);
english_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
englishSelected();
}
});
english_txt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
englishSelected();
}
});
sinhala_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sinhalaSelected();
}
});
sinhala_txt_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sinhalaSelected();
}
});
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if ( text == null ) {
Toast.makeText(getApplicationContext(), "Please select a language", Toast.LENGTH_SHORT).show();
}
else {
Intent intent = new Intent(LanguageActivity.this, ParentDetailsActivity.class);
startActivity(intent);
}
}
});
}
public void englishSelected() {
english_btn.getLayoutParams().height = 700;
english_btn.getLayoutParams().width= 700;
english_btn.requestLayout();
sinhala_btn.getLayoutParams().height = 656;
sinhala_btn.getLayoutParams().width= 656;
sinhala_btn.requestLayout();
english_txt.setPadding(0, 0, 0,10 );
english_txt.setTextSize(43);
sinhala_txt_btn.getLayoutParams().height = 184;
sinhala_txt_btn.getLayoutParams().width= 394;
sinhala_txt_btn.requestLayout();
text = "English";
changeLanguage();
}
public void sinhalaSelected() {
english_btn.getLayoutParams().height = 656;
english_btn.getLayoutParams().width= 656;
english_btn.requestLayout();
sinhala_btn.getLayoutParams().height = 700;
sinhala_btn.getLayoutParams().width= 700;
sinhala_btn.requestLayout();
english_txt.setPadding(0, 10, 0,0 );
english_txt.setTextSize(40);
sinhala_txt_btn.getLayoutParams().height = 200;
sinhala_txt_btn.getLayoutParams().width= 410;
sinhala_txt_btn.requestLayout();
text = "සිංහල";
changeLanguage();
}
public void changeLanguage() {
LanguageSetter.setLanguage(text);
LanguageSetter.changeLanguage(text, LanguageActivity.this);
next.setText(LanguageSetter.getresources().getString(R.string.next));
selectLanguage.setText(LanguageSetter.getresources().getString(R.string.language));
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.language;
import android.content.Context;
import android.content.res.Resources;
public class LanguageSetter {
private static String language;
private static Context context;
private static Resources resources;
public static void setLanguage(String language){
com.anuththara18.attentionassessment.language.LanguageSetter.language = language;
}
public static String getLanguage(){
return com.anuththara18.attentionassessment.language.LanguageSetter.language;
}
public static Resources getresources(){
return com.anuththara18.attentionassessment.language.LanguageSetter.resources;
}
public static void changeLanguage(String language, Context c){
//if user select prefered language as English then
if(language.equals("English"))
{
context = LocaleHelper.setLocale(c, "en");
resources = context.getResources();
}
//if user select prefered language as Tamil then
if(language.equals("தமிழ்"))
{
context = LocaleHelper.setLocale(c, "ta");
resources = context.getResources();
}
//if user select prefered language as Sinhala then
if(language.equals("සිංහල"))
{
context = LocaleHelper.setLocale(c, "si");
resources = context.getResources();
}
}
}
package com.anuththara18.attentionassessment.language;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.preference.PreferenceManager;
import java.util.Locale;
public class LocaleHelper {
private static final String SELECTED_LANGUAGE = "Locale.Helper.Selected.Language";
/* public static Context onAttach(Context context) {
String lang = getPersistedData(context, Locale.getDefault().getLanguage());
return setLocale(context, lang);
}
public static Context onAttach(Context context, String defaultLanguage) {
String lang = getPersistedData(context, defaultLanguage);
return setLocale(context, lang);
}
public static String getLanguage(Context context) {
return getPersistedData(context, Locale.getDefault().getLanguage());
}*/
public static Context setLocale(Context context, String language) {
persist(context, language);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
return updateResources(context, language);
}
return updateResourcesLegacy(context, language);
}
/* private static String getPersistedData(Context context, String defaultLanguage) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
return preferences.getString(SELECTED_LANGUAGE, defaultLanguage);
}*/
private static void persist(Context context, String language) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = preferences.edit();
editor.putString(SELECTED_LANGUAGE, language);
editor.apply();
}
@TargetApi(Build.VERSION_CODES.N)
private static Context updateResources(Context context, String language) {
Locale locale = new Locale(language);
Locale.setDefault(locale);
Configuration configuration = context.getResources().getConfiguration();
configuration.setLocale(locale);
configuration.setLayoutDirection(locale);
return context.createConfigurationContext(configuration);
}
@SuppressWarnings("deprecation")
private static Context updateResourcesLegacy(Context context, String language) {
Locale locale = new Locale(language);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
configuration.setLayoutDirection(locale);
}
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return context;
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.loginregistration;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.anuththara18.attentionassessment.R;
public class LoginActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.loginregistration;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.anuththara18.attentionassessment.R;
public class RegistrationActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration);
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.map;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import com.anuththara18.attentionassessment.R;
public class Map1Activity extends AppCompatActivity {
ImageButton imageButton1, imageButton2, imageButton3, imageButton4, imageButton5;
public static int level = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map1);
imageButton1 = findViewById(R.id.imageButton1);
imageButton2 = findViewById(R.id.imageButton2);
imageButton3 = findViewById(R.id.imageButton3);
imageButton4 = findViewById(R.id.imageButton4);
imageButton5 = findViewById(R.id.imageButton5);
imageButton1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
level = 1;
}
});
imageButton2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
level = 2;
}
});
imageButton3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
level = 3;
}
});
imageButton4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
level = 4;
}
});
imageButton5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
level = 5;
}
});
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.map;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageButton;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import com.anuththara18.attentionassessment.selective.SelectiveAttentionGame1;
public class Map2Activity extends AppCompatActivity {
ImageButton imageButton1, imageButton2, imageButton3, imageButton4, imageButton5;
public static int level = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_map2);
imageButton1 = findViewById(R.id.imageButton1);
imageButton2 = findViewById(R.id.imageButton2);
imageButton3 = findViewById(R.id.imageButton3);
imageButton4 = findViewById(R.id.imageButton4);
imageButton5 = findViewById(R.id.imageButton5);
imageButton1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
level = 1;
Intent intent = new Intent(getApplicationContext(), SelectiveAttentionGame1.class);
finish();
startActivity(intent);
}
});
imageButton2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
level = 2;
Intent intent = new Intent(getApplicationContext(), SelectiveAttentionGame1.class);
finish();
startActivity(intent);
}
});
imageButton3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
level = 3;
Intent intent = new Intent(getApplicationContext(), SelectiveAttentionGame1.class);
finish();
startActivity(intent);
}
});
imageButton4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
level = 4;
Intent intent = new Intent(getApplicationContext(), SelectiveAttentionGame1.class);
finish();
startActivity(intent);
}
});
imageButton5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
level = 5;
Intent intent = new Intent(getApplicationContext(), SelectiveAttentionGame1.class);
finish();
startActivity(intent);
}
});
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.selective;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.language.LanguageSetter;
import com.anuththara18.attentionassessment.sustained.SustainedAttentionGame1;
public class BirdChoosingActivity extends AppCompatActivity {
TextView textView8;
CardView bird1, bird2, bird3, bird4;
ImageButton imageButton;
LinearLayout l1, l2, l3, l4;
public static Integer birdSelected = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_bird_choosing);
textView8 = findViewById(R.id.textview8);
bird1 = findViewById(R.id.bird1);
bird2 = findViewById(R.id.bird2);
bird3 = findViewById(R.id.bird3);
bird4 = findViewById(R.id.bird4);
imageButton = findViewById(R.id.imageButton);
l1 = findViewById(R.id.l1);
l2 = findViewById(R.id.l2);
l3 = findViewById(R.id.l3);
l4 = findViewById(R.id.l4);
textView8.setText(LanguageSetter.getresources().getString(R.string.birdselect));
bird1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
birdSelected = 1;
l1.setBackgroundResource(R.drawable.selected_gridview_background);
l2.setBackgroundResource(R.drawable.gridview_background);
l3.setBackgroundResource(R.drawable.gridview_background);
l4.setBackgroundResource(R.drawable.gridview_background);
}
});
bird2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
birdSelected = 2;
l2.setBackgroundResource(R.drawable.selected_gridview_background);
l1.setBackgroundResource(R.drawable.gridview_background);
l3.setBackgroundResource(R.drawable.gridview_background);
l4.setBackgroundResource(R.drawable.gridview_background);
//Toast.makeText(getApplicationContext(), "yellow", Toast.LENGTH_SHORT).show();
}
});
bird3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
birdSelected = 3;
l3.setBackgroundResource(R.drawable.selected_gridview_background);
l2.setBackgroundResource(R.drawable.gridview_background);
l1.setBackgroundResource(R.drawable.gridview_background);
l4.setBackgroundResource(R.drawable.gridview_background);
}
});
bird4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
birdSelected = 4;
l2.setBackgroundResource(R.drawable.gridview_background);
l3.setBackgroundResource(R.drawable.gridview_background);
l1.setBackgroundResource(R.drawable.gridview_background);
l4.setBackgroundResource(R.drawable.selected_gridview_background);
}
});
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(birdSelected == 0) {
Toast.makeText(getApplicationContext(), LanguageSetter.getresources().getString(R.string.birdselect), Toast.LENGTH_SHORT).show();
}
else {
Intent intent = new Intent(BirdChoosingActivity.this, SustainedAttentionGame1.class);
startActivity(intent);
}
}
});
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.selective;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.anuththara18.attentionassessment.R;
import java.util.ArrayList;
public class GVAdapter extends ArrayAdapter<GridModel> {
public GVAdapter(@NonNull Context context, ArrayList<GridModel> gridModelArrayList) {
super(context, 0, gridModelArrayList);
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View listitemView = convertView;
if (listitemView == null) {
// Layout Inflater inflates each item to be displayed in GridView.
if (SelectiveAttentionGame1.columns == 3) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.card_item, parent, false);
}
else if (SelectiveAttentionGame1.columns == 4) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.card_item2, parent, false);
}
else if (SelectiveAttentionGame1.columns == 5) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.card_item3, parent, false);
}
//listitemView = LayoutInflater.from(getContext()).inflate(R.layout.card_item3, parent, false);
for ( int i = 0; i < SelectiveAttentionGame1.correctResponses.size(); i++ ) {
if (position == SelectiveAttentionGame1.correctResponses.get(i)) {
if (SelectiveAttentionGame1.columns == 3) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.clicked_card1, parent, false);
}
else if (SelectiveAttentionGame1.columns == 4) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.clicked_card2, parent, false);
}
else if (SelectiveAttentionGame1.columns == 5) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.clicked_card, parent, false);
}
}
}
for ( int i = 0; i < SelectiveAttentionGame1.incorrectResponses.size(); i++ ) {
if (position == SelectiveAttentionGame1.incorrectResponses.get(i)) {
if (SelectiveAttentionGame1.columns == 3) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.clicked_card1, parent, false);
}
else if (SelectiveAttentionGame1.columns == 4) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.clicked_card2, parent, false);
}
else if (SelectiveAttentionGame1.columns == 5) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.clicked_card, parent, false);
}
}
}
}
GridModel gridModel = getItem(position);
ImageView gridImage = listitemView.findViewById(R.id.gridImage);
gridImage.setImageResource(gridModel.getImgid());
/*
for ( int i = 0; i < SelectiveAttentionGame1.correctResponses.size(); i++ ) {
if (position == SelectiveAttentionGame1.correctResponses.get(i)) {
gridImage.setImageResource(R.drawable.blue_bird);
}
}
for ( int i = 0; i < SelectiveAttentionGame1.incorrectResponses.size(); i++ ) {
if (position == SelectiveAttentionGame1.incorrectResponses.get(i)) {
gridImage.setImageResource(R.drawable.red_btn);
}
}
*/
return listitemView;
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.selective;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.anuththara18.attentionassessment.R;
import java.util.ArrayList;
public class GVAdapter2 extends ArrayAdapter<GridModel> {
public GVAdapter2(@NonNull Context context, ArrayList<GridModel> gridModelArrayList) {
super(context, 0, gridModelArrayList);
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View listitemView = convertView;
if (listitemView == null) {
// Layout Inflater inflates each item to be displayed in GridView.
if (SelectiveAttentionGame1.columns == 3) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.card_item, parent, false);
}
else if (SelectiveAttentionGame1.columns == 4) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.card_item2, parent, false);
}
else if (SelectiveAttentionGame1.columns == 5) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.card_item3, parent, false);
}
//listitemView = LayoutInflater.from(getContext()).inflate(R.layout.card_item3, parent, false);
for ( int i = 0; i < SelectiveAttentionGame1.correctResponses.size(); i++ ) {
if (position == SelectiveAttentionGame1.correctResponses.get(i)) {
if (SelectiveAttentionGame1.columns == 3) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.green_card1, parent, false);
}
else if (SelectiveAttentionGame1.columns == 4) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.green_card2, parent, false);
}
else if (SelectiveAttentionGame1.columns == 5) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.green_card, parent, false);
}
}
}
for ( int i = 0; i < SelectiveAttentionGame1.incorrectResponses.size(); i++ ) {
if (position == SelectiveAttentionGame1.incorrectResponses.get(i)) {
if (SelectiveAttentionGame1.columns == 3) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.red_card1, parent, false);
}
else if (SelectiveAttentionGame1.columns == 4) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.red_card2, parent, false);
}
else if (SelectiveAttentionGame1.columns == 5) {
listitemView = LayoutInflater.from(getContext()).inflate(R.layout.red_card, parent, false);
}
}
}
}
GridModel gridModel = getItem(position);
ImageView gridImage = listitemView.findViewById(R.id.gridImage);
gridImage.setImageResource(gridModel.getImgid());
for ( int i = 0; i < SelectiveAttentionGame1.correctResponses.size(); i++ ) {
if (position == SelectiveAttentionGame1.correctResponses.get(i)) {
gridImage.setImageResource(R.drawable.tick);
}
}
for ( int i = 0; i < SelectiveAttentionGame1.incorrectResponses.size(); i++ ) {
if (position == SelectiveAttentionGame1.incorrectResponses.get(i)) {
gridImage.setImageResource(R.drawable.cross);
}
}
return listitemView;
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.selective;
public class GridModel {
private String image_name;
private int imgid;
public GridModel(String image_name, int imgid) {
this.image_name = image_name;
this.imgid = imgid;
}
public String getImage_name() {
return image_name;
}
public void setImage_name(String image_name) {
this.image_name = image_name;
}
public int getImgid() {
return imgid;
}
public void setImgid(int imgid) {
this.imgid = imgid;
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.selective;
public class Selective {
private int id;
private int childID;
private int totalCorrectResponses;
private int noOfCorrectResponses;
private int noOfCommissionErrors;
private int noOfOmmissionErrors;
private int meanReactionTime;
private int totalDuration;
public Selective(int id, int childID, int totalCorrectResponses, int noOfCorrectResponses, int noOfCommissionErrors, int noOfOmmissionErrors, int meanReactionTime, int totalDuration) {
this.id = id;
this.childID = childID;
this.totalCorrectResponses = totalCorrectResponses;
this.noOfCorrectResponses = noOfCorrectResponses;
this.noOfCommissionErrors = noOfCommissionErrors;
this.noOfOmmissionErrors = noOfOmmissionErrors;
this.meanReactionTime = meanReactionTime;
this.totalDuration = totalDuration;
}
public int getId() {
return id;
}
public int getChildID() {
return childID;
}
public int getTotalCorrectResponses() {
return totalCorrectResponses;
}
public int getNoOfCorrectResponses() {
return noOfCorrectResponses;
}
public int getNoOfCommissionErrors() {
return noOfCommissionErrors;
}
public int getNoOfOmmissionErrors() {
return noOfOmmissionErrors;
}
public int getMeanReactionTime() {
return meanReactionTime;
}
public int getTotalDuration() {
return totalDuration;
}
/*
CREATE TABLE sustainedAttention (
id int NOT NULL AUTO_INCREMENT,
childID int NOT NULL,
totalCorrectResponses int NOT NULL,
noOfCorrectResponses int NOT NULL,
noOfCommissionErrors int NOT NULL,
noOfOmmissionErrors int NOT NULL,
meanReactionTime int NOT NULL,
totalDuration int NOT NULL,
CONSTRAINT sustainedAttention_pk PRIMARY KEY (id)
);
*/
}
package com.anuththara18.attentionassessment.selective;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.pdf.PdfDocument;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import com.anuththara18.attentionassessment.BuildConfig;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.age.AgeActivity;
import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static android.Manifest.permission.MANAGE_EXTERNAL_STORAGE;
import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
public class SelectiveACompleteScreen extends AppCompatActivity {
ImageView complete;
List<Selective> dataList;
SQLiteDatabase mDatabase;
// declaring width and height
// for our PDF file.
int pageHeight = 1120;
int pagewidth = 792;
// creating a bitmap variable
// for storing our images
Bitmap bmp, scaledbmp;
// constant code for runtime permissions
private static final int PERMISSION_REQUEST_CODE = 200;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_complete_screen2);
complete = findViewById(R.id.complete);
complete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
finish();
startActivity(intent);
}
});
dataList = new ArrayList<>();
//opening the database
mDatabase = openOrCreateDatabase(SelectiveAttentionGame1.DATABASE_NAME, MODE_PRIVATE, null);
/*******************************************************************************************/
// initializing our variables.
bmp = BitmapFactory.decodeResource(getResources(), R.drawable.selective);
scaledbmp = Bitmap.createScaledBitmap(bmp, 140, 140, false);
// below code is used for
// checking our permissions.
if (checkPermission()) {
//Toast.makeText(this, "Permission Granted", Toast.LENGTH_SHORT).show();
} else {
requestPermission();
}
/*******************************************************************************************/
//this part will display the data in the list
//we used rawQuery(sql, selectionargs) for fetching all the employees
Cursor cursorEmployees = mDatabase.rawQuery("SELECT * FROM selectiveAttention", null);
//if the cursor has some data
if (cursorEmployees.moveToFirst()) {
//looping through all the records
do {
//pushing each record in the employee list
dataList.add(new Selective(
cursorEmployees.getInt(0),
cursorEmployees.getInt(1),
cursorEmployees.getInt(2),
cursorEmployees.getInt(3),
cursorEmployees.getInt(4),
cursorEmployees.getInt(5),
cursorEmployees.getInt(6),
cursorEmployees.getInt(7)
));
} while (cursorEmployees.moveToNext());
}
//closing the cursor
cursorEmployees.close();
/*******************************************************************************************/
// generate our PDF file.
// creating an object variable
// for our PDF document.
PdfDocument pdfDocument = new PdfDocument();
// two variables for paint "paint" is used
// for drawing shapes and we will use "title"
// for adding text in our PDF file.
Paint paint = new Paint();
Paint title = new Paint();
// we are adding page info to our PDF file
// in which we will be passing our pageWidth,
// pageHeight and number of pages and after that
// we are calling it to create our PDF.
PdfDocument.PageInfo mypageInfo = new PdfDocument.PageInfo.Builder(pagewidth, pageHeight, 1).create();
// below line is used for setting
// start page for our PDF file.
PdfDocument.Page myPage = pdfDocument.startPage(mypageInfo);
// creating a variable for canvas
// from our page of PDF.
Canvas canvas = myPage.getCanvas();
// below line is used to draw our image on our PDF file.
// the first parameter of our drawbitmap method is
// our bitmap
// second parameter is position from left
// third parameter is position from top and last
// one is our variable for paint.
canvas.drawBitmap(scaledbmp, 56, 40, paint);
// below line is used for adding typeface for
// our text which we will be adding in our PDF file.
title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
// below line is used for setting text size
// which we will be displaying in our PDF file.
title.setTextSize(20);
// below line is sued for setting color
// of our text inside our PDF file.
title.setColor(ContextCompat.getColor(this, R.color.orange));
// below line is used to draw text in our PDF file.
// the first parameter is our text, second parameter
// is position from start, third parameter is position from top
// and then we are passing our variable of paint which is title.
canvas.drawText("Selective Attention", 250, 80, title);
title.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
title.setColor(ContextCompat.getColor(this, R.color.black));
title.setTextSize(15);
canvas.drawText("Age : " + AgeActivity.age, 150, 250, title);
String gender;
if (GenderActivity.gender == 0) {
gender = "Male";
}
else {
gender = "Female";
}
canvas.drawText("Gender: " + gender, 150, 300, title);
/*
canvas.drawText("Child Name: " + gender, 150, 350, title);
canvas.drawText("Parent Name: " + gender, 150, 400, title);
canvas.drawText("Contact No: " + gender, 150, 450, title);
canvas.drawText("Email: " + gender, 150, 500, title);
*/
// similarly we are creating another text and in this
// we are aligning this text to center of our PDF file.
title.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
title.setColor(ContextCompat.getColor(this, R.color.black));
title.setTextSize(15);
// below line is used for setting
// our text to center of PDF.
//title.setTextAlign(Paint.Align.CENTER);
int space = 0;
// Printing elements one by one
for (int i = 0; i < dataList.size(); i++) {
//getting employee of the specified position
Selective data = dataList.get(i);
Log.d("********************************", "ID : " + String.valueOf(data.getId()) + ", \t" +
"C: " + String.valueOf(data.getChildID()) + ", \t" +
"TCR: " + String.valueOf(data.getTotalCorrectResponses()) + ", \t" +
"CR: " + String.valueOf(data.getNoOfCorrectResponses()) + ", \t" +
"CE: " + String.valueOf(data.getNoOfCommissionErrors()) + ", \t" +
"OE: " + String.valueOf(data.getNoOfOmmissionErrors()) + ", \t" +
"MRT: " + String.valueOf(data.getMeanReactionTime()) + ", \t" +
"TD: " + String.valueOf(data.getTotalDuration()) );
canvas.drawText("ID : " + String.valueOf(data.getId()) + ", \t" +
"C: " + String.valueOf(data.getChildID()) + ", \t" +
"TCR: " + String.valueOf(data.getTotalCorrectResponses()) + ", \t" +
"CR: " + String.valueOf(data.getNoOfCorrectResponses()) + ", \t" +
"CE: " + String.valueOf(data.getNoOfCommissionErrors()) + ", \t" +
"OE: " + String.valueOf(data.getNoOfOmmissionErrors()) + ", \t" +
"MRT: " + String.valueOf(data.getMeanReactionTime()) + ", \t" +
"TD: " + String.valueOf(data.getTotalDuration()) + " ", 150, 350 + space, title);
space = space + 50;
}
// after adding all attributes to our
// PDF file we will be finishing our page.
pdfDocument.finishPage(myPage);
// below line is used to set the name of
// our PDF file and its path.
File file = new File(Environment.getExternalStorageDirectory(), "SelectiveAttention.pdf");
try {
// after creating a file name we will
// write our PDF file to that location.
pdfDocument.writeTo(new FileOutputStream(file));
/*
// Uri path = Uri.fromFile(file);
Uri path = FileProvider.getUriForFile(SelectiveACompleteScreen.this, BuildConfig.APPLICATION_ID + ".provider", file);
Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
pdfIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
pdfIntent.setDataAndType(path, "application/pdf");
pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try{
startActivity(pdfIntent);
}catch(ActivityNotFoundException e){
Toast.makeText(getApplicationContext(), "No Application available to view PDF", Toast.LENGTH_SHORT).show();
}
*/
// below line is to print toast message
// on completion of PDF generation.
Toast.makeText(getApplicationContext(), "PDF file generated successfully.", Toast.LENGTH_LONG).show();
} catch (IOException e) {
// below line is used
// to handle error
e.printStackTrace();
}
// after storing our pdf to that
// location we are closing our PDF file.
pdfDocument.close();
}
/**************************************************************************************************/
private boolean checkPermission() {
// checking of permissions.
int permission1 = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);
int permission2 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);
int permission3 = ContextCompat.checkSelfPermission(getApplicationContext(), MANAGE_EXTERNAL_STORAGE);
return permission1 == PackageManager.PERMISSION_GRANTED && permission2 == PackageManager.PERMISSION_GRANTED && permission3 == PackageManager.PERMISSION_GRANTED;
}
/**************************************************************************************************/
private void requestPermission() {
// requesting permissions if not provided.
ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE, MANAGE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == PERMISSION_REQUEST_CODE) {
if (grantResults.length > 0) {
/*
Intent intent = new Intent();
intent.setAction(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
Uri uri = Uri.fromParts("package", this.getPackageName(), null);
intent.setData(uri);
startActivity(intent);
*/
// after requesting permissions we are showing
// users a toast message of permission granted.
boolean writeStorage = grantResults[0] == PackageManager.PERMISSION_GRANTED;
boolean readStorage = grantResults[1] == PackageManager.PERMISSION_GRANTED;
if (writeStorage && readStorage) {
//Toast.makeText(this, "Permission Granted..", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "Permission Denied.", Toast.LENGTH_SHORT).show();
finish();
}
}
}
}
/**************************************************************************************************/
}
package com.anuththara18.attentionassessment.selective;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.PorterDuff;
import android.media.MediaPlayer;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.anuththara18.attentionassessment.CompleteScreen;
import com.anuththara18.attentionassessment.CompleteScreen2;
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.focused.FocusedAttentionGame1;
import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import com.anuththara18.attentionassessment.language.LanguageSetter;
import com.anuththara18.attentionassessment.map.Map2Activity;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
public class SelectiveAttentionGame1 extends AppCompatActivity {
// get reaction time - if image is clicked before 3 seconds
private static final int CODE_GET_REQUEST = 1024;
private static final int CODE_POST_REQUEST = 1025;
public static final String DATABASE_NAME = "selectiveAttention";
SQLiteDatabase mDatabase;
GridView gridView;
ImageView main_img, cross_btn;
ImageButton imageButton;
ArrayList<GridModel> gridModelArrayList;
public static ArrayList<Integer> correctResponses;
public static ArrayList<Integer> incorrectResponses;
public static int columns;
int rows, noOfObjects;
int gridSize = 0;
int num = 0;
int image = 0;
String image_name;
SimpleDateFormat simpleDateFormat;
Calendar calendar;
Date startDate, endDate;
TextView textview;
// test variables
int totalCorrectResponses = 0;
int noOfCorrectResponses = 0;
int noOfCommissionErrors = 0;
int noOfOmmissionErrors = 0;
long completionTime = 0;
int a, b, c, d, e, f, g, h, ii, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, aa;
String a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, x1, y1, z1, aa1;
int age = AgeActivity.age;
int level = Map2Activity.level;
Random random;
MediaPlayer mp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_selective_attention_game1);
main_img = findViewById(R.id.main_img);
gridView = findViewById(R.id.gridView);
imageButton = findViewById(R.id.imageButton);
cross_btn = (ImageView) findViewById(R.id.cross_btn);
textview = findViewById(R.id.textview);
textview.setText(LanguageSetter.getresources().getString(R.string.select));
mp = MediaPlayer.create(getApplicationContext(), R.raw.selective);
mp.start();
//creating a database
mDatabase = openOrCreateDatabase(DATABASE_NAME, MODE_PRIVATE, null);
random = new Random();
correctResponses = new ArrayList<>();
incorrectResponses = new ArrayList<>();
// level 1 & 2
a = R.drawable.ladybird;
a1 = "ladybird";
b = R.drawable.blue_buterfly;
b1 = "blue_buterfly";
c = R.drawable.yellow_bee;
c1 = "yellow_bee";
d = R.drawable.green_bird;
d1 = "green_bird";
e = R.drawable.pink_flower;
e1 = "pink_flower";
f = R.drawable.bear;
f1 = "bear";
g = R.drawable.pink_pig;
g1 = "pink_pig";
/*
// level 3 - 4 & 6 (2 same)
g = R.drawable.white_cow;
g1 = "white_cow";
h = R.drawable.brown_donkey;
h1 = "brown_donkey";
ii = R.drawable.grey_goat;
i1 = "grey_goat";
j = R.drawable.blue_elephant;
j1 = "blue_elephant";
k = R.drawable.blue_hippo;
k1 = "blue_hippo";
// level 4 - 4 (2 same) & 6 (3 same)
l = R.drawable.white_zebra;
l1 = "white_zebra";
m = R.drawable.orange_tiger;
m1 = "orange_tiger";
n = R.drawable.brown_ox;
n1 = "brown_ox";
o = R.drawable.green_dino;
o1 = "green_dino";
p = R.drawable.green_snake;
p1 = "green_snake";
q = R.drawable.green_croc;
q1 = "green_croc";
// level 5 - 5 (2 same) & 7 (4 same)
r = R.drawable.brown_lion;
r1 = "brown_lion";
s = R.drawable.grey_elephant;
s1 = "grey_elephant";
t = R.drawable.blue_peacock;
t1 = "blue_peacock";
u = R.drawable.yellow_chicken;
u1 = "yellow_chicken";
v = R.drawable.yellow_dino;
v1 = "yellow_dino";
w = R.drawable.yellow_girraffe;
w1 = "yellow_girraffe";
x = R.drawable.yellow_leapoard;
x1 = "yellow_leapoard";
y = R.drawable.white_cow;
y1 = "white_cow";
z = R.drawable.pink_pig;
z1 = "pink_pig";
*/
image = num = random.nextInt(100);
if ( age >= 4 && age <= 5 ) {
if (level == 1) {
// 2 objects
num = random.nextInt(100);
if(num % 2 == 0) {
main_img.setImageResource(a);
image_name = a1;
}
else {
main_img.setImageResource(b);
image_name = b1;
}
}
else if (level == 2) {
// 3 objects
num = random.nextInt(120);
if(num >= 0 && num < 40) {
main_img.setImageResource(c);
}
else if(num >= 40 && num < 80) {
main_img.setImageResource(d);
}
else if(num >= 80 && num < 120) {
main_img.setImageResource(e);
}
}
else if (level == 3) {
// 4 objects
num = random.nextInt(120);
if(num >= 0 && num < 30) {
main_img.setImageResource(a);
}
else if(num >= 30 && num < 60) {
main_img.setImageResource(b);
}
else if(num >= 60 && num < 90) {
main_img.setImageResource(c);
}
else if(num >= 90 && num < 120) {
main_img.setImageResource(d);
}
}
else if (level == 4) {
num = random.nextInt(120);
if(num >= 0 && num < 30) {
main_img.setImageResource(a);
}
else if(num >= 30 && num < 60) {
main_img.setImageResource(b);
}
else if(num >= 60 && num < 90) {
main_img.setImageResource(c);
}
else if(num >= 90 && num < 120) {
main_img.setImageResource(d);
}
}
else if (level == 5) {
num = random.nextInt(100);
if(num >= 0 && num < 20) {
main_img.setImageResource(a);
}
else if(num >= 20 && num < 40) {
main_img.setImageResource(b);
}
else if(num >= 40 && num < 60) {
main_img.setImageResource(c);
}
else if(num >= 60 && num < 80) {
main_img.setImageResource(d);
}
else if(num >= 80 && num < 100) {
main_img.setImageResource(e);
}
}
}
if (age >= 6 && age <= 7 ) {
if (level == 1) {
// 4 objects
num = random.nextInt(120);
if (num >= 0 && num < 30) {
main_img.setImageResource(a);
} else if (num >= 30 && num < 60) {
main_img.setImageResource(b);
} else if (num >= 60 && num < 90) {
main_img.setImageResource(c);
} else if (num >= 90 && num < 120) {
main_img.setImageResource(d);
}
} else if (level == 2) {
// 5 objects
num = random.nextInt(100);
if (num >= 0 && num < 20) {
main_img.setImageResource(a);
} else if (num >= 20 && num < 40) {
main_img.setImageResource(b);
} else if (num >= 40 && num < 60) {
main_img.setImageResource(c);
} else if (num >= 60 && num < 80) {
main_img.setImageResource(d);
} else if (num >= 80 && num < 100) {
main_img.setImageResource(e);
}
} else if (level == 3) {
// 6 objects
num = random.nextInt(120);
if (num >= 0 && num < 20) {
main_img.setImageResource(a);
} else if (num >= 20 && num < 40) {
main_img.setImageResource(b);
} else if (num >= 40 && num < 60) {
main_img.setImageResource(c);
} else if (num >= 60 && num < 80) {
main_img.setImageResource(d);
} else if (num >= 80 && num < 100) {
main_img.setImageResource(e);
} else if (num >= 100 && num < 120) {
main_img.setImageResource(f);
}
} else if (level == 4) {
// 6 objects
num = random.nextInt(120);
if (num >= 0 && num < 20) {
main_img.setImageResource(a);
} else if (num >= 20 && num < 40) {
main_img.setImageResource(b);
} else if (num >= 40 && num < 60) {
main_img.setImageResource(c);
} else if (num >= 60 && num < 80) {
main_img.setImageResource(d);
} else if (num >= 80 && num < 100) {
main_img.setImageResource(e);
} else if (num >= 100 && num < 120) {
main_img.setImageResource(f);
}
} else if (level == 5) {
// 7 objects
num = random.nextInt(140);
if (num >= 0 && num < 20) {
main_img.setImageResource(a);
} else if (num >= 20 && num < 40) {
main_img.setImageResource(b);
} else if (num >= 40 && num < 60) {
main_img.setImageResource(c);
} else if (num >= 60 && num < 80) {
main_img.setImageResource(d);
} else if (num >= 80 && num < 100) {
main_img.setImageResource(e);
} else if (num >= 100 && num < 120) {
main_img.setImageResource(f);
} else if (num >= 120 && num < 140) {
main_img.setImageResource(g);
}
}
}
/*
if ( age == 1 && level == 1 ) {
num = random.nextInt(120);
if(num >= 0 && num < 20) {
main_img.setImageResource(a);
image_name = a1;
}
else if(num >= 20 && num < 40) {
main_img.setImageResource(b);
image_name = b1;
}
else if(num >= 40 && num < 60) {
main_img.setImageResource(c);
image_name = c1;
}
else if(num >= 60 && num < 80) {
main_img.setImageResource(d);
image_name = d1;
}
else if(num >= 80 && num < 100) {
main_img.setImageResource(e);
image_name = e1;
}
else if(num >= 100 && num < 120) {
main_img.setImageResource(aa);
image_name = aa1;
}
}
*/
getGridSize();
ArrayList<GridModel> gridModelArrayList = new ArrayList<GridModel>();
for ( int i = 1; i <= gridSize; i++) {
/*
// 7 objects - 4 same coloured
num = random.nextInt(120);
if(num >= 0 && num < 20) {
gridModelArrayList.add(new GridModel(a1, a));
}
else if(num >= 20 && num < 40) {
gridModelArrayList.add(new GridModel(b1, b));
}
else if(num >= 40 && num < 60) {
gridModelArrayList.add(new GridModel(c1, c));
}
else if(num >= 60 && num < 80) {
gridModelArrayList.add(new GridModel(d1, d));
}
else if(num >= 80 && num < 100) {
gridModelArrayList.add(new GridModel(e1, e));
}
else if(num >= 100 && num < 120) {
gridModelArrayList.add(new GridModel(aa1, aa));
}
*/
if ( age >= 4 && age <= 5 ) {
if (level == 1) {
// 2 objects
num = random.nextInt(100);
if(num % 2 == 0) {
gridModelArrayList.add(new GridModel(a1, a));
}
else {
gridModelArrayList.add(new GridModel(b1, b));
}
}
else if (level == 2) {
// 3 objects
num = random.nextInt(120);
if(num >= 0 && num < 40) {
gridModelArrayList.add(new GridModel(a1, a));
}
else if(num >= 40 && num < 80) {
gridModelArrayList.add(new GridModel(b1, b));
}
else if(num >= 80 && num < 120) {
gridModelArrayList.add(new GridModel(c1, c));
}
}
else if (level == 3) {
// 4 objects
num = random.nextInt(120);
if(num >= 0 && num < 30) {
gridModelArrayList.add(new GridModel(a1, a));
}
else if(num >= 30 && num < 60) {
gridModelArrayList.add(new GridModel(b1, b));
}
else if(num >= 60 && num < 90) {
gridModelArrayList.add(new GridModel(c1, c));
}
else if(num >= 90 && num < 120) {
gridModelArrayList.add(new GridModel(d1, d));
}
}
else if (level == 4) {
// 4 objects
num = random.nextInt(120);
if(num >= 0 && num < 30) {
gridModelArrayList.add(new GridModel(a1, a));
}
else if(num >= 30 && num < 60) {
gridModelArrayList.add(new GridModel(b1, b));
}
else if(num >= 60 && num < 90) {
gridModelArrayList.add(new GridModel(c1, c));
}
else if(num >= 90 && num < 120) {
gridModelArrayList.add(new GridModel(d1, d));
}
}
else if (level == 5) {
// 5 objects
num = random.nextInt(100);
if(num >= 0 && num < 20) {
gridModelArrayList.add(new GridModel(a1, a));
}
else if(num >= 20 && num < 40) {
gridModelArrayList.add(new GridModel(b1, b));
}
else if(num >= 40 && num < 60) {
gridModelArrayList.add(new GridModel(c1, c));
}
else if(num >= 60 && num < 80) {
gridModelArrayList.add(new GridModel(d1, d));
}
else if(num >= 80 && num < 100) {
gridModelArrayList.add(new GridModel(e1, e));
}
}
}
if (age >= 6 && age <= 7 ){
if (level == 1) {
// 4 objects
num = random.nextInt(120);
if(num >= 0 && num < 30) {
gridModelArrayList.add(new GridModel(a1, a));
}
else if(num >= 30 && num < 60) {
gridModelArrayList.add(new GridModel(b1, b));
}
else if(num >= 60 && num < 90) {
gridModelArrayList.add(new GridModel(c1, c));
}
else if(num >= 90 && num < 120) {
gridModelArrayList.add(new GridModel(d1, d));
}
}
else if (level == 2) {
// 5 objects
num = random.nextInt(100);
if(num >= 0 && num < 20) {
gridModelArrayList.add(new GridModel(a1, a));
}
else if(num >= 20 && num < 40) {
gridModelArrayList.add(new GridModel(b1, b));
}
else if(num >= 40 && num < 60) {
gridModelArrayList.add(new GridModel(c1, c));
}
else if(num >= 60 && num < 80) {
gridModelArrayList.add(new GridModel(d1, d));
}
else if(num >= 80 && num < 100) {
gridModelArrayList.add(new GridModel(e1, e));
}
}
else if (level == 3) {
// 6 objects
num = random.nextInt(120);
if(num >= 0 && num < 20) {
gridModelArrayList.add(new GridModel(a1, a));
}
else if(num >= 20 && num < 40) {
gridModelArrayList.add(new GridModel(b1, b));
}
else if(num >= 40 && num < 60) {
gridModelArrayList.add(new GridModel(c1, c));
}
else if(num >= 60 && num < 80) {
gridModelArrayList.add(new GridModel(d1, d));
}
else if(num >= 80 && num < 100) {
gridModelArrayList.add(new GridModel(e1, e));
}
else if(num >= 100 && num < 120) {
gridModelArrayList.add(new GridModel(f1, f));
}
}
else if (level == 4) {
// 6 objects
num = random.nextInt(120);
if(num >= 0 && num < 20) {
gridModelArrayList.add(new GridModel(a1, a));
}
else if(num >= 20 && num < 40) {
gridModelArrayList.add(new GridModel(b1, b));
}
else if(num >= 40 && num < 60) {
gridModelArrayList.add(new GridModel(c1, c));
}
else if(num >= 60 && num < 80) {
gridModelArrayList.add(new GridModel(d1, d));
}
else if(num >= 80 && num < 100) {
gridModelArrayList.add(new GridModel(e1, e));
}
else if(num >= 100 && num < 120) {
gridModelArrayList.add(new GridModel(f1, f));
}
}
else if (level == 5) {
// 7 objects
num = random.nextInt(140);
if(num >= 0 && num < 20) {
gridModelArrayList.add(new GridModel(a1, a));
}
else if(num >= 20 && num < 40) {
gridModelArrayList.add(new GridModel(b1, b));
}
else if(num >= 40 && num < 60) {
gridModelArrayList.add(new GridModel(c1, c));
}
else if(num >= 60 && num < 80) {
gridModelArrayList.add(new GridModel(d1, d));
}
else if(num >= 80 && num < 100) {
gridModelArrayList.add(new GridModel(e1, e));
}
else if(num >= 100 && num < 120) {
gridModelArrayList.add(new GridModel(f1, f));
}
else if(num >= 120 && num < 140) {
gridModelArrayList.add(new GridModel(g1, g));
}
}
}
}
GVAdapter adapter = new GVAdapter(this, gridModelArrayList);
gridView.setAdapter(adapter);
try {
calendar = Calendar.getInstance();
simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
startDate = simpleDateFormat.parse(String.valueOf(simpleDateFormat.format(calendar.getTime())));
Log.d("startTime", String.valueOf(simpleDateFormat.format(calendar.getTime())));
} catch (ParseException parseException) {
parseException.printStackTrace();
}
for ( int i = 0; i < gridSize; i++) {
GridModel data = (GridModel) gridModelArrayList.get(i);
if ( data.getImage_name().equals(image_name)){
totalCorrectResponses++;
}
}
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView parent, View v, int position, long id) {
GridModel data = (GridModel) gridModelArrayList.get(position);
//Toast.makeText(SelectiveAttentionGame1.this, "" + position + data.getImage_name() + data.getImgid(), Toast.LENGTH_SHORT).show();
if ( data.getImage_name().equals(image_name) ) {
noOfCorrectResponses++;
correctResponses.add(position);
gridView.setAdapter(adapter);
}
else {
// incorrect clicks
noOfCommissionErrors++;
incorrectResponses.add(position);
gridView.setAdapter(adapter);
}
}
});
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
calendar = Calendar.getInstance();
simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
endDate = simpleDateFormat.parse(String.valueOf(simpleDateFormat.format(calendar.getTime())));
Log.d("endTime", String.valueOf(simpleDateFormat.format(calendar.getTime())));
} catch (ParseException parseException) {
parseException.printStackTrace();
}
// missed clicks
noOfOmmissionErrors = totalCorrectResponses - noOfCorrectResponses;
Log.d("total", String.valueOf(totalCorrectResponses));
Log.d("correctResponses", String.valueOf(noOfCorrectResponses));
Log.d("omissionErrors", String.valueOf(totalCorrectResponses - noOfCorrectResponses));
Log.d("commissionErrors", String.valueOf(noOfCommissionErrors));
Log.d("duration", String.valueOf(getCompletionTime()));
completionTime = getCompletionTime();
GVAdapter2 adapter = new GVAdapter2(getApplicationContext(), gridModelArrayList);
gridView.setAdapter(adapter);
saveDataToOnlineDB();
createTable();
saveDataToLocalDB();
Intent intent = new Intent(getApplicationContext(), SelectiveACompleteScreen.class);
finish();
mp.pause();
startActivity(intent);
}
});
cross_btn.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN: {
cross_btn.getBackground().setColorFilter(0x77000000, PorterDuff.Mode.SRC_ATOP);
view.invalidate();
break;
}
case MotionEvent.ACTION_UP:
alert();
mp.pause();
case MotionEvent.ACTION_CANCEL: {
cross_btn.getBackground().clearColorFilter();
view.invalidate();
break;
}
}
return true;
}
});
}
/*************************************************************************************************/
@Override
public void onBackPressed() {
super.onBackPressed();
mp.pause();
}
/*************************************************************************************************/
private void alert() {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setMessage("Do you really want to quit the game?");
alertDialogBuilder.setPositiveButton("yes",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
Intent intent = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
finish();
startActivity(intent);
//Toast.makeText(FocusedAttentionGame1.this,"You clicked yes button",Toast.LENGTH_LONG).show();
}
});
alertDialogBuilder.setNegativeButton("No",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//finish();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
/*************************************************************************************************/
public long getCompletionTime() {
long difference = 0;
try {
difference = endDate.getTime() - startDate.getTime();
if(difference<0)
{
Date dateMax = simpleDateFormat.parse("24:00:00");
Date dateMin = simpleDateFormat.parse("00:00:00");
difference=(dateMax.getTime() -startDate.getTime() )+(endDate.getTime()-dateMin.getTime());
}
int days = (int) (difference / (1000*60*60*24));
int hours = (int) ((difference - (1000*60*60*24*days)) / (1000*60*60));
int min = (int) (difference - (1000*60*60*24*days) - (1000*60*60*hours)) / (1000*60);
int sec = (int) (difference - (1000*60*60*24*days) - (1000*60*60*hours) - (1000*60*min)) / (1000);
Log.i("log_tag","Hours: "+hours+", Mins: "+min+", Secs: "+sec + "diff: " + difference);
completionTime = difference;
} catch (ParseException parseException) {
parseException.printStackTrace();
}
return difference;
}
/*************************************************************************************************/
private void saveDataToOnlineDB() {
String child = String.valueOf(GenderActivity.gender) + String.valueOf(AgeActivity.age) + String.valueOf(Map2Activity.level);
int child_ID = Integer.parseInt(child);
int total_correct_responses = totalCorrectResponses;
int no_of_correct_responses = noOfCorrectResponses;
int no_of_ommission_errors = noOfOmmissionErrors;
int no_of_commission_errors = noOfCommissionErrors;
int mean_reaction_time = 0;
int total_duration = (int) completionTime;
HashMap<String, Integer> params = new HashMap<>();
params.put("childID", child_ID);
params.put("totalCorrectResponses", total_correct_responses);
params.put("noOfCorrectResponses", no_of_correct_responses);
params.put("noOfCommissionErrors", no_of_commission_errors);
params.put("noOfOmmissionErrors", no_of_ommission_errors);
params.put("meanReactionTime", mean_reaction_time);
params.put("totalDuration", total_duration);
//Calling the create hero API
PerformNetworkRequest request = new PerformNetworkRequest(Api.URL_SELECTIVE_ATTENTION, params, CODE_POST_REQUEST);
request.execute();
}
/*************************************************************************************************/
//inner class to perform network request extending an AsyncTask
private class PerformNetworkRequest extends AsyncTask<Void, Void, String> {
//the url where we need to send the request
String url;
//the parameters
HashMap<String, Integer> params;
//the request code to define whether it is a GET or POST
int requestCode;
//constructor to initialize values
PerformNetworkRequest(String url, HashMap<String, Integer> params, int requestCode) {
this.url = url;
this.params = params;
this.requestCode = requestCode;
}
//when the task started displaying a progressbar
@Override
protected void onPreExecute() {
super.onPreExecute();
}
//this method will give the response from the request
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
try {
JSONObject object = new JSONObject(s);
if (!object.getBoolean("error")) {
Toast.makeText(getApplicationContext(), object.getString("message"), Toast.LENGTH_SHORT).show();
//refreshing the herolist after every operation
//so we get an updated list
//we will create this method right now it is commented
//because we haven't created it yet
//refreshHeroList(object.getJSONArray("heroes"));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
//the network operation will be performed in background
@Override
protected String doInBackground(Void... voids) {
RequestHandler requestHandler = new RequestHandler();
if (requestCode == CODE_POST_REQUEST)
return requestHandler.sendPostRequest(url, params);
if (requestCode == CODE_GET_REQUEST)
return requestHandler.sendGetRequest(url);
return null;
}
}
/*************************************************************************************************/
private void createTable() {
mDatabase.execSQL(
"CREATE TABLE IF NOT EXISTS selectiveAttention (\n" +
" id INTEGER PRIMARY KEY AUTOINCREMENT,\n" +
" childID int 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" +
");"
);
}
/*************************************************************************************************/
private void saveDataToLocalDB() {
String child = String.valueOf(GenderActivity.gender) + String.valueOf(AgeActivity.age) + String.valueOf(Map2Activity.level);
int child_ID = Integer.parseInt(child);
int total_correct_responses = totalCorrectResponses;
int no_of_correct_responses = noOfCorrectResponses;
int no_of_ommission_errors = noOfOmmissionErrors;
int no_of_commission_errors = noOfCommissionErrors;
int mean_reaction_time = 0;
int total_duration = (int) completionTime;
String insertSQL = "INSERT INTO selectiveAttention \n" +
"(childID, totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration)\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});
Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
}
/*************************************************************************************************/
public void getGridSize(){
// ages 4 & 5
if (age >= 4 && age <= 5 && level == 1) {
columns = 3;
rows = 3;
gridSize = 9;
gridView.setNumColumns(3);
gridView.setHorizontalSpacing(-200);
gridView.setVerticalSpacing(40);
noOfObjects = 2;
}
else if (age >= 4 && age <= 5 && level == 2) {
columns = 3;
rows = 4;
gridSize = 12;
gridView.setNumColumns(3);
gridView.setHorizontalSpacing(-240);
gridView.setVerticalSpacing(30);
noOfObjects = 3;
}
else if (age >= 4 && age <= 5 && level == 3) {
columns = 4;
rows = 4;
gridSize = 16;
gridView.setNumColumns(4);
gridView.setHorizontalSpacing(-290);
noOfObjects = 4;
}
else if (age >= 4 && age <= 5 && level == 4) {
columns = 4;
rows = 5;
gridSize = 20;
gridView.setNumColumns(4);
gridView.setHorizontalSpacing(-220);
noOfObjects = 5;
}
else if (age >= 4 && age <= 5 && level == 5) {
columns = 5;
rows = 5;
gridSize = 25;
gridView.setNumColumns(5);
gridView.setHorizontalSpacing(-220);
noOfObjects = 5;
}
// ages 6 & 7
if (age >= 6 && age <= 7 && level == 1) {
columns = 3;
rows = 4;
gridSize = 12;
gridView.setNumColumns(3);
gridView.setHorizontalSpacing(-240);
gridView.setVerticalSpacing(30);
noOfObjects = 4;
}
else if (age >= 6 && age <= 7 && level == 2) {
columns = 4;
rows = 4;
gridSize = 16;
gridView.setNumColumns(4);
gridView.setHorizontalSpacing(-290);
noOfObjects = 5;
}
else if (age >= 6 && age <= 7 && level == 3) {
columns = 4;
rows = 5;
gridSize = 20;
gridView.setNumColumns(4);
gridView.setHorizontalSpacing(-220);
noOfObjects = 6;
}
else if (age >= 6 && age <= 7 && level == 4) {
columns = 5;
rows = 5;
gridSize = 25;
gridView.setNumColumns(5);
gridView.setHorizontalSpacing(-220);
noOfObjects = 6;
}
else if (age >= 6 && age <= 7 && level == 5) {
columns = 5;
rows = 6;
gridSize = 30;
gridView.setNumColumns(5);
gridView.setHorizontalSpacing(-220);
noOfObjects = 7;
}
/*
columns = 5;
rows = 6;
gridSize = 30;
gridView.setNumColumns(5);
gridView.setHorizontalSpacing(-220);
noOfObjects = 7; // 4 same coloured
*/
}
}
/*
if ( age >= 4 && age <= 5 ) {
if (level == 1) {
// 2 objects
num = random.nextInt(100);
if(num % 2 == 0) {
main_img.setImageResource(a);
image_name = a1;
}
else {
main_img.setImageResource(b);
image_name = b1;
}
}
else if (level == 2) {
// 3 objects
num = random.nextInt(120);
if(num >= 0 && num < 40) {
main_img.setImageResource(c);
}
else if(num >= 40 && num < 80) {
main_img.setImageResource(d);
}
else if(num >= 80 && num < 120) {
main_img.setImageResource(e);
}
}
else if (level == 3) {
// 4 objects
num = random.nextInt(120);
if(num >= 0 && num < 30) {
main_img.setImageResource(f);
}
else if(num >= 30 && num < 60) {
main_img.setImageResource(g);
}
else if(num >= 60 && num < 90) {
main_img.setImageResource(h);
}
else if(num >= 90 && num < 120) {
main_img.setImageResource(j);
}
}
else if (level == 4) {
// 4 objects - 2 same coloured
num = random.nextInt(120);
if(num >= 0 && num < 30) {
main_img.setImageResource(l);
}
else if(num >= 30 && num < 60) {
main_img.setImageResource(m);
}
else if(num >= 60 && num < 90) {
main_img.setImageResource(p);
}
else if(num >= 90 && num < 120) {
main_img.setImageResource(q);
}
}
else if (level == 5) {
// 5 objects - 2 same coloured
num = random.nextInt(100);
if(num >= 0 && num < 20) {
main_img.setImageResource(y);
}
else if(num >= 20 && num < 40) {
main_img.setImageResource(z);
}
else if(num >= 40 && num < 60) {
main_img.setImageResource(t);
}
else if(num >= 60 && num < 80) {
main_img.setImageResource(w);
}
else if(num >= 80 && num < 100) {
main_img.setImageResource(x);
}
}
}
if (age >= 6 && age <= 7 ){
if (level == 1) {
// 4 objects
num = random.nextInt(120);
if(num >= 0 && num < 30) {
main_img.setImageResource(a);
}
else if(num >= 30 && num < 60) {
main_img.setImageResource(b);
}
else if(num >= 60 && num < 90) {
main_img.setImageResource(c);
}
else if(num >= 90 && num < 120) {
main_img.setImageResource(d);
}
}
else if (level == 2) {
// 5 objects
num = random.nextInt(100);
if(num >= 0 && num < 20) {
main_img.setImageResource(a);
}
else if(num >= 20 && num < 40) {
main_img.setImageResource(b);
}
else if(num >= 40 && num < 60) {
main_img.setImageResource(c);
}
else if(num >= 60 && num < 80) {
main_img.setImageResource(d);
}
else if(num >= 80 && num < 100) {
main_img.setImageResource(e);
}
}
else if (level == 3) {
// 6 objects - 2 same coloured
num = random.nextInt(120);
if(num >= 0 && num < 20) {
main_img.setImageResource(f);
}
else if(num >= 20 && num < 40) {
main_img.setImageResource(g);
}
else if(num >= 40 && num < 60) {
main_img.setImageResource(h);
}
else if(num >= 60 && num < 80) {
main_img.setImageResource(ii);
}
else if(num >= 80 && num < 100) {
main_img.setImageResource(j);
}
else if(num >= 100 && num < 120) {
main_img.setImageResource(k);
}
}
else if (level == 4) {
// 6 objects - 3 same coloured
num = random.nextInt(120);
if(num >= 0 && num < 20) {
main_img.setImageResource(l);
}
else if(num >= 20 && num < 40) {
main_img.setImageResource(m);
}
else if(num >= 40 && num < 60) {
main_img.setImageResource(n);
}
else if(num >= 60 && num < 80) {
main_img.setImageResource(o);
}
else if(num >= 80 && num < 100) {
main_img.setImageResource(p);
}
else if(num >= 100 && num < 120) {
main_img.setImageResource(q);
}
}
else if (level == 5) {
// 7 objects - 4 same coloured
num = random.nextInt(140);
if(num >= 0 && num < 20) {
main_img.setImageResource(r);
}
else if(num >= 20 && num < 40) {
main_img.setImageResource(s);
}
else if(num >= 40 && num < 60) {
main_img.setImageResource(t);
}
else if(num >= 60 && num < 80) {
main_img.setImageResource(u);
}
else if(num >= 80 && num < 100) {
main_img.setImageResource(v);
}
else if(num >= 100 && num < 120) {
main_img.setImageResource(w);
}
else if(num >= 120 && num < 140) {
main_img.setImageResource(x);
}
}
} */
/*
if ( age >= 4 && age <= 5 ) {
if (level == 1) {
// 2 objects
num = random.nextInt(100);
if(num % 2 == 0) {
gridModelArrayList.add(new GridModel(a1, a));
}
else {
gridModelArrayList.add(new GridModel(b1, b));
}
}
else if (level == 2) {
// 3 objects
num = random.nextInt(120);
if(num >= 0 && num < 40) {
gridModelArrayList.add(new GridModel(c1, c));
}
else if(num >= 40 && num < 80) {
gridModelArrayList.add(new GridModel(d1, d));
}
else if(num >= 80 && num < 120) {
gridModelArrayList.add(new GridModel(e1, e));
}
}
else if (level == 3) {
// 4 objects
num = random.nextInt(120);
if(num >= 0 && num < 30) {
gridModelArrayList.add(new GridModel(f1, f));
}
else if(num >= 30 && num < 60) {
gridModelArrayList.add(new GridModel(g1, g));
}
else if(num >= 60 && num < 90) {
gridModelArrayList.add(new GridModel(h1, h));
}
else if(num >= 90 && num < 120) {
gridModelArrayList.add(new GridModel(j1, j));
}
}
else if (level == 4) {
// 4 objects - 2 same coloured
num = random.nextInt(120);
if(num >= 0 && num < 30) {
gridModelArrayList.add(new GridModel(l1, l));
}
else if(num >= 30 && num < 60) {
gridModelArrayList.add(new GridModel(m1, m));
}
else if(num >= 60 && num < 90) {
gridModelArrayList.add(new GridModel(p1, p));
}
else if(num >= 90 && num < 120) {
gridModelArrayList.add(new GridModel(q1, q));
}
}
else if (level == 5) {
// 5 objects - 2 same coloured
num = random.nextInt(100);
if(num >= 0 && num < 20) {
gridModelArrayList.add(new GridModel(y1, y));
}
else if(num >= 20 && num < 40) {
gridModelArrayList.add(new GridModel(z1, z));
}
else if(num >= 40 && num < 60) {
gridModelArrayList.add(new GridModel(t1, t));
}
else if(num >= 60 && num < 80) {
gridModelArrayList.add(new GridModel(w1, w));
}
else if(num >= 80 && num < 100) {
gridModelArrayList.add(new GridModel(x1, x));
}
}
}
if (age >= 6 && age <= 7 ){
if (level == 1) {
// 4 objects
num = random.nextInt(120);
if(num >= 0 && num < 30) {
gridModelArrayList.add(new GridModel(a1, a));
}
else if(num >= 30 && num < 60) {
gridModelArrayList.add(new GridModel(b1, b));
}
else if(num >= 60 && num < 90) {
gridModelArrayList.add(new GridModel(c1, c));
}
else if(num >= 90 && num < 120) {
gridModelArrayList.add(new GridModel(d1, d));
}
}
else if (level == 2) {
// 5 objects
num = random.nextInt(100);
if(num >= 0 && num < 20) {
gridModelArrayList.add(new GridModel(a1, a));
}
else if(num >= 20 && num < 40) {
gridModelArrayList.add(new GridModel(b1, b));
}
else if(num >= 40 && num < 60) {
gridModelArrayList.add(new GridModel(c1, c));
}
else if(num >= 60 && num < 80) {
gridModelArrayList.add(new GridModel(d1, d));
}
else if(num >= 80 && num < 100) {
gridModelArrayList.add(new GridModel(e1, e));
}
}
else if (level == 3) {
// 6 objects - 2 same coloured
num = random.nextInt(120);
if(num >= 0 && num < 20) {
gridModelArrayList.add(new GridModel(f1, f));
}
else if(num >= 20 && num < 40) {
gridModelArrayList.add(new GridModel(g1, g));
}
else if(num >= 40 && num < 60) {
gridModelArrayList.add(new GridModel(h1, h));
}
else if(num >= 60 && num < 80) {
gridModelArrayList.add(new GridModel(i1, ii));
}
else if(num >= 80 && num < 100) {
gridModelArrayList.add(new GridModel(j1, j));
}
else if(num >= 100 && num < 120) {
gridModelArrayList.add(new GridModel(k1, k));
}
}
else if (level == 4) {
// 6 objects - 3 same coloured
num = random.nextInt(120);
if(num >= 0 && num < 20) {
gridModelArrayList.add(new GridModel(l1, l));
}
else if(num >= 20 && num < 40) {
gridModelArrayList.add(new GridModel(m1, m));
}
else if(num >= 40 && num < 60) {
gridModelArrayList.add(new GridModel(n1, n));
}
else if(num >= 60 && num < 80) {
gridModelArrayList.add(new GridModel(o1, o));
}
else if(num >= 80 && num < 100) {
gridModelArrayList.add(new GridModel(p1, p));
}
else if(num >= 100 && num < 120) {
gridModelArrayList.add(new GridModel(q1, q));
}
}
else if (level == 5) {
// 7 objects - 4 same coloured
num = random.nextInt(140);
if(num >= 0 && num < 20) {
gridModelArrayList.add(new GridModel(r1, r));
}
else if(num >= 20 && num < 40) {
gridModelArrayList.add(new GridModel(s1, s));
}
else if(num >= 40 && num < 60) {
gridModelArrayList.add(new GridModel(t1, t));
}
else if(num >= 60 && num < 80) {
gridModelArrayList.add(new GridModel(u1, u));
}
else if(num >= 80 && num < 100) {
gridModelArrayList.add(new GridModel(v1, v));
}
else if(num >= 100 && num < 120) {
gridModelArrayList.add(new GridModel(w1, w));
}
else if(num >= 120 && num < 140) {
gridModelArrayList.add(new GridModel(x1, x));
}
}
}*/
\ No newline at end of file
package com.anuththara18.attentionassessment.splashscreen;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.WindowManager;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.language.LanguageActivity;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_splash);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashActivity.this, LanguageActivity.class);
startActivity(intent);
finish();
}
},2000);
}
}
\ No newline at end of file
package com.anuththara18.attentionassessment.sustained;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.pdf.PdfDocument;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import com.anuththara18.attentionassessment.BuildConfig;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.age.AgeActivity;
import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static android.Manifest.permission.MANAGE_EXTERNAL_STORAGE;
import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
public class SA1CompleteScreen extends AppCompatActivity {
ImageView complete;
List<Sustained> dataList;
SQLiteDatabase mDatabase;
// declaring width and height
// for our PDF file.
int pageHeight = 1120;
int pagewidth = 792;
// creating a bitmap variable
// for storing our images
Bitmap bmp, scaledbmp;
// constant code for runtime permissions
private static final int PERMISSION_REQUEST_CODE = 200;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_complete_screen2);
complete = findViewById(R.id.complete);
complete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
finish();
startActivity(intent);
}
});
dataList = new ArrayList<>();
//opening the database
mDatabase = openOrCreateDatabase(SustainedAttentionGame1.DATABASE_NAME, MODE_PRIVATE, null);
/*******************************************************************************************/
// initializing our variables.
bmp = BitmapFactory.decodeResource(getResources(), R.drawable.sustained);
scaledbmp = Bitmap.createScaledBitmap(bmp, 140, 140, false);
// below code is used for
// checking our permissions.
if (checkPermission()) {
//Toast.makeText(this, "Permission Granted", Toast.LENGTH_SHORT).show();
} else {
requestPermission();
}
/*******************************************************************************************/
//this part will display the data in the list
//we used rawQuery(sql, selectionargs) for fetching all the employees
Cursor cursorEmployees = mDatabase.rawQuery("SELECT * FROM sustainedAttention", null);
//if the cursor has some data
if (cursorEmployees.moveToFirst()) {
//looping through all the records
do {
//pushing each record in the employee list
dataList.add(new Sustained(
cursorEmployees.getInt(0),
cursorEmployees.getInt(1),
cursorEmployees.getInt(2),
cursorEmployees.getInt(3),
cursorEmployees.getInt(4),
cursorEmployees.getInt(5),
cursorEmployees.getInt(6),
cursorEmployees.getInt(7)
));
} while (cursorEmployees.moveToNext());
}
//closing the cursor
cursorEmployees.close();
/*******************************************************************************************/
// generate our PDF file.
// creating an object variable
// for our PDF document.
PdfDocument pdfDocument = new PdfDocument();
// two variables for paint "paint" is used
// for drawing shapes and we will use "title"
// for adding text in our PDF file.
Paint paint = new Paint();
Paint title = new Paint();
// we are adding page info to our PDF file
// in which we will be passing our pageWidth,
// pageHeight and number of pages and after that
// we are calling it to create our PDF.
PdfDocument.PageInfo mypageInfo = new PdfDocument.PageInfo.Builder(pagewidth, pageHeight, 1).create();
// below line is used for setting
// start page for our PDF file.
PdfDocument.Page myPage = pdfDocument.startPage(mypageInfo);
// creating a variable for canvas
// from our page of PDF.
Canvas canvas = myPage.getCanvas();
// below line is used to draw our image on our PDF file.
// the first parameter of our drawbitmap method is
// our bitmap
// second parameter is position from left
// third parameter is position from top and last
// one is our variable for paint.
canvas.drawBitmap(scaledbmp, 56, 40, paint);
// below line is used for adding typeface for
// our text which we will be adding in our PDF file.
title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
// below line is used for setting text size
// which we will be displaying in our PDF file.
title.setTextSize(20);
// below line is sued for setting color
// of our text inside our PDF file.
title.setColor(ContextCompat.getColor(this, R.color.orange));
// below line is used to draw text in our PDF file.
// the first parameter is our text, second parameter
// is position from start, third parameter is position from top
// and then we are passing our variable of paint which is title.
canvas.drawText("Sustained Attention", 250, 80, title);
title.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
title.setColor(ContextCompat.getColor(this, R.color.black));
title.setTextSize(15);
canvas.drawText("Age : " + AgeActivity.age, 150, 250, title);
String gender;
if (GenderActivity.gender == 0) {
gender = "Male";
}
else {
gender = "Female";
}
canvas.drawText("Gender: " + gender, 150, 300, title);
/*
canvas.drawText("Child Name: " + gender, 150, 350, title);
canvas.drawText("Parent Name: " + gender, 150, 400, title);
canvas.drawText("Contact No: " + gender, 150, 450, title);
canvas.drawText("Email: " + gender, 150, 500, title);
*/
// similarly we are creating another text and in this
// we are aligning this text to center of our PDF file.
title.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
title.setColor(ContextCompat.getColor(this, R.color.black));
title.setTextSize(15);
// below line is used for setting
// our text to center of PDF.
//title.setTextAlign(Paint.Align.CENTER);
int space = 0;
// Printing elements one by one
for (int i = 0; i < dataList.size(); i++) {
//getting employee of the specified position
Sustained data = dataList.get(i);
Log.d("********************************", "ID : " + String.valueOf(data.getId()) + ", \t" +
"C: " + String.valueOf(data.getChildID()) + ", \t" +
"TCR: " + String.valueOf(data.getTotalCorrectResponses()) + ", \t" +
"CR: " + String.valueOf(data.getNoOfCorrectResponses()) + ", \t" +
"CE: " + String.valueOf(data.getNoOfCommissionErrors()) + ", \t" +
"OE: " + String.valueOf(data.getNoOfOmmissionErrors()) + ", \t" +
"MRT: " + String.valueOf(data.getMeanReactionTime()) + ", \t" +
"TD: " + String.valueOf(data.getTotalDuration()) );
canvas.drawText("ID : " + String.valueOf(data.getId()) + ", \t" +
"C: " + String.valueOf(data.getChildID()) + ", \t" +
"TCR: " + String.valueOf(data.getTotalCorrectResponses()) + ", \t" +
"CR: " + String.valueOf(data.getNoOfCorrectResponses()) + ", \t" +
"CE: " + String.valueOf(data.getNoOfCommissionErrors()) + ", \t" +
"OE: " + String.valueOf(data.getNoOfOmmissionErrors()) + ", \t" +
"MRT: " + String.valueOf(data.getMeanReactionTime()) + ", \t" +
"TD: " + String.valueOf(data.getTotalDuration()) + " ", 150, 350 + space, title);
space = space + 50;
}
// after adding all attributes to our
// PDF file we will be finishing our page.
pdfDocument.finishPage(myPage);
// below line is used to set the name of
// our PDF file and its path.
File file = new File(Environment.getExternalStorageDirectory(), "SustainedAttention1.pdf");
try {
// after creating a file name we will
// write our PDF file to that location.
pdfDocument.writeTo(new FileOutputStream(file));
/*
// Uri path = Uri.fromFile(file);
Uri path = FileProvider.getUriForFile(SA1CompleteScreen.this, BuildConfig.APPLICATION_ID + ".provider", file);
Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
pdfIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
pdfIntent.setDataAndType(path, "application/pdf");
pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try{
startActivity(pdfIntent);
}catch(ActivityNotFoundException e){
Toast.makeText(getApplicationContext(), "No Application available to view PDF", Toast.LENGTH_SHORT).show();
}
*/
// below line is to print toast message
// on completion of PDF generation.
Toast.makeText(getApplicationContext(), "PDF file generated successfully.", Toast.LENGTH_LONG).show();
} catch (IOException e) {
// below line is used
// to handle error
e.printStackTrace();
}
// after storing our pdf to that
// location we are closing our PDF file.
pdfDocument.close();
}
/**************************************************************************************************/
private boolean checkPermission() {
// checking of permissions.
int permission1 = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);
int permission2 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);
int permission3 = ContextCompat.checkSelfPermission(getApplicationContext(), MANAGE_EXTERNAL_STORAGE);
return permission1 == PackageManager.PERMISSION_GRANTED && permission2 == PackageManager.PERMISSION_GRANTED && permission3 == PackageManager.PERMISSION_GRANTED;
}
/**************************************************************************************************/
private void requestPermission() {
// requesting permissions if not provided.
ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE, MANAGE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == PERMISSION_REQUEST_CODE) {
if (grantResults.length > 0) {
/*
Intent intent = new Intent();
intent.setAction(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
Uri uri = Uri.fromParts("package", this.getPackageName(), null);
intent.setData(uri);
startActivity(intent);
*/
// after requesting permissions we are showing
// users a toast message of permission granted.
boolean writeStorage = grantResults[0] == PackageManager.PERMISSION_GRANTED;
boolean readStorage = grantResults[1] == PackageManager.PERMISSION_GRANTED;
if (writeStorage && readStorage) {
//Toast.makeText(this, "Permission Granted..", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "Permission Denined.", Toast.LENGTH_SHORT).show();
finish();
}
}
}
}
/**************************************************************************************************/
}
package com.anuththara18.attentionassessment.sustained;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.pdf.PdfDocument;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import com.anuththara18.attentionassessment.BuildConfig;
import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.age.AgeActivity;
import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static android.Manifest.permission.MANAGE_EXTERNAL_STORAGE;
import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
public class SA2CompleteScreen extends AppCompatActivity {
ImageView complete;
List<Sustained> dataList;
SQLiteDatabase mDatabase;
// declaring width and height
// for our PDF file.
int pageHeight = 1120;
int pagewidth = 792;
// creating a bitmap variable
// for storing our images
Bitmap bmp, scaledbmp;
// constant code for runtime permissions
private static final int PERMISSION_REQUEST_CODE = 200;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_complete_screen2);
complete = findViewById(R.id.complete);
complete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
finish();
startActivity(intent);
}
});
dataList = new ArrayList<>();
//opening the database
mDatabase = openOrCreateDatabase(SustainedAttentionGame2.DATABASE_NAME, MODE_PRIVATE, null);
/*******************************************************************************************/
// initializing our variables.
bmp = BitmapFactory.decodeResource(getResources(), R.drawable.sustained2);
scaledbmp = Bitmap.createScaledBitmap(bmp, 140, 140, false);
// below code is used for
// checking our permissions.
if (checkPermission()) {
//Toast.makeText(this, "Permission Granted", Toast.LENGTH_SHORT).show();
} else {
requestPermission();
}
/*******************************************************************************************/
//this part will display the data in the list
//we used rawQuery(sql, selectionargs) for fetching all the employees
Cursor cursorEmployees = mDatabase.rawQuery("SELECT * FROM sustainedAttention2", null);
//if the cursor has some data
if (cursorEmployees.moveToFirst()) {
//looping through all the records
do {
//pushing each record in the employee list
dataList.add(new Sustained(
cursorEmployees.getInt(0),
cursorEmployees.getInt(1),
cursorEmployees.getInt(2),
cursorEmployees.getInt(3),
cursorEmployees.getInt(4),
cursorEmployees.getInt(5),
cursorEmployees.getInt(6),
cursorEmployees.getInt(7)
));
} while (cursorEmployees.moveToNext());
}
//closing the cursor
cursorEmployees.close();
/*******************************************************************************************/
// generate our PDF file.
// creating an object variable
// for our PDF document.
PdfDocument pdfDocument = new PdfDocument();
// two variables for paint "paint" is used
// for drawing shapes and we will use "title"
// for adding text in our PDF file.
Paint paint = new Paint();
Paint title = new Paint();
// we are adding page info to our PDF file
// in which we will be passing our pageWidth,
// pageHeight and number of pages and after that
// we are calling it to create our PDF.
PdfDocument.PageInfo mypageInfo = new PdfDocument.PageInfo.Builder(pagewidth, pageHeight, 1).create();
// below line is used for setting
// start page for our PDF file.
PdfDocument.Page myPage = pdfDocument.startPage(mypageInfo);
// creating a variable for canvas
// from our page of PDF.
Canvas canvas = myPage.getCanvas();
// below line is used to draw our image on our PDF file.
// the first parameter of our drawbitmap method is
// our bitmap
// second parameter is position from left
// third parameter is position from top and last
// one is our variable for paint.
canvas.drawBitmap(scaledbmp, 56, 40, paint);
// below line is used for adding typeface for
// our text which we will be adding in our PDF file.
title.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
// below line is used for setting text size
// which we will be displaying in our PDF file.
title.setTextSize(20);
// below line is sued for setting color
// of our text inside our PDF file.
title.setColor(ContextCompat.getColor(this, R.color.orange));
// below line is used to draw text in our PDF file.
// the first parameter is our text, second parameter
// is position from start, third parameter is position from top
// and then we are passing our variable of paint which is title.
canvas.drawText("Sustained Attention 2", 250, 80, title);
title.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
title.setColor(ContextCompat.getColor(this, R.color.black));
title.setTextSize(15);
canvas.drawText("Age : " + AgeActivity.age, 150, 250, title);
String gender;
if (GenderActivity.gender == 0) {
gender = "Male";
}
else {
gender = "Female";
}
canvas.drawText("Gender: " + gender, 150, 300, title);
/*
canvas.drawText("Child Name: " + gender, 150, 350, title);
canvas.drawText("Parent Name: " + gender, 150, 400, title);
canvas.drawText("Contact No: " + gender, 150, 450, title);
canvas.drawText("Email: " + gender, 150, 500, title);
*/
// similarly we are creating another text and in this
// we are aligning this text to center of our PDF file.
title.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
title.setColor(ContextCompat.getColor(this, R.color.black));
title.setTextSize(15);
// below line is used for setting
// our text to center of PDF.
//title.setTextAlign(Paint.Align.CENTER);
int space = 0;
// Printing elements one by one
for (int i = 0; i < dataList.size(); i++) {
//getting employee of the specified position
Sustained data = dataList.get(i);
Log.d("********************************", "ID : " + String.valueOf(data.getId()) + ", \t" +
"C: " + String.valueOf(data.getChildID()) + ", \t" +
"TCR: " + String.valueOf(data.getTotalCorrectResponses()) + ", \t" +
"CR: " + String.valueOf(data.getNoOfCorrectResponses()) + ", \t" +
"CE: " + String.valueOf(data.getNoOfCommissionErrors()) + ", \t" +
"OE: " + String.valueOf(data.getNoOfOmmissionErrors()) + ", \t" +
"MRT: " + String.valueOf(data.getMeanReactionTime()) + ", \t" +
"TD: " + String.valueOf(data.getTotalDuration()) );
canvas.drawText("ID : " + String.valueOf(data.getId()) + ", \t" +
"C: " + String.valueOf(data.getChildID()) + ", \t" +
"TCR: " + String.valueOf(data.getTotalCorrectResponses()) + ", \t" +
"CR: " + String.valueOf(data.getNoOfCorrectResponses()) + ", \t" +
"CE: " + String.valueOf(data.getNoOfCommissionErrors()) + ", \t" +
"OE: " + String.valueOf(data.getNoOfOmmissionErrors()) + ", \t" +
"MRT: " + String.valueOf(data.getMeanReactionTime()) + ", \t" +
"TD: " + String.valueOf(data.getTotalDuration()) + " ", 150, 350 + space, title);
space = space + 50;
}
// after adding all attributes to our
// PDF file we will be finishing our page.
pdfDocument.finishPage(myPage);
// below line is used to set the name of
// our PDF file and its path.
File file = new File(Environment.getExternalStorageDirectory(), "SustainedAttention2.pdf");
try {
// after creating a file name we will
// write our PDF file to that location.
pdfDocument.writeTo(new FileOutputStream(file));
/*
// Uri path = Uri.fromFile(file);
Uri path = FileProvider.getUriForFile(SA2CompleteScreen.this, BuildConfig.APPLICATION_ID + ".provider", file);
Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
pdfIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
pdfIntent.setDataAndType(path, "application/pdf");
pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try{
startActivity(pdfIntent);
}catch(ActivityNotFoundException e){
Toast.makeText(getApplicationContext(), "No Application available to view PDF", Toast.LENGTH_SHORT).show();
}
*/
// below line is to print toast message
// on completion of PDF generation.
Toast.makeText(getApplicationContext(), "PDF file generated successfully.", Toast.LENGTH_LONG).show();
} catch (IOException e) {
// below line is used
// to handle error
e.printStackTrace();
}
// after storing our pdf to that
// location we are closing our PDF file.
pdfDocument.close();
}
/**************************************************************************************************/
private boolean checkPermission() {
// checking of permissions.
int permission1 = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);
int permission2 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);
int permission3 = ContextCompat.checkSelfPermission(getApplicationContext(), MANAGE_EXTERNAL_STORAGE);
return permission1 == PackageManager.PERMISSION_GRANTED && permission2 == PackageManager.PERMISSION_GRANTED && permission3 == PackageManager.PERMISSION_GRANTED;
}
/**************************************************************************************************/
private void requestPermission() {
// requesting permissions if not provided.
ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE, MANAGE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == PERMISSION_REQUEST_CODE) {
if (grantResults.length > 0) {
/*
Intent intent = new Intent();
intent.setAction(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
Uri uri = Uri.fromParts("package", this.getPackageName(), null);
intent.setData(uri);
startActivity(intent);
*/
// after requesting permissions we are showing
// users a toast message of permission granted.
boolean writeStorage = grantResults[0] == PackageManager.PERMISSION_GRANTED;
boolean readStorage = grantResults[1] == PackageManager.PERMISSION_GRANTED;
if (writeStorage && readStorage) {
//Toast.makeText(this, "Permission Granted..", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "Permission Denied.", Toast.LENGTH_SHORT).show();
finish();
}
}
}
}
/**************************************************************************************************/
}
package com.anuththara18.attentionassessment.sustained;
public class Sustained {
private int id;
private int childID;
private int totalCorrectResponses;
private int noOfCorrectResponses;
private int noOfCommissionErrors;
private int noOfOmmissionErrors;
private int meanReactionTime;
private int totalDuration;
public Sustained(int id, int childID, int totalCorrectResponses, int noOfCorrectResponses, int noOfCommissionErrors, int noOfOmmissionErrors, int meanReactionTime, int totalDuration) {
this.id = id;
this.childID = childID;
this.totalCorrectResponses = totalCorrectResponses;
this.noOfCorrectResponses = noOfCorrectResponses;
this.noOfCommissionErrors = noOfCommissionErrors;
this.noOfOmmissionErrors = noOfOmmissionErrors;
this.meanReactionTime = meanReactionTime;
this.totalDuration = totalDuration;
}
public int getId() {
return id;
}
public int getChildID() {
return childID;
}
public int getTotalCorrectResponses() {
return totalCorrectResponses;
}
public int getNoOfCorrectResponses() {
return noOfCorrectResponses;
}
public int getNoOfCommissionErrors() {
return noOfCommissionErrors;
}
public int getNoOfOmmissionErrors() {
return noOfOmmissionErrors;
}
public int getMeanReactionTime() {
return meanReactionTime;
}
public int getTotalDuration() {
return totalDuration;
}
/*
CREATE TABLE sustainedAttention (
id int NOT NULL AUTO_INCREMENT,
childID int NOT NULL,
totalCorrectResponses int NOT NULL,
noOfCorrectResponses int NOT NULL,
noOfCommissionErrors int NOT NULL,
noOfOmmissionErrors int NOT NULL,
meanReactionTime int NOT NULL,
totalDuration int NOT NULL,
CONSTRAINT sustainedAttention_pk PRIMARY KEY (id)
);
*/
}
package com.anuththara18.attentionassessment.sustained;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.PorterDuff;
import android.graphics.drawable.AnimationDrawable;
import android.media.MediaPlayer;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
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.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.anuththara18.attentionassessment.CompleteScreen2;
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.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import com.anuththara18.attentionassessment.language.LanguageSetter;
import com.anuththara18.attentionassessment.selective.BirdChoosingActivity;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
public class SustainedAttentionGame1 extends AppCompatActivity {
private static final int CODE_GET_REQUEST = 1024;
private static final int CODE_POST_REQUEST = 1025;
public static final String DATABASE_NAME = "sustainedAttention";
SQLiteDatabase mDatabase;
ImageButton red_btn;
ImageView gifImageView, cross_btn, bird;
TextView textView;
// isi = 10 - 60 secs
Integer[] isi = { 10000, 45000, 25000, 50000, 20000, 35000, 60000, 15000, 30000, 55000, 40000,
10000, 45000, 25000, 50000, 20000, 35000, 60000, 15000, 30000, 55000, 40000,
10000, 15000, 10000, 15000 };
/*Integer[] isi = { 1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000,
1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000,
1000, 1500, 1000, 1500 };*/
Integer[] image = { R.drawable.red_bird_gif,
R.drawable.blue_bird_gif,
R.drawable.green_bird_gif,
R.drawable.black_bird_gif,
R.drawable.blue_bird2_gif,
R.drawable.yellow_bird_gif};
int correctImage, clickedImage;
Random random = new Random();
int randomImage = 0;
int i = 1;
int j = 0;
int duration = 0;
private long startTime, clickedTime = 0;
float reactionTime;
int totalCorrectResponses = 0;
int noOfCorrectResponses = 0;
int noOfCommissionErrors = 0;
int noOfOmmissionErrors = 0;
long totalReactionTime = 0;
int meanReactionTime = 0;
MediaPlayer mp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_sustained_attention_game1);
gifImageView = findViewById(R.id.gifImageView);
red_btn = (ImageButton) findViewById(R.id.red_btn);
cross_btn = (ImageView) findViewById(R.id.cross_btn);
bird = (ImageView) findViewById(R.id.bird);
textView = (TextView) findViewById(R.id.textView);
textView = (TextView) findViewById(R.id.textView);
textView.setText(LanguageSetter.getresources().getString(R.string.susg1));
mp = MediaPlayer.create(getApplicationContext(), R.raw.sustained);
mp.start();
long gameStart = System.currentTimeMillis();
//creating a database
mDatabase = openOrCreateDatabase(DATABASE_NAME, MODE_PRIVATE, null);
//Toast.makeText(getApplicationContext(), BirdChoosingActivity.birdSelected.toString(), Toast.LENGTH_SHORT).show();
Log.d("******************************", String.valueOf(BirdChoosingActivity.birdSelected));
new Runnable() {
int updateInterval;
@Override
public void run() {
if ( i <= 51 ) { // tot duration - 14.5 mins = 870000
//385000 , 770000, (50000)
if ( i % 2 != 0 || totalCorrectResponses > 25 ) {
randomImage = random.nextInt(6);
bird.setVisibility(View.INVISIBLE);
gifImageView.setVisibility(View.VISIBLE);
gifImageView.setImageResource(image[randomImage]);
clickedImage = image[randomImage];
updateInterval = isi[j];
Log.d("radomTimer", String.valueOf(i + " " + updateInterval));
gifImageView.postDelayed(this, updateInterval);
duration = duration + updateInterval;
i++;
j++;
}
// appearance - 0.5s * 25 times
else if ( totalCorrectResponses <= 25 ) {
Log.d("radomTimer", String.valueOf(i + " 2000" ));
Log.d("******************************", "start 1");
if (BirdChoosingActivity.birdSelected == 1) {
bird.setImageResource(R.drawable.blue_bird);
clickedImage = R.drawable.blue_bird;
}
else if (BirdChoosingActivity.birdSelected == 2) {
Log.d("******************************", "start 2");
bird.setImageResource(R.drawable.yellow_bird);
clickedImage = R.drawable.yellow_bird;
}
else if (BirdChoosingActivity.birdSelected == 3) {
bird.setImageResource(R.drawable.red_angry_bird);
clickedImage = R.drawable.red_angry_bird;
}
else if (BirdChoosingActivity.birdSelected == 4) {
bird.setImageResource(R.drawable.woody_bird);
clickedImage = R.drawable.woody_bird;
}
bird.setVisibility(View.VISIBLE);
gifImageView.setVisibility(View.INVISIBLE);
startTime = System.currentTimeMillis();
gifImageView.postDelayed(this, 2000);
totalCorrectResponses++;
duration = duration + 2000;
i++;
}
}
else {
long gameEnd = System.currentTimeMillis();
long seconds = (gameEnd - gameStart) / 1000;
meanReactionTime = (int) Math.ceil(totalReactionTime / noOfCorrectResponses); // ms
Log.d("****************************************************", "****************************************************");
Log.d("Game Time", String.valueOf(seconds));
Log.d("total", String.valueOf(totalCorrectResponses));
Log.d("correctResponses", String.valueOf(noOfCorrectResponses));
noOfOmmissionErrors = totalCorrectResponses - noOfCorrectResponses;
Log.d("omissionErrors", String.valueOf(totalCorrectResponses - noOfCorrectResponses));
Log.d("commissionErrors", String.valueOf(noOfCommissionErrors));
Log.d("meanReactionTime", String.valueOf(meanReactionTime));
Log.d("duration", String.valueOf(duration));
saveDataToOnlineDB();
createTable();
saveDataToLocalDB();
Intent intent = new Intent(getApplicationContext(), SA1CompleteScreen.class);
finish();
mp.pause();
startActivity(intent);
}
}
}.run();
if (BirdChoosingActivity.birdSelected == 1) {
correctImage = R.drawable.blue_bird;
}
else if (BirdChoosingActivity.birdSelected == 2) {
correctImage = R.drawable.yellow_bird;
}
else if (BirdChoosingActivity.birdSelected == 3) {
correctImage = R.drawable.red_angry_bird;
}
else if (BirdChoosingActivity.birdSelected == 4) {
correctImage = R.drawable.woody_bird;
}
red_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
clickedTime = System.currentTimeMillis();
reactionTime = ( clickedTime - startTime );
if (correctImage == clickedImage) {
totalReactionTime = (long) (totalReactionTime + reactionTime);
Log.d("correct " , startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++;
}
else if (reactionTime < 4000) {
totalReactionTime = (long) (totalReactionTime + reactionTime);
Log.d("correct " , startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++;
}
else {
noOfCommissionErrors++;
Log.d( "wrong" , startTime + " " + clickedTime + " " + reactionTime);
}
}
});
cross_btn.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN: {
cross_btn.getBackground().setColorFilter(0x77000000, PorterDuff.Mode.SRC_ATOP);
view.invalidate();
break;
}
case MotionEvent.ACTION_UP:
alert();
mp.pause();
case MotionEvent.ACTION_CANCEL: {
cross_btn.getBackground().clearColorFilter();
view.invalidate();
break;
}
}
return true;
}
});
}
/*************************************************************************************************/
@Override
public void onBackPressed() {
super.onBackPressed();
mp.pause();
}
/*************************************************************************************************/
private void alert() {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setMessage("Do you really want to quit the game?");
alertDialogBuilder.setPositiveButton("yes",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
Intent intent = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
finish();
startActivity(intent);
//Toast.makeText(FocusedAttentionGame1.this,"You clicked yes button",Toast.LENGTH_LONG).show();
}
});
alertDialogBuilder.setNegativeButton("No",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//finish();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
/*************************************************************************************************/
private void saveDataToOnlineDB() {
String child = String.valueOf(GenderActivity.gender) + String.valueOf(AgeActivity.age);
int child_ID = Integer.parseInt(child);
int total_correct_responses = totalCorrectResponses;
int no_of_correct_responses = noOfCorrectResponses;
int no_of_ommission_errors = noOfOmmissionErrors;
int no_of_commission_errors = noOfCommissionErrors;
int mean_reaction_time = (int) meanReactionTime;
int total_duration = duration;
HashMap<String, Integer> params = new HashMap<>();
params.put("childID", child_ID);
params.put("totalCorrectResponses", total_correct_responses);
params.put("noOfCorrectResponses", no_of_correct_responses);
params.put("noOfCommissionErrors", no_of_commission_errors);
params.put("noOfOmmissionErrors", no_of_ommission_errors);
params.put("meanReactionTime", mean_reaction_time);
params.put("totalDuration", total_duration);
//Calling the create hero API
PerformNetworkRequest request = new PerformNetworkRequest(Api.URL_SUSTAINED_ATTENTION, params, CODE_POST_REQUEST);
request.execute();
}
/*************************************************************************************************/
//inner class to perform network request extending an AsyncTask
private class PerformNetworkRequest extends AsyncTask<Void, Void, String> {
//the url where we need to send the request
String url;
//the parameters
HashMap<String, Integer> params;
//the request code to define whether it is a GET or POST
int requestCode;
//constructor to initialize values
PerformNetworkRequest(String url, HashMap<String, Integer> params, int requestCode) {
this.url = url;
this.params = params;
this.requestCode = requestCode;
}
//when the task started displaying a progressbar
@Override
protected void onPreExecute() {
super.onPreExecute();
}
//this method will give the response from the request
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
try {
JSONObject object = new JSONObject(s);
if (!object.getBoolean("error")) {
Toast.makeText(getApplicationContext(), object.getString("message"), Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
//the network operation will be performed in background
@Override
protected String doInBackground(Void... voids) {
RequestHandler requestHandler = new RequestHandler();
if (requestCode == CODE_POST_REQUEST)
return requestHandler.sendPostRequest(url, params);
if (requestCode == CODE_GET_REQUEST)
return requestHandler.sendGetRequest(url);
return null;
}
}
/*************************************************************************************************/
private void createTable() {
mDatabase.execSQL(
"CREATE TABLE IF NOT EXISTS sustainedAttention (\n" +
" id INTEGER PRIMARY KEY AUTOINCREMENT,\n" +
" childID int 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" +
");"
);
}
/*************************************************************************************************/
private void saveDataToLocalDB() {
String child = String.valueOf(GenderActivity.gender) + String.valueOf(AgeActivity.age);
int child_ID = Integer.parseInt(child);
int total_correct_responses = totalCorrectResponses;
int no_of_correct_responses = noOfCorrectResponses;
int no_of_ommission_errors = noOfOmmissionErrors;
int no_of_commission_errors = noOfCommissionErrors;
int mean_reaction_time = (int) meanReactionTime;
int total_duration = duration;
String insertSQL = "INSERT INTO sustainedAttention \n" +
"(childID, totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration)\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});
Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
}
/*************************************************************************************************/
}
\ No newline at end of file
package com.anuththara18.attentionassessment.sustained;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.PorterDuff;
import android.media.MediaPlayer;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import com.anuththara18.attentionassessment.CompleteScreen2;
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.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import com.anuththara18.attentionassessment.language.LanguageSetter;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Random;
public class SustainedAttentionGame2 extends AppCompatActivity {
private static final int CODE_GET_REQUEST = 1024;
private static final int CODE_POST_REQUEST = 1025;
public static final String DATABASE_NAME = "sustainedAttention2";
SQLiteDatabase mDatabase;
ImageButton red_btn;
ImageView bird, cross_btn;
TextView textView;
// isi = 10 - 60 secs
Integer[] isi = { 10000, 45000, 25000, 50000, 20000, 35000, 60000, 15000, 30000, 55000, 40000,
10000, 45000, 25000, 50000, 20000, 35000, 60000, 15000, 30000, 55000, 40000,
10000, 15000, 10000, 15000 };
/*Integer[] isi = { 1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000,
1000, 4500, 2500, 5000, 2000, 3500, 6000, 1500, 3000, 5500, 4000,
1000, 1500, 1000, 1500 };*/
Integer[] image = { R.drawable.red_bird_gif,
R.drawable.blue_bird_gif,
R.drawable.green_bird_gif,
R.drawable.black_bird_gif};
int correctImage, clickedImage;
Random random = new Random();
int randomImage = 0;
int i = 1;
int j = 0;
int duration = 0;
private long startTime, clickedTime = 0;
float reactionTime;
int totalCorrectResponses = 0;
int noOfCorrectResponses = 0;
int noOfCommissionErrors = 0;
int noOfOmmissionErrors = 0;
long totalReactionTime = 0;
int meanReactionTime = 0;
MediaPlayer mp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_sustained_attention_game2);
bird = findViewById(R.id.bird);
red_btn = (ImageButton) findViewById(R.id.red_btn);
cross_btn = (ImageView) findViewById(R.id.cross_btn);
textView = (TextView) findViewById(R.id.textView);
textView.setText(LanguageSetter.getresources().getString(R.string.susg1));
mp = MediaPlayer.create(getApplicationContext(), R.raw.divided);
mp.start();
long gameStart = System.currentTimeMillis();
//creating a database
mDatabase = openOrCreateDatabase(DATABASE_NAME, MODE_PRIVATE, null);
new Runnable() {
int updateInterval;
@Override
public void run() {
if ( i <= 51 ) { // tot duration - 14.5 mins = 870000
//385000 , 770000, (50000)
if ( i % 2 != 0 || totalCorrectResponses > 25 ) {
randomImage = random.nextInt(4);
bird.setVisibility(View.INVISIBLE);
//gifImageView.setImageResource(image[randomImage]);
clickedImage = image[randomImage];
updateInterval = isi[j];
Log.d("radomTimer", String.valueOf(i + " " + updateInterval));
bird.postDelayed(this, updateInterval);
duration = duration + updateInterval;
i++;
j++;
}
// appearance - 0.5s * 25 times
else if ( totalCorrectResponses <= 25 ) {
Log.d("radomTimer", String.valueOf(i + " 2000" ));
bird.setVisibility(View.VISIBLE);
startTime = System.currentTimeMillis();
clickedImage = R.drawable.blue_bird;
bird.postDelayed(this, 2000);
totalCorrectResponses++;
duration = duration + 2000;
i++;
}
}
else {
long gameEnd = System.currentTimeMillis();
long seconds = (gameEnd - gameStart) / 1000;
meanReactionTime = (int) Math.ceil(totalReactionTime / noOfCorrectResponses); // ms
Log.d("****************************************************", "****************************************************");
Log.d("Game Time", String.valueOf(seconds));
Log.d("total", String.valueOf(totalCorrectResponses));
Log.d("correctResponses", String.valueOf(noOfCorrectResponses));
noOfOmmissionErrors = totalCorrectResponses - noOfCorrectResponses;
Log.d("omissionErrors", String.valueOf(totalCorrectResponses - noOfCorrectResponses));
Log.d("commissionErrors", String.valueOf(noOfCommissionErrors));
Log.d("meanReactionTime", String.valueOf(meanReactionTime));
Log.d("duration", String.valueOf(duration));
saveDataToOnlineDB();
createTable();
saveDataToLocalDB();
Intent intent = new Intent(getApplicationContext(), SA2CompleteScreen.class);
finish();
mp.pause();
startActivity(intent);
}
}
}.run();
correctImage = R.drawable.blue_bird;
red_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
clickedTime = System.currentTimeMillis();
reactionTime = ( clickedTime - startTime );
if (correctImage == clickedImage) {
totalReactionTime = (long) (totalReactionTime + reactionTime);
Log.d("correct " , startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++;
}
else if (reactionTime < 4000) {
totalReactionTime = (long) (totalReactionTime + reactionTime);
Log.d("correct " , startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++;
}
else {
noOfCommissionErrors++;
Log.d( "wrong" , startTime + " " + clickedTime + " " + reactionTime);
}
}
});
cross_btn.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN: {
cross_btn.getBackground().setColorFilter(0x77000000, PorterDuff.Mode.SRC_ATOP);
view.invalidate();
break;
}
case MotionEvent.ACTION_UP:
alert();
mp.pause();
case MotionEvent.ACTION_CANCEL: {
cross_btn.getBackground().clearColorFilter();
view.invalidate();
break;
}
}
return true;
}
});
}
/*************************************************************************************************/
@Override
public void onBackPressed() {
super.onBackPressed();
mp.pause();
}
/*************************************************************************************************/
private void alert() {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setMessage("Do you really want to quit the game?");
alertDialogBuilder.setPositiveButton("yes",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
Intent intent = new Intent(getApplicationContext(), NavigationDrawerActivity.class);
finish();
startActivity(intent);
//Toast.makeText(FocusedAttentionGame1.this,"You clicked yes button",Toast.LENGTH_LONG).show();
}
});
alertDialogBuilder.setNegativeButton("No",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//finish();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
/*************************************************************************************************/
private void saveDataToOnlineDB() {
String child = String.valueOf(GenderActivity.gender) + String.valueOf(AgeActivity.age) + "9";
int child_ID = Integer.parseInt(child);
int total_correct_responses = totalCorrectResponses;
int no_of_correct_responses = noOfCorrectResponses;
int no_of_ommission_errors = noOfOmmissionErrors;
int no_of_commission_errors = noOfCommissionErrors;
int mean_reaction_time = (int) meanReactionTime;
int total_duration = duration;
HashMap<String, Integer> params = new HashMap<>();
params.put("childID", child_ID);
params.put("totalCorrectResponses", total_correct_responses);
params.put("noOfCorrectResponses", no_of_correct_responses);
params.put("noOfCommissionErrors", no_of_commission_errors);
params.put("noOfOmmissionErrors", no_of_ommission_errors);
params.put("meanReactionTime", mean_reaction_time);
params.put("totalDuration", total_duration);
//Calling the create hero API
PerformNetworkRequest request = new PerformNetworkRequest(Api.URL_SUSTAINED_ATTENTION, params, CODE_POST_REQUEST);
request.execute();
}
/*************************************************************************************************/
//inner class to perform network request extending an AsyncTask
private class PerformNetworkRequest extends AsyncTask<Void, Void, String> {
//the url where we need to send the request
String url;
//the parameters
HashMap<String, Integer> params;
//the request code to define whether it is a GET or POST
int requestCode;
//constructor to initialize values
PerformNetworkRequest(String url, HashMap<String, Integer> params, int requestCode) {
this.url = url;
this.params = params;
this.requestCode = requestCode;
}
//when the task started displaying a progressbar
@Override
protected void onPreExecute() {
super.onPreExecute();
}
//this method will give the response from the request
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
try {
JSONObject object = new JSONObject(s);
if (!object.getBoolean("error")) {
Toast.makeText(getApplicationContext(), object.getString("message"), Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
//the network operation will be performed in background
@Override
protected String doInBackground(Void... voids) {
RequestHandler requestHandler = new RequestHandler();
if (requestCode == CODE_POST_REQUEST)
return requestHandler.sendPostRequest(url, params);
if (requestCode == CODE_GET_REQUEST)
return requestHandler.sendGetRequest(url);
return null;
}
}
/*************************************************************************************************/
private void createTable() {
mDatabase.execSQL(
"CREATE TABLE IF NOT EXISTS sustainedAttention (\n" +
" id INTEGER PRIMARY KEY AUTOINCREMENT,\n" +
" childID int 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" +
");"
);
}
/*************************************************************************************************/
private void saveDataToLocalDB() {
String child = String.valueOf(GenderActivity.gender) + String.valueOf(AgeActivity.age);
int child_ID = Integer.parseInt(child);
int total_correct_responses = totalCorrectResponses;
int no_of_correct_responses = noOfCorrectResponses;
int no_of_ommission_errors = noOfOmmissionErrors;
int no_of_commission_errors = noOfCommissionErrors;
int mean_reaction_time = (int) meanReactionTime;
int total_duration = duration;
String insertSQL = "INSERT INTO sustainedAttention \n" +
"(childID, totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration)\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});
Toast.makeText(this, "Data Added Successfully", Toast.LENGTH_SHORT).show();
}
/*************************************************************************************************/
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator" >
<alpha
android:fromAlpha="0"
android:toAlpha="1"
android:duration="100" >
</alpha>
<alpha
android:startOffset="2000"
android:fromAlpha="1"
android:toAlpha="0"
android:duration="2000" >
</alpha>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true" >
<scale
android:duration="500"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:interpolator="@android:anim/linear_interpolator"
android:toXScale="1.0"
android:toYScale="0.0" />
</set>
\ No newline at end of file
<?xml version = "1.0" encoding = "utf-8" ?>
<shape
android:shape = "rectangle"
xmlns:android = "http://schemas.android.com/apk/res/android" >
<gradient
android:startColor = "#4BA7F3"
android:centerColor="#1A629C"
android:endColor = "#042A57"
android:angle = "315"
android:type = "linear" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="360"
android:startColor="#FFA80A"
android:endColor="#F22E63"
android:type="linear" />
<corners android:radius="7dp"/>
</shape>
</item>
<item
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp">
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#FFF3CE" />
<corners android:radius="7dp"/>
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M20.01,15.38c-1.23,0 -2.42,-0.2 -3.53,-0.56 -0.35,-0.12 -0.74,-0.03 -1.01,0.24l-1.57,1.97c-2.83,-1.35 -5.48,-3.9 -6.89,-6.83l1.95,-1.66c0.27,-0.28 0.35,-0.67 0.24,-1.02 -0.37,-1.11 -0.56,-2.3 -0.56,-3.53 0,-0.54 -0.45,-0.99 -0.99,-0.99H4.19C3.65,3 3,3.24 3,3.99 3,13.28 10.73,21 20.01,21c0.71,0 0.99,-0.63 0.99,-1.18v-3.45c0,-0.54 -0.45,-0.99 -0.99,-0.99z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M3,13h8L11,3L3,3v10zM3,21h8v-6L3,15v6zM13,21h8L21,11h-8v10zM13,3v6h8L21,3h-8z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,19h-2v-2h2v2zM15.07,11.25l-0.9,0.92C13.45,12.9 13,13.5 13,15h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2L8,9c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88 -0.36,1.68 -0.93,2.25z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"
android:pathData="M11,7L9.6,8.4l2.6,2.6H2v2h10.2l-2.6,2.6L11,17l5,-5L11,7zM20,19h-8v2h8c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2h-8v2h8V19z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"
android:pathData="M17,7l-1.41,1.41L18.17,11H8v2h10.17l-2.58,2.58L17,17l5,-5zM4,5h8V3H4c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h8v-2H4V5z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M20,6h-4V4c0,-1.1 -0.9,-2 -2,-2h-4C8.9,2 8,2.9 8,4v2H4C2.9,6 2,6.9 2,8v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V8C22,6.9 21.1,6 20,6zM10,4h4v2h-4V4zM16,15h-3v3h-2v-3H8v-2h3v-3h2v3h3V15z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,5c1.66,0 3,1.34 3,3s-1.34,3 -3,3 -3,-1.34 -3,-3 1.34,-3 3,-3zM12,19.2c-2.5,0 -4.71,-1.28 -6,-3.22 0.03,-1.99 4,-3.08 6,-3.08 1.99,0 5.97,1.09 6,3.08 -1.29,1.94 -3.5,3.22 -6,3.22z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12c0,5.52 4.48,10 10,10s10,-4.48 10,-10C22,6.48 17.52,2 12,2zM19.46,9.12l-2.78,1.15c-0.51,-1.36 -1.58,-2.44 -2.95,-2.94l1.15,-2.78C16.98,5.35 18.65,7.02 19.46,9.12zM12,15c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3s3,1.34 3,3S13.66,15 12,15zM9.13,4.54l1.17,2.78c-1.38,0.5 -2.47,1.59 -2.98,2.97L4.54,9.13C5.35,7.02 7.02,5.35 9.13,4.54zM4.54,14.87l2.78,-1.15c0.51,1.38 1.59,2.46 2.97,2.96l-1.17,2.78C7.02,18.65 5.35,16.98 4.54,14.87zM14.88,19.46l-1.15,-2.78c1.37,-0.51 2.45,-1.59 2.95,-2.97l2.78,1.17C18.65,16.98 16.98,18.65 14.88,19.46z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"
android:pathData="M20,3H4C2.9,3 2,3.9 2,5v14c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V5C22,3.9 21.1,3 20,3zM10,17H5v-2h5V17zM10,13H5v-2h5V13zM10,9H5V7h5V9zM14.82,15L12,12.16l1.41,-1.41l1.41,1.42L17.99,9l1.42,1.42L14.82,15z"
android:fillType="evenOdd"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="360"
android:startColor="#00FFFF"
android:endColor="#0523E3"
android:type="linear" />
<corners android:radius="7dp"/>
</shape>
</item>
<item
android:bottom="3dp"
android:left="3dp"
android:right="3dp"
android:top="3dp">
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#575757" />
<corners android:radius="7dp"/>
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version = "1.0" encoding = "utf-8" ?>
<shape
android:shape = "rectangle"
xmlns:android = "http://schemas.android.com/apk/res/android" >
<gradient
android:startColor = "#277A03"
android:centerColor="#3BFF34"
android:endColor = "#277A03"
android:angle = "315"
android:type = "linear" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="360"
android:startColor="#00FFFF"
android:endColor="#0523E3"
android:type="linear" />
<corners android:radius="7dp"/>
</shape>
</item>
<item
android:bottom="3dp"
android:left="3dp"
android:right="3dp"
android:top="3dp">
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@android:color/holo_green_light" />
<corners android:radius="7dp"/>
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="360"
android:startColor="#00FFFF"
android:endColor="#0523E3"
android:type="linear" />
<corners android:radius="7dp"/>
</shape>
</item>
<item
android:bottom="3dp"
android:left="3dp"
android:right="3dp"
android:top="3dp">
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@android:color/holo_red_light" />
<corners android:radius="7dp"/>
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="360"
android:startColor="#157FD3"
android:endColor="#0319A5"
android:type="linear" />
<corners android:radius="7dp"/>
</shape>
</item>
<item
android:bottom="4dp"
android:left="4dp"
android:right="4dp"
android:top="4dp">
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#1BB3F8" />
<corners android:radius="7dp"/>
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="Aclonica"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="Acme"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="name=Poppins&amp;weight=700"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="name=Poppins&amp;weight=500"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>
<?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/bg2"
tools:context=".age.AgeActivity">
<TextView
android:id="@+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:drawableStart="@drawable/icon_left"
android:drawableTint="@color/black"
android:fontFamily="@font/poppins_medium"
android:gravity="center"
android:paddingLeft="30dp"
android:text="@string/previous"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/selectAge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:fontFamily="@font/poppins_bold"
android:paddingLeft="30dp"
android:text="@string/age"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="22sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:drawableEnd="@drawable/icon_right"
android:drawableTint="@color/black"
android:fontFamily="@font/poppins_medium"
android:gravity="center"
android:paddingRight="30dp"
android:text="@string/next"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="125dp"
android:layout_marginBottom="-8dp"
android:src="@drawable/stick"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="@+id/bunny_img"
android:layout_width="220dp"
android:layout_height="190dp"
android:layout_marginStart="40dp"
android:layout_marginBottom="108dp"
android:src="@drawable/age_bunny"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/age_txt"
android:layout_width="54dp"
android:layout_height="113dp"
android:layout_marginStart="128dp"
android:layout_marginBottom="10dp"
android:fontFamily="@font/poppins_bold"
android:text="4"
android:textColor="@color/black"
android:textSize="78sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/bunny_img"
app:layout_constraintStart_toStartOf="@+id/bunny_img" />
<ImageButton
android:id="@+id/right_btn"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginEnd="18dp"
android:layout_marginBottom="25dp"
android:background="@drawable/right_btn"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ImageButton
android:id="@+id/left_btn"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginStart="18dp"
android:layout_marginBottom="25dp"
android:background="@drawable/left_btn"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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/bg8"
tools:context=".alternating.AlternatingAttentionGame1">
<ImageView
android:id="@+id/imageView6"
android:layout_width="46dp"
android:layout_height="match_parent"
android:src="@drawable/divider_stick"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" />
<ImageButton
android:id="@+id/cross_btn"
android:layout_width="45dp"
android:layout_height="45dp"
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="45dp"
android:layout_height="45dp"
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="550dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:fontFamily="@font/poppins_bold"
android:text="@string/altg1"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="22sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<pl.droidsonroids.gif.GifImageView
android:id="@+id/imageView1"
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/red_angry_bird"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/imageView6"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<pl.droidsonroids.gif.GifImageView
android:id="@+id/imageView2"
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/blowing_crab"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/imageView6"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/red_btn_right"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="-25dp"
android:background="@drawable/red_btn"
android:elevation="80dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ImageButton
android:id="@+id/red_btn_left"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginStart="10dp"
android:layout_marginBottom="-25dp"
android:background="@drawable/red_btn"
android:elevation="80dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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/bg5"
tools:context=".selective.BirdChoosingActivity">
<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/textview8"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:textAlignment="center"
android:layout_marginStart="30dp"
android:layout_marginTop="80dp"
android:layout_marginEnd="30dp"
android:fontFamily="@font/poppins_bold"
android:text="@string/birdselect"
android:textColor="@color/black"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="40dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textview8">
<androidx.cardview.widget.CardView
android:id="@+id/bird1"
android:layout_width="175dp"
android:layout_height="175dp"
android:layout_gravity="center"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">
<LinearLayout
android:id="@+id/l1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gridview_background"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="@drawable/bluey" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/bird2"
android:layout_width="175dp"
android:layout_height="175dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">
<LinearLayout
android:id="@+id/l2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gridview_background"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:src="@drawable/twety" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout1">
<androidx.cardview.widget.CardView
android:id="@+id/bird3"
android:layout_width="175dp"
android:layout_height="175dp"
android:layout_gravity="center"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">
<LinearLayout
android:id="@+id/l3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gridview_background"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:src="@drawable/red_angry_bird" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/bird4"
android:layout_width="175dp"
android:layout_height="175dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">
<LinearLayout
android:id="@+id/l4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gridview_background"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="@drawable/woody" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<ImageButton
android:id="@+id/imageButton"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center"
android:layout_marginBottom="30dp"
android:background="@drawable/complete"
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
<?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/bg1"
tools:context=".CompleteScreen">
<!-- LANDSCAPE -->
<pl.droidsonroids.gif.GifImageView
android:id="@+id/gifImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="50dp"
android:src="@drawable/complete_gif2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/complete"
android:layout_width="0dp"
android:layout_height="50dp"
android:src="@drawable/tap_to_continue"
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
<?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/bg5"
tools:context=".CompleteScreen2">
<pl.droidsonroids.gif.GifImageView
android:id="@+id/gifImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="150dp"
android:src="@drawable/complete_gif2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/complete"
android:layout_width="0dp"
android:layout_height="50dp"
android:src="@drawable/tap_to_continue"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/gifImageView" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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:orientation="vertical"
android:background="#F6F6F6"
tools:context=".consentform.ConsentFormActivity">
<TextView
android:id="@+id/next"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:drawableEnd="@drawable/icon_right"
android:drawableTint="@color/black"
android:gravity="right"
android:paddingRight="30dp"
android:text="@string/proceed"
android:textColor="@color/black"
android:textSize="16sp" />
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:layout_marginTop="10dp"
android:text="@string/consentForm"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="20sp"
android:textStyle="bold"
android:gravity="center_horizontal" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp" />
</LinearLayout>
\ No newline at end of file
<?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/bg5"
tools:context=".dividedattention.DividedAttentionGame1">
<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/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="70dp"
android:fontFamily="@font/poppins_bold"
android:gravity="center"
android:text="@string/divg1"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/sq1"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_marginTop="15dp"
android:src="@color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
<ImageView
android:id="@+id/sq2"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_marginTop="25dp"
android:src="@color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sq1" />
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="-25dp"
android:src="@drawable/grass2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent" />
<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
<?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/bg3"
tools:context=".focused.FocusedAttentionGame1">
<ImageButton
android:id="@+id/cross_btn"
android:layout_width="45dp"
android:layout_height="45dp"
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="45dp"
android:layout_height="45dp"
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="550dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:fontFamily="@font/poppins_bold"
android:text="@string/focg1"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="22sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/imageView"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_marginBottom="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" />
<ImageButton
android:id="@+id/red_btn"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="-20dp"
android:background="@drawable/red_btn"
android:elevation="80dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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="#00B0FF"
tools:context=".focused.FocusedAttentionGame2">
<ImageButton
android:id="@+id/cross_btn"
android:layout_width="45dp"
android:layout_height="45dp"
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="45dp"
android:layout_height="45dp"
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="550dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:fontFamily="@font/poppins_bold"
android:text="@string/susg1"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="22sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/imageView4"
android:layout_width="400dp"
android:layout_height="340dp"
android:background="@drawable/cave"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.782"
app:layout_constraintStart_toStartOf="parent"
tools:layout_marginBottom="-20dp" />
<ImageView
android:id="@+id/imageView5"
android:layout_width="350dp"
android:layout_height="300dp"
android:background="@drawable/cave"
app:layout_constraintBottom_toBottomOf="parent"
tools:layout_marginBottom="-18dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="-70dp"
/>
<ImageView
android:layout_width="280dp"
android:layout_height="230dp"
android:background="@drawable/cave"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.31"
app:layout_constraintStart_toStartOf="parent"
tools:layout_marginBottom="0dp" />
<ImageView
android:layout_width="290dp"
android:layout_height="240dp"
android:layout_marginRight="-70dp"
android:background="@drawable/cave"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
tools:layout_marginBottom="0dp" />
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="110dp"
android:layout_marginBottom="-8dp"
android:src="@drawable/grass1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent" />
<ImageButton
android:id="@+id/bear1"
android:layout_width="167dp"
android:layout_height="133dp"
android:layout_marginBottom="16dp"
android:background="@drawable/bear"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.028"
app:layout_constraintStart_toStartOf="parent" />
<ImageButton
android:id="@+id/bear2"
android:layout_width="139dp"
android:layout_height="112dp"
android:layout_marginBottom="16dp"
android:background="@drawable/bear"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.359"
app:layout_constraintStart_toStartOf="parent" />
<ImageButton
android:id="@+id/bear3"
android:layout_width="189dp"
android:layout_height="151dp"
android:layout_marginBottom="16dp"
android:background="@drawable/bear"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.671"
app:layout_constraintStart_toStartOf="parent" />
<ImageButton
android:id="@+id/bear4"
android:layout_width="132dp"
android:layout_height="104dp"
android:layout_marginBottom="24dp"
android:background="@drawable/bear"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.984"
app:layout_constraintStart_toStartOf="parent" />
<ImageButton
android:id="@+id/imageButton9"
android:layout_width="57dp"
android:layout_height="43dp"
android:layout_marginTop="16dp"
android:background="@drawable/bear"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.384"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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/bg1"
tools:context=".gender.GenderActivity">
<TextView
android:id="@+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:drawableStart="@drawable/icon_left"
android:drawableTint="@color/black"
android:fontFamily="@font/poppins_medium"
android:gravity="center"
android:paddingLeft="30dp"
android:text="@string/previous"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/selectGender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:fontFamily="@font/poppins_bold"
android:text="@string/gender"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="22sp"
android:textStyle="bold"
android:gravity="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:drawableEnd="@drawable/icon_right"
android:drawableTint="@color/black"
android:fontFamily="@font/poppins_medium"
android:gravity="center"
android:paddingRight="30dp"
android:text="@string/next"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="110dp"
android:layout_marginBottom="-8dp"
android:src="@drawable/grass1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="@+id/boy_img"
android:layout_width="150dp"
android:layout_height="250dp"
android:layout_marginStart="50dp"
android:layout_marginBottom="15dp"
android:src="@drawable/boy"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="@+id/girl_img"
android:layout_width="190dp"
android:layout_height="280dp"
android:layout_marginEnd="50dp"
android:src="@drawable/girl"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ImageButton
android:id="@+id/toggle_btn"
android:layout_width="150dp"
android:layout_height="150dp"
android:background="@drawable/toggle_left"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/girl_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="-50dp"
android:layout_marginBottom="80dp"
android:fontFamily="@font/acme"
android:text="@string/girl"
android:textColor="#F22E63"
android:textSize="30sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/girl_img" />
<TextView
android:id="@+id/boy_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="-15dp"
android:layout_marginBottom="80dp"
android:fontFamily="@font/acme"
android:text="@string/boy"
android:textColor="#007CDF"
android:textSize="30sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/boy_img" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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="@color/white"
tools:context=".consentform.GetParentsConsentActivity">
<TextView
android:id="@+id/next"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:drawableEnd="@drawable/icon_right"
android:drawableTint="@color/black"
android:gravity="right"
android:paddingRight="30dp"
android:text="@string/proceed"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="120dp"
android:gravity="center"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:text="@string/provideconsent"
android:textColor="@color/black"
android:textSize="17sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/fingerprintImageView"
android:layout_width="300dp"
android:layout_height="200dp"
android:layout_marginTop="50dp"
android:maxHeight="200dp"
android:src="@drawable/fingerprint"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView3" />
<Button
android:id="@+id/btnGetSignature"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:layout_marginTop="20dp"
android:layout_marginRight="70dp"
android:background="@color/blue"
android:text="@string/getSignature"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="normal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/fingerprintImageView" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".consentform.GetSignatureActivity">
<LinearLayout
android:id="@+id/canvasLL"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#fff"
android:orientation="vertical" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btnclear"
android:layout_gravity="center"
android:text="Clear"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btnsave"
android:layout_gravity="center"
android:text="Save"/>
</LinearLayout>
\ No newline at end of file
<?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/bg1"
tools:context=".language.LanguageActivity">
<TextView
android:id="@+id/selectLanguage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:fontFamily="@font/poppins_bold"
android:paddingLeft="30dp"
android:text="@string/language"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="22sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:drawableEnd="@drawable/icon_right"
android:drawableTint="@color/black"
android:fontFamily="@font/poppins_medium"
android:gravity="center"
android:paddingRight="30dp"
android:text="@string/next"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/english_btn"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_marginStart="65dp"
android:layout_marginBottom="30dp"
android:background="@drawable/language_board"
android:paddingRight="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ImageButton
android:id="@+id/sinhala_btn"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_marginEnd="65dp"
android:layout_marginBottom="30dp"
android:background="@drawable/language_board"
android:paddingLeft="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/english_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="113dp"
android:layout_marginBottom="148dp"
android:fontFamily="@font/poppins_medium"
android:text="English"
android:textColor="@color/black"
android:textSize="40sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ImageButton
android:id="@+id/sinhala_txt_btn"
android:layout_width="150dp"
android:layout_height="70dp"
android:layout_marginEnd="120dp"
android:layout_marginBottom="144dp"
android:background="@drawable/sinhala"
android:paddingLeft="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ImageView
android:id="@+id/imageView"
android:layout_width="900dp"
android:layout_height="430dp"
android:layout_marginBottom="-132dp"
android:src="@drawable/grass2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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"
tools:context=".loginregistration.LoginActivity"
android:orientation="vertical"
android:gravity="center"
android:background="@color/white" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp" >
<EditText
android:id="@+id/email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:padding="10dp"
android:singleLine="true"
android:textColor="@color/black" />
<EditText
android:id="@+id/password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:hint="@string/pwd"
android:inputType="textPassword"
android:padding="10dp"
android:singleLine="true"
android:textColor="@color/black" />
<TextView
android:id="@+id/btnLoginFgtPwd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:gravity="center"
android:text="@string/fgtPassword"
android:textColor="#2196F3"
android:textSize="16sp" />
<Button
android:id="@+id/btnLoginSignIn"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginLeft="50dp"
android:layout_marginTop="30dp"
android:layout_marginRight="50dp"
android:background="#2196F3"
android:padding="16dp"
android:text="@string/signIn"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@color/white"
android:textSize="21sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/noAccnt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/noAccnt"
android:textAlignment="center"
android:textSize="16sp"
android:gravity="center_horizontal" />
<TextView
android:id="@+id/btnLoginSignUp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="@string/signUp"
android:textColor="#2196F3"
android:textSize="16sp"
android:layout_marginLeft="10dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?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/map1"
tools:context=".map.Map1Activity">
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="90dp"
android:layout_height="81.95dp"
android:background="@drawable/num1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.464"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.093" />
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="78dp"
android:layout_height="79.32dp"
android:background="@drawable/num2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.69"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.371" />
<ImageButton
android:id="@+id/imageButton3"
android:layout_width="79dp"
android:layout_height="78.35dp"
android:background="@drawable/num3"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.277"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.526" />
<ImageButton
android:id="@+id/imageButton4"
android:layout_width="90dp"
android:layout_height="80.53dp"
android:background="@drawable/num4"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.772"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.662" />
<ImageButton
android:id="@+id/imageButton5"
android:layout_width="90dp"
android:layout_height="79.25dp"
android:background="@drawable/num5"
android:translationZ="5dp"
android:elevation="15dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.464"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.871" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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/map2"
tools:context=".map.Map2Activity">
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="90dp"
android:layout_height="81.95dp"
android:background="@drawable/num1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.464"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.038" />
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="78dp"
android:layout_height="79.32dp"
android:background="@drawable/num2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.744"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.262" />
<ImageButton
android:id="@+id/imageButton3"
android:layout_width="79dp"
android:layout_height="78.35dp"
android:background="@drawable/num3"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.692"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.468" />
<ImageButton
android:id="@+id/imageButton4"
android:layout_width="90dp"
android:layout_height="80.53dp"
android:background="@drawable/num4"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.336"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.662" />
<ImageButton
android:id="@+id/imageButton5"
android:layout_width="90dp"
android:layout_height="79.25dp"
android:background="@drawable/num5"
android:elevation="15dp"
android:translationZ="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.582"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.851" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
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:id="@+id/activity_main_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start"
tools:context=".home.NavigationDrawerActivity">
<!-- 1 | MainActivity RootView -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<!-- Toolbar -->
<androidx.appcompat.widget.Toolbar
android:id="@+id/activity_main_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:theme="@style/ToolBarStyle"/>
<!-- FrameLayout for our fragments -->
<FrameLayout
android:id="@+id/activity_main_frame_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
<!-- 2 | NavigationView -->
<com.google.android.material.navigation.NavigationView
android:id="@+id/activity_main_nav_view"
android:layout_width="255dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/navigation_drawer_header"
app:menu="@menu/drawermenu" />
</androidx.drawerlayout.widget.DrawerLayout>
<?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/bg1"
tools:context=".details.ParentDetailsActivity">
<TextView
android:id="@+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:drawableStart="@drawable/icon_left"
android:drawableTint="@color/black"
android:fontFamily="@font/poppins_medium"
android:gravity="center"
android:paddingLeft="30dp"
android:text="@string/previous"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:drawableEnd="@drawable/icon_right"
android:drawableTint="@color/black"
android:fontFamily="@font/poppins_medium"
android:gravity="center"
android:paddingRight="30dp"
android:text="@string/next"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="20dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/next" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_bold"
android:text="@string/childName"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/opt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_bold"
android:layout_marginLeft="20dp"
android:text="@string/optional"
android:textColor="@color/red"
android:textSize="15sp" />
</LinearLayout>
<EditText
android:id="@+id/childName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Child Name"
android:layout_marginTop="5dp"
android:fontFamily="@font/poppins_bold"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_bold"
android:text="@string/parentEmail"
android:layout_marginTop="10dp"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/opt2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_bold"
android:layout_marginLeft="20dp"
android:text="@string/optional"
android:textColor="@color/red"
android:textSize="15sp" />
</LinearLayout>
<EditText
android:id="@+id/parentEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="xxxxx@gmail.com"
android:layout_marginTop="5dp"
android:fontFamily="@font/poppins_bold"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/contact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_bold"
android:text="@string/parentContact"
android:layout_marginTop="10dp"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/opt3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_bold"
android:layout_marginLeft="20dp"
android:text="@string/optional"
android:textColor="@color/red"
android:textSize="15sp" />
</LinearLayout>
<EditText
android:id="@+id/parentContact"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="+94 771 154 785"
android:layout_marginTop="5dp"
android:fontFamily="@font/poppins_bold"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="110dp"
android:layout_marginBottom="-8dp"
android:src="@drawable/grass1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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"
tools:context=".loginregistration.RegistrationActivity">
<CheckBox
android:id="@+id/regCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginTop="20dp"
android:text="@string/agree"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/btnRegTermsAndConditions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/terms"
android:textColor="#2196F3"
android:textSize="16sp"
app:layout_constraintBaseline_toBaselineOf="@+id/regCheckBox"
app:layout_constraintStart_toEndOf="@+id/regCheckBox" />
<Button
android:id="@+id/btnRegSignUp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginTop="30dp"
android:layout_marginRight="50dp"
android:background="#2196F3"
android:text="@string/signUp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@color/white"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/regCheckBox" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btnRegSignUp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/haveAccnt"
android:textAlignment="center"
android:textSize="16sp" />
<TextView
android:id="@+id/btnRegSignIn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="@string/signIn"
android:textColor="#2196F3"
android:textSize="16sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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/bg7"
tools:context=".selective.SelectiveAttentionGame1">
<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" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="50dp"
android:gravity="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/textview"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:fontFamily="@font/poppins_bold"
android:gravity="center"
android:paddingRight="10dp"
android:paddingTop="15dp"
android:text="@string/select"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/main_img"
android:layout_width="50dp"
android:layout_height="match_parent"
android:gravity="center" />
</LinearLayout>
<GridView
android:id="@+id/gridView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:numColumns="3"
android:verticalSpacing="5dp"
android:gravity="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout" />
<ImageButton
android:id="@+id/imageButton"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center"
android:layout_marginBottom="30dp"
android:background="@drawable/complete"
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
<?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="@color/white"
tools:context=".splashscreen.SplashActivity">
<ImageView
android:id="@+id/imageView2"
android:layout_width="390dp"
android:layout_height="280dp"
android:background="@drawable/splash"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:fontFamily="@font/poppins_medium"
android:paddingLeft="35dp"
android:paddingRight="35dp"
android:text="@string/splash"
android:textAlignment="center"
android:textColor="#2196F3"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView2" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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.SustainedAttentionGame1">
<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_height="wrap_content"
android:layout_width="match_parent"
android:textAlignment="center"
android:layout_marginStart="50dp"
android:layout_marginTop="95dp"
android:layout_marginEnd="50dp"
android:fontFamily="@font/poppins_bold"
android:text="@string/susg1"
android:textColor="@color/black"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<pl.droidsonroids.gif.GifImageView
android:id="@+id/gifImageView"
android:layout_width="250dp"
android:layout_height="250dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.332" />
<ImageView
android:id="@+id/bird"
android:layout_width="200dp"
android:layout_height="200dp"
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:background="@drawable/red_btn"
android:elevation="80dp"
android:layout_marginBottom="-20dp"
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
<?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="24sp"
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
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
android:id="@+id/card_item"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_gravity="center"
android:background="@drawable/gridview_background"
app:cardCornerRadius="7dp"
app:cardElevation="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/gridview_background">
<ImageView
android:id="@+id/gridImage"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
android:id="@+id/card_item"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="center"
android:background="@drawable/gridview_background"
app:cardCornerRadius="7dp"
app:cardElevation="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/gridview_background">
<ImageView
android:id="@+id/gridImage"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
android:id="@+id/card_item"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:background="@drawable/gridview_background"
app:cardCornerRadius="7dp"
app:cardElevation="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/gridview_background">
<ImageView
android:id="@+id/gridImage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
android:id="@+id/card_item"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:background="@drawable/clicked_gridview_background"
app:cardCornerRadius="7dp"
app:cardElevation="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/clicked_gridview_background">
<ImageView
android:id="@+id/gridImage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
android:id="@+id/card_item"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_gravity="center"
android:background="@drawable/clicked_gridview_background"
app:cardCornerRadius="7dp"
app:cardElevation="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/clicked_gridview_background">
<ImageView
android:id="@+id/gridImage"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
android:id="@+id/card_item"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="center"
android:background="@drawable/clicked_gridview_background"
app:cardCornerRadius="7dp"
app:cardElevation="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/clicked_gridview_background">
<ImageView
android:id="@+id/gridImage"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="10dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
app:cardBackgroundColor="@color/cardview_light_background"
android:padding="8dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/titleTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="15dp"
android:text="Question"
android:drawableRight="@drawable/icon_dropdown"
android:drawableTint="@color/blue"
android:textStyle="bold"
android:textColor="@color/blue"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="?attr/selectableItemBackground"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/expandableLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="visible"
android:gravity="center"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:padding="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/titleTextView">
<TextView
android:id="@+id/descriptions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Description"
android:textColor="@color/black"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textSize="13dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:gravity="center_horizontal" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/gradient_background"
tools:context=".home.MainFragment">
<ScrollView
android:id="@+id/ScrlView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp">
<androidx.cardview.widget.CardView
android:id="@+id/focusedAttention"
android:layout_height="200dp"
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gridview_background"
android:orientation="horizontal"
android:gravity="center" >
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:layout_marginBottom="-20dp"
android:src="@drawable/focused" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="40dp"
android:fontFamily="@font/aclonica"
android:layout_marginRight="15dp"
android:gravity="center"
android:text="Focused Attention"
android:textColor="@color/red"
android:textSize="20dp"
android:textStyle="bold" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/play_btn" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/selectiveAttention"
android:layout_height="200dp"
android:layout_width="match_parent"
android:layout_gravity="fill"
android:layout_marginBottom="10dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gridview_background"
android:orientation="horizontal"
android:gravity="center" >
<ImageView
android:layout_width="170dp"
android:layout_height="170dp"
android:layout_marginRight="10dp"
android:src="@drawable/selective" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/holo_blue_dark"
android:layout_marginTop="40dp"
android:layout_gravity="center"
android:gravity="center"
android:textSize="20dp"
android:layout_marginRight="10dp"
android:fontFamily="@font/aclonica"
android:textStyle="bold"
android:text="Selective Attention" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/play_btn" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/dividedAttention"
android:layout_height="200dp"
android:layout_width="match_parent"
android:layout_gravity="fill"
android:layout_marginBottom="10dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gridview_background"
android:orientation="horizontal"
android:gravity="center" >
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginLeft="15dp"
android:src="@drawable/divided" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/holo_orange_dark"
android:layout_marginTop="40dp"
android:layout_gravity="center"
android:gravity="center"
android:textSize="20dp"
android:fontFamily="@font/aclonica"
android:text="Divided Attention"
android:textStyle="bold"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/play_btn" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/sustainedAttention"
android:layout_height="200dp"
android:layout_width="match_parent"
android:layout_gravity="fill"
android:layout_marginBottom="10dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@drawable/gridview_background"
android:gravity="center" >
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginLeft="15dp"
android:src="@drawable/sustained" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/green"
android:layout_marginTop="40dp"
android:layout_gravity="center"
android:gravity="center"
android:textSize="20dp"
android:layout_marginRight="15dp"
android:fontFamily="@font/aclonica"
android:text="Sustained Attention I"
android:textStyle="bold"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/play_btn" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/alternatingAttention"
android:layout_height="200dp"
android:layout_width="match_parent"
android:layout_gravity="fill"
android:layout_marginBottom="10dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@drawable/gridview_background"
android:gravity="center" >
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginLeft="15dp"
android:src="@drawable/sustained2" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/pink"
android:layout_marginTop="40dp"
android:layout_gravity="center"
android:gravity="center"
android:textSize="20dp"
android:layout_marginRight="15dp"
android:fontFamily="@font/aclonica"
android:text="Sustained Attention II"
android:textStyle="bold"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="50dp"
android:src="@drawable/play_btn" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/alternatingAttention2"
android:layout_height="200dp"
android:layout_width="match_parent"
android:layout_gravity="fill"
android:layout_marginBottom="10dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@drawable/gridview_background"
android:gravity="center" >
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginLeft="15dp"
android:src="@drawable/alternative" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/purple"
android:layout_marginTop="40dp"
android:layout_gravity="center"
android:gravity="center"
android:textSize="20dp"
android:layout_marginRight="15dp"
android:fontFamily="@font/aclonica"
android:text="Alternating Attention"
android:textStyle="bold"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="50dp"
android:src="@drawable/play_btn" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<!--
<GridLayout
android:id="@+id/gridView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:rowCount="5"
android:columnCount="2">
<androidx.cardview.widget.CardView
android:id="@+id/focgame1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_row="0"
android:layout_column="0"
android:layout_gravity="fill"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_gravity="center_vertical|center_horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ladybird" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="acrrew"
android:textStyle="bold"
android:textAlignment="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/focgame2"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_row="0"
android:layout_column="1"
android:layout_gravity="fill"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_gravity="center_vertical|center_horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ladybird" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="acrrew"
android:textStyle="bold"
android:textAlignment="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/selectivegame1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_row="1"
android:layout_column="0"
android:layout_gravity="fill"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_gravity="center_vertical|center_horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ladybird" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="acrrew"
android:textStyle="bold"
android:textAlignment="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/selectivegame2"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_row="1"
android:layout_column="1"
android:layout_gravity="fill"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_gravity="center_vertical|center_horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ladybird" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="acrrew"
android:textStyle="bold"
android:textAlignment="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_row="2"
android:layout_column="0"
android:layout_gravity="fill"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_gravity="center_vertical|center_horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ladybird" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="acrrew"
android:textStyle="bold"
android:textAlignment="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_row="2"
android:layout_column="1"
android:layout_gravity="fill"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_gravity="center_vertical|center_horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ladybird" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="acrrew"
android:textStyle="bold"
android:textAlignment="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_row="3"
android:layout_column="0"
android:layout_gravity="fill"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_gravity="center_vertical|center_horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ladybird" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="acrrew"
android:textStyle="bold"
android:textAlignment="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_row="3"
android:layout_column="1"
android:layout_gravity="fill"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_gravity="center_vertical|center_horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ladybird" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="acrrew"
android:textStyle="bold"
android:textAlignment="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_row="4"
android:layout_column="0"
android:layout_gravity="fill"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_gravity="center_vertical|center_horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ladybird" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="acrrew"
android:textStyle="bold"
android:textAlignment="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_row="4"
android:layout_column="1"
android:layout_gravity="fill"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_gravity="center_vertical|center_horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ladybird" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="acrrew"
android:textStyle="bold"
android:textAlignment="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</GridLayout>
-->
</LinearLayout>
</ScrollView>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
android:id="@+id/card_item"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:background="@drawable/green_gridview_background"
app:cardCornerRadius="7dp"
app:cardElevation="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/green_gridview_background">
<ImageView
android:id="@+id/gridImage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
android:id="@+id/card_item"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_gravity="center"
android:background="@drawable/green_gridview_background"
app:cardCornerRadius="7dp"
app:cardElevation="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/green_gridview_background">
<ImageView
android:id="@+id/gridImage"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
android:id="@+id/card_item"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="center"
android:background="@drawable/green_gridview_background"
app:cardCornerRadius="7dp"
app:cardElevation="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/green_gridview_background">
<ImageView
android:id="@+id/gridImage"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<?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="100dp"
android:background="@color/black"
android:padding="20dp">
<ImageView
android:id="@+id/imageView3"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="15dp"
android:src="@drawable/ladybird"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:gravity="center"
android:text="@string/app_name"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView3" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
android:id="@+id/card_item"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:background="@drawable/red_gridview_background"
app:cardCornerRadius="7dp"
app:cardElevation="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/red_gridview_background">
<ImageView
android:id="@+id/gridImage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
android:id="@+id/card_item"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_gravity="center"
android:background="@drawable/red_gridview_background"
app:cardCornerRadius="7dp"
app:cardElevation="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/red_gridview_background">
<ImageView
android:id="@+id/gridImage"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
android:id="@+id/card_item"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="center"
android:background="@drawable/red_gridview_background"
app:cardCornerRadius="7dp"
app:cardElevation="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/red_gridview_background">
<ImageView
android:id="@+id/gridImage"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view">
<item android:title="Title">
<menu>
<group android:checkableBehavior="single">
<item android:id="@+id/dashboard" android:title="Dashboard" android:icon="@drawable/icon_dashboard"/>
<item android:id="@+id/admin" android:title="Visual Attention Assessments" android:icon="@drawable/icon_profile"/>
<item android:id="@+id/parents" android:title="Ayeshka" android:icon="@drawable/icon_profile"/>
<item android:id="@+id/healthProfessional" android:title="Sandunika" android:icon="@drawable/icon_profile"/>
<item android:id="@+id/doctor" android:title="Isuri" android:icon="@drawable/icon_profile"/>
</group>
</menu>
</item>
<group android:checkableBehavior="single">
<item android:id="@+id/consentForm" android:title="Consent Form" android:icon="@drawable/icon_terms"/>
<item android:id="@+id/termsAndConditions" android:title="Preliminary Medical Guidance" android:icon="@drawable/icon_medical"/>
<item android:id="@+id/aboutUs" android:title="Contact Health Professional" android:icon="@drawable/icon_support"/>
<item android:id="@+id/logOut" android:title="Logout" android:icon="@drawable/icon_logout"/>
</group>
</menu>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.AttentionAssessment" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<style name="ToolBarStyle" parent="AppTheme">
<item name="android:textColorPrimary">@android:color/white</item>
<item name="colorControlNormal">@android:color/white</item>
</style>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">AttentionAssessment</string>
<string name="splash">Name - \n Attention Assessment &amp; Training Game</string>
<!-- Navigation Drawer-->
<string name="heading">අවධානය ඇගයීම ක්රියාකාරකම්</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="gender">ඔබේ දරුවාගේ ලිංගභේදය තෝරන්න:</string>
<string name="girl">ගැහැණු</string>
<string name="boy">පිරිමි</string>
<string name="next">ඊළඟ</string>
<string name="previous">පෙර</string>
<string name="age">ඔබේ දරුවාගේ වයස තෝරන්න:</string>
<string name="language">භාෂාව තෝරන්න:</string>
<string name="childName">දරුවාගේ නම :</string>
<string name="parentEmail">විද්යුත් තැපෑල් ලිපිනය:</string>
<string name="parentContact">දුරකතන අංකය :</string>
<string name="optional">* විකල්ප</string>
<string name="select">තෝරන්න</string>
<string name="birdselect">ඔබ වඩාත්ම කැමති චරිතය තෝරන්න</string>
<string name="focg1">වඳුරු පැටවා දිස්වන විට රතු බොත්තම ඔබන්න </string>
<string name="divg1">වර්ණ ගැලපෙන විට රතු බොත්තම ඔබන්න</string>
<string name="susg1">කුරුල්ලා අත්ත මත වාඩි වූ විට රතු බොත්තම ඔබන්න</string>
<string name="altg1">සතා පෙනෙන පැත්තේ ඇති රතු බොත්තම ඔබන්න</string>
<string name="provideconsent">I have read this consent form and my questions have been answered. My signature below means that I do want my child to be in the study. I know that I can withdraw my child from the study at any time without any problems.</string>
<string name="getSignature">මෙහි අත්සන් කරන්න</string>
<string name="proceed">ඉදිරියට</string>
<string name="consentForm">පර්යේෂණ අධ්‍යයනයකට සහභාගී වීමට කැමැත්ත දක්වන පෝරමය</string>
<!-- Login Screen -->
<string name="welcome">ආයුබෝවන්!</string>
<string name="name">ඔබේ නම ඇතුළත් කරන්න</string>
<string name="email">ඔබගේ විද්‍යුත් ලිපිනය ඇතුළත් කරන්න</string>
<string name="pwd">මුරපදය ඇතුළත් කරන්න</string>
<string name="confirmPwd">මුරපදය තහවුරු කරන්න</string>
<string name="fgtPassword">මුරපදය අමතක වුණා ද?</string>
<string name="resetPassword">මුරපදය යළි සකසන්න</string>
<string name="rememberPassword">ඔබට මුරපදය මතකද?</string>
<string name="signIn">ඇතුල් වන්න</string>
<string name="signUp">ලියාපදිංචි වන්න</string>
<string name="createAccnt">ගිණුමක් තනන්න</string>
<string name="noAccnt">ඔබට ගිණුමක් නැද්ද?</string>
<string name="haveAccnt">දැනටමත් ගිණුමක් තිබේද?</string>
<string name="agree">මම එකඟයි</string>
<string name="terms">නියම සහ කොන්දේසි</string>
<string name="fgtPwdPara">ඔබගේ විද්‍යුත් තැපැල් ලිපිනය ඇතුලත් කරන්න, ඔබගේ මුරපදය නැවත සැකසීමට අපි ඔබට සබැඳියක් එවන්නෙමු.</string>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="red">#F44336</color>
<color name="blue">#2196F3</color>
<color name="yellow">#FFC107</color>
<color name="green">#00A107</color>
<color name="pink">#E91E63</color>
<color name="purple">#9C27B0</color>
<color name="orange">@android:color/holo_orange_dark</color>
<color name="teal">@color/teal_700</color>
<color name="white">#FFFFFFFF</color>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="com_google_android_gms_fonts_certs">
<item>@array/com_google_android_gms_fonts_certs_dev</item>
<item>@array/com_google_android_gms_fonts_certs_prod</item>
</array>
<string-array name="com_google_android_gms_fonts_certs_dev">
<item>
MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBANbOLggKv+IxTdGNs8/TGFy0PTP6DHThvbbR24kT9ixcOd9W+EaBPWW+wPPKQmsHxajtWjmQwWfna8mZuSeJS48LIgAZlKkpFeVyxW0qMBujb8X8ETrWy550NaFtI6t9+u7hZeTfHwqNvacKhp1RbE6dBRGWynwMVX8XW8N1+UjFaq6GCJukT4qmpN2afb8sCjUigq0GuMwYXrFVee74bQgLHWGJwPmvmLHC69EH6kWr22ijx4OKXlSIx2xT1AsSHee70w5iDBiK4aph27yH3TxkXy9V89TDdexAcKk/cVHYNnDBapcavl7y0RiQ4biu8ymM8Ga/nmzhRKya6G0cGw8CAQOjgfwwgfkwHQYDVR0OBBYEFI0cxb6VTEM8YYY6FbBMvAPyT+CyMIHJBgNVHSMEgcEwgb6AFI0cxb6VTEM8YYY6FbBMvAPyT+CyoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJANWFuGx90071MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBABnTDPEF+3iSP0wNfdIjIz1AlnrPzgAIHVvXxunW7SBrDhEglQZBbKJEk5kT0mtKoOD1JMrSu1xuTKEBahWRbqHsXclaXjoBADb0kkjVEJu/Lh5hgYZnOjvlba8Ld7HCKePCVePoTJBdI4fvugnL8TsgK05aIskyY0hKI9L8KfqfGTl1lzOv2KoWD0KWwtAWPoGChZxmQ+nBli+gwYMzM1vAkP+aayLe0a1EQimlOalO762r0GXO0ks+UeXde2Z4e+8S/pf7pITEI/tP+MxJTALw9QUWEv9lKTk+jkbqxbsh8nfBUapfKqYn0eidpwq2AzVp3juYl7//fKnaPhJD9gs=
</item>
</string-array>
<string-array name="com_google_android_gms_fonts_certs_prod">
<item>
MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JORland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfYwXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK
</item>
</string-array>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="preloaded_fonts" translatable="false">
<item>@font/aclonica</item>
<item>@font/acme</item>
<item>@font/poppins_bold</item>
<item>@font/poppins_medium</item>
</array>
</resources>
<resources>
<string name="app_name">AttentionAssessment</string>
<string name="splash">Name - \n Attention Assessment &amp; Training Game</string>
<!-- Navigation Drawer-->
<string name="heading">Attention Assessment Game</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="gender">Select your child\'s gender:</string>
<string name="girl">Girl</string>
<string name="boy">Boy</string>
<string name="next">Next</string>
<string name="previous">Previous</string>
<string name="age">Select your child\'s age:</string>
<string name="language">Select language:</string>
<string name="childName">Child Name :</string>
<string name="parentEmail">Email :</string>
<string name="parentContact">Contact Number :</string>
<string name="optional">* Optional</string>
<string name="select">Select the</string>
<string name="birdselect">Pick your favourite character</string>
<string name="focg1">Press the red button when the monkey appears</string>
<string name="divg1">Press the red button when the colours match</string>
<string name="susg1">Press the red button when the bird sits on the branch</string>
<string name="altg1">Press the red button on the same side where the animal appears</string>
<string name="provideconsent">I have read this consent form and my questions have been answered. My signature below means that I do want my child to be in the study. I know that I can withdraw my child from the study at any time without any problems.</string>
<string name="getSignature">Sign Here</string>
<string name="proceed">Proceed</string>
<string name="consentForm">Consent Form To Participate in a Research Study</string>
<!-- Login Screen -->
<string name="welcome">Welcome!</string>
<string name="name">Enter your name</string>
<string name="email">Enter your email</string>
<string name="pwd">Enter your password</string>
<string name="confirmPwd">Confirm password</string>
<string name="fgtPassword">Forgot Password?</string>
<string name="resetPassword">Reset Password</string>
<string name="rememberPassword">Remember Password ?</string>
<string name="signIn">Sign In</string>
<string name="signUp">Sign Up</string>
<string name="createAccnt">Create an Account</string>
<string name="noAccnt">Don\'t have an account?</string>
<string name="haveAccnt">Already have an account?</string>
<string name="agree">I agree to the</string>
<string name="terms">Terms and Conditions</string>
<string name="fgtPwdPara">Enter your email and we\'ll send you a link to reset your password.</string>
</resources>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.AttentionAssessment" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<!-- Toolbar theme. -->
<style name="ToolBarStyle" parent="AppTheme">
<item name="android:textColorPrimary">@android:color/white</item>
<item name="colorControlNormal">@android:color/white</item>
</style>
<style name="AppTheme"></style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path name="external_files" path="."/>
</paths>
\ No newline at end of file
package com.anuththara18.attentionassessment;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.3"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
\ No newline at end of file
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
\ No newline at end of file
#Thu Jan 06 08:58:24 IST 2022
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
include ':app'
rootProject.name = "AttentionAssessment"
\ 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