mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-22 20:00:50 +00:00
Add order checkout layout
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user