kali ini saya akan membuat program Canteen menggunakan Android Studio.
Tanpa berlama-lama, langsung saja kita ke code.
- Deskripsi Aplikasi
- Pertama kali membuka aplikasi, kita akan ditunjukkan tampilan login.
- Masukkan username "admin" dan password "123" untuk masuk ke dalam aplikasi
- Setelah masuk, akan muncul tampilan All Warung yang mana bisa dilihat 4 warung yang tersedia. Klik warung pertama.
- Setelah mengklik warung pertama, akan muncul list menu yang ada di warung 1. Pilih jumlah menu yang akan kita pesan, kemudian tekan teks bayar.
- Setelah mengklik tulisan bayar, akan muncul summary menu yang kita pilih beserta total harganya. Masukkan nominal bayar kemudian tekan tombol pay.
- Akan muncul list menu yang kita bayar, beserta total, nominal dan kembalian. Klik tombol back untuk kembali ke menu all warung.
- Dalam tampilan all warung, tekan tombol logout untuk kembali ke menu login.
- Source Code Aplikasi
Berikut source code aplikasi saya :
- Source code java untuk halaman login
package com.hiskur.canteen;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final EditText user = (EditText) findViewById(R.id.user);
final EditText pass = (EditText) findViewById(R.id.pass);
Button button = (Button) findViewById(R.id.btnLogin);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(user.getText().toString().equals("admin") && pass.getText().toString().equals("123")){
Intent i = new Intent(MainActivity.this, allWarung.class);
i.putExtra("name", user.getText().toString());
Toast.makeText(getApplicationContext(),"Login Sukses",Toast.LENGTH_SHORT).show();
startActivity(i);
} else {
Toast.makeText(getApplicationContext(),"Username dan Password salah",Toast.LENGTH_SHORT).show();
user.setText("");
pass.setText("");
}
}
});
}
}
- Source code XML untuk halaman login
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
tools:context=".MainActivity">
<Button
android:id="@+id/btnLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="160dp"
android:layout_marginLeft="160dp"
android:layout_marginTop="92dp"
android:text="Login"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/pass" />
<EditText
android:id="@+id/user"
android:layout_width="276dp"
android:layout_height="50dp"
android:layout_marginStart="68dp"
android:layout_marginLeft="68dp"
android:layout_marginTop="72dp"
android:hint="username"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView4" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="156dp"
android:layout_marginLeft="156dp"
android:layout_marginTop="52dp"
android:text="Welcome"
android:textAppearance="?android:attr/textAppearanceLarge"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/pass"
android:layout_width="276dp"
android:layout_height="44dp"
android:layout_marginStart="68dp"
android:layout_marginLeft="68dp"
android:layout_marginTop="24dp"
android:ems="10"
android:hint="password"
android:inputType="textPassword"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/user" />
<ImageView
android:id="@+id/imageView"
android:layout_width="56dp"
android:layout_height="49dp"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="72dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView4"
app:srcCompat="@drawable/ic_people"
android:contentDescription="TODO" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="57dp"
android:layout_height="45dp"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="145dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView4"
app:srcCompat="@drawable/ic_password" />
</androidx.constraintlayout.widget.ConstraintLayout> - Source code java untuk halaman allwarung
package com.hiskur.canteen;
import androidx.appcompat.app.AppCompatActivity;
import android.app.ActionBar;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class allWarung extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_all_warung);
String [] merchant ={"Canteen 01 : Siomay","Canteen 02 : Bakso","Canteen 03 : Mie Ayam","Canteen 04 : Warung Padang"};
String [] ketMerchant = {"Siomay basah,Siomay Kering","Bakso Ayam, Bakso Urat","Mie Ayam Pangsit, Mie Ayam Bakso","Aneka Masakan Padang"};
final ListView ey = (ListView) findViewById(R.id.listView1);
final Button logout = (Button) findViewById(R.id.btnLogout);
List<Map<String, String>> data = new ArrayList<Map<String, String>>();
for (int i=0; i<merchant.length; i++) {
Map<String, String> datum = new HashMap<String, String>(2);
datum.put("title", merchant[i]);
datum.put("subtitle", String.valueOf(ketMerchant[i]));
data.add(datum);
}
SimpleAdapter adapter = new SimpleAdapter(this, data,
android.R.layout.simple_list_item_2,
new String[] {"title", "subtitle"},
new int[] {android.R.id.text1,
android.R.id.text2});
ey.setAdapter(adapter);
logout.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(),"Logout berhasil",Toast.LENGTH_SHORT).show();
Intent go =new Intent(allWarung.this,MainActivity.class);
startActivity(go);
}
});
ey.setOnItemClickListener(new AdapterView.OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int itemKe, long arg3){
//TODO
if(itemKe == 0){
Intent I = new Intent(arg0.getContext(),canteen01.class);
startActivityForResult(I,0);
} else if(itemKe == 1){
Intent I = new Intent(arg0.getContext(),canteen02.class);
startActivityForResult(I,0);
} else if(itemKe == 2){
Intent I = new Intent(arg0.getContext(),canteen03.class);
startActivityForResult(I,0);
} else if(itemKe == 3){
Intent I = new Intent(arg0.getContext(),canteen04.class);
startActivityForResult(I,0);
}
}
});
}
}
- Source code XML untuk halaman allwarung
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
tools:context=".allWarung">
<ListView
android:id="@+id/listView1"
android:layout_width="313dp"
android:layout_height="440dp"
android:layout_marginStart="36dp"
android:layout_marginLeft="36dp"
android:layout_marginTop="76dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="36dp"
android:layout_marginLeft="36dp"
android:layout_marginTop="56dp"
android:text="Please select one of the merchants : "
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btnLogout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="36dp"
android:layout_marginLeft="36dp"
android:layout_marginTop="21dp"
android:text="LOGOUT"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/listView1" />
</androidx.constraintlayout.widget.ConstraintLayout> - Source code java untuk halaman canteen (menu dalam warung)
package com.hiskur.canteen;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class canteen01 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_canteen01);
ListView listView = (ListView) findViewById(R.id.listView1);
List<Makanan> listMakanan = new ArrayList<Makanan>();
final Makanan menu01,menu02,menu03,menu04;
menu01 = new Makanan();
menu01.setImage(R.drawable.ic_restaurant_menu_black_24dp);
menu01.setName("Menu 01 : Paket Siomay Biasa");
menu01.setHarga("Rp 8.000,-");
listMakanan.add(menu01);
menu02 = new Makanan();
menu02.setImage(R.drawable.ic_restaurant_menu_black_24dp);
menu02.setName("Menu 02 : Paket Siomay Special");
menu02.setHarga("Rp 10.000,-");
listMakanan.add(menu02);
menu03 = new Makanan();
menu03.setImage(R.drawable.ic_restaurant_menu_black_24dp);
menu03.setName("Menu 03 : Siomay Biasa");
menu03.setHarga("Rp 1.000,-");
listMakanan.add(menu03);
menu04 = new Makanan();
menu04.setImage(R.drawable.ic_restaurant_menu_black_24dp);
menu04.setName("Menu 04 : Siomay Goreng");
menu04.setHarga("Rp 2.000,-");
listMakanan.add(menu04);
listView.setAdapter(new MakananAdapter(this,R.layout.listview_menu,listMakanan));
final TextView bayar = (TextView) findViewById(R.id.textView3);
bayar.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
System.out.println("clicked?");
// int satu = menu02.getQty();
// Toast.makeText(getApplicationContext(),"anda mendapat "+satu,Toast.LENGTH_SHORT).show();
Intent go =new Intent(canteen01.this,Bayar.class);
go.putExtra("menu1Q", menu01.getQty());
go.putExtra("menu2Q",menu02.getQty());
go.putExtra("menu3Q",menu03.getQty());
go.putExtra("menu4Q",menu04.getQty());
go.putExtra("menu1N",menu01.getName());
go.putExtra("menu2N",menu02.getName());
go.putExtra("menu3N",menu03.getName());
go.putExtra("menu4N",menu04.getName());
go.putExtra("menu1H",8000);
go.putExtra("menu2H",10000);
go.putExtra("menu3H",1000);
go.putExtra("menu4H",2000);
go.putExtra("warung","Canteen 01");
startActivity(go);
}
});
TextView home = (TextView) findViewById(R.id.backText);
home.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(canteen01.this, allWarung.class);
startActivity(i);
}
});
}
}
- Source code XML untuk halaman canteen (menu dalam warung)
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
tools:context=".canteen01">
<ListView
android:id="@+id/listView1"
android:layout_width="405dp"
android:layout_height="500dp"
android:layout_marginStart="3dp"
android:layout_marginLeft="3dp"
android:layout_marginTop="76dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView3"
android:layout_width="76dp"
android:layout_height="43dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:text="BAYAR"
android:textSize="22sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/backText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="32dp"
android:text="@string/home"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
untuk membuat List view seperti di contoh, diperlukan custom list view. - Source code XML untuk custom List View
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginRight="10dp"
android:contentDescription="Hello World"
android:src="@drawable/ic_restaurant_menu_black_24dp"/>
<TextView
android:id="@+id/name"
android:layout_marginLeft="100dp"
android:layout_marginTop="15dp"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:textSize="10pt"
android:textColor="@color/colorBlack"
android:text="Nama"/>
<TextView
android:id="@+id/harga"
android:layout_marginLeft="100dp"
android:layout_width="100dp"
android:layout_below="@+id/name"
android:layout_height="wrap_content"
android:textSize="8pt"
android:text="Harga"/>
<Button
android:id="@+id/plus"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:background="#FFFFFF"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="+"
android:textColor="#0099CC" />
<Button
android:id="@+id/minus"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_below="@+id/plus"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:background="#FFFFFF"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="-"
android:textColor="#0099CC" />
<TextView
android:id="@+id/qty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="35dp"
android:layout_marginRight="60dp"
android:text="0"
android:textSize="22sp" />
</RelativeLayout> - Source code java untuk custom List View
package com.hiskur.canteen;
public class Makanan {
private int image;
private String name;
private String harga;
private int qty;
public int getImage(){
return image;
}
public void setImage(int image){
this.image = image;
}
public String getName(){
return name;
}
public void setName(String name){
this.name = name;
}
public String getHarga(){
return harga;
}
public void setHarga(String harga){
this.harga = harga;
}
public int getQty(){
return qty;
}
public void setQty(int qty){
this.qty = qty;
}
}
package com.hiskur.canteen;
import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class MakananAdapter extends ArrayAdapter<Makanan>{
List<Makanan> listMakanan;
Context context;
int layout;
int jumlah = 0;
public MakananAdapter(Context context, int layout, List<Makanan> listMakanan){
super(context,layout,listMakanan);
this.context = context;
this.layout = layout;
this.listMakanan = listMakanan;
}
@Override
public View getView(int position, View convertView, ViewGroup parent){
View v = convertView;
final MakananHolder holder;
if(v == null){
LayoutInflater vi = ((Activity)context).getLayoutInflater();
v = vi.inflate(layout,parent,false);
holder = new MakananHolder();
holder.imageView = (ImageView) v.findViewById(R.id.image);
holder.nameView = (TextView) v.findViewById(R.id.name);
holder.hargaView = (TextView) v.findViewById(R.id.harga);
holder.qty = (TextView) v.findViewById(R.id.qty);
holder.btnPlus = (Button) v.findViewById(R.id.plus);
holder.btnMinus = (Button) v.findViewById(R.id.minus);
v.setTag(holder);
} else {
holder = (MakananHolder) v.getTag();
}
final Makanan makanan = listMakanan.get(position);
holder.imageView.setImageResource(makanan.getImage());
holder.nameView.setText(makanan.getName());
holder.hargaView.setText(makanan.getHarga());
// holder.qty.setText(String.valueOf(makanan.getQty()));
// final int yeah= 0;
holder.btnPlus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int qty1 = Integer.parseInt(holder.qty.getText().toString());
int tambah = 0;
if(qty1 > -1) {
tambah = qty1+1;
}
holder.qty.setText(String.valueOf(tambah));
makanan.setQty(tambah);
}
});
holder.btnMinus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int qty2 = Integer.parseInt(holder.qty.getText().toString());
int kurang = 0;
if(qty2 > 0){
kurang = qty2-1;
}
holder.qty.setText(String.valueOf(kurang));
makanan.setQty(kurang);
}
});
return v;
}
public int increaseInteger(View view){
jumlah++;
return jumlah;
}
public int decreaseInteger(View view){
jumlah--;
return jumlah;
}
static class MakananHolder{
ImageView imageView;
TextView nameView;
TextView hargaView;
TextView qty;
Button btnPlus;
Button btnMinus;
}
}
- Source code java untuk halaman bayar
package com.hiskur.canteen;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.util.Arrays;
public class Bayar extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bayar);
TextView back = (TextView) findViewById(R.id.backText);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(Bayar.this, allWarung.class);
startActivity(i);
}
});
TextView warung = (TextView) findViewById(R.id.warung);
TextView menu01 = (TextView) findViewById(R.id.menu01);
TextView menu02 = (TextView) findViewById(R.id.menu02);
TextView menu03 = (TextView) findViewById(R.id.menu03);
TextView menu04 = (TextView) findViewById(R.id.menu04);
TextView qty1 = (TextView) findViewById(R.id.qty1);
TextView qty2 = (TextView) findViewById(R.id.qty2);
TextView qty3 = (TextView) findViewById(R.id.qty3);
TextView qty4 = (TextView) findViewById(R.id.qty4);
TextView harga1 = (TextView) findViewById(R.id.harga1);
TextView harga2 = (TextView) findViewById(R.id.harga2);
TextView harga3 = (TextView) findViewById(R.id.harga3);
TextView harga4 = (TextView) findViewById(R.id.harga4);
TextView totalHarga = (TextView) findViewById(R.id.totalHarga);
final EditText nominal = (EditText) findViewById(R.id.editText);
Button pay = (Button) findViewById(R.id.payButton);
Bundle bundle=getIntent().getExtras();
int menu1Q=bundle.getInt("menu1Q");
int menu2Q=bundle.getInt("menu2Q");
int menu3Q=bundle.getInt("menu3Q");
int menu4Q=bundle.getInt("menu4Q");
String menu1N=bundle.getString("menu1N");
String menu2N=bundle.getString("menu2N");
String menu3N=bundle.getString("menu3N");
String menu4N=bundle.getString("menu4N");
int menu1H=bundle.getInt("menu1H");
int menu2H=bundle.getInt("menu2H");
int menu3H=bundle.getInt("menu3H");
int menu4H=bundle.getInt("menu4H");
final String warungs = bundle.getString("warung");
warung.setText(warungs);
int a1 = 0;
int b1 = 0;
int c1 = 0;
int d1 = 0;
int j = 0;
int total = 0;
final String[] menuz = new String[4];
final String[] qtyz = new String[4];
final String[] hargaz = new String[4];
for (int i = 0; i<4;i++){
if(menu1Q != 0 && a1 == 0){
//blabla
System.out.println("Menu 1 : " + menu1Q);
switch(j){
case 0:
menu01.setText(menu1N);
qty1.setText(String.valueOf(menu1Q));
int tot1 = menu1H * menu1Q;
harga1.setText(String.valueOf(tot1));
total+=tot1;
menuz[j] = menu1N;
qtyz[j] = String.valueOf(menu1Q);
hargaz[j] = String.valueOf(tot1);
break;
case 1:
menu02.setText(menu1N);
qty2.setText(String.valueOf(menu1Q));
int tot2 = menu1H * menu1Q;
harga2.setText(String.valueOf(tot2));
total+=tot2;
menuz[j] = menu1N;
qtyz[j] = String.valueOf(menu1Q);
hargaz[j] = String.valueOf(tot2);
break;
case 2:
menu03.setText(menu1N);
qty3.setText(String.valueOf(menu1Q));
int tot3 = menu1H * menu1Q;
harga3.setText(String.valueOf(tot3));
total+=tot3;
menuz[j] = menu1N;
qtyz[j] = String.valueOf(menu1Q);
hargaz[j] = String.valueOf(tot3);
break;
case 3:
menu04.setText(menu1N);
qty4.setText(String.valueOf(menu1Q));
int tot4 = menu1H * menu1Q;
harga4.setText(String.valueOf(tot4));
total+=tot4;
menuz[j] = menu1N;
qtyz[j] = String.valueOf(menu1Q);
hargaz[j] = String.valueOf(tot4);
break;
}
a1 = 1;
j++;
} else {
if(menu2Q != 0 && b1 == 0){
//blabla
System.out.println("Menu 2 : " + menu2Q);
switch(j){
case 0:
menu01.setText(menu2N);
qty1.setText(String.valueOf(menu2Q));
int tot1 = menu2H * menu2Q;
harga1.setText(String.valueOf(tot1));
total+=tot1;
menuz[j] = menu2N;
qtyz[j] = String.valueOf(menu2Q);
hargaz[j] = String.valueOf(tot1);
break;
case 1:
menu02.setText(menu2N);
qty2.setText(String.valueOf(menu2Q));
int tot2 = menu2H * menu2Q;
harga2.setText(String.valueOf(tot2));
total+=tot2;
menuz[j] = menu2N;
qtyz[j] = String.valueOf(menu2Q);
hargaz[j] = String.valueOf(tot2);
break;
case 2:
menu03.setText(menu2N);
qty3.setText(String.valueOf(menu2Q));
int tot3 = menu2H * menu2Q;
harga3.setText(String.valueOf(tot3));
total+=tot3;
menuz[j] = menu2N;
qtyz[j] = String.valueOf(menu2Q);
hargaz[j] = String.valueOf(tot3);
break;
case 3:
menu04.setText(menu2N);
qty4.setText(String.valueOf(menu2Q));
int tot4 = menu2H * menu2Q;
harga4.setText(String.valueOf(tot4));
total+=tot4;
menuz[j] = menu2N;
qtyz[j] = String.valueOf(menu2Q);
hargaz[j] = String.valueOf(tot4);
break;
}
b1 = 1;
j++;
} else {
if(menu3Q != 0 && c1 == 0){
//blabla
System.out.println("Menu 3 : " + menu3Q);
switch(j){
case 0:
menu01.setText(menu3N);
qty1.setText(String.valueOf(menu3Q));
int tot1 = menu3H * menu3Q;
harga1.setText(String.valueOf(tot1));
total+=tot1;
menuz[j] = menu3N;
qtyz[j] = String.valueOf(menu3Q);
hargaz[j] = String.valueOf(tot1);
break;
case 1:
menu02.setText(menu3N);
qty2.setText(String.valueOf(menu3Q));
int tot2 = menu3H * menu3Q;
harga2.setText(String.valueOf(tot2));
total+=tot2;
menuz[j] = menu3N;
qtyz[j] = String.valueOf(menu3Q);
hargaz[j] = String.valueOf(tot2);
break;
case 2:
menu03.setText(menu3N);
qty3.setText(String.valueOf(menu3Q));
int tot3 = menu3H * menu3Q;
harga3.setText(String.valueOf(tot3));
total+=tot3;
menuz[j] = menu3N;
qtyz[j] = String.valueOf(menu3Q);
hargaz[j] = String.valueOf(tot3);
break;
case 3:
menu04.setText(menu3N);
qty4.setText(String.valueOf(menu3Q));
int tot4 = menu3H * menu3Q;
harga4.setText(String.valueOf(tot4));
total+=tot4;
menuz[j] = menu3N;
qtyz[j] = String.valueOf(menu3Q);
hargaz[j] = String.valueOf(tot4);
break;
}
c1 = 1;
j++;
} else {
if (menu4Q != 0 && d1 == 0) {
//blabla
System.out.println("Menu 4 : " + menu4Q);
switch(j){
case 0:
menu01.setText(menu4N);
qty1.setText(String.valueOf(menu4Q));
int tot1 = menu4H * menu4Q;
harga1.setText(String.valueOf(tot1));
total+=tot1;
menuz[j] = menu4N;
qtyz[j] = String.valueOf(menu4Q);
hargaz[j] = String.valueOf(tot1);
break;
case 1:
menu02.setText(menu4N);
qty2.setText(String.valueOf(menu4Q));
int tot2 = menu4H * menu4Q;
harga2.setText(String.valueOf(tot2));
total+=tot2;
menuz[j] = menu4N;
qtyz[j] = String.valueOf(menu4Q);
hargaz[j] = String.valueOf(tot2);
break;
case 2:
menu03.setText(menu4N);
qty3.setText(String.valueOf(menu4Q));
int tot3 = menu4H * menu4Q;
harga3.setText(String.valueOf(tot3));
total+=tot3;
menuz[j] = menu4N;
qtyz[j] = String.valueOf(menu4Q);
hargaz[j] = String.valueOf(tot3);
break;
case 3:
menu04.setText(menu4N);
qty4.setText(String.valueOf(menu4Q));
int tot4 = menu4H * menu4Q;
harga4.setText(String.valueOf(tot4));
total+=tot4;
menuz[j] = menu4N;
qtyz[j] = String.valueOf(menu4Q);
hargaz[j] = String.valueOf(tot4);
break;
}
d1 = 1;
j++;
} else {
System.out.println("kosong");
menuz[j] = "";
qtyz[j] = "";
hargaz[j] = "";
j++;
}
}
}
}
totalHarga.setText(String.valueOf(total));
}
final int finalTotal = total;
pay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String bla = nominal.getText().toString();
int blas = Integer.valueOf(bla);
int kembalian = blas - finalTotal;
if(kembalian < 0){
} else {
Intent i = new Intent(Bayar.this, orders.class);
i.putExtra("total", finalTotal);
i.putExtra("bayar", blas);
i.putExtra("kembalian", kembalian);
//
i.putExtra("menu1",menuz[0]);
i.putExtra("menu2",menuz[1]);
i.putExtra("menu3",menuz[2]);
i.putExtra("menu4",menuz[3]);
i.putExtra("qty1",qtyz[0]);
i.putExtra("qty2",qtyz[1]);
i.putExtra("qty3",qtyz[2]);
i.putExtra("qty4",qtyz[3]);
i.putExtra("harga1",hargaz[0]);
i.putExtra("harga2",hargaz[1]);
i.putExtra("harga3",hargaz[2]);
i.putExtra("harga4",hargaz[3]);
i.putExtra("warung",warungs);
System.out.println("awe " + Arrays.toString(menuz)+" " + Arrays.toString(qtyz) +" " + Arrays.toString(hargaz));
startActivity(i);
}
}
});
}
}
- Source code XML untuk halaman bayar
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
tools:context=".Bayar">
<TextView
android:id="@+id/menu04"
android:layout_width="190dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="11dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/menu03" />
<TextView
android:id="@+id/harga4"
android:layout_width="95dp"
android:layout_height="wrap_content"
android:layout_marginStart="53dp"
android:layout_marginLeft="53dp"
android:layout_marginTop="11dp"
android:gravity="right"
app:layout_constraintStart_toEndOf="@+id/qty1"
app:layout_constraintTop_toBottomOf="@+id/harga3" />
<TextView
android:id="@+id/qty4"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
android:layout_marginTop="11dp"
android:gravity="center"
app:layout_constraintStart_toEndOf="@+id/menu01"
app:layout_constraintTop_toBottomOf="@+id/qty3" />
<TextView
android:id="@+id/menu03"
android:layout_width="190dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="11dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/menu02" />
<TextView
android:id="@+id/harga3"
android:layout_width="95dp"
android:layout_height="wrap_content"
android:layout_marginStart="53dp"
android:layout_marginLeft="53dp"
android:layout_marginTop="11dp"
android:gravity="right"
app:layout_constraintStart_toEndOf="@+id/qty1"
app:layout_constraintTop_toBottomOf="@+id/harga2" />
<TextView
android:id="@+id/qty3"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
android:layout_marginTop="11dp"
android:gravity="center"
app:layout_constraintStart_toEndOf="@+id/menu01"
app:layout_constraintTop_toBottomOf="@+id/qty2" />
<TextView
android:id="@+id/menu02"
android:layout_width="190dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="11dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/menu01" />
<TextView
android:id="@+id/harga2"
android:layout_width="95dp"
android:layout_height="wrap_content"
android:layout_marginStart="53dp"
android:layout_marginLeft="53dp"
android:layout_marginTop="11dp"
android:gravity="right"
app:layout_constraintStart_toEndOf="@+id/qty1"
app:layout_constraintTop_toBottomOf="@+id/harga1" />
<TextView
android:id="@+id/qty2"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
android:layout_marginTop="11dp"
android:gravity="center"
app:layout_constraintStart_toEndOf="@+id/menu01"
app:layout_constraintTop_toBottomOf="@+id/qty1" />
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="16dp"
android:text="Warung "
android:textColor="@color/colorBlack"
android:textSize="24sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView31"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="16dp"
android:text=":"
android:textColor="@color/colorBlack"
android:textSize="24sp"
app:layout_constraintStart_toEndOf="@+id/textView6"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/warung"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="16dp"
android:text="warung"
android:textColor="@color/colorBlack"
android:textSize="24sp"
app:layout_constraintStart_toEndOf="@+id/textView31"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="52dp"
android:text="Item"
android:textColor="@color/colorBlack"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView6" />
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="158dp"
android:layout_marginLeft="158dp"
android:layout_marginTop="101dp"
android:text="Qty"
android:textColor="@color/colorBlack"
android:textSize="18sp"
app:layout_constraintStart_toEndOf="@+id/textView7"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="49dp"
android:layout_marginLeft="49dp"
android:layout_marginTop="100dp"
android:text="Total Harga"
android:textColor="@color/colorBlack"
android:textSize="18sp"
app:layout_constraintStart_toEndOf="@+id/textView8"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/menu01"
android:layout_width="190dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="15dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView7" />
<TextView
android:id="@+id/qty1"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
android:layout_marginTop="15dp"
android:gravity="center"
app:layout_constraintStart_toEndOf="@+id/menu01"
app:layout_constraintTop_toBottomOf="@+id/textView8" />
<TextView
android:id="@+id/harga1"
android:layout_width="95dp"
android:layout_height="wrap_content"
android:layout_marginStart="53dp"
android:layout_marginLeft="53dp"
android:layout_marginTop="17dp"
android:gravity="right"
app:layout_constraintStart_toEndOf="@+id/qty1"
app:layout_constraintTop_toBottomOf="@+id/textView9" />
<View
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="20dp"
android:background="@android:color/darker_gray"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/harga4" />
<TextView
android:id="@+id/textView25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="23dp"
android:text="Grand Total"
android:textColor="@color/colorBlack"
android:textSize="30sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view" />
<TextView
android:id="@+id/totalHarga"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="23dp"
android:gravity="right"
android:text="0"
android:textColor="@color/colorBlack"
android:textSize="30dp"
app:layout_constraintStart_toEndOf="@+id/textView25"
app:layout_constraintTop_toBottomOf="@+id/view" />
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="25dp"
android:ems="10"
android:hint="nominal"
android:inputType="textPersonName"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView25" />
<Button
android:id="@+id/payButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="68dp"
android:layout_marginLeft="68dp"
android:layout_marginTop="25dp"
android:text="Pay"
app:layout_constraintStart_toEndOf="@+id/editText"
app:layout_constraintTop_toBottomOf="@+id/totalHarga" />
<TextView
android:id="@+id/backText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="42dp"
android:text="@string/back"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText" />
</androidx.constraintlayout.widget.ConstraintLayout> - Source code java untuk halaman orders
package com.hiskur.canteen;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import org.w3c.dom.Text;
public class orders extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_orders);
Bundle bundle=getIntent().getExtras();
int total=bundle.getInt("total");
int bayar=bundle.getInt("bayar");
int kembalian=bundle.getInt("kembalian");
System.out.println("total"+total);
System.out.println("bayar"+bayar);
System.out.println("kembalian"+kembalian);
//
String menu1 = bundle.getString("menu1");
String menu2 = bundle.getString("menu2");
String menu3 = bundle.getString("menu3");
String menu4 = bundle.getString("menu4");
String qty1 = bundle.getString("qty1");
String qty2 = bundle.getString("qty2");
String qty3 = bundle.getString("qty3");
String qty4 = bundle.getString("qty4");
String harga1 = bundle.getString("harga1");
String harga2 = bundle.getString("harga2");
String harga3 = bundle.getString("harga3");
String harga4 = bundle.getString("harga4");
String warung = bundle.getString("warung");
TextView warungz = (TextView) findViewById(R.id.warungs);
warungz.setText(warung);
TextView totald = (TextView) findViewById(R.id.totals);
TextView bayard = (TextView) findViewById(R.id.bayars);
TextView kembaliand = (TextView) findViewById(R.id.kembalians);
totald.setText(""+total);
bayard.setText(""+bayar);
kembaliand.setText(""+kembalian);
TextView menu01 = (TextView) findViewById(R.id.menu01);
menu01.setText(menu1);
TextView menu02 = (TextView) findViewById(R.id.menu02);
menu02.setText(menu2);
TextView menu03 = (TextView) findViewById(R.id.menu03);
menu03.setText(menu3);
TextView menu04 = (TextView) findViewById(R.id.menu04);
menu04.setText(menu4);
TextView qty01 = (TextView) findViewById(R.id.qty1);
qty01.setText(qty1);
TextView qty02 = (TextView) findViewById(R.id.qty2);
qty02.setText(qty2);
TextView qty03 = (TextView) findViewById(R.id.qty3);
qty03.setText(qty3);
TextView qty04 = (TextView) findViewById(R.id.qty4);
qty04.setText(qty4);
TextView harga01 = (TextView) findViewById(R.id.harga1);
harga01.setText(harga1);
TextView harga02 = (TextView) findViewById(R.id.harga2);
harga02.setText(harga2);
TextView harga03 = (TextView) findViewById(R.id.harga3);
harga03.setText(harga3);
TextView harga04 = (TextView) findViewById(R.id.harga4);
harga04.setText(harga4);
TextView home = (TextView) findViewById(R.id.backText);
home.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(orders.this, allWarung.class);
startActivity(i);
}
});
}
}
- Source code XML untuk halaman orders
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
tools:context=".orders">
<TextView
android:id="@+id/textView29"
android:layout_width="3dp"
android:layout_height="wrap_content"
android:layout_marginStart="26dp"
android:layout_marginLeft="26dp"
android:layout_marginTop="14dp"
android:text="\:"
app:layout_constraintStart_toEndOf="@+id/textView14"
app:layout_constraintTop_toBottomOf="@+id/textView28" />
<TextView
android:id="@+id/kembalians"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="9dp"
android:layout_marginLeft="9dp"
android:layout_marginTop="14dp"
android:text="0"
app:layout_constraintStart_toEndOf="@+id/textView29"
app:layout_constraintTop_toBottomOf="@+id/textView28" />
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="16dp"
android:text="Warung"
android:textColor="@color/colorBlack"
android:textSize="24sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView30"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="9dp"
android:layout_marginLeft="9dp"
android:layout_marginTop="16dp"
android:text=":"
android:textColor="@color/colorBlack"
android:textSize="24sp"
app:layout_constraintStart_toEndOf="@+id/textView6"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/warungs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="9dp"
android:layout_marginLeft="9dp"
android:layout_marginTop="16dp"
android:textColor="@color/colorBlack"
android:textSize="24sp"
app:layout_constraintStart_toEndOf="@+id/textView30"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="176dp"
android:text="Item"
android:textColor="@color/colorBlack"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView6" />
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="52dp"
android:layout_marginLeft="52dp"
android:layout_marginTop="224dp"
android:text="Total Harga"
android:textColor="@color/colorBlack"
android:textSize="18sp"
app:layout_constraintStart_toEndOf="@+id/textView8"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/menu01"
android:layout_width="190dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="12dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView7" />
<TextView
android:id="@+id/qty1"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="16dp"
android:gravity="center"
app:layout_constraintStart_toEndOf="@+id/menu01"
app:layout_constraintTop_toBottomOf="@+id/textView8" />
<TextView
android:id="@+id/harga1"
android:layout_width="95dp"
android:layout_height="wrap_content"
android:layout_marginStart="52dp"
android:layout_marginLeft="52dp"
android:layout_marginTop="16dp"
android:gravity="right"
app:layout_constraintStart_toEndOf="@+id/qty1"
app:layout_constraintTop_toBottomOf="@+id/textView9" />
<TextView
android:id="@+id/menu02"
android:layout_width="190dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="12dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/menu01" />
<TextView
android:id="@+id/qty2"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="8dp"
android:gravity="center"
app:layout_constraintStart_toEndOf="@+id/menu01"
app:layout_constraintTop_toBottomOf="@+id/qty1" />
<TextView
android:id="@+id/harga2"
android:layout_width="95dp"
android:layout_height="wrap_content"
android:layout_marginStart="52dp"
android:layout_marginLeft="52dp"
android:layout_marginTop="12dp"
android:gravity="right"
app:layout_constraintStart_toEndOf="@+id/qty1"
app:layout_constraintTop_toBottomOf="@+id/harga1" />
<TextView
android:id="@+id/menu03"
android:layout_width="190dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="12dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/menu02" />
<TextView
android:id="@+id/qty3"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="12dp"
android:gravity="center"
app:layout_constraintStart_toEndOf="@+id/menu01"
app:layout_constraintTop_toBottomOf="@+id/qty2" />
<TextView
android:id="@+id/harga3"
android:layout_width="95dp"
android:layout_height="wrap_content"
android:layout_marginStart="52dp"
android:layout_marginLeft="52dp"
android:layout_marginTop="12dp"
android:gravity="right"
app:layout_constraintStart_toEndOf="@+id/qty1"
app:layout_constraintTop_toBottomOf="@+id/harga2" />
<TextView
android:id="@+id/menu04"
android:layout_width="190dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="12dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/menu03" />
<TextView
android:id="@+id/qty4"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="12dp"
android:gravity="center"
app:layout_constraintStart_toEndOf="@+id/menu01"
app:layout_constraintTop_toBottomOf="@+id/qty3" />
<TextView
android:id="@+id/harga4"
android:layout_width="95dp"
android:layout_height="wrap_content"
android:layout_marginStart="52dp"
android:layout_marginLeft="52dp"
android:layout_marginTop="8dp"
android:gravity="right"
app:layout_constraintStart_toEndOf="@+id/qty1"
app:layout_constraintTop_toBottomOf="@+id/harga3" />
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="164dp"
android:layout_marginLeft="164dp"
android:layout_marginTop="224dp"
android:text="Qty"
android:textColor="@color/colorBlack"
android:textSize="18sp"
app:layout_constraintStart_toEndOf="@+id/textView7"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/backText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="75dp"
android:text="@string/home"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/menu04" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="14dp"
android:text="Total"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView6" />
<TextView
android:id="@+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="14dp"
android:text="Bayar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView5" />
<TextView
android:id="@+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="14dp"
android:text="Kembalian"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView13" />
<TextView
android:id="@+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="60dp"
android:layout_marginLeft="60dp"
android:layout_marginTop="14dp"
android:text=":"
app:layout_constraintStart_toEndOf="@+id/textView5"
app:layout_constraintTop_toBottomOf="@+id/textView6" />
<TextView
android:id="@+id/totals"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="9dp"
android:layout_marginLeft="9dp"
android:layout_marginTop="14dp"
android:text="0"
app:layout_constraintStart_toEndOf="@+id/textView15"
app:layout_constraintTop_toBottomOf="@+id/textView6" />
<TextView
android:id="@+id/textView28"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="57dp"
android:layout_marginLeft="57dp"
android:layout_marginTop="14dp"
android:text=":"
app:layout_constraintStart_toEndOf="@+id/textView13"
app:layout_constraintTop_toBottomOf="@+id/textView15" />
<TextView
android:id="@+id/bayars"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="9dp"
android:layout_marginLeft="9dp"
android:layout_marginTop="14dp"
android:text="0"
app:layout_constraintStart_toEndOf="@+id/textView28"
app:layout_constraintTop_toBottomOf="@+id/textView15" />
</androidx.constraintlayout.widget.ConstraintLayout>
- Running Aplikasi
Berikut tampilan screen aplikasi saya.
Tampilan Login |
Tampilan allWarung |
Tampilan canteen01 |
Tampilan canteen02 |
Tampilan canteen03 |
tampilan canteen04 |
Tampilan Bayar |
Tampilan Orders |
Links :
APK : here
Project : here
Sekian dari saya, terima kasih