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;
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.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;
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.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.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.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
<?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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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