Commit 0df5f15a authored by Anuththara18's avatar Anuththara18

Added Completion Stars to Game Maps

parent e1ea293e
......@@ -49,6 +49,9 @@ import java.util.List;
import java.util.Random;
import java.util.Set;
import static com.anuththara18.attentionassessment.map.Map1Activity.comp1;
import static com.anuththara18.attentionassessment.map.Map1Activity.comp2;
public class FocusedAttentionGame1 extends AppCompatActivity {
private static final int CODE_GET_REQUEST = 1024;
......@@ -395,6 +398,15 @@ public class FocusedAttentionGame1 extends AppCompatActivity {
saveDataToOnlineDB();
createTable();
saveDataToLocalDB();
if (Map1Activity.level == 3){
Map1Activity.comp3 = 1;
}
else if (Map1Activity.level == 4){
Map1Activity.comp4 = 1;
}
else if (Map1Activity.level == 5){
Map1Activity.comp5 = 1;
}
Intent intent = new Intent(getApplicationContext(), FACompleteScreen.class);
finish();
mp.pause();
......
......@@ -37,6 +37,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Random;
import static com.anuththara18.attentionassessment.map.Map1Activity.comp1;
import static com.anuththara18.attentionassessment.map.Map1Activity.comp2;
public class FocusedAttentionGame2 extends AppCompatActivity {
private static final int CODE_GET_REQUEST = 1024;
......@@ -210,6 +213,12 @@ public class FocusedAttentionGame2 extends AppCompatActivity {
saveDataToOnlineDB();
createTable();
saveDataToLocalDB();
if (Map1Activity.level == 1){
comp1 = 1;
}
else if (Map1Activity.level == 2){
comp2 = 1;
}
Intent intent = new Intent(getApplicationContext(), FACompleteScreen.class);
finish();
mp.pause();
......
......@@ -10,6 +10,7 @@ import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import com.anuththara18.attentionassessment.R;
......
......@@ -52,6 +52,8 @@ public class NavigationDrawerActivity extends AppCompatActivity implements Navig
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_navigation_drawer);
toolbar.setNavigationIcon(null);
// Configure all views
this.configureToolBar();
this.configureDrawerLayout();
......
......@@ -18,6 +18,9 @@ import com.anuththara18.attentionassessment.videos.IntroductoryVideoPortraitActi
public class Map1Activity extends AppCompatActivity {
ImageButton imageButton1, imageButton2, imageButton3, imageButton4, imageButton5;
ImageButton star1, star2, star3, star4, star5;
public static int comp1, comp2, comp3, comp4, comp5 = 0;
public static int level = 1;
......@@ -31,6 +34,33 @@ public class Map1Activity extends AppCompatActivity {
imageButton3 = findViewById(R.id.imageButton3);
imageButton4 = findViewById(R.id.imageButton4);
imageButton5 = findViewById(R.id.imageButton5);
star1 = findViewById(R.id.star1);
star2 = findViewById(R.id.star2);
star3 = findViewById(R.id.star3);
star4 = findViewById(R.id.star4);
star5 = findViewById(R.id.star5);
star1.setVisibility(View.INVISIBLE);
star2.setVisibility(View.INVISIBLE);
star3.setVisibility(View.INVISIBLE);
star4.setVisibility(View.INVISIBLE);
star5.setVisibility(View.INVISIBLE);
if (comp1 == 1) {
star1.setVisibility(View.VISIBLE);
}
else if (comp2 == 1){
star2.setVisibility(View.VISIBLE);
}
else if (comp3 == 1){
star3.setVisibility(View.VISIBLE);
}
else if (comp4 == 1){
star4.setVisibility(View.VISIBLE);
}
else if (comp5 == 1){
star5.setVisibility(View.VISIBLE);
}
imageButton1.setOnClickListener(new View.OnClickListener() {
@Override
......
......@@ -17,6 +17,9 @@ import com.anuththara18.attentionassessment.videos.IntroductoryVideoPortraitActi
public class Map2Activity extends AppCompatActivity {
ImageButton imageButton1, imageButton2, imageButton3, imageButton4, imageButton5;
ImageButton star1, star2, star3, star4, star5;
public static int comp1, comp2, comp3, comp4, comp5 = 0;
public static int level = 1;
......@@ -38,6 +41,34 @@ public class Map2Activity extends AppCompatActivity {
imageButton4 = findViewById(R.id.imageButton4);
imageButton5 = findViewById(R.id.imageButton5);
star1 = findViewById(R.id.star1);
star2 = findViewById(R.id.star2);
star3 = findViewById(R.id.star3);
star4 = findViewById(R.id.star4);
star5 = findViewById(R.id.star5);
star1.setVisibility(View.INVISIBLE);
star2.setVisibility(View.INVISIBLE);
star3.setVisibility(View.INVISIBLE);
star4.setVisibility(View.INVISIBLE);
star5.setVisibility(View.INVISIBLE);
if (comp1 == 1) {
star1.setVisibility(View.VISIBLE);
}
else if (comp2 == 1){
star2.setVisibility(View.VISIBLE);
}
else if (comp3 == 1){
star3.setVisibility(View.VISIBLE);
}
else if (comp4 == 1){
star4.setVisibility(View.VISIBLE);
}
else if (comp5 == 1){
star5.setVisibility(View.VISIBLE);
}
imageButton1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
......
......@@ -32,6 +32,7 @@ import com.anuththara18.attentionassessment.focused.FocusedAttentionGame1;
import com.anuththara18.attentionassessment.gender.GenderActivity;
import com.anuththara18.attentionassessment.home.NavigationDrawerActivity;
import com.anuththara18.attentionassessment.language.LanguageSetter;
import com.anuththara18.attentionassessment.map.Map1Activity;
import com.anuththara18.attentionassessment.map.Map2Activity;
import org.json.JSONException;
......@@ -45,6 +46,9 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import static com.anuththara18.attentionassessment.map.Map1Activity.comp1;
import static com.anuththara18.attentionassessment.map.Map1Activity.comp2;
public class SelectiveAttentionGame1 extends AppCompatActivity {
// get reaction time - if image is clicked before 3 seconds
......@@ -416,6 +420,23 @@ public class SelectiveAttentionGame1 extends AppCompatActivity {
GVAdapter2 adapter = new GVAdapter2(getApplicationContext(), gridModelArrayList);
gridView.setAdapter(adapter);
gridView.setEnabled(false);
if (Map2Activity.level == 1){
Map2Activity.comp1 = 1;
}
else if (Map2Activity.level == 2){
Map2Activity.comp2 = 1;
}
else if (Map2Activity.level == 3){
Map2Activity.comp3 = 1;
}
else if (Map2Activity.level == 4){
Map2Activity.comp4 = 1;
}
else if (Map2Activity.level == 5){
Map2Activity.comp5 = 1;
}
saveDataToOnlineDB();
createTable();
saveDataToLocalDB();
......
......@@ -19,6 +19,19 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.093" />
<ImageButton
android:id="@+id/star1"
android:layout_width="110dp"
android:layout_height="101.95dp"
android:background="@drawable/stars"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.470"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.029" />
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="78dp"
......@@ -31,6 +44,19 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.371" />
<ImageButton
android:id="@+id/star2"
android:layout_width="110dp"
android:layout_height="101.95dp"
android:background="@drawable/stars"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.71"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.315" />
<ImageButton
android:id="@+id/imageButton3"
android:layout_width="79dp"
......@@ -43,6 +69,19 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.526" />
<ImageButton
android:id="@+id/star3"
android:layout_width="110dp"
android:layout_height="101.95dp"
android:background="@drawable/stars"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.250"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.480" />
<ImageButton
android:id="@+id/imageButton4"
android:layout_width="90dp"
......@@ -55,6 +94,19 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.662" />
<ImageButton
android:id="@+id/star4"
android:layout_width="110dp"
android:layout_height="101.95dp"
android:background="@drawable/stars"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.782"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.615" />
<ImageButton
android:id="@+id/imageButton5"
android:layout_width="90dp"
......@@ -69,4 +121,19 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.871" />
<ImageButton
android:id="@+id/star5"
android:layout_width="110dp"
android:layout_height="101.95dp"
android:background="@drawable/stars"
android:translationZ="5dp"
android:elevation="15dp"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.472"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.830" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -19,6 +19,20 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.038" />
<ImageButton
android:id="@+id/star1"
android:layout_width="110dp"
android:layout_height="101.95dp"
android:background="@drawable/stars"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="-20dp"
app:layout_constraintHorizontal_bias="0.472"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.000" />
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="78dp"
......@@ -31,6 +45,20 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.262" />
<ImageButton
android:id="@+id/star2"
android:layout_width="110dp"
android:layout_height="101.95dp"
android:layout_marginTop="-20dp"
android:background="@drawable/stars"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.764"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.225" />
<ImageButton
android:id="@+id/imageButton3"
android:layout_width="79dp"
......@@ -43,6 +71,20 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.468" />
<ImageButton
android:id="@+id/star3"
android:layout_width="110dp"
android:layout_height="101.95dp"
android:layout_marginTop="-20dp"
android:background="@drawable/stars"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.705"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.433" />
<ImageButton
android:id="@+id/imageButton4"
android:layout_width="90dp"
......@@ -55,6 +97,20 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.662" />
<ImageButton
android:id="@+id/star4"
android:layout_width="110dp"
android:layout_height="101.95dp"
android:layout_marginTop="-20dp"
android:visibility="invisible"
android:background="@drawable/stars"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.315"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.625" />
<ImageButton
android:id="@+id/imageButton5"
android:layout_width="90dp"
......@@ -69,4 +125,17 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.851" />
<ImageButton
android:id="@+id/star5"
android:layout_width="110dp"
android:layout_height="101.95dp"
android:background="@drawable/stars"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.590"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.800" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment