mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-22 13:38:41 +00:00
Add order checkout layout
This commit is contained in:
@@ -28,10 +28,12 @@
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:replace="android:theme"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".Activity.OrderCheckOutActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".Activity.FavoriteFoodActivity"
|
||||
android:exported="false"
|
||||
/>
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".Activity.ShopDetailActivity"
|
||||
android:exported="false" />
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.capstone.foodify.Activity;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.capstone.foodify.Adapter.OrderDetailAdapter;
|
||||
import com.capstone.foodify.Model.OrderDetail;
|
||||
import com.capstone.foodify.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class OrderCheckOutActivity extends AppCompatActivity {
|
||||
|
||||
public List<OrderDetail> listOrderDetails = new ArrayList<>();
|
||||
OrderDetailAdapter adapter;
|
||||
RecyclerView recyclerView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_order_check_out);
|
||||
|
||||
adapter = new OrderDetailAdapter();
|
||||
recyclerView = findViewById(R.id.list_order);
|
||||
|
||||
for(int i = 0; i < 5; i++){
|
||||
listOrderDetails.add(new OrderDetail());
|
||||
}
|
||||
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, RecyclerView.VERTICAL, false);
|
||||
recyclerView.setLayoutManager(linearLayoutManager);
|
||||
|
||||
adapter.setData(listOrderDetails);
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.capstone.foodify.Fragment;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -15,6 +17,7 @@ import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.capstone.foodify.Activity.OrderCheckOutActivity;
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.ItemTouchHelperListener;
|
||||
import com.capstone.foodify.Model.Basket;
|
||||
@@ -32,7 +35,7 @@ public class BasketFragment extends Fragment implements ItemTouchHelperListener
|
||||
private BasketAdapter adapter;
|
||||
private List<Basket> listBasketFood = new ArrayList<>();
|
||||
private RelativeLayout listBasketFoodView;
|
||||
|
||||
private Button btnCheckOut;
|
||||
public ConstraintLayout empty_layout;
|
||||
|
||||
public TextView total;
|
||||
@@ -48,6 +51,7 @@ public class BasketFragment extends Fragment implements ItemTouchHelperListener
|
||||
adapter = new BasketAdapter(this);
|
||||
total = view.findViewById(R.id.total_text_view);
|
||||
empty_layout = view.findViewById(R.id.empty_layout);
|
||||
btnCheckOut = view.findViewById(R.id.btnCheckOut);
|
||||
|
||||
//Init data
|
||||
total.setText(Common.changeCurrencyUnit(0));
|
||||
@@ -68,6 +72,14 @@ public class BasketFragment extends Fragment implements ItemTouchHelperListener
|
||||
ItemTouchHelper.SimpleCallback simpleCallback = new RecyclerViewItemTouchHelperBasketFood(0, ItemTouchHelper.LEFT, this);
|
||||
new ItemTouchHelper(simpleCallback).attachToRecyclerView(recyclerView_basket_food);
|
||||
|
||||
//Set event for button check out
|
||||
btnCheckOut.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(getContext(), OrderCheckOutActivity.class));
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,382 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView 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=".Activity.OrderCheckOutActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_image"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/back_button"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="35dp"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:text="Chi tiết đơn"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/back_image" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/list_order"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView"
|
||||
tools:listitem="@layout/item_order_detail"
|
||||
android:visibility="visible"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/line_view"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="@color/gray"
|
||||
app:layout_constraintTop_toBottomOf="@id/list_order"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:text="Thông tin giao hàng"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/list_order"
|
||||
/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/name_layout"
|
||||
>
|
||||
<TextView
|
||||
android:text="Tên:"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:text="Nguyễn Văn A"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/name_layout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/phone_layout"
|
||||
>
|
||||
<TextView
|
||||
android:text="Số điện thoại: "
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:text="0987654321"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:text="Địa chỉ nhận hàng:"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/phone_layout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/address_option"
|
||||
>
|
||||
<RadioButton android:id="@+id/radio_pirates"
|
||||
android:layout_width="wrap_content"
|
||||
android:buttonTint="@color/primaryColor"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Chọn địa chỉ dưới đây:"/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/list_address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/auto_detect_location"
|
||||
android:text="Lấy vị trí thiết bị của bạn"
|
||||
android:buttonTint="@color/primaryColor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_address_detect"
|
||||
android:hint="Đang lấy vị trí...."
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textMultiLine"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<RadioButton android:id="@+id/radio_ninjas"
|
||||
android:layout_width="wrap_content"
|
||||
android:buttonTint="@color/primaryColor"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Tự nhập thủ công"/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textInput_address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Địa chỉ"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:startIconDrawable="@drawable/baseline_home_24"
|
||||
app:startIconTint="@color/primaryColor">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:inputType="text" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout_district_ward"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textInput_address"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/district"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:textAlignment="viewEnd"
|
||||
android:gravity="end"
|
||||
android:paddingEnd="25dp"
|
||||
android:contentDescription="district"
|
||||
android:layout_weight="0.43"
|
||||
/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/ward"
|
||||
android:textAlignment="viewEnd"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="end"
|
||||
android:paddingEnd="25dp"
|
||||
android:contentDescription="ward"
|
||||
android:layout_weight="0.57"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</RadioGroup>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/address_option"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/shipper_cost_layout"
|
||||
>
|
||||
<TextView
|
||||
android:text="Phí ship: "
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:text="30.000 VNĐ"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/shipper_cost_layout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/total_cost_layout"
|
||||
>
|
||||
<TextView
|
||||
android:text="Tổng: "
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/primaryColor"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:textSize="20sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:text="500.000 VNĐ"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/primaryColor"
|
||||
android:textSize="20sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btnPaymentMethod"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/total_cost_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginTop="20dp"
|
||||
>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnZaloPay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="center"
|
||||
android:backgroundTint="#008FE5"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:gravity="center"
|
||||
android:text="Thanh toán bằng ZaloPay"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/white"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="10dp"
|
||||
app:iconTint="@null"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnPay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="center"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:gravity="center"
|
||||
android:text="Thanh toán khi nhận hàng"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/white"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="10dp"
|
||||
app:iconTint="@null"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
@@ -108,7 +108,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPlaceOrder"
|
||||
android:id="@+id/btnCheckOut"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="android:textColorHint">@color/grayLight</item>
|
||||
<item name="android:datePickerDialogTheme">@style/MyDatePickerDialogTheme</item>
|
||||
</style>
|
||||
|
||||
<style name="CustomToolbarTheme" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
@@ -44,4 +45,10 @@
|
||||
<item name="android:textAllCaps">false</item>
|
||||
</style>
|
||||
|
||||
<style name="MyDatePickerDialogTheme" parent="android:Theme.Material.Light.Dialog">
|
||||
<item name="android:colorAccent">@color/primaryColor</item>
|
||||
<item name="colorOnPrimary">@color/primaryColor</item>
|
||||
</style>
|
||||
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user