Commit 7365fd04 authored by Anuththara18's avatar Anuththara18

Gender Selection Screen UI Modification

parent ea360eec
...@@ -3,12 +3,16 @@ package com.anuththara18.attentionassessment.gender; ...@@ -3,12 +3,16 @@ package com.anuththara18.attentionassessment.gender;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent; import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -22,13 +26,14 @@ import com.anuththara18.attentionassessment.language.LanguageSetter; ...@@ -22,13 +26,14 @@ import com.anuththara18.attentionassessment.language.LanguageSetter;
public class GenderActivity extends AppCompatActivity { public class GenderActivity extends AppCompatActivity {
ImageButton toggle_btn; ImageButton toggle_btn, next, previous;
ImageView girl_img, boy_img; ImageView girl_img, boy_img;
TextView boy_txt, girl_txt, next, previous, selectGender; TextView boy_txt, girl_txt, selectGender;
public static int gender = 2; public static int gender = 2;
int click = 1; int click = 1;
MediaPlayer mp;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -42,19 +47,17 @@ public class GenderActivity extends AppCompatActivity { ...@@ -42,19 +47,17 @@ public class GenderActivity extends AppCompatActivity {
decorView.setSystemUiVisibility(uiOptions); decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_gender); setContentView(R.layout.activity_gender);
toggle_btn = (ImageButton)findViewById(R.id.toggle_btn); //toggle_btn = (ImageButton)findViewById(R.id.toggle_btn);
girl_img = (ImageView)findViewById(R.id.girl_img); girl_img = (ImageView)findViewById(R.id.girl_img);
boy_img = (ImageView)findViewById(R.id.boy_img); boy_img = (ImageView)findViewById(R.id.boy_img);
girl_txt = (TextView)findViewById(R.id.girl_txt); girl_txt = (TextView)findViewById(R.id.girl_txt);
boy_txt = (TextView)findViewById(R.id.boy_txt); boy_txt = (TextView)findViewById(R.id.boy_txt);
next = (TextView)findViewById(R.id.next); next = (ImageButton)findViewById(R.id.next);
previous = (TextView)findViewById(R.id.previous); previous = (ImageButton)findViewById(R.id.previous);
selectGender = (TextView)findViewById(R.id.selectGender); selectGender = (TextView)findViewById(R.id.selectGender);
girl_txt.setText(LanguageSetter.getresources().getString(R.string.girl)); girl_txt.setText(LanguageSetter.getresources().getString(R.string.girl));
boy_txt.setText(LanguageSetter.getresources().getString(R.string.boy)); 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)); selectGender.setText(LanguageSetter.getresources().getString(R.string.gender));
// initially // initially
...@@ -63,6 +66,79 @@ public class GenderActivity extends AppCompatActivity { ...@@ -63,6 +66,79 @@ public class GenderActivity extends AppCompatActivity {
boy_img.setImageAlpha(255); boy_img.setImageAlpha(255);
boy_txt.setAlpha(1f); boy_txt.setAlpha(1f);
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
Animation animZoomOut = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.zoom_out);
next.startAnimation(animZoomOut);
handler.postDelayed(this, 750);
}
});
}
}, 0);
girl_img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mp = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp.start();
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));
}
});
girl_txt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mp = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp.start();
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));
}
});
boy_img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mp = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp.start();
girl_img.setImageAlpha(127);
girl_txt.setAlpha(0.5f);
boy_img.setImageAlpha(255);
boy_txt.setAlpha(1f);
gender = 2; // boy
Log.d("gender", String.valueOf(gender));
}
});
boy_txt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mp = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp.start();
girl_img.setImageAlpha(127);
girl_txt.setAlpha(0.5f);
boy_img.setImageAlpha(255);
boy_txt.setAlpha(1f);
gender = 2; // boy
Log.d("gender", String.valueOf(gender));
}
});
/*
toggle_btn.setOnClickListener(new View.OnClickListener() { toggle_btn.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
...@@ -91,10 +167,13 @@ public class GenderActivity extends AppCompatActivity { ...@@ -91,10 +167,13 @@ public class GenderActivity extends AppCompatActivity {
} }
} }
}); });
*/
next.setOnClickListener(new View.OnClickListener() { next.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
finish();
Intent intent = new Intent(GenderActivity.this, AgeActivity.class); Intent intent = new Intent(GenderActivity.this, AgeActivity.class);
startActivity(intent); startActivity(intent);
} }
......
...@@ -204,7 +204,7 @@ public class LanguageActivity extends AppCompatActivity { ...@@ -204,7 +204,7 @@ public class LanguageActivity extends AppCompatActivity {
Toast.makeText(getApplicationContext(), "Please select a language", Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), "Please select a language", Toast.LENGTH_SHORT).show();
} }
else { else {
mp.pause(); //mp.pause();
finish(); finish();
Intent intent = new Intent(LanguageActivity.this, GenderActivity.class); Intent intent = new Intent(LanguageActivity.this, GenderActivity.class);
startActivity(intent); startActivity(intent);
......
...@@ -7,19 +7,13 @@ ...@@ -7,19 +7,13 @@
android:background="@drawable/bg1" android:background="@drawable/bg1"
tools:context=".gender.GenderActivity"> tools:context=".gender.GenderActivity">
<TextView <ImageButton
android:id="@+id/previous" android:id="@+id/previous"
android:layout_width="wrap_content" android:layout_width="50dp"
android:layout_height="wrap_content" android:layout_height="50dp"
android:layout_marginTop="30dp" android:layout_marginLeft="20dp"
android:drawableStart="@drawable/icon_left" android:layout_marginTop="20dp"
android:drawableTint="@color/black" android:background="@drawable/left_btn"
android:fontFamily="@font/poppins_medium"
android:gravity="center"
android:paddingLeft="30dp"
android:text="@string/previous"
android:textColor="@color/black"
android:textSize="16dp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
...@@ -40,19 +34,13 @@ ...@@ -40,19 +34,13 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<TextView <ImageButton
android:id="@+id/next" android:id="@+id/next"
android:layout_width="wrap_content" android:layout_width="50dp"
android:layout_height="wrap_content" android:layout_height="50dp"
android:layout_marginTop="30dp" android:layout_marginRight="20dp"
android:drawableEnd="@drawable/icon_right" android:layout_marginTop="20dp"
android:drawableTint="@color/black" android:background="@drawable/right_btn"
android:fontFamily="@font/poppins_medium"
android:gravity="center"
android:paddingRight="30dp"
android:text="@string/next"
android:textColor="@color/black"
android:textSize="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
...@@ -71,7 +59,7 @@ ...@@ -71,7 +59,7 @@
android:id="@+id/boy_img" android:id="@+id/boy_img"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="250dp" android:layout_height="250dp"
android:layout_marginStart="50dp" android:layout_marginStart="65dp"
android:layout_marginBottom="15dp" android:layout_marginBottom="15dp"
android:src="@drawable/boy" android:src="@drawable/boy"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
...@@ -81,22 +69,11 @@ ...@@ -81,22 +69,11 @@
android:id="@+id/girl_img" android:id="@+id/girl_img"
android:layout_width="190dp" android:layout_width="190dp"
android:layout_height="280dp" android:layout_height="280dp"
android:layout_marginEnd="50dp" android:layout_marginEnd="65dp"
android:src="@drawable/girl" android:src="@drawable/girl"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" /> app:layout_constraintEnd_toEndOf="parent" />
<ImageButton
android:id="@+id/toggle_btn"
android:layout_width="150dp"
android:layout_height="150dp"
android:background="@drawable/toggle_left"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/girl_txt" android:id="@+id/girl_txt"
android:layout_width="wrap_content" android:layout_width="wrap_content"
......
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