Commit ea360eec authored by Anuththara18's avatar Anuththara18

Language Selection Screen UI Modification

parent 89ca9449
......@@ -12,10 +12,10 @@
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@drawable/logo"
android:supportsRtl="true"
android:theme="@style/Theme.AttentionAssessment"
android:usesCleartextTraffic="true">
......
......@@ -4,13 +4,19 @@ import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.media.MediaPlayer;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AbsoluteLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
......@@ -18,14 +24,21 @@ import com.anuththara18.attentionassessment.R;
import com.anuththara18.attentionassessment.details.ParentDetailsActivity;
import com.anuththara18.attentionassessment.gender.GenderActivity;
import pl.droidsonroids.gif.GifImageView;
public class LanguageActivity extends AppCompatActivity {
ImageButton english_btn, sinhala_btn, sinhala_txt_btn;
ImageView english_btn, sinhala_btn;
TextView english_txt;
public static String text = "";
public static final String sharedKey = "Language";
TextView selectLanguage, next;
TextView selectLanguage;
ImageButton next, sinhala_txt_btn;
public static SharedPreferences sharedPref;
GifImageView red_circle;
int click = 1;
MediaPlayer mp;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -39,54 +52,151 @@ public class LanguageActivity extends AppCompatActivity {
decorView.setSystemUiVisibility(uiOptions);
setContentView(R.layout.activity_language);
english_btn = (ImageButton)findViewById(R.id.english_btn);
sinhala_btn = (ImageButton)findViewById(R.id.sinhala_btn);
english_btn = (ImageView)findViewById(R.id.english_btn);
sinhala_btn = (ImageView)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);
next = (ImageButton) findViewById(R.id.next);
red_circle = findViewById(R.id.red_circle);
sharedPref = getSharedPreferences(sharedKey, MODE_PRIVATE);
sinhala_btn.getLayoutParams().height = 656;
sinhala_btn.getLayoutParams().width= 656;
sinhala_btn.requestLayout();
sinhala_txt_btn.getLayoutParams().height = 184;
sinhala_txt_btn.getLayoutParams().width= 394;
sinhala_txt_btn.requestLayout();
english_btn.getLayoutParams().height = 656;
english_btn.getLayoutParams().width= 656;
english_btn.requestLayout();
english_txt.setPadding(0, 10, 0,0 );
english_txt.setTextSize(40);
int bt_notes_blink = 0;
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
/*
Animation animation1 =
AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.blink);
next.startAnimation(animation1);
Animation animZoomIn = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.zoom_in);
next.startAnimation(animZoomIn);
*/
Animation animZoomOut = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.zoom_out);
next.startAnimation(animZoomOut);
handler.postDelayed(this, 750);
}
});
}
}, 0);
english_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
englishSelected();
mp = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp.start();
red_circle.setVisibility(View.VISIBLE);
sinhala_btn.setImageAlpha(127);
sinhala_txt_btn.setAlpha(0.5f);
english_btn.setImageAlpha(255);
english_txt.setAlpha(1f);
text = "English";
setLangPref();
changeLanguage();
}
});
english_txt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
englishSelected();
mp = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp.start();
red_circle.setVisibility(View.VISIBLE);
sinhala_btn.setImageAlpha(127);
sinhala_txt_btn.setAlpha(0.5f);
english_btn.setImageAlpha(255);
english_txt.setAlpha(1f);
text = "English";
setLangPref();
changeLanguage();
}
});
sinhala_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sinhalaSelected();
mp = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp.start();
red_circle.setVisibility(View.VISIBLE);
english_btn.setImageAlpha(127);
english_txt.setAlpha(0.5f);
sinhala_btn.setImageAlpha(255);
sinhala_txt_btn.setAlpha(1f);
text = "සිංහල";
setLangPref();
changeLanguage();
}
});
sinhala_txt_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sinhalaSelected();
mp = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp.start();
red_circle.setVisibility(View.VISIBLE);
english_btn.setImageAlpha(127);
english_txt.setAlpha(0.5f);
sinhala_btn.setImageAlpha(255);
sinhala_txt_btn.setAlpha(1f);
text = "සිංහල";
setLangPref();
changeLanguage();
}
});
/*
toggle_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
click++;
mp = MediaPlayer.create(getApplicationContext(), R.raw.button_click);
mp.start();
if(click % 2 == 0) {
toggle_btn.setBackgroundResource(R.drawable.toggle_right);
english_btn.setImageAlpha(127);
english_txt.setAlpha(0.5f);
sinhala_btn.setImageAlpha(255);
sinhala_txt_btn.setAlpha(1f);
text = "සිංහල";
setLangPref();
changeLanguage();
}
else {
toggle_btn.setBackgroundResource(R.drawable.toggle_left);
sinhala_btn.setImageAlpha(127);
sinhala_txt_btn.setAlpha(0.5f);
english_btn.setImageAlpha(255);
english_txt.setAlpha(1f);
text = "English";
setLangPref();
changeLanguage();
}
}
});
sinhala_btn.getLayoutParams().height = 656;
sinhala_btn.getLayoutParams().width= 656;
sinhala_btn.requestLayout();
sinhala_txt_btn.getLayoutParams().height = 184;
sinhala_txt_btn.getLayoutParams().width= 394;
sinhala_txt_btn.requestLayout();
english_btn.getLayoutParams().height = 656;
english_btn.getLayoutParams().width= 656;
english_btn.requestLayout();
english_txt.setPadding(0, 10, 0,0 );
english_txt.setTextSize(40);
*/
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
......@@ -94,6 +204,8 @@ public class LanguageActivity extends AppCompatActivity {
Toast.makeText(getApplicationContext(), "Please select a language", Toast.LENGTH_SHORT).show();
}
else {
mp.pause();
finish();
Intent intent = new Intent(LanguageActivity.this, GenderActivity.class);
startActivity(intent);
}
......@@ -138,7 +250,6 @@ public class LanguageActivity extends AppCompatActivity {
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));
}
......
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha android:fromAlpha="0.0"
android:toAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:duration="600"
android:repeatMode="reverse"
android:repeatCount="infinite"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="1000"
android:fromXScale="2"
android:fromYScale="2"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="4"
android:toYScale="4" >
</scale>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:duration="2500"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale=".2"
android:toYScale=".2" />
</set>
\ No newline at end of file
......@@ -24,50 +24,43 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
<ImageButton
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:drawableEnd="@drawable/icon_right"
android:drawableTint="@color/black"
android:fontFamily="@font/poppins_medium"
android:gravity="center"
android:paddingRight="30dp"
android:text="@string/next"
android:textColor="@color/black"
android:textSize="16dp"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginRight="20dp"
android:layout_marginTop="20dp"
android:background="@drawable/right_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
<pl.droidsonroids.gif.GifImageView
android:id="@+id/red_circle"
android:layout_width="100dp"
android:layout_marginRight="-6dp"
android:layout_marginTop="-5dp"
android:layout_height="100dp"
android:visibility="invisible"
android:src="@drawable/red_circle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/english_btn"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_marginStart="65dp"
android:layout_marginBottom="30dp"
android:background="@drawable/language_board"
android:paddingRight="50dp"
android:src="@drawable/language_board"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ImageButton
android:id="@+id/sinhala_btn"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_marginEnd="65dp"
android:layout_marginBottom="30dp"
android:background="@drawable/language_board"
android:paddingLeft="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/english_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="113dp"
android:layout_marginBottom="148dp"
android:layout_marginStart="115dp"
android:layout_marginBottom="144dp"
android:fontFamily="@font/poppins_medium"
android:text="English"
android:textColor="@color/black"
......@@ -75,11 +68,21 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="@+id/sinhala_btn"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_marginEnd="65dp"
android:layout_marginBottom="30dp"
android:src="@drawable/language_board"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ImageButton
android:id="@+id/sinhala_txt_btn"
android:layout_width="150dp"
android:layout_height="70dp"
android:layout_marginEnd="120dp"
android:layout_marginEnd="125dp"
android:layout_marginBottom="144dp"
android:background="@drawable/sinhala"
android:paddingLeft="50dp"
......@@ -88,8 +91,8 @@
<ImageView
android:id="@+id/imageView"
android:layout_width="900dp"
android:layout_height="430dp"
android:layout_width="850dp"
android:layout_height="375dp"
android:layout_marginBottom="-132dp"
android:src="@drawable/grass2"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -9,9 +9,9 @@
<item android:id="@+id/dashboard" android:title="Dashboard" android:icon="@drawable/icon_dashboard"/>
<item android:id="@+id/admin" android:title="Visual Attention Assessments" android:icon="@drawable/icon_assessment"/>
<item android:id="@+id/parents" android:title="Ayeshka" android:icon="@drawable/icon_assessment"/>
<item android:id="@+id/healthProfessional" android:title="Sandunika" android:icon="@drawable/icon_assessment"/>
<item android:id="@+id/doctor" android:title="Isuri" android:icon="@drawable/icon_assessment"/>
<item android:id="@+id/parents" android:title="Coming Soon..." android:icon="@drawable/icon_assessment"/>
<item android:id="@+id/healthProfessional" android:title="Coming Soon..." android:icon="@drawable/icon_assessment"/>
<item android:id="@+id/doctor" android:title="Coming Soon..." android:icon="@drawable/icon_assessment"/>
</group>
</menu>
</item>
......
......@@ -31,7 +31,7 @@
<string name="focg2">ගුහාවෙන් එළියට එන වලස් පැටවා ඔබන්න</string>
<string name="divg1">වර්ණ ගැලපෙන විට රතු බොත්තම ඔබන්න</string>
<string name="divg2">සතුන් දෙදෙනාම ගැලපෙන විට පහළ සත්වයා ඔබන්න</string>
<string name="susg1">කුරුල්ලා අත්ත මත වාඩි වූ විට රතු බොත්තම ඔබන්න</string>
<string name="susg1">කුරුල්ලා අත්ත මත වාඩි වූ විට කුරුල්ලා මත ඔබන්න</string>
<string name="altg1">තිරය මත දිස්වන සත්වයා ඔබන්න</string>
<string name="provideconsent">මම මේ කැමති පත්‍රය කියවා ඒ සම්බන්ධව ඇති වූ ගැටළු නිරාකරණය කර ගත්තෙමි. පහත සඳහන් අත්සනින් මම මගේ දරුවා මෙම අධ්‍යයනයට සම්බන්ධ කරවීමට කැමති බව ප්‍රකාශ කර සිටිමි. මා කැමති ඕනෑම අවස්ථාවක කිසිදු ගැටලුවකින් තොරව මෙම අධ්‍යයනයෙන් මගේ දරුවා ඉවත්කරගැනීමේ හැකියාවද ඇති බව මම දනිමි.</string>
......
......@@ -30,7 +30,7 @@
<string name="focg2">Press the bear coming out of the cave</string>
<string name="divg1">Press the red button when the colours 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="susg1">Press on the bird when the bird sits on the branch</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>
......
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