KasirApp-Kelompok5/app/src/main/res/layout/activity_main.xml
2026-01-15 15:58:24 +07:00

195 lines
7.3 KiB
XML

<?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">
<!-- Header -->
<RelativeLayout
android:id="@+id/header"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:padding="16dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="🛒 KASIR APP"
android:textColor="@android:color/white"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="@+id/subtitle_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Selamat datang, Kasir!"
android:textColor="@android:color/white" />
</LinearLayout>
<Button
android:id="@+id/btn_logout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:text="LOGOUT"
app:backgroundTint="@android:color/holo_red_light" />
</RelativeLayout>
<!-- Search Bar -->
<EditText
android:id="@+id/et_search_menu"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:hint="Cari menu..."
android:inputType="text"
android:padding="12dp"
android:background="@drawable/edit_text_background"
app:layout_constraintTop_toBottomOf="@id/header"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<!-- Cart Section (This will always be at the bottom) -->
<LinearLayout
android:id="@+id/cart_section"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#F5F5F5"
android:orientation="vertical"
android:padding="16dp"
android:elevation="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="🛒 KERANJANG"
android:textAppearance="@android:style/TextAppearance.Large"
android:textColor="@android:color/black"
android:textStyle="bold"/>
<TextView
android:id="@+id/empty_cart_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="16dp"
android:text="Keranjang masih kosong" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_cart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxHeight="120dp"
app:layout_constrainedHeight="true"
tools:listitem="@layout/item_cart"
tools:itemCount="2" />
<!-- Bottom Buttons and Total -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal">
<Button
android:id="@+id/btn_dine_in"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:layout_weight="1"
app:backgroundTint="@android:color/holo_blue_dark"
android:text="DINE-IN" />
<Button
android:id="@+id/btn_takeaway"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_weight="1"
app:backgroundTint="@android:color/darker_gray"
android:text="TAKEAWAY" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TOTAL:"
android:textAppearance="@android:style/TextAppearance.Large"
android:textColor="@android:color/black" />
<TextView
android:id="@+id/total_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end"
android:text="Rp 0"
android:textAppearance="@android:style/TextAppearance.Large"
android:textColor="@android:color/holo_green_dark" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btn_clear_cart"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_weight="1"
app:backgroundTint="@android:color/holo_red_light"
android:text="HAPUS SEMUA" />
<Button
android:id="@+id/btn_checkout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1"
app:backgroundTint="@android:color/holo_green_dark"
android:text="BAYAR" />
</LinearLayout>
</LinearLayout>
<!-- Product List -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_products"
android:layout_width="0dp"
android:layout_height="0dp"
android:padding="16dp"
app:layout_constraintTop_toBottomOf="@id/et_search_menu"
app:layout_constraintBottom_toTopOf="@id/cart_section"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>