Commit 703be6af authored by Anuththara18's avatar Anuththara18

Divided Attention - Removing Buttons & UI Modification

parent 1974bd94
......@@ -43,7 +43,7 @@ public class DividedAttentionGame1 extends AppCompatActivity {
private static final int CODE_POST_REQUEST = 1025;
ImageView sq1, sq2;
ImageButton red_btn, cross_btn;
ImageButton cross_btn;
TextView textView2;
int i = 0;
......@@ -90,7 +90,6 @@ public class DividedAttentionGame1 extends AppCompatActivity {
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));
......@@ -111,6 +110,7 @@ public class DividedAttentionGame1 extends AppCompatActivity {
public void run() {
if ( i < 40 ) { // 40 times
/*
if (AgeActivity.age == 4) {
if (i >= 0 && i < 5) {
......@@ -143,35 +143,35 @@ public class DividedAttentionGame1 extends AppCompatActivity {
if (j.equals("0") || j.equals("8") || j.equals("16") || j.equals("24") || j.equals("34") || j.equals("40")) {
sq2.setImageResource(image[0]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(image[0]);
} else if (j.equals("1") || j.equals("6") || j.equals("17") || j.equals("25") || j.equals("33") || j.equals("41")) {
sq2.setImageResource(image[1]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(image[1]);
} else if (j.equals("2") || j.equals("14") || j.equals("19") || j.equals("26") || j.equals("30") || j.equals("42")) {
sq2.setImageResource(image[2]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(image[2]);
} else if (j.equals("4") || j.equals("11") || j.equals("18") || j.equals("27") || j.equals("35") || j.equals("43")) {
sq2.setImageResource(image[3]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(image[3]);
} else if (j.equals("3") || j.equals("12") || j.equals("20") || j.equals("29") || j.equals("36") || j.equals("44")) {
sq2.setImageResource(image[4]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(image[4]);
} else if (j.equals("5") || j.equals("13") || j.equals("21") || j.equals("28") || j.equals("37") || j.equals("45")) {
sq2.setImageResource(image[5]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(image[5]);
} else if (j.equals("9") || j.equals("15") || j.equals("22") || j.equals("32") || j.equals("39") || j.equals("46")) {
sq2.setImageResource(image[6]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(image[6]);
} else if (j.equals("7") || j.equals("10") || j.equals("23") || j.equals("31") || j.equals("38") || j.equals("47")) {
sq2.setImageResource(image[7]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(image[7]);
}
startTime = System.currentTimeMillis();
......@@ -180,10 +180,11 @@ public class DividedAttentionGame1 extends AppCompatActivity {
duration = duration + 2000;
i++;
}
*/
/*---------------------------------------------------------------------------------*/
if (AgeActivity.age == 5) {
if (AgeActivity.age == 4 || AgeActivity.age == 5) {
textView2.setText(LanguageSetter.getresources().getString(R.string.divg2));
......@@ -217,35 +218,35 @@ public class DividedAttentionGame1 extends AppCompatActivity {
if (j.equals("0") || j.equals("8") || j.equals("16") || j.equals("24") || j.equals("34") || j.equals("40")) {
sq2.setImageResource(animal5[0]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal5[0]);
} else if (j.equals("1") || j.equals("6") || j.equals("17") || j.equals("25") || j.equals("33") || j.equals("41")) {
sq2.setImageResource(animal5[1]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal5[1]);
} else if (j.equals("2") || j.equals("14") || j.equals("19") || j.equals("26") || j.equals("30") || j.equals("42")) {
sq2.setImageResource(animal5[2]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal5[2]);
} else if (j.equals("4") || j.equals("11") || j.equals("18") || j.equals("27") || j.equals("35") || j.equals("43")) {
sq2.setImageResource(animal5[3]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal5[3]);
} else if (j.equals("3") || j.equals("12") || j.equals("20") || j.equals("29") || j.equals("36") || j.equals("44")) {
sq2.setImageResource(animal5[4]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal5[4]);
} else if (j.equals("5") || j.equals("13") || j.equals("21") || j.equals("28") || j.equals("37") || j.equals("45")) {
sq2.setImageResource(animal5[5]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal5[5]);
} else if (j.equals("9") || j.equals("15") || j.equals("22") || j.equals("32") || j.equals("39") || j.equals("46")) {
sq2.setImageResource(animal5[6]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal5[6]);
} else if (j.equals("7") || j.equals("10") || j.equals("23") || j.equals("31") || j.equals("38") || j.equals("47")) {
sq2.setImageResource(animal5[7]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal5[7]);
}
startTime = System.currentTimeMillis();
......@@ -290,35 +291,35 @@ public class DividedAttentionGame1 extends AppCompatActivity {
if (j.equals("0") || j.equals("8") || j.equals("16") || j.equals("24") || j.equals("34") || j.equals("40")) {
sq2.setImageResource(animal7[0]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal7[0]);
} else if (j.equals("1") || j.equals("6") || j.equals("17") || j.equals("25") || j.equals("33") || j.equals("41")) {
sq2.setImageResource(animal7[1]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal7[1]);
} else if (j.equals("2") || j.equals("14") || j.equals("19") || j.equals("26") || j.equals("30") || j.equals("42")) {
sq2.setImageResource(animal7[2]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal7[2]);
} else if (j.equals("4") || j.equals("11") || j.equals("18") || j.equals("27") || j.equals("35") || j.equals("43")) {
sq2.setImageResource(animal7[3]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal7[3]);
} else if (j.equals("3") || j.equals("12") || j.equals("20") || j.equals("29") || j.equals("36") || j.equals("44")) {
sq2.setImageResource(animal7[4]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal7[4]);
} else if (j.equals("5") || j.equals("13") || j.equals("21") || j.equals("28") || j.equals("37") || j.equals("45")) {
sq2.setImageResource(animal7[5]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal7[5]);
} else if (j.equals("9") || j.equals("15") || j.equals("22") || j.equals("32") || j.equals("39") || j.equals("46")) {
sq2.setImageResource(animal7[6]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal7[6]);
} else if (j.equals("7") || j.equals("10") || j.equals("23") || j.equals("31") || j.equals("38") || j.equals("47")) {
sq2.setImageResource(animal7[7]);
red_btn.setEnabled(true);
sq2.setEnabled(true);
sq2.setTag(animal7[7]);
}
startTime = System.currentTimeMillis();
......@@ -359,18 +360,11 @@ public class DividedAttentionGame1 extends AppCompatActivity {
}
}.run();
red_btn.setOnTouchListener(new View.OnTouchListener() {
sq2.setOnClickListener(new View.OnClickListener() {
@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();
public void onClick(View view) {
mp2 = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp2.start();
break;
}
case MotionEvent.ACTION_UP:
clickedTime = System.currentTimeMillis();
reactionTime = ( clickedTime - startTime );
clickedImage = (int) sq2.getTag();
......@@ -378,20 +372,12 @@ public class DividedAttentionGame1 extends AppCompatActivity {
totalReactionTime = totalReactionTime + reactionTime;
Log.d("correct " , startTime + " " + clickedTime + " " + reactionTime);
noOfCorrectResponses++;
red_btn.setEnabled(false);
sq2.setEnabled(false);
}
else {
Log.d( "wrong" , startTime + " " + clickedTime + " " + reactionTime);
noOfCommissionErrors++;
}
case MotionEvent.ACTION_CANCEL: {
red_btn.getBackground().clearColorFilter();
view.invalidate();
break;
}
}
return true;
}
});
......
......@@ -46,10 +46,9 @@
<ImageView
android:id="@+id/sq1"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_marginTop="15dp"
android:src="@color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
......@@ -57,10 +56,9 @@
<ImageView
android:id="@+id/sq2"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_marginTop="25dp"
android:src="@color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
......@@ -77,6 +75,7 @@
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent" />
<!--
<ImageButton
android:id="@+id/red_btn"
android:layout_width="150dp"
......@@ -88,5 +87,6 @@
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
......@@ -19,16 +19,16 @@
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btnclear"
android:id="@+id/btnsave"
android:layout_gravity="center"
android:text="@string/clear"/>
android:text="@string/save"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btnsave"
android:id="@+id/btnclear"
android:layout_gravity="center"
android:text="@string/save"/>
android:text="@string/clear"/>
</LinearLayout>
\ No newline at end of file
......@@ -82,6 +82,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Child Name"
android:textColorHint="#575757"
android:fontFamily="@font/poppins_bold"
android:textColor="@color/black"
android:textSize="18sp"
......@@ -121,6 +122,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="xxxxx@gmail.com"
android:textColorHint="#575757"
android:fontFamily="@font/poppins_bold"
android:textColor="@color/black"
android:textSize="18sp"
......@@ -161,6 +163,7 @@
android:layout_height="wrap_content"
android:hint="0771234567"
android:fontFamily="@font/poppins_bold"
android:textColorHint="#575757"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold" />
......
......@@ -23,11 +23,11 @@
<string name="select">තෝරන්න</string>
<string name="birdselect">ඔබ වඩාත්ම කැමති චරිතය තෝරන්න</string>
<string name="focg1">සත්වයා දිස්වන විට රතු බොත්තම ඔබන්න </string>
<string name="focg1">තිරය මත දිස්වන සත්වයා ඔබන්න</string>
<string name="divg1">වර්ණ ගැලපෙන විට රතු බොත්තම ඔබන්න</string>
<string name="divg2">සතුන් ගැලපෙන විට රතු බොත්තම ඔබන්න</string>
<string name="divg2">සතුන් දෙදෙනාම ගැලපෙන විට පහළ සත්වයා ඔබන්න</string>
<string name="susg1">කුරුල්ලා අත්ත මත වාඩි වූ විට රතු බොත්තම ඔබන්න</string>
<string name="altg1">සතා පෙනෙන පැත්තේ ඇති රතු බොත්තම ඔබන්න</string>
<string name="altg1">තිරය මත දිස්වන සත්වයා ඔබන්න</string>
<string name="provideconsent">මම මේ කැමති පත්‍රය කියවා ඒ සම්බන්ධව ඇති වූ ගැටළු නිරාකරණය කර ගත්තෙමි. පහත සඳහන් අත්සනින් මම මගේ දරුවා මෙම අධ්‍යයනයට සම්බන්ධ කරවීමට කැමති බව ප්‍රකාශ කර සිටිමි. මා කැමති ඕනෑම අවස්ථාවක කිසිදු ගැටලුවකින් තොරව මෙම අධ්‍යයනයෙන් මගේ දරුවා ඉවත්කරගැනීමේ හැකියාවද ඇති බව මම දනිමි.</string>
<string name="getSignature">මෙහි අත්සන් කරන්න</string>
......
......@@ -22,11 +22,11 @@
<string name="select">Select the</string>
<string name="birdselect">Pick your favourite character</string>
<string name="focg1">Press the red button when the animal appears</string>
<string name="focg1">Press the animal appearing on the screen</string>
<string name="divg1">Press the red button when the colours match</string>
<string name="divg2">Press the red button when the animals match</string>
<string name="divg2">Press the animal at the bottom when both animals 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="altg1">Press the animal appearing on the screen</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>
......
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