Show order, add category ui product

This commit is contained in:
Nezumi
2023-03-30 17:14:22 +07:00
parent fe6836d8df
commit bedfc013ba
26 changed files with 945 additions and 134 deletions
@@ -31,7 +31,7 @@ public interface FoodApi {
Gson gson = new GsonBuilder().setDateFormat("HH:mm:ss dd-MM-yyyy").setLenient().create();
FoodApi apiService = new Retrofit.Builder()
.baseUrl("https://foodify-backend-production.up.railway.app/api/").addConverterFactory(GsonConverterFactory.create(gson))
.baseUrl("http://192.168.1.183:8080/api/").addConverterFactory(GsonConverterFactory.create(gson))
.build()
.create(FoodApi.class);
@@ -12,6 +12,7 @@ import com.capstone.foodify.Model.Response.Addresses;
import com.capstone.foodify.Model.Response.Comments;
import com.capstone.foodify.Model.Response.CustomResponse;
import com.capstone.foodify.Model.Response.Foods;
import com.capstone.foodify.Model.Response.Orders;
import com.capstone.foodify.Model.User;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -49,7 +50,7 @@ public interface FoodApiToken {
FoodApiToken apiService = new Retrofit.Builder()
.client(client)
.baseUrl("https://foodify-backend-production.up.railway.app/api/").addConverterFactory(GsonConverterFactory.create(gson))
.baseUrl("http://192.168.1.183:8080/api/").addConverterFactory(GsonConverterFactory.create(gson))
.build()
.create(FoodApiToken.class);
@@ -92,4 +93,10 @@ public interface FoodApiToken {
@PUT("products/{productId}/comments/{commentId}")
Call<CustomResponse> updateComment(@Path("productId") int productId, @Path("commentId") int commentId, @Body Comment comment);
@GET("users/{userId}/orders/status/{status}")
Call<Orders> getOrderUser(@Path("userId") int userId, @Path("status") String status, @Query("pageNo") int pageNo, @Query("pageSize") int pageSize, @Query("sortBy") String sortBy, @Query("sortDir") String sortDir);
@DELETE("users/{userId}/orders/{orderId}")
Call<CustomResponse> deleteOrder(@Path("userId") int userId, @Path("orderId") int orderId);
}
@@ -7,6 +7,7 @@ import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
@@ -30,6 +31,7 @@ import com.capstone.foodify.API.FoodApiToken;
import com.capstone.foodify.Adapter.CommentAdapter;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Basket;
import com.capstone.foodify.Model.Category;
import com.capstone.foodify.Model.Food;
import com.capstone.foodify.Model.Image;
import com.capstone.foodify.Model.Response.Comments;
@@ -39,6 +41,8 @@ import com.capstone.foodify.R;
import com.denzcoskun.imageslider.ImageSlider;
import com.denzcoskun.imageslider.constants.ScaleTypes;
import com.denzcoskun.imageslider.models.SlideModel;
import com.google.android.material.chip.Chip;
import com.google.android.material.chip.ChipGroup;
import com.mcdev.quantitizerlibrary.AnimationStyle;
import com.mcdev.quantitizerlibrary.HorizontalQuantitizer;
import com.mcdev.quantitizerlibrary.QuantitizerListener;
@@ -84,6 +88,7 @@ public class FoodDetailActivity extends AppCompatActivity {
private ProgressBar progressBar;
private CardView user_comment_layout;
private Comment commentUser = null;
private ChipGroup list_category;
private void initComponent() {
horizontalQuantitizer = findViewById(R.id.quantity_option);
@@ -112,6 +117,7 @@ public class FoodDetailActivity extends AppCompatActivity {
delete_button = findViewById(R.id.delete_button);
user_comment_layout = findViewById(R.id.user_comment_layout);
edt_button = findViewById(R.id.edit_button);
list_category = findViewById(R.id.list_category);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -425,6 +431,7 @@ public class FoodDetailActivity extends AppCompatActivity {
}
private void initData() {
LayoutInflater inflater = LayoutInflater.from(this);
foodName_txt.setText(food.getName());
shopName_txt.setText(food.getShop().getName());
@@ -437,6 +444,15 @@ public class FoodDetailActivity extends AppCompatActivity {
countRating_txt.setText(food.getReviewCount() + " đánh giá");
}
//Init category
for(Category category: food.getCategories()){
Chip chip = (Chip) inflater.inflate(R.layout.chip_item, null, false);
chip.setText(category.getName());
chip.setClickable(false);
list_category.addView(chip);
}
add_to_basket_button.setText("ADD TO BASKET - " + Common.changeCurrencyUnit(0));
@@ -191,11 +191,6 @@ public class MainActivity extends AppCompatActivity {
}, 3000);
}
private void getLocationUser(){
}
private void initComponent() {
bottomNavigationView = findViewById(R.id.bottom_nav);
viewPager2 = findViewById(R.id.viewPager);
@@ -1,30 +1,52 @@
package com.capstone.foodify.Activity;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.capstone.foodify.API.FoodApiToken;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Basket;
import com.capstone.foodify.Model.Order;
import com.capstone.foodify.Model.OrderDetail;
import com.capstone.foodify.Adapter.OrderDetailAdapter;
import com.capstone.foodify.Model.Response.CustomResponse;
import com.capstone.foodify.Model.User;
import com.capstone.foodify.R;
import com.sjapps.library.customdialog.BasicDialog;
import com.sjapps.library.customdialog.DialogButtonEvents;
import com.thecode.aestheticdialogs.AestheticDialog;
import com.thecode.aestheticdialogs.DialogStyle;
import com.thecode.aestheticdialogs.DialogType;
import com.thecode.aestheticdialogs.OnDialogClickListener;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
public class OrderDetailActivity extends AppCompatActivity {
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class OrderDetailActivity extends AppCompatActivity {
private static final String AWAITING = "AWAITING";
private TextView order_tracking_number, user_name, phone, address, orderTime, total;
private ImageView back_image;
public List<OrderDetail> listOrderDetails = new ArrayList<>();
private List<Basket> listOrderDetails = new ArrayList<>();
OrderDetailAdapter adapter;
RecyclerView recyclerView;
private Order order;
private Button btn_cancel_order;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -32,6 +54,109 @@ public class OrderDetailActivity extends AppCompatActivity {
setContentView(R.layout.activity_order_detail);
//Init Component
initComponent();
//Get data from previous fragment
if(getIntent() != null)
order = (Order) getIntent().getSerializableExtra("order");
if(order.getStatus().equals(AWAITING))
btn_cancel_order.setVisibility(View.VISIBLE);
//Init data
order_tracking_number.setText("Order Id: #" + order.getOrderTrackingNumber());
user_name.setText("Họ và tên: " + Common.CURRENT_USER.getFullName());
phone.setText("Số điện thoại: " + Common.CURRENT_USER.getPhoneNumber());
address.setText("Địa chỉ: " + order.getAddress());
orderTime.setText("Thời gian đặt: " + order.getOrderTime());
total.setText("Tổng: " + Common.changeCurrencyUnit(order.getTotal()));
for(OrderDetail tempFood: order.getOrderDetails()){
Basket food = new Basket(tempFood.getFood().getId(), tempFood.getFood().getImages().get(0).getImageUrl(),
tempFood.getFood().getName(), tempFood.getFood().getCost() ,tempFood.getFood().getShop().getName(), tempFood.getQuantity(),
tempFood.getFood().getDiscountPercent());
listOrderDetails.add(food);
}
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, RecyclerView.VERTICAL, false);
recyclerView.setLayoutManager(linearLayoutManager);
adapter.setData(listOrderDetails);
recyclerView.setAdapter(adapter);
back_image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onBackPressed();
}
});
//Set event for delete order button
btn_cancel_order.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showDeleteDialogConfirm();
}
});
}
private void showDeleteDialogConfirm(){
BasicDialog dialog = new BasicDialog();
dialog.Builder(this)
.setTitle("Xác nhận huỷ đơn hàng này?")
.setLeftButtonText("Xác nhận")
.setRightButtonText("Không")
.setDialogBackgroundColor(getResources().getColor(R.color.white, null))
.setLeftButtonColor(getResources().getColor(R.color.primaryColor, null))
.setRightButtonColor(getResources().getColor(R.color.gray, null))
.onButtonClick(new DialogButtonEvents() {
@Override
public void onLeftButtonClick() {
deleteOrderUser();
dialog.dismiss();
}
@Override
public void onRightButtonClick() {
dialog.dismiss();
}
})
.show();
}
private void deleteOrderUser(){
FoodApiToken.apiService.deleteOrder(Common.CURRENT_USER.getId(), order.getId()).enqueue(new Callback<CustomResponse>() {
@Override
public void onResponse(Call<CustomResponse> call, Response<CustomResponse> response) {
if(response.code() == 200){
new AestheticDialog.Builder(OrderDetailActivity.this, DialogStyle.RAINBOW, DialogType.SUCCESS)
.setTitle("Thông báo!")
.setMessage("Đã xoá đơn thành công!")
.setCancelable(false)
.setOnClickListener(new OnDialogClickListener() {
@Override
public void onClick(@NonNull AestheticDialog.Builder builder) {
startActivity(new Intent(OrderDetailActivity.this, OrderActivity.class));
builder.dismiss();
finish();
}
})
.show();
} else {
Toast.makeText(OrderDetailActivity.this, "Đã có lỗi hệ thống! Mã lỗi: " + response.code(), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<CustomResponse> call, Throwable t) {
Toast.makeText(OrderDetailActivity.this, "Đã có lỗi kết nối đến hệ thống! Vui lòng thử lại sau!", Toast.LENGTH_SHORT).show();
}
});
}
private void initComponent(){
order_tracking_number = findViewById(R.id.order_tracking_number);
user_name = findViewById(R.id.user_name);
phone = findViewById(R.id.phone);
@@ -41,34 +166,6 @@ public class OrderDetailActivity extends AppCompatActivity {
adapter = new OrderDetailAdapter();
recyclerView = findViewById(R.id.recycler_view_order_detail);
back_image = findViewById(R.id.back_image);
//Init temp data
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm:ss dd/MM/yyyy");
LocalDateTime now = LocalDateTime.now();
int b = (int)(Math.random()*(999999-100000+1)+100000);
order_tracking_number.setText("Order Id: #" + b);
user_name.setText("Tên: Nguyễn Văn A");
phone.setText("0987654321");
address.setText("Phạm Như Xương, Hoà Khánh Nam, Liên Chiểu");
orderTime.setText(dtf.format(now));
total.setText("Tổng: 1.200.000đ");
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);
back_image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onBackPressed();
}
});
btn_cancel_order = findViewById(R.id.cancel_order_button);
}
}
@@ -11,18 +11,26 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.Activity.OrderDetailActivity;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Order;
import com.capstone.foodify.R;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
public class OrderAdapter extends RecyclerView.Adapter<OrderAdapter.OrderViewHolder>{
public List<Order> listOrders;
private Context context;
public OrderAdapter() {
public OrderAdapter(Context context) {
this.context = context;
}
public void setData(List<Order> listOrders){
@@ -40,18 +48,26 @@ public class OrderAdapter extends RecyclerView.Adapter<OrderAdapter.OrderViewHol
public void onBindViewHolder(@NonNull OrderViewHolder holder, int position) {
Order order = listOrders.get(position);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm:ss dd/MM/yyyy");
LocalDateTime now = LocalDateTime.now();
if(order == null)
return;
holder.order_tracking_number.setText("Order Id: #" + order.getOrderTrackingNumber());
holder.user_name.setText("Tên: Nguyễn Văn A");
holder.phone.setText("0987654321");
holder.address.setText("Phạm Như Xương, Hoà Khánh Nam, Liên Chiểu");
holder.orderTime.setText(dtf.format(now));
holder.total.setText("Tổng: 1.200.000đ");
holder.user_name.setText("Họ và tên: " + Common.CURRENT_USER.getFullName());
holder.phone.setText("Số điện thoại: " + Common.CURRENT_USER.getPhoneNumber());
holder.address.setText("Địa chỉ: " + order.getAddress());
holder.orderTime.setText("Thời gian đặt: " + order.getOrderTime());
if(order.getTotal() != null)
holder.total.setText("Tổng: " + Common.changeCurrencyUnit(order.getTotal()));
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, OrderDetailActivity.class);
intent.putExtra("order", order);
context.startActivity(intent);
}
});
}
@Override
@@ -76,13 +92,20 @@ public class OrderAdapter extends RecyclerView.Adapter<OrderAdapter.OrderViewHol
address = itemView.findViewById(R.id.address);
orderTime = itemView.findViewById(R.id.order_time);
total = itemView.findViewById(R.id.total);
}
}
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
context.startActivity(new Intent(context, OrderDetailActivity.class));
}
});
public static Timestamp convertStringToTimestamp(String strDate) {
try {
DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
// you can change format of date
Date date = formatter.parse(strDate);
Timestamp timeStampDate = new Timestamp(date.getTime());
return timeStampDate;
} catch (ParseException e) {
System.out.println("Exception :" + e);
return null;
}
}
}
@@ -2,19 +2,124 @@ package com.capstone.foodify.Fragment.Order;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.capstone.foodify.API.FoodApiToken;
import com.capstone.foodify.Adapter.OrderAdapter;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Order;
import com.capstone.foodify.Model.Response.Orders;
import com.capstone.foodify.R;
public class CancelOrderFragment extends Fragment {
import java.util.ArrayList;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class CancelOrderFragment extends Fragment {
private static final String STATUS = "CANCELED";
private static int CURRENT_PAGE = 0;
private static final int PAGE_SIZE = 8;
private static final String SORT_BY = "id";
private static final String SORT_DIR = "asc";
private static boolean LAST_PAGE;
private List<Order> listOrders = new ArrayList<>();
RecyclerView recyclerView;
OrderAdapter orderAdapter;
NestedScrollView nestedScrollView;
private ProgressBar progressBar;
private TextView endOfListText;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_cancel_order, container, false);
View view = inflater.inflate(R.layout.fragment_cancel_order, container, false);
//Init Component
initComponent(view);
getOrderUser(0);
orderAdapter = new OrderAdapter(getContext());
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false);
recyclerView.setLayoutManager(linearLayoutManager);
//Set event when user scroll down
if (nestedScrollView != null) {
nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(@NonNull NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
if (scrollY == (v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight())) {
//When user scroll to bottom, load more data
dataLoadMore();
}
}
});
}
return view;
}
private void initComponent(View view) {
recyclerView = view.findViewById(R.id.list_order);
nestedScrollView = view.findViewById(R.id.root_view);
progressBar = view.findViewById(R.id.progress_bar);
endOfListText = view.findViewById(R.id.end_of_list_text);
}
private void getOrderUser(int page){
FoodApiToken.apiService.getOrderUser(Common.CURRENT_USER.getId(), STATUS, page, PAGE_SIZE, SORT_BY, SORT_DIR).enqueue(new Callback<Orders>() {
@Override
public void onResponse(Call<Orders> call, Response<Orders> response) {
if(response.code() == 200){
Orders orderResponse = response.body();
//Init data
listOrders.addAll(orderResponse.getOrders());
LAST_PAGE = orderResponse.getPage().isLast();
if(LAST_PAGE)
hideProgressBarAndShowEndOfList();
orderAdapter.setData(listOrders);
recyclerView.setAdapter(orderAdapter);
} else {
Toast.makeText(getContext(), "Đã có lỗi hệ thống! Mã lỗi: " + response.code(), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<Orders> call, Throwable t) {
Toast.makeText(getContext(), "Đã có lỗi kết nối đến hệ thống!", Toast.LENGTH_SHORT).show();
}
});
}
private void dataLoadMore() {
if(!LAST_PAGE){
getOrderUser(++CURRENT_PAGE);
} else {
hideProgressBarAndShowEndOfList();
}
}
private void hideProgressBarAndShowEndOfList() {
progressBar.setVisibility(View.GONE);
endOfListText.setVisibility(View.VISIBLE);
}
}
@@ -2,6 +2,8 @@ package com.capstone.foodify.Fragment.Order;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -9,19 +11,38 @@ import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.capstone.foodify.API.FoodApiToken;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Order;
import com.capstone.foodify.Adapter.OrderAdapter;
import com.capstone.foodify.Model.Response.Orders;
import com.capstone.foodify.R;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class CompleteOrderFragment extends Fragment {
private static final String STATUS = "COMPLETED";
private static int CURRENT_PAGE = 0;
private static final int PAGE_SIZE = 8;
private static final String SORT_BY = "id";
private static final String SORT_DIR = "asc";
private static boolean LAST_PAGE;
private List<Order> listOrders = new ArrayList<>();
RecyclerView recyclerView;
OrderAdapter orderAdapter;
NestedScrollView nestedScrollView;
private ProgressBar progressBar;
private TextView endOfListText;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -30,20 +51,77 @@ public class CompleteOrderFragment extends Fragment {
View view = inflater.inflate(R.layout.fragment_complete_order, container, false);
//Init Component
recyclerView = view.findViewById(R.id.recycler_view_process_order);
initComponent(view);
orderAdapter = new OrderAdapter();
getOrderUser(0);
for(int i = 0; i < 5; i++){
int b = (int)(Math.random()*(999999-100000+1)+100000);
listOrders.add(new Order(String.valueOf(b)));
}
orderAdapter = new OrderAdapter(getContext());
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false);
recyclerView.setLayoutManager(linearLayoutManager);
orderAdapter.setData(listOrders);
recyclerView.setAdapter(orderAdapter);
//Set event when user scroll down
if (nestedScrollView != null) {
nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(@NonNull NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
if (scrollY == (v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight())) {
//When user scroll to bottom, load more data
dataLoadMore();
}
}
});
}
return view;
}
private void initComponent(View view) {
recyclerView = view.findViewById(R.id.list_order);
nestedScrollView = view.findViewById(R.id.root_view);
progressBar = view.findViewById(R.id.progress_bar);
endOfListText = view.findViewById(R.id.end_of_list_text);
}
private void getOrderUser(int page){
FoodApiToken.apiService.getOrderUser(Common.CURRENT_USER.getId(), STATUS, page, PAGE_SIZE, SORT_BY, SORT_DIR).enqueue(new Callback<Orders>() {
@Override
public void onResponse(Call<Orders> call, Response<Orders> response) {
if(response.code() == 200){
Orders orderResponse = response.body();
//Init data
listOrders.addAll(orderResponse.getOrders());
LAST_PAGE = orderResponse.getPage().isLast();
if(LAST_PAGE)
hideProgressBarAndShowEndOfList();
orderAdapter.setData(listOrders);
recyclerView.setAdapter(orderAdapter);
} else {
Toast.makeText(getContext(), "Đã có lỗi hệ thống! Mã lỗi: " + response.code(), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<Orders> call, Throwable t) {
Toast.makeText(getContext(), "Đã có lỗi kết nối đến hệ thống!", Toast.LENGTH_SHORT).show();
}
});
}
private void dataLoadMore() {
if(!LAST_PAGE){
getOrderUser(++CURRENT_PAGE);
} else {
hideProgressBarAndShowEndOfList();
}
}
private void hideProgressBarAndShowEndOfList() {
progressBar.setVisibility(View.GONE);
endOfListText.setVisibility(View.VISIBLE);
}
}
@@ -2,6 +2,8 @@ package com.capstone.foodify.Fragment.Order;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -9,19 +11,37 @@ import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.capstone.foodify.API.FoodApiToken;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Order;
import com.capstone.foodify.Adapter.OrderAdapter;
import com.capstone.foodify.Model.Response.Orders;
import com.capstone.foodify.R;
import java.util.ArrayList;
import java.util.List;
public class PreparingFragment extends Fragment {
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class PreparingFragment extends Fragment {
private static final String STATUS = "CONFIRMED";
private static int CURRENT_PAGE = 0;
private static final int PAGE_SIZE = 8;
private static final String SORT_BY = "id";
private static final String SORT_DIR = "asc";
private static boolean LAST_PAGE;
private List<Order> listOrders = new ArrayList<>();
RecyclerView recyclerView;
OrderAdapter orderAdapter;
NestedScrollView nestedScrollView;
private ProgressBar progressBar;
private TextView endOfListText;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -30,20 +50,77 @@ public class PreparingFragment extends Fragment {
View view = inflater.inflate(R.layout.fragment_preparing, container, false);
//Init Component
recyclerView = view.findViewById(R.id.recycler_view_process_order);
initComponent(view);
orderAdapter = new OrderAdapter();
getOrderUser(0);
for(int i = 0; i < 5; i++){
int b = (int)(Math.random()*(999999-100000+1)+100000);
listOrders.add(new Order(String.valueOf(b)));
}
orderAdapter = new OrderAdapter(getContext());
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false);
recyclerView.setLayoutManager(linearLayoutManager);
orderAdapter.setData(listOrders);
recyclerView.setAdapter(orderAdapter);
//Set event when user scroll down
if (nestedScrollView != null) {
nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(@NonNull NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
if (scrollY == (v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight())) {
//When user scroll to bottom, load more data
dataLoadMore();
}
}
});
}
return view;
}
private void initComponent(View view) {
recyclerView = view.findViewById(R.id.list_order);
nestedScrollView = view.findViewById(R.id.root_view);
progressBar = view.findViewById(R.id.progress_bar);
endOfListText = view.findViewById(R.id.end_of_list_text);
}
private void getOrderUser(int page){
FoodApiToken.apiService.getOrderUser(Common.CURRENT_USER.getId(), STATUS, page, PAGE_SIZE, SORT_BY, SORT_DIR).enqueue(new Callback<Orders>() {
@Override
public void onResponse(Call<Orders> call, Response<Orders> response) {
if(response.code() == 200){
Orders orderResponse = response.body();
//Init data
listOrders.addAll(orderResponse.getOrders());
LAST_PAGE = orderResponse.getPage().isLast();
if(LAST_PAGE)
hideProgressBarAndShowEndOfList();
orderAdapter.setData(listOrders);
recyclerView.setAdapter(orderAdapter);
} else {
Toast.makeText(getContext(), "Đã có lỗi hệ thống! Mã lỗi: " + response.code(), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<Orders> call, Throwable t) {
Toast.makeText(getContext(), "Đã có lỗi kết nối đến hệ thống!", Toast.LENGTH_SHORT).show();
}
});
}
private void dataLoadMore() {
if(!LAST_PAGE){
getOrderUser(++CURRENT_PAGE);
} else {
hideProgressBarAndShowEndOfList();
}
}
private void hideProgressBarAndShowEndOfList() {
progressBar.setVisibility(View.GONE);
endOfListText.setVisibility(View.VISIBLE);
}
}
@@ -1,27 +1,47 @@
package com.capstone.foodify.Fragment.Order;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.capstone.foodify.Model.Order;
import com.capstone.foodify.API.FoodApiToken;
import com.capstone.foodify.Adapter.OrderAdapter;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Order;
import com.capstone.foodify.Model.Response.Orders;
import com.capstone.foodify.R;
import java.util.ArrayList;
import java.util.List;
public class ProcessOderFragment extends Fragment {
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class ProcessOderFragment extends Fragment {
private static final String STATUS = "AWAITING";
private static int CURRENT_PAGE = 0;
private static final int PAGE_SIZE = 8;
private static final String SORT_BY = "id";
private static final String SORT_DIR = "asc";
private static boolean LAST_PAGE;
private List<Order> listOrders = new ArrayList<>();
RecyclerView recyclerView;
OrderAdapter orderAdapter;
NestedScrollView nestedScrollView;
private ProgressBar progressBar;
private TextView endOfListText;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -30,21 +50,79 @@ public class ProcessOderFragment extends Fragment {
View view = inflater.inflate(R.layout.fragment_process_order, container, false);
//Init Component
recyclerView = view.findViewById(R.id.recycler_view_process_order);
initComponent(view);
orderAdapter = new OrderAdapter();
getOrderUser(0);
for(int i = 0; i < 5; i++){
int b = (int)(Math.random()*(999999-100000+1)+100000);
listOrders.add(new Order(String.valueOf(b)));
}
orderAdapter = new OrderAdapter(getContext());
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false);
recyclerView.setLayoutManager(linearLayoutManager);
orderAdapter.setData(listOrders);
recyclerView.setAdapter(orderAdapter);
//Set event when user scroll down
if (nestedScrollView != null) {
nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(@NonNull NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
if (scrollY == (v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight())) {
//When user scroll to bottom, load more data
dataLoadMore();
}
}
});
}
return view;
}
private void initComponent(View view) {
recyclerView = view.findViewById(R.id.list_order);
nestedScrollView = view.findViewById(R.id.root_view);
progressBar = view.findViewById(R.id.progress_bar);
endOfListText = view.findViewById(R.id.end_of_list_text);
}
private void getOrderUser(int page){
FoodApiToken.apiService.getOrderUser(Common.CURRENT_USER.getId(), STATUS, page, PAGE_SIZE, SORT_BY, SORT_DIR).enqueue(new Callback<Orders>() {
@Override
public void onResponse(Call<Orders> call, Response<Orders> response) {
if(response.code() == 200){
Orders orderResponse = response.body();
//Init data
listOrders.addAll(orderResponse.getOrders());
LAST_PAGE = orderResponse.getPage().isLast();
if(LAST_PAGE)
hideProgressBarAndShowEndOfList();
orderAdapter.setData(listOrders);
recyclerView.setAdapter(orderAdapter);
} else {
Toast.makeText(getContext(), "Đã có lỗi hệ thống! Mã lỗi: " + response.code(), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<Orders> call, Throwable t) {
Toast.makeText(getContext(), "Đã có lỗi kết nối đến hệ thống!", Toast.LENGTH_SHORT).show();
}
});
}
private void dataLoadMore() {
if(!LAST_PAGE){
getOrderUser(++CURRENT_PAGE);
} else {
hideProgressBarAndShowEndOfList();
}
}
private void hideProgressBarAndShowEndOfList() {
progressBar.setVisibility(View.GONE);
endOfListText.setVisibility(View.VISIBLE);
}
}
@@ -2,6 +2,8 @@ package com.capstone.foodify.Fragment.Order;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -9,19 +11,38 @@ import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.capstone.foodify.API.FoodApiToken;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Order;
import com.capstone.foodify.Adapter.OrderAdapter;
import com.capstone.foodify.Model.Response.Orders;
import com.capstone.foodify.R;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class ShipOrderFragment extends Fragment {
private static final String STATUS = "SHIPPING";
private static int CURRENT_PAGE = 0;
private static final int PAGE_SIZE = 8;
private static final String SORT_BY = "id";
private static final String SORT_DIR = "asc";
private static boolean LAST_PAGE;
private List<Order> listOrders = new ArrayList<>();
RecyclerView recyclerView;
OrderAdapter orderAdapter;
NestedScrollView nestedScrollView;
private ProgressBar progressBar;
private TextView endOfListText;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -30,20 +51,76 @@ public class ShipOrderFragment extends Fragment {
View view = inflater.inflate(R.layout.fragment_ship_order, container, false);
//Init Component
recyclerView = view.findViewById(R.id.recycler_view_process_order);
initComponent(view);
orderAdapter = new OrderAdapter();
getOrderUser(0);
for(int i = 0; i < 5; i++){
int b = (int)(Math.random()*(999999-100000+1)+100000);
listOrders.add(new Order(String.valueOf(b)));
}
orderAdapter = new OrderAdapter(getContext());
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false);
recyclerView.setLayoutManager(linearLayoutManager);
orderAdapter.setData(listOrders);
recyclerView.setAdapter(orderAdapter);
//Set event when user scroll down
if (nestedScrollView != null) {
nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(@NonNull NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
if (scrollY == (v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight())) {
//When user scroll to bottom, load more data
dataLoadMore();
}
}
});
}
return view;
}
private void initComponent(View view) {
recyclerView = view.findViewById(R.id.list_order);
nestedScrollView = view.findViewById(R.id.root_view);
progressBar = view.findViewById(R.id.progress_bar);
endOfListText = view.findViewById(R.id.end_of_list_text);
}
private void getOrderUser(int page){
FoodApiToken.apiService.getOrderUser(Common.CURRENT_USER.getId(), STATUS, page, PAGE_SIZE, SORT_BY, SORT_DIR).enqueue(new Callback<Orders>() {
@Override
public void onResponse(Call<Orders> call, Response<Orders> response) {
if(response.code() == 200){
Orders orderResponse = response.body();
//Init data
listOrders.addAll(orderResponse.getOrders());
LAST_PAGE = orderResponse.getPage().isLast();
if(LAST_PAGE)
hideProgressBarAndShowEndOfList();
orderAdapter.setData(listOrders);
recyclerView.setAdapter(orderAdapter);
} else {
Toast.makeText(getContext(), "Đã có lỗi hệ thống! Mã lỗi: " + response.code(), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<Orders> call, Throwable t) {
Toast.makeText(getContext(), "Đã có lỗi kết nối đến hệ thống!", Toast.LENGTH_SHORT).show();
}
});
}
private void dataLoadMore() {
if(!LAST_PAGE){
getOrderUser(++CURRENT_PAGE);
} else {
hideProgressBarAndShowEndOfList();
}
}
private void hideProgressBarAndShowEndOfList() {
progressBar.setVisibility(View.GONE);
endOfListText.setVisibility(View.VISIBLE);
}
}
@@ -1,6 +1,8 @@
package com.capstone.foodify.Model;
public class Category {
import java.io.Serializable;
public class Category implements Serializable {
private String id;
private String name;
private String imageUrl;
@@ -1,8 +1,9 @@
package com.capstone.foodify.Model;
import java.io.Serializable;
import java.util.List;
public class Food implements Comparable<Food>{
public class Food implements Comparable<Food>, Serializable {
private String id;
private String name;
private String description;
@@ -1,6 +1,8 @@
package com.capstone.foodify.Model;
public class Image {
import java.io.Serializable;
public class Image implements Serializable {
private int id;
private String imageUrl;
private int productId;
@@ -1,8 +1,10 @@
package com.capstone.foodify.Model;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;
public class Order {
public class Order implements Serializable {
private int id;
private String orderTrackingNumber;
private int shipperId;
@@ -11,8 +13,10 @@ public class Order {
private String status;
private String address;
private List<OrderDetail> orderDetails;
private String orderTime;
private String lat;
private String lng;
private Long total;
public Order(String orderTrackingNumber, String paymentMethod, float shippingCost, String status, String address, List<OrderDetail> orderDetails, String lat, String lng) {
this.orderTrackingNumber = orderTrackingNumber;
@@ -115,4 +119,20 @@ public class Order {
public void setLng(String lng) {
this.lng = lng;
}
public String getOrderTime() {
return orderTime;
}
public void setOrderTime(String orderTime) {
this.orderTime = orderTime;
}
public Long getTotal() {
return total;
}
public void setTotal(Long total) {
this.total = total;
}
}
@@ -1,12 +1,17 @@
package com.capstone.foodify.Model;
public class OrderDetail {
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
public class OrderDetail implements Serializable {
private int id;
private int orderId;
private int productId;
private String quantity;
private float subTotal;
@SerializedName("product")
private Food food;
public OrderDetail(int productId, String quantity) {
this.productId = productId;
this.quantity = quantity;
@@ -54,4 +59,12 @@ public class OrderDetail {
public void setSubTotal(float subTotal) {
this.subTotal = subTotal;
}
public Food getFood() {
return food;
}
public void setFood(Food food) {
this.food = food;
}
}
@@ -0,0 +1,27 @@
package com.capstone.foodify.Model.Response;
import com.capstone.foodify.Model.Order;
import com.capstone.foodify.Model.Page;
import java.util.List;
public class Orders {
private List<Order> orders;
private Page page;
public List<Order> getOrders() {
return orders;
}
public void setOrders(List<Order> orders) {
this.orders = orders;
}
public Page getPage() {
return page;
}
public void setPage(Page page) {
this.page = page;
}
}
@@ -1,6 +1,8 @@
package com.capstone.foodify.Model;
public class Shop {
import java.io.Serializable;
public class Shop implements Serializable {
private int id;
private String name;
private String description;
@@ -161,6 +161,33 @@
</LinearLayout>
<LinearLayout
android:id="@+id/category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/rating_layout"
android:orientation="horizontal"
android:layout_marginTop="8dp"
>
<TextView
android:text="Danh mục:"
android:textSize="18sp"
android:fontFamily="@font/bebas"
android:textColor="@color/black"
android:layout_marginEnd="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
/>
<com.google.android.material.chip.ChipGroup
android:id="@+id/list_category"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<TextView
android:id="@+id/description_text_view"
android:text="Mô tả"
@@ -170,7 +197,7 @@
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/rating_layout"
app:layout_constraintTop_toBottomOf="@id/category"
app:layout_constraintStart_toStartOf="parent"
/>
@@ -126,6 +126,7 @@
app:layout_constraintTop_toBottomOf="@id/order_view"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
/>
<View
@@ -1,14 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Fragment.Order.CancelOrderFragment">
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".Fragment.Order.CancelOrderFragment"
android:id="@+id/root_view">
<!-- TODO: Update blank fragment layout -->
<TextView
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
android:layout_height="wrap_content">
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_order"
tools:listitem="@layout/item_order"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
/>
<ProgressBar
android:id="@+id/progress_bar"
android:indeterminateTint="@color/primaryColor"
app:layout_constraintTop_toBottomOf="@id/list_order"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/end_of_list_text"
android:text="End of list"
android:fontFamily="@font/opensans"
android:textColor="@color/grayLight"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/progress_bar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
@@ -3,13 +3,46 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Fragment.Order.CompleteOrderFragment">
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".Fragment.Order.CompleteOrderFragment"
android:id="@+id/root_view"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_process_order"
tools:listitem="@layout/item_order"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_order"
tools:listitem="@layout/item_order"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
/>
<ProgressBar
android:id="@+id/progress_bar"
android:indeterminateTint="@color/primaryColor"
app:layout_constraintTop_toBottomOf="@id/list_order"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/end_of_list_text"
android:text="End of list"
android:fontFamily="@font/opensans"
android:textColor="@color/grayLight"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/progress_bar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
+39 -6
View File
@@ -3,13 +3,46 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Fragment.Order.PreparingFragment">
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".Fragment.Order.PreparingFragment"
android:id="@+id/root_view"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_process_order"
tools:listitem="@layout/item_order"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_order"
tools:listitem="@layout/item_order"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
/>
<ProgressBar
android:id="@+id/progress_bar"
android:indeterminateTint="@color/primaryColor"
app:layout_constraintTop_toBottomOf="@id/list_order"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/end_of_list_text"
android:text="End of list"
android:fontFamily="@font/opensans"
android:textColor="@color/grayLight"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/progress_bar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
@@ -3,13 +3,45 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".Fragment.Order.ProcessOderFragment">
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".Fragment.Order.ProcessOderFragment"
android:id="@+id/root_view">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_process_order"
tools:listitem="@layout/item_order"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_order"
tools:listitem="@layout/item_order"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
/>
<ProgressBar
android:id="@+id/progress_bar"
android:indeterminateTint="@color/primaryColor"
app:layout_constraintTop_toBottomOf="@id/list_order"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/end_of_list_text"
android:text="End of list"
android:fontFamily="@font/opensans"
android:textColor="@color/grayLight"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/progress_bar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
+1 -1
View File
@@ -48,7 +48,7 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_search"
tools:listitem="@layout/item_food_search_and_favorite"
tools:listitem="@layout/item_food_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/list_category"
@@ -3,13 +3,45 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Fragment.Order.ShipOrderFragment">
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".Fragment.Order.ShipOrderFragment"
android:id="@+id/root_view">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_process_order"
tools:listitem="@layout/item_order"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_order"
tools:listitem="@layout/item_order"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
/>
<ProgressBar
android:id="@+id/progress_bar"
android:indeterminateTint="@color/primaryColor"
app:layout_constraintTop_toBottomOf="@id/list_order"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/end_of_list_text"
android:text="End of list"
android:fontFamily="@font/opensans"
android:textColor="@color/grayLight"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/progress_bar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>