APLIKASI PEMBELAJARAN BAHASA INGGRIS
BERBASIS ANDROID UNTUK GURU SDIT ANAK
SHOLEH
Tim Penyusun :
1. Sardiarinto
2. Angela Bayu Pertama Sari
3. Dwi Iswahyuni
4. Anik Andriani
5. Eko Saputro
PETUNJUK PENGGUNAAN APLIKASI
1. Instalasi
Pada tahap ini di lakukan instalasi aplikasi pada handphone dengan sistem operasi
android. Program yang sudah jadi dipackage ke file “.apk” terlebih dahulu. Kemudian
file apk dipindahkan ke handphone dan dilakukan instalasi. Proses instalasi dapat
dilihat pada gambar 1,2 dan 3.
Gambar 1. File APK Hasil Package
Gambar 3. Hasil Istalasi
Aplikasi Pembelajaran Bahasa Inggris yang sudah terinstal dapat langsung
digunakan sebagai media sarana belajar bagi Guru SDIT Anak Sholeh dan juga anak
didiknya.
2. Implementasi Menu utama
Pada aplikasi pertama terdapat beberapa pilihan menu utama yaitu mengenal
huruf, mengenal kalimat, tes suara dan keluar. Setelah menu dipilih akan muncul
beberapa pilihan sesuai sub menu. Bentuk menu utama dapat dilihat pada gambar 4.
Gambar 4. Menu Utama
3. Implementasi Menu Mengenal Huruf
Tampilan menu Alphabet dapat dilihat pada gambar 5 yang didalamnya terdiri
dari 6 tombol alphabet yang jika ditekan akan berbunyi sesuai ejaan Bahasa Inggris.
Tekan tombol next
untuk melanjutkan alphabet selanjutnya, dan jika ingin kembali
ke alphabet sebelumnya dapat menekan tombol back
. Tekan tombol home
untuk
kembali ke menu utama
Gambar 5. Menu Mengenal Huruf
4. Implementasi Menu Mengenal Kalimat
Tampilan menu Mengenal Kalimat dapat dilihat pada gambar 6.Terdapat sepuluh
pilihan menu yaitu sapaan, Instruksi bekerja, Instruksi perilaku, larangan,
menanyakan sesuatu, meminta ijin, memberikan ijin, meminta tolong, pujian,
berpisah.
Gambar 6. Menu Mengenal Kalimat
5. Implementasi Sub Menu Mengenal Kalimat
Tampilan salah satu Sub Menu Mengenal Kalimat dapat dilihat pada gambar 7.
Misalkan sub menu sapaan jika di klik akan muncul kalimat sapaan dalam Bahasa
Indonesia dan Bahasa inggris. Jika ingin mengetes suara di lakukan uji coba
menggunakan tombol sound
. Untuk melihat atau mendengarkan kalimat yang lain
dapat menekan tombol next
dan untuk melihat atau mendengarkan kalimat
sebelumnya dapat ditekan tombol back
Gambar 7. Contoh Sub Menu Mengenal Kalimat
6. Implementasi Sub Menu Tes Suara
Tampilan salah satu Sub Menu Tes Suara dapat dilihat pada gambar 8. Jika ingin
mengetes suara kita sudah sesuai dengan grammar atau belum dapat di lakukan uji
coba menggunakan tombol micropone
lalu ucapkan. Setelah mengucapkan kalimat
akan muncul hasil pengucapan apakah sesuai dengan grammar Bahasa inggris atau
belum di kolom hasil pengucapan. Untuk melihat atau mendengarkan kalimat yang
lain dapat menekan tombol next
dan untuk melihat atau mendengarkan kalimat
sebelumnya dapat ditekan tombol back
KODE PROGRAM APLIKASI
1. activity_splash_screen.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:orientation="vertical"
tools:context="com.joes.myapplication.MainActivity"> <TextView
android:id="@+id/textView3"
android:layout_width="match_parent" android:layout_height="299dp" android:textAlignment="center" android:textSize="36sp"
android:textStyle="bold" /> <ProgressBar
android:id="@+id/loading"
android:layout_width="match_parent" android:layout_height="204dp"
android:layout_below="@+id/textView2" android:layout_centerHorizontal="true" /> <TextView
android:id="@+id/textView2"
android:layout_width="match_parent" android:layout_height="wrap_content" android:text="WELCOME"
android:textAlignment="center" android:textSize="36sp"
android:textStyle="bold" /> </LinearLayout>
2. SplashScreen.java
package com.joes.myapplication; import android.content.Intent; import android.os.Bundle; import android.os.StrictMode; import android.support.v7.app.AppCompatActivity;public class SplashScreen extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);
if (android.os.Build.VERSION.SDK_INT > 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy);
}
final int waktu = 1500;
Thread welcomeThread = new Thread() { int tunggu = 0;
@Override
public void run() { try {
super.run();
while (tunggu < waktu) { sleep(100);
tunggu += 100; }
} catch (Exception e) {
System.out.println("Exc=" + e); } finally {
Intent intent = new Intent(SplashScreen.this, MainActivity.class); finish(); startActivity(intent); } } }; welcomeThread.start(); } }
3. activity_main.xml
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"android:layout_height="match_parent"> <LinearLayout
android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" tools:layout_editor_absoluteX="22dp" tools:layout_editor_absoluteY="88dp"> <android.support.v7.widget.Toolbar android:id="@+id/btnHuruf" android:layout_width="340dp"
android:layout_height="wrap_content" android:layout_margin="5dp"
android:background="@color/colorAccent"
android:minHeight="@android:dimen/notification_large_icon_width" android:onClick="getMenuHuruf"
android:theme="?attr/actionBarTheme"
app:logo="@android:drawable/btn_star_big_on" app:title=" Mengenal Huruf" />
<android.support.v7.widget.Toolbar android:id="@+id/btnKalimat"
android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="5dp"
android:background="@color/colorAccent"
android:minHeight="@android:dimen/notification_large_icon_width" android:onClick="getMenuKalimat"
android:theme="?attr/actionBarTheme"
app:logo="@android:drawable/ic_menu_agenda" app:title=" Mengenal Kalimat" />
<android.support.v7.widget.Toolbar android:id="@+id/btnKuis"
android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="5dp"
android:background="@color/colorAccent"
android:minHeight="@android:dimen/notification_large_icon_width" android:onClick="getMenuKuis"
android:theme="?attr/actionBarTheme"
app:logo="@android:drawable/presence_audio_busy" app:title=" Tes Suara Anda" />
<android.support.v7.widget.Toolbar android:id="@+id/btnKeluar"
android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="5dp"
android:background="@color/colorAccent"
android:minHeight="@android:dimen/notification_large_icon_width" android:onClick="getMenuExit"
android:theme="?attr/actionBarTheme" app:logo="@android:drawable/ic_delete" app:title=" Keluar" />
</LinearLayout> </android.support.constraint.ConstraintLayout>
4. MainActivity.java
package com.joes.myapplication; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView;public class MainActivity extends AppCompatActivity { private TextView txtHasil;
@Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txtHasil = (TextView) findViewById(R.id.txtHasil); }
public void getMenuHuruf(View view) {
startActivity(intent); }
public void getMenuKalimat(View view) {
Intent intent = new Intent(MainActivity.this, MenuKalimat.class); startActivity(intent);
}
public void getMenuKuis(View view) {
Intent intent = new Intent(MainActivity.this, Kuis.class); startActivity(intent);
}
public void getMenuExit(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setCancelable(false);
builder.setMessage("Yakin Mau Keluar?"); builder.setPositiveButton("Ya", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) { finish();
} });
builder.setNegativeButton("Tidak", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) { dialog.cancel();
} });
AlertDialog alert = builder.create(); alert.show();
} }
5. activity_menu_huruf.xml
<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
<TableLayout
android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="32dp" android:layout_marginLeft="32dp" android:layout_marginEnd="32dp" android:layout_marginRight="32dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" tools:layout_editor_absoluteY="8dp">
<TableRow
android:layout_width="366dp" android:layout_height="41dp" android:orientation="horizontal"> <Button
android:id="@+id/btn1"
style="@android:style/Widget.Button.Inset" android:layout_width="114dp"
android:layout_height="114dp" android:text="A"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textSize="60sp"
android:textStyle="bold" android:typeface="normal" /> <Button
android:id="@+id/btn2"
style="@android:style/Widget.Button.Inset" android:layout_width="114dp"
android:layout_height="114dp" android:text="B"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textSize="60sp"
android:textStyle="bold" android:typeface="normal" /> <Button
android:id="@+id/btn3"
style="@android:style/Widget.Button.Inset" android:layout_width="114dp"
android:layout_height="114dp" android:text="C"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textSize="60sp"
android:textStyle="bold" android:typeface="normal" /> </TableRow>
<TableRow
android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <Button
android:id="@+id/btn4"
style="@android:style/Widget.Button.Inset" android:layout_width="114dp"
android:layout_height="114dp" android:text="D"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textSize="60sp"
android:textStyle="bold" android:typeface="normal" /> <Button
android:id="@+id/btn5"
style="@android:style/Widget.Button.Inset" android:layout_width="114dp"
android:layout_height="114dp" android:text="E"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textSize="60sp"
android:textStyle="bold" android:typeface="normal" /> <Button
android:id="@+id/btn6"
style="@android:style/Widget.Button.Inset" android:layout_width="114dp"
android:layout_height="114dp" android:text="F"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textSize="60sp"
android:textStyle="bold" android:typeface="normal" /> </TableRow>
<TableRow
android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <Button
android:id="@+id/btn7"
style="@android:style/Widget.Button.Inset" android:layout_width="114dp"
android:layout_height="114dp" android:text="G"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textSize="60sp"
android:textStyle="bold" android:typeface="normal" /> <Button
android:id="@+id/btn8"
style="@android:style/Widget.Button.Inset" android:layout_width="114dp"
android:layout_height="114dp" android:text="H"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textSize="60sp"
android:textStyle="bold" android:typeface="normal" /> <Button
android:id="@+id/btn9"
style="@android:style/Widget.Button.Inset" android:layout_width="114dp"
android:layout_height="114dp" android:text="I"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textSize="60sp"
android:textStyle="bold" android:typeface="normal" /> </TableRow>
<TableRow
android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <ImageButton
android:id="@+id/btnHome" android:layout_width="114dp" android:layout_height="114dp"
android:background="?attr/colorBackgroundFloating" android:onClick="getMenuUtama"
android:scaleType="fitCenter" app:srcCompat="@drawable/menu" /> <ImageButton
android:id="@+id/btnHome" android:layout_width="114dp" android:layout_height="114dp"
android:background="?attr/colorBackgroundFloating" android:onClick="setBack"
android:scaleType="fitCenter" app:srcCompat="@drawable/back" /> <ImageButton
android:id="@+id/btnNext" android:layout_width="114dp" android:layout_height="114dp"
android:background="?attr/colorBackgroundFloating" android:onClick="setNext"
android:scaleType="fitCenter" app:srcCompat="@drawable/next" /> </TableRow>
</TableLayout>
</android.support.constraint.ConstraintLayout>
package com.joes.myapplication; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.speech.tts.TextToSpeech; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import java.util.Locale;
public class MenuHuruf extends AppCompatActivity { Button bt1,bt2,bt3,bt4,bt5,bt6,bt7,bt8,bt9; TextToSpeech textToSpeech;
int x=0;
String isi1[] = {"A","J","S"}; String isi2[] = {"B","K","T"}; String isi3[] = {"C","L","U"}; String isi4[] = {"D","M","V"}; String isi5[] = {"E","N","W"}; String isi6[] = {"F","O","X"}; String isi7[] = {"G","P","Y"}; String isi8[] = {"H","Q","Z"}; String isi9[] = {"I","R",""}; public void tampil(){
bt1.setText(isi1[x]); bt2.setText(isi2[x]); bt3.setText(isi3[x]); bt4.setText(isi4[x]); bt5.setText(isi5[x]); bt6.setText(isi6[x]); bt7.setText(isi7[x]); bt8.setText(isi8[x]); bt9.setText(isi9[x]); }
public void setNext(View view) { x++;
if (x >= 2) { x = 2; }
tampil(); }
public void setBack(View view){ x--; if(x<=0){ x=0; } tampil(); } @Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_menu_huruf); bt1= (Button)findViewById(R.id.btn1); bt2= (Button)findViewById(R.id.btn2); bt3= (Button)findViewById(R.id.btn3); bt4= (Button)findViewById(R.id.btn4); bt5= (Button)findViewById(R.id.btn5); bt6= (Button)findViewById(R.id.btn6); bt7= (Button)findViewById(R.id.btn7); bt8= (Button)findViewById(R.id.btn8); bt9= (Button)findViewById(R.id.btn9);
textToSpeech = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status != TextToSpeech.ERROR) { textToSpeech.setLanguage(Locale.US); }
} });
bt1.setOnClickListener(new View.OnClickListener() { @Override
public void onClick(View view) {
String text = bt1.getText().toString(); if (Build.VERSION.SDK_INT >=
Build.VERSION_CODES.LOLLIPOP) {
textToSpeech.speak(text,TextToSpeech.QUEUE_FLUSH,null,null); } else {
textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null);
} } });
bt2.setOnClickListener(new View.OnClickListener() { @Override
public void onClick(View view) {
String text = bt2.getText().toString(); if (Build.VERSION.SDK_INT >=
Build.VERSION_CODES.LOLLIPOP) {
textToSpeech.speak(text,TextToSpeech.QUEUE_FLUSH,null,null); } else {
textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null);
} } });
bt3.setOnClickListener(new View.OnClickListener() { @Override
public void onClick(View view) {
String text = bt3.getText().toString(); if (Build.VERSION.SDK_INT >=
Build.VERSION_CODES.LOLLIPOP) {
textToSpeech.speak(text,TextToSpeech.QUEUE_FLUSH,null,null); } else {
textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null);
} } });
bt4.setOnClickListener(new View.OnClickListener() { @Override
public void onClick(View view) {
String text = bt4.getText().toString(); if (Build.VERSION.SDK_INT >=
Build.VERSION_CODES.LOLLIPOP) {
} else {
textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null);
} } });
bt5.setOnClickListener(new View.OnClickListener() { @Override
public void onClick(View view) {
String text = bt5.getText().toString(); if (Build.VERSION.SDK_INT >=
Build.VERSION_CODES.LOLLIPOP) {
textToSpeech.speak(text,TextToSpeech.QUEUE_FLUSH,null,null); } else {
textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null);
} } });
bt6.setOnClickListener(new View.OnClickListener() { @Override
public void onClick(View view) {
String text = bt6.getText().toString(); if (Build.VERSION.SDK_INT >=
Build.VERSION_CODES.LOLLIPOP) {
textToSpeech.speak(text,TextToSpeech.QUEUE_FLUSH,null,null); } else {
textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null);
} } });
bt7.setOnClickListener(new View.OnClickListener() { @Override
public void onClick(View view) {
String text = bt7.getText().toString(); if (Build.VERSION.SDK_INT >=
Build.VERSION_CODES.LOLLIPOP) {
textToSpeech.speak(text,TextToSpeech.QUEUE_FLUSH,null,null); } else {
textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null);
} } });
bt8.setOnClickListener(new View.OnClickListener() { @Override
public void onClick(View view) {
String text = bt8.getText().toString(); if (Build.VERSION.SDK_INT >=
Build.VERSION_CODES.LOLLIPOP) {
textToSpeech.speak(text,TextToSpeech.QUEUE_FLUSH,null,null); } else {
textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null);
} } });
bt9.setOnClickListener(new View.OnClickListener() { @Override
public void onClick(View view) {
String text = bt9.getText().toString(); if (Build.VERSION.SDK_INT >=
Build.VERSION_CODES.LOLLIPOP) {
textToSpeech.speak(text,TextToSpeech.QUEUE_FLUSH,null,null); } else {
textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null);
} } }); }
public void getMenuUtama(View view) {
Intent intent = new Intent(MenuHuruf.this, MainActivity.class); startActivity(intent);
}
7. activity_menu_kalimat.xml
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"android:layout_height="match_parent"> <LinearLayout
android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="13dp" android:layout_marginLeft="13dp" android:layout_marginEnd="13dp" android:layout_marginRight="13dp" android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" tools:layout_editor_absoluteY="88dp">
<TableLayout
android:layout_width="match_parent" android:layout_height="wrap_content"> <TableRow
android:layout_width="match_parent" android:layout_height="match_parent"> <Button
android:id="@+id/btnKalimat10" android:layout_width="180dp" android:layout_height="110dp" android:layout_margin="2dp" android:layout_marginLeft="30dp" android:layout_marginRight="30dp"
android:drawableTop="@android:drawable/ic_menu_directions" android:onClick="getDetilKalimat10" android:paddingRight="20dp"
<Button
android:id="@+id/btnKalimat9" android:layout_width="170dp" android:layout_height="110dp" android:layout_margin="2dp" android:layout_marginRight="30dp"
android:drawableTop="@android:drawable/ic_menu_crop" android:onClick="getDetilKalimat9"
android:text="PUJIAN" /> </TableRow>
<TableRow
android:layout_width="match_parent" android:layout_height="145dp"> <Button
android:id="@+id/btnKalimat6" android:layout_width="170dp" android:layout_height="110dp" android:layout_margin="2dp"
android:drawableTop="@android:drawable/ic_menu_compass" android:onClick="getDetilKalimat6"
android:text="MEMINTA IJIN" /> <Button
android:id="@+id/btnKalimat5" android:layout_width="170dp" android:layout_height="110dp" android:layout_margin="2dp"
android:drawableTop="@android:drawable/ic_menu_help" android:onClick="getDetilKalimat5"
android:text="BERTANYA" /> </TableRow>
<TableRow
android:layout_width="match_parent" android:layout_height="match_parent"> <Button
android:id="@+id/btnHuruf" android:layout_width="170dp" android:layout_height="110dp" android:layout_margin="2dp"
android:drawableTop="@android:drawable/ic_menu_myplaces" android:onClick="getDetilKalimat2"
android:text="SAPAAN" /> <Button
android:id="@+id/btnKalimat4" android:layout_width="170dp" android:layout_height="110dp" android:layout_margin="2dp"
android:drawableTop="@android:drawable/btn_dialog" android:onClick="getDetilKalimat4"
android:text="LARANGAN" /> </TableRow>
<TableRow
android:layout_width="match_parent" android:layout_height="match_parent"> <Button
android:id="@+id/btnKalimat8" android:layout_width="170dp" android:layout_height="110dp" android:layout_margin="2dp"
android:drawableTop="@android:drawable/ic_menu_call" android:onClick="getDetilKalimat8"
android:text="MEMINTA TOLONG" /> <Button
android:id="@+id/btnKalimat7" android:layout_width="170dp" android:layout_height="110dp" android:layout_margin="2dp"
android:drawableTop="@android:drawable/ic_menu_set_as" android:onClick="getDetilKalimat7"
android:text="MERESPON IJIN" /> </TableRow>
<TableRow
android:layout_width="match_parent" android:layout_height="match_parent"> <Button
android:id="@+id/btnKalimat3" android:layout_width="170dp" android:layout_height="110dp" android:layout_margin="2dp"
android:drawableTop="@android:drawable/ic_lock_silent_mode_off" android:onClick="getDetilKalimat3"
android:text="Intruksi Perilaku" /> <Button
android:id="@+id/btnKalimat" android:layout_width="170dp" android:layout_height="110dp" android:layout_margin="2dp"
android:drawableTop="@android:drawable/ic_menu_preferences" android:onClick="getDetilKalimat1" android:text="INSTRUKSI BEKERJA" /> </TableRow>
</TableLayout>
<Button
android:id="@+id/btnKeluar" android:layout_width="340dp"
android:layout_height="wrap_content" android:layout_margin="5dp"
android:background="@android:color/holo_orange_dark" android:onClick="getMenuUtama"
android:text="BACK"
android:textColor="@android:color/background_light" /> </LinearLayout> </android.support.constraint.ConstraintLayout>
8. MenuKalimat.java
package com.joes.myapplication; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView;public static final String EXTRA_MESSAGE =
"com.joes.myapplication.MESSAGE"; @Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu_kalimat); }
public void getDetilKalimat1(View view) { String data="kalimat1";
Intent intent = new Intent(MenuKalimat.this, DetilKalimat.class); intent.putExtra(EXTRA_MESSAGE, data);
startActivity(intent); }
public void getDetilKalimat2(View view) { String data="kalimat2";
Intent intent = new Intent(MenuKalimat.this, DetilKalimat.class); intent.putExtra(EXTRA_MESSAGE, data);
startActivity(intent); }
public void getDetilKalimat3(View view) { String data="kalimat3";
Intent intent = new Intent(MenuKalimat.this, DetilKalimat.class); intent.putExtra(EXTRA_MESSAGE, data);
startActivity(intent); }
public void getDetilKalimat4(View view) { String data="kalimat4";
Intent intent = new Intent(MenuKalimat.this, DetilKalimat.class); intent.putExtra(EXTRA_MESSAGE, data);
startActivity(intent); }
public void getDetilKalimat5(View view) { String data="kalimat5";
Intent intent = new Intent(MenuKalimat.this, DetilKalimat.class); intent.putExtra(EXTRA_MESSAGE, data);
startActivity(intent); }
public void getDetilKalimat6(View view) { String data="kalimat6";
Intent intent = new Intent(MenuKalimat.this, DetilKalimat.class); intent.putExtra(EXTRA_MESSAGE, data);
startActivity(intent); }
public void getDetilKalimat7(View view) { String data="kalimat7";
Intent intent = new Intent(MenuKalimat.this, DetilKalimat.class); intent.putExtra(EXTRA_MESSAGE, data);
startActivity(intent); }
public void getDetilKalimat8(View view) { String data="kalimat8";
Intent intent = new Intent(MenuKalimat.this, DetilKalimat.class); intent.putExtra(EXTRA_MESSAGE, data);
startActivity(intent); }
public void getDetilKalimat9(View view) { String data="kalimat9";
Intent intent = new Intent(MenuKalimat.this, DetilKalimat.class); intent.putExtra(EXTRA_MESSAGE, data);
startActivity(intent); }
public void getDetilKalimat10(View view) { String data="kalimat10";
Intent intent = new Intent(MenuKalimat.this, DetilKalimat.class); intent.putExtra(EXTRA_MESSAGE, data);
startActivity(intent); }
public void getMenuUtama(View view) {
Intent intent = new Intent(MenuKalimat.this, MainActivity.class); startActivity(intent); } }
9. activity_detil_kalimat.xml
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"android:layout_height="match_parent"
android:background="?attr/colorButtonNormal" android:paddingLeft="13dp"
android:paddingTop="13dp" android:paddingRight="13dp" android:theme="@style/AppTheme"> <LinearLayout
android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" tools:layout_editor_absoluteX="22dp" tools:layout_editor_absoluteY="88dp"> <LinearLayout
android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:color/white" android:orientation="vertical">
<android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="340dp"
android:layout_height="wrap_content"
android:background="@color/design_default_color_primary" android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme" app:title="Bahasa Indonesia" /> <TextView
android:id="@+id/txtInd" android:layout_width="340dp" android:layout_height="123dp"
android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:padding="15dp"
android:textColor="#000" android:textSize="26sp" android:textStyle="normal" /> </LinearLayout>
<TextView
android:layout_width="340dp" android:layout_height="51dp"
android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:textColor="#000"
android:textSize="26sp" android:textStyle="normal"
android:visibility="invisible" /> <LinearLayout
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="@android:color/background_light" android:orientation="vertical">
<android.support.v7.widget.Toolbar android:id="@+id/toolbar2" android:layout_width="340dp"
android:layout_height="wrap_content" android:background="@color/colorAccent" android:minHeight="?attr/actionBarSize" android:theme="?attr/actionBarTheme" app:title="Bahasa Inggris" />
<TextView
android:id="@+id/txtEng" android:layout_width="340dp" android:layout_height="122dp"
android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:padding="15dp"
android:textColor="#000" android:textSize="26sp" android:textStyle="normal" /> </LinearLayout>
<TextView
android:id="@+id/txtHasil" android:layout_width="340dp" android:layout_height="51dp"
android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:textColor="#000"
android:textSize="26sp" android:textStyle="normal"
android:visibility="invisible" /> <LinearLayout
android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <ImageButton
android:id="@+id/btnHome"
android:layout_width="match_parent" android:layout_height="99dp"
android:layout_weight="1" android:onClick="getMenuUtama" android:scaleType="fitCenter" app:srcCompat="@drawable/menu" /> <ImageButton
android:id="@+id/btnBack"
android:layout_width="match_parent" android:layout_height="99dp"
android:layout_weight="1" android:onClick="setBack" android:scaleType="fitCenter" app:srcCompat="@drawable/back" /> <ImageButton
android:id="@+id/btnSpeak"
android:layout_width="match_parent" android:layout_height="99dp"
android:layout_weight="1" android:onClick="getSuaraDetil" android:scaleType="fitCenter" app:srcCompat="@drawable/osuara" /> <ImageButton
android:id="@+id/btnNext"
android:layout_width="match_parent" android:layout_height="99dp"
android:layout_weight="1" android:onClick="setNext" android:scaleType="fitCenter" app:srcCompat="@drawable/next" />
</LinearLayout> </LinearLayout> </android.support.constraint.ConstraintLayout>
10. DetilKalimat.java
package com.joes.myapplication; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.speech.tts.TextToSpeech; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.TextView; import java.util.Locale;public class DetilKalimat extends AppCompatActivity { TextToSpeech textToSpeech;
TextView SuaraEng; int x=0;
String sapaan[] = {"Hallo, apa kabarmu?","Bagaimana kabarmu?","Bagaimana aktifitasmu?"};
String esapaan[] = {"Hello, how are you?","How’s life?","How is your day?"};
String instruksi_bekerja[]={"Tolong siapkan selembar kertas","Tolong berbaris","Tolong angkat tangan"};
String einstruksi_bekerja[]={"Please take a piece of paper","Please make a line","Raise your hand please"};
String instruksi_perilaku[]={"Tolong tenang","Kembali ke tempat dudukmu","Hormati yang lain"};
String einstruksi_perilaku[]={"Quiet please","Go back to your seat","Respect others"};
String larangan[]={"Jangan mencontek","Jangan berkata kasar/ jelek","Jangan membuang sampah di lantai"};
String elarangan[]={"Don’t cheat","Don’t say bad words","Don’t throw garbage in the floor"};
String menanyakan_sesuatu[]={"Apakah ada pertanyaan, sejauh ini?","Apa sudah jelas / paham?","Apa bisa mendengar saya?"};
String emenanyakan_sesuatu[]={"Is there any question, so far?","Do you understand?","Do you hear me?"};
String meminta_ijin[]={"Apa saya boleh ke toilet?","Bolehkah saya bertanya sesuatu?","Bolehkah saya membersihkan papan tulis?"};
String ememinta_ijin[]={"May I go to the toilet?","May I ask something?","May I clean the whiteboard? "};
String memberikan_ijin[]={"Tentu saja","Ya boleh","Tentu saja , boleh"};
String ememberikan_ijin[]={"Sure","Yes please","Of course, you can"}; String meminta_tolong[]={"Tolong bagikan kertas ini ke teman-teman kalian","Tolong kumpulkan bukunya","Tolong bersihkan papan tulisnya"}; String ememinta_tolong[]={"Please distribute this paper to your friend","Please collect the books","Clean the whiteboard please"}; String pujian[]={"Kerja yang bagus!","Usaha yang baik","Hebat"}; String epujian[]={"Good job","Nice try","Awesome "};
String berpisah[]={"Saatnya untuk pulang/ pergi, sampai jumpa", "Hati-hati","Sampai jumpa dan smoga harimu menyenangkan"};
String eberpisah[]={"It’s time to go, see you","Take care","See you and have a good day"};
/**/
public void setTampil(){
TextView kalimat=(TextView)findViewById(R.id.txtHasil); String teks =kalimat.getText().toString();
TextView SuaraInd = findViewById(R.id.txtInd); TextView SuaraEng = findViewById(R.id.txtEng); if(teks.equals("kalimat1")) { SuaraInd.setText(sapaan[x]); SuaraEng.setText(esapaan[x]); } if(teks.equals("kalimat2")) { SuaraInd.setText(instruksi_bekerja[x]); SuaraEng.setText(einstruksi_bekerja[x]); } if(teks.equals("kalimat3")) { SuaraInd.setText(instruksi_perilaku[x]); SuaraEng.setText(einstruksi_perilaku[x]); }
if(teks.equals("kalimat4")) { SuaraInd.setText(larangan[x]); SuaraEng.setText(elarangan[x]); } if(teks.equals("kalimat5")) { SuaraInd.setText(menanyakan_sesuatu[x]); SuaraEng.setText(emenanyakan_sesuatu[x]); } if(teks.equals("kalimat6")) { SuaraInd.setText(meminta_ijin[x]); SuaraEng.setText(ememinta_ijin[x]); } if(teks.equals("kalimat7")) { SuaraInd.setText(memberikan_ijin[x]); SuaraEng.setText(ememberikan_ijin[x]); } if(teks.equals("kalimat8")) { SuaraInd.setText(meminta_tolong[x]); SuaraEng.setText(ememinta_tolong[x]); } if(teks.equals("kalimat9")) { SuaraInd.setText(pujian[x]); SuaraEng.setText(epujian[x]); } if(teks.equals("kalimat4")) { SuaraInd.setText(berpisah[x]); SuaraEng.setText(eberpisah[x]); } }
public void setNext(View view){ x++; if(x>=2){ x=2; } setTampil(); }
public void setBack(View view){ x--; if(x<=0){ x=0; } setTampil(); }
@Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detil_kalimat); Intent intent = getIntent();
String data = intent.getStringExtra(MenuKalimat.EXTRA_MESSAGE); TextView textView = findViewById(R.id.txtHasil);
textView.setText(data);
textToSpeech = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status != TextToSpeech.ERROR) { textToSpeech.setLanguage(Locale.US); }
} });
}
public void getSuaraDetil(View view) {
SuaraEng=(TextView)findViewById(R.id.txtEng); String text =SuaraEng.getText().toString();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { textToSpeech.speak(text,TextToSpeech.QUEUE_FLUSH,null,null); } else {
textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null); }
}
public void getMenuUtama(View view) {
Intent intent = new Intent(DetilKalimat.this, MainActivity.class); startActivity(intent); } }
11. activity_menu_kuis.xml
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"android:background="?attr/colorButtonNormal"> <LinearLayout
android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:padding="15dp"
tools:layout_editor_absoluteX="22dp" tools:layout_editor_absoluteY="88dp"> <LinearLayout
android:layout_width="340dp"
android:layout_height="wrap_content"
android:background="@android:color/background_light" android:orientation="vertical">
<android.support.v7.widget.Toolbar android:id="@+id/toolbar4" android:layout_width="340dp"
android:layout_height="wrap_content" android:background="@color/colorAccent" android:minHeight="?attr/actionBarSize" android:theme="?attr/actionBarTheme" app:title="Hasil Pengucapan" /> <TextView
android:id="@+id/txtInd"
android:layout_width="match_parent" android:layout_height="121dp"
android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:padding="15dp"
android:textColor="#000" android:textSize="26sp" android:textStyle="normal" /> </LinearLayout>
<TextView
android:id="@+id/txtJarak" android:layout_width="340dp"
android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"
android:background="?attr/colorButtonNormal" android:textColor="#000"
android:textSize="26sp" android:textStyle="normal"
android:visibility="invisible" /> <LinearLayout
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="@android:color/background_light" android:orientation="vertical">
<android.support.v7.widget.Toolbar android:id="@+id/toolbar3" android:layout_width="340dp"
android:layout_height="wrap_content"
android:background="@color/design_default_color_primary" android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme" app:title="Bahasa Inggris" />
<TextView
android:id="@+id/txtEng" android:layout_width="340dp" android:layout_height="119dp"
android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:padding="15dp"
android:textColor="#000" android:textSize="26sp" android:textStyle="normal" /> </LinearLayout>
<TextView
android:id="@+id/txtHasil" android:layout_width="340dp"
android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:background="?attr/colorButtonNormal" android:textColor="#000"
android:textSize="26sp" android:textStyle="normal"
android:visibility="invisible" /> <LinearLayout
android:layout_width="340dp"
android:layout_height="wrap_content" android:orientation="horizontal"> <ImageButton
android:id="@+id/btnHome"
android:layout_width="match_parent" android:layout_height="99dp"
android:layout_weight="1" android:onClick="getMenuUtama" android:scaleType="fitCenter" app:srcCompat="@drawable/menu" /> <ImageButton
android:id="@+id/btnBack"
android:layout_width="match_parent" android:layout_height="99dp"
android:layout_weight="1" android:onClick="setBack" android:scaleType="fitCenter" app:srcCompat="@drawable/back" /> <ImageButton
android:id="@+id/btnSuara"
android:layout_width="match_parent" android:layout_height="99dp"
android:layout_weight="1" android:onClick="getInputSuara" android:scaleType="fitCenter" app:srcCompat="@drawable/isuara" /> <ImageButton
android:id="@+id/btnNext"
android:layout_width="match_parent" android:layout_height="99dp"
android:layout_weight="1" android:onClick="setNext" android:scaleType="fitCenter" app:srcCompat="@drawable/next" /> </LinearLayout>
</LinearLayout> </android.support.constraint.ConstraintLayout>
12. Kuis.java
package com.joes.myapplication; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.speech.RecognizerIntent; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.Locale;public class Kuis extends AppCompatActivity { int x=0;
private TextView txtHasil;
String kalimat[] = {"Hello, how are you?","How’s life?","How is your day?",
"Please take a piece of paper","Please distribute this paper to your friend","Raise your hand please",
"May I clean the whiteboard?","Go back to your seat","Please collect the books",
"It’s time to go, see you","Don’t throw garbage in the floor"};
public void setTampil(){
TextView SuaraEng = findViewById(R.id.txtEng); TextView SuaraHasil = findViewById(R.id.txtHasil); SuaraHasil.setText("");
SuaraEng.setText(kalimat[x]); }
public void setNext(View view){ x++; if(x>=10){ x=10; } setTampil(); }
public void setBack(View view){ x--; if(x<=0){ x=0; } setTampil(); } @Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu_kuis); txtHasil = (TextView) findViewById(R.id.txtHasil); }
public void getMenuUtama(View view) {
Intent intent = new Intent(Kuis.this, MainActivity.class); startActivity(intent);
}
public void getInputSuara(View view) {
Intent intent = new
Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.ENGLISH);
if (intent.resolveActivity(getPackageManager()) != null) { startActivityForResult(intent, 10);
} else {
Toast.makeText(this, "Perangkat Tidak Cocok", Toast.LENGTH_SHORT).show();
} }
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) { case 10:
if (resultCode == RESULT_OK && data != null) { ArrayList<String> result =
data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); txtHasil.setText(result.get(0)); } break; } } }