mirror of
https://github.com/Nezumi-2711/Foodify-Shipper.git
synced 2026-09-22 13:38:42 +00:00
Completed Shipper App
This commit is contained in:
@@ -8,6 +8,12 @@ android {
|
|||||||
namespace 'com.capstone.foodify.shipper'
|
namespace 'com.capstone.foodify.shipper'
|
||||||
compileSdk 31
|
compileSdk 31
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
checkReleaseBuilds false
|
||||||
|
tasks.lint.enabled = false
|
||||||
|
baseline file("lint-baseline.xml")
|
||||||
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.capstone.foodify.shipper"
|
applicationId "com.capstone.foodify.shipper"
|
||||||
minSdk 26
|
minSdk 26
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<issues format="6" by="lint 7.4.2" type="baseline" client="gradle" dependencies="false" name="AGP (7.4.2)" variant="fatal" version="7.4.2">
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="ExpiredTargetSdkVersion"
|
||||||
|
message="Google Play requires that apps target API level 31 or higher.
"
|
||||||
|
errorLine1=" targetSdk 30"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="19"
|
||||||
|
column="9"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
</issues>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"artifactType": {
|
||||||
|
"type": "APK",
|
||||||
|
"kind": "Directory"
|
||||||
|
},
|
||||||
|
"applicationId": "com.capstone.foodify.shipper",
|
||||||
|
"variantName": "release",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "SINGLE",
|
||||||
|
"filters": [],
|
||||||
|
"attributes": [],
|
||||||
|
"versionCode": 1,
|
||||||
|
"versionName": "1.0",
|
||||||
|
"outputFile": "app-release.apk"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"elementType": "File"
|
||||||
|
}
|
||||||
@@ -82,7 +82,7 @@ public class OrderDetailActivity extends AppCompatActivity {
|
|||||||
ConstraintLayout progressLayout;
|
ConstraintLayout progressLayout;
|
||||||
RecyclerView rcv_list_order;
|
RecyclerView rcv_list_order;
|
||||||
OrderDetailAdapter adapter;
|
OrderDetailAdapter adapter;
|
||||||
LinearLayout layoutConfirmOrder;
|
LinearLayout layout1;
|
||||||
private GeofencingClient geofencingClient;
|
private GeofencingClient geofencingClient;
|
||||||
private GeofenceHelper geofenceHelper;
|
private GeofenceHelper geofenceHelper;
|
||||||
private float GEOFENCE_RADIUS = 200;
|
private float GEOFENCE_RADIUS = 200;
|
||||||
@@ -155,6 +155,7 @@ public class OrderDetailActivity extends AppCompatActivity {
|
|||||||
} else{
|
} else{
|
||||||
Common.showErrorDialog(OrderDetailActivity.this, "Không thể lấy được thông tin đơn, vui lòng thử lại sau!");
|
Common.showErrorDialog(OrderDetailActivity.this, "Không thể lấy được thông tin đơn, vui lòng thử lại sau!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -184,7 +185,7 @@ public class OrderDetailActivity extends AppCompatActivity {
|
|||||||
geofencingClient = LocationServices.getGeofencingClient(this);
|
geofencingClient = LocationServices.getGeofencingClient(this);
|
||||||
geofenceHelper = new GeofenceHelper(this);
|
geofenceHelper = new GeofenceHelper(this);
|
||||||
|
|
||||||
if(!order.getStatus().equals(COMPLETE_STATUS) && !order.getStatus().equals(CANCEL_STATUS)){
|
if(!order.getStatus().equals(COMPLETE_STATUS)){
|
||||||
getLocation();
|
getLocation();
|
||||||
|
|
||||||
final Handler handler = new Handler(Looper.getMainLooper());
|
final Handler handler = new Handler(Looper.getMainLooper());
|
||||||
@@ -202,8 +203,8 @@ public class OrderDetailActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}, 5000);
|
}, 5000);
|
||||||
} else {
|
} else {
|
||||||
btn_shipping.setVisibility(View.GONE);
|
btn_call.setVisibility(View.GONE);
|
||||||
layoutConfirmOrder.setVisibility(View.GONE);
|
layout1.setVisibility(View.GONE);
|
||||||
progressLayout.setVisibility(View.GONE);
|
progressLayout.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -215,7 +216,7 @@ public class OrderDetailActivity extends AppCompatActivity {
|
|||||||
if(response.code() == 200){
|
if(response.code() == 200){
|
||||||
String tempToken = response.body();
|
String tempToken = response.body();
|
||||||
assert tempToken != null;
|
assert tempToken != null;
|
||||||
Common.FCM_TOKEN_USER = tempToken.replace("\"", "");
|
Common.FCM_TOKEN_CUSTOMER = tempToken.replace("\"", "");
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(OrderDetailActivity.this, "Error code: " + response.code(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(OrderDetailActivity.this, "Error code: " + response.code(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
@@ -278,7 +279,7 @@ public class OrderDetailActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
rcv_list_order = findViewById(R.id.list_order);
|
rcv_list_order = findViewById(R.id.list_order);
|
||||||
|
|
||||||
layoutConfirmOrder = findViewById(R.id.layout1);
|
layout1 = findViewById(R.id.layout1);
|
||||||
|
|
||||||
progressLayout = findViewById(R.id.progress_layout);
|
progressLayout = findViewById(R.id.progress_layout);
|
||||||
|
|
||||||
@@ -471,11 +472,11 @@ public class OrderDetailActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void changeLayoutButton(double lat1, double lng1) {
|
private void changeLayoutButton(double lat1, double lng1) {
|
||||||
if(distance(lat1, lng1, order.getLat(), order.getLng()) < 0.2){
|
if(distance(lat1, lng1, order.getLat(), order.getLng()) < 0.2){
|
||||||
btn_shipping.setVisibility(View.GONE);
|
layout1.setVisibility(View.GONE);
|
||||||
layoutConfirmOrder.setVisibility(View.VISIBLE);
|
btn_confirm_ship_completed.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
btn_shipping.setVisibility(View.VISIBLE);
|
layout1.setVisibility(View.VISIBLE);
|
||||||
layoutConfirmOrder.setVisibility(View.GONE);
|
btn_confirm_ship_completed.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,6 +532,6 @@ public class OrderDetailActivity extends AppCompatActivity {
|
|||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
stopLocationService();
|
stopLocationService();
|
||||||
Common.CURRENT_ORDER = null;
|
Common.CURRENT_ORDER = null;
|
||||||
Common.FCM_TOKEN_USER = null;
|
Common.FCM_TOKEN_CUSTOMER = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import android.content.Intent;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
@@ -30,6 +31,7 @@ import com.google.firebase.auth.FirebaseAuth;
|
|||||||
import com.google.firebase.auth.FirebaseUser;
|
import com.google.firebase.auth.FirebaseUser;
|
||||||
import com.google.firebase.auth.GetTokenResult;
|
import com.google.firebase.auth.GetTokenResult;
|
||||||
import com.google.firebase.auth.SignInMethodQueryResult;
|
import com.google.firebase.auth.SignInMethodQueryResult;
|
||||||
|
import com.google.firebase.messaging.FirebaseMessaging;
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@@ -92,6 +94,16 @@ public class SignInActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
FirebaseMessaging.getInstance().getToken()
|
||||||
|
.addOnCompleteListener(new OnCompleteListener<String>() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull Task<String> task) {
|
||||||
|
if(task.isSuccessful()){
|
||||||
|
Log.d("TOKEN_FCM", "Token: " + task.getResult());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
edt_password.addTextChangedListener(new TextWatcher() {
|
edt_password.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
@@ -182,9 +194,6 @@ public class SignInActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
//Get shipper id
|
//Get shipper id
|
||||||
getShipperId(userData.getId());
|
getShipperId(userData.getId());
|
||||||
|
|
||||||
startActivity(new Intent(SignInActivity.this, MainActivity.class));
|
|
||||||
finish();
|
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(SignInActivity.this, "Tài khoản không hợp lệ! Vui lòng kiểm tra lại!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(SignInActivity.this, "Tài khoản không hợp lệ! Vui lòng kiểm tra lại!", Toast.LENGTH_SHORT).show();
|
||||||
FirebaseAuth.getInstance().signOut();
|
FirebaseAuth.getInstance().signOut();
|
||||||
@@ -277,7 +286,10 @@ public class SignInActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<Shipper> call, Response<Shipper> response) {
|
public void onResponse(Call<Shipper> call, Response<Shipper> response) {
|
||||||
if(response.code() == 200){
|
if(response.code() == 200){
|
||||||
Common.CURRENT_SHIPPER = response.body();
|
Common.CURRENT_SHIPPER = response.body();
|
||||||
|
|
||||||
|
startActivity(new Intent(SignInActivity.this, MainActivity.class));
|
||||||
|
finish();
|
||||||
//Dismiss progress bar
|
//Dismiss progress bar
|
||||||
progressLayout.setVisibility(View.GONE);
|
progressLayout.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ public class Common {
|
|||||||
public static Order CURRENT_ORDER = null;
|
public static Order CURRENT_ORDER = null;
|
||||||
public static String TOKEN = null;
|
public static String TOKEN = null;
|
||||||
public static String FCM_TOKEN_SHIPPER = null;
|
public static String FCM_TOKEN_SHIPPER = null;
|
||||||
public static String FCM_TOKEN_USER = null;
|
public static String FCM_TOKEN_CUSTOMER = null;
|
||||||
public static Location CURRENT_LOCATION = null;
|
public static Location CURRENT_LOCATION = null;
|
||||||
public static final String BASE_URL = "http://192.168.1.183:8080/api/";
|
public static final String BASE_URL = "https://foodify-backend-production.up.railway.app/api/";
|
||||||
public static final String MAP_API = "AIzaSyAY14Ic32UP26Hg6GILznOfbBihiY5BUxw";
|
public static final String MAP_API = "AIzaSyAY14Ic32UP26Hg6GILznOfbBihiY5BUxw";
|
||||||
public static final String FORMAT_DATE="dd-MM-yyyy";
|
public static final String FORMAT_DATE="dd-MM-yyyy";
|
||||||
public static final String VALID_EMAIL_ADDRESS_REGEX = "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$";
|
public static final String VALID_EMAIL_ADDRESS_REGEX = "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$";
|
||||||
|
|||||||
@@ -0,0 +1,157 @@
|
|||||||
|
package com.capstone.foodify.shipper.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 androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
|
||||||
|
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.shipper.API.FoodApiToken;
|
||||||
|
import com.capstone.foodify.shipper.Adapter.OrderAdapter;
|
||||||
|
import com.capstone.foodify.shipper.Common;
|
||||||
|
import com.capstone.foodify.shipper.Model.Order;
|
||||||
|
import com.capstone.foodify.shipper.Model.Response.Orders;
|
||||||
|
import com.capstone.foodify.shipper.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Currency;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
public class AwaitingOrder extends Fragment {
|
||||||
|
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 = false;
|
||||||
|
private final List<Order> listOrders = new ArrayList<>();
|
||||||
|
RecyclerView recyclerView;
|
||||||
|
OrderAdapter orderAdapter;
|
||||||
|
TextView end_of_list_text_view, no_order_text;
|
||||||
|
NestedScrollView list_order_layout;
|
||||||
|
ProgressBar progressBar;
|
||||||
|
SwipeRefreshLayout swipeRefreshLayout;
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
View view = inflater.inflate(R.layout.fragment_waiting_order, container, false);
|
||||||
|
|
||||||
|
//Init component
|
||||||
|
recyclerView = view.findViewById(R.id.rcv_list_order);
|
||||||
|
list_order_layout = view.findViewById(R.id.list_order_layout);
|
||||||
|
progressBar = view.findViewById(R.id.progress_bar);
|
||||||
|
end_of_list_text_view = view.findViewById(R.id.end_of_list_text);
|
||||||
|
no_order_text = view.findViewById(R.id.no_oder_text);
|
||||||
|
swipeRefreshLayout = view.findViewById(R.id.swipe_refresh);
|
||||||
|
|
||||||
|
orderAdapter = new OrderAdapter(getActivity());
|
||||||
|
|
||||||
|
CURRENT_PAGE = 0;
|
||||||
|
getListOrder();
|
||||||
|
|
||||||
|
|
||||||
|
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false);
|
||||||
|
recyclerView.setLayoutManager(linearLayoutManager);
|
||||||
|
|
||||||
|
recyclerView.setAdapter(orderAdapter);
|
||||||
|
|
||||||
|
if (list_order_layout != null) {
|
||||||
|
list_order_layout.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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh() {
|
||||||
|
listOrders.clear();
|
||||||
|
CURRENT_PAGE = 0;
|
||||||
|
getListOrder();
|
||||||
|
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
no_order_text.setVisibility(View.GONE);
|
||||||
|
end_of_list_text_view.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getListOrder(){
|
||||||
|
if(Common.CURRENT_SHIPPER != null){
|
||||||
|
FoodApiToken.apiService.getListOrder(Common.CURRENT_SHIPPER.getId(), "AWAITING", CURRENT_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){
|
||||||
|
|
||||||
|
assert response.body() != null;
|
||||||
|
listOrders.addAll(response.body().getOrders());
|
||||||
|
|
||||||
|
orderAdapter.setData(listOrders);
|
||||||
|
|
||||||
|
LAST_PAGE = response.body().getPage().isLast();
|
||||||
|
|
||||||
|
|
||||||
|
if(listOrders.size() == 0){
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
|
end_of_list_text_view.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
no_order_text.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
if(LAST_PAGE)
|
||||||
|
hideProgressBarAndShowEndOfListText();
|
||||||
|
}
|
||||||
|
|
||||||
|
} 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(), Common.ERROR_CONNECT_SERVER, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideProgressBarAndShowEndOfListText(){
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
|
end_of_list_text_view.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void defaultLayout(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dataLoadMore() {
|
||||||
|
if(!LAST_PAGE){
|
||||||
|
getListOrder();
|
||||||
|
} else {
|
||||||
|
hideProgressBarAndShowEndOfListText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import androidx.core.widget.NestedScrollView;
|
|||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -31,28 +32,30 @@ import retrofit2.Response;
|
|||||||
|
|
||||||
public class CompletedOrder extends Fragment {
|
public class CompletedOrder extends Fragment {
|
||||||
private static int CURRENT_PAGE = 0;
|
private static int CURRENT_PAGE = 0;
|
||||||
private static int PAGE_SIZE = 8;
|
private static final int PAGE_SIZE = 8;
|
||||||
private static String SORT_BY = "id";
|
private static final String SORT_BY = "id";
|
||||||
private static String SORT_DIR = "asc";
|
private static final String SORT_DIR = "asc";
|
||||||
private static boolean LAST_PAGE = false;
|
private static boolean LAST_PAGE = false;
|
||||||
private List<Order> listOrders = new ArrayList<>();
|
private final List<Order> listOrders = new ArrayList<>();
|
||||||
RecyclerView recyclerView;
|
RecyclerView recyclerView;
|
||||||
OrderAdapter orderAdapter;
|
OrderAdapter orderAdapter;
|
||||||
TextView end_of_list_text_view;
|
TextView end_of_list_text_view, no_order_text;
|
||||||
NestedScrollView list_order_layout;
|
NestedScrollView list_order_layout;
|
||||||
ProgressBar progressBar;
|
ProgressBar progressBar;
|
||||||
|
SwipeRefreshLayout swipeRefreshLayout;
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
View view = inflater.inflate(R.layout.fragment_completed_order, container, false);
|
View view = inflater.inflate(R.layout.fragment_waiting_order, container, false);
|
||||||
|
|
||||||
//Init component
|
//Init component
|
||||||
recyclerView = view.findViewById(R.id.rcv_list_order);
|
recyclerView = view.findViewById(R.id.rcv_list_order);
|
||||||
list_order_layout = view.findViewById(R.id.list_order_layout);
|
list_order_layout = view.findViewById(R.id.list_order_layout);
|
||||||
progressBar = view.findViewById(R.id.progress_bar);
|
progressBar = view.findViewById(R.id.progress_bar);
|
||||||
end_of_list_text_view = view.findViewById(R.id.end_of_list_text);
|
end_of_list_text_view = view.findViewById(R.id.end_of_list_text);
|
||||||
|
no_order_text = view.findViewById(R.id.no_oder_text);
|
||||||
|
swipeRefreshLayout = view.findViewById(R.id.swipe_refresh);
|
||||||
|
|
||||||
orderAdapter = new OrderAdapter(getActivity());
|
orderAdapter = new OrderAdapter(getActivity());
|
||||||
|
|
||||||
@@ -76,6 +79,23 @@ public class CompletedOrder extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh() {
|
||||||
|
listOrders.clear();
|
||||||
|
CURRENT_PAGE = 0;
|
||||||
|
getListOrder();
|
||||||
|
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
no_order_text.setVisibility(View.GONE);
|
||||||
|
end_of_list_text_view.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,14 +106,24 @@ public class CompletedOrder extends Fragment {
|
|||||||
public void onResponse(Call<Orders> call, Response<Orders> response) {
|
public void onResponse(Call<Orders> call, Response<Orders> response) {
|
||||||
if(response.code() == 200){
|
if(response.code() == 200){
|
||||||
|
|
||||||
|
assert response.body() != null;
|
||||||
listOrders.addAll(response.body().getOrders());
|
listOrders.addAll(response.body().getOrders());
|
||||||
|
|
||||||
orderAdapter.setData(listOrders);
|
orderAdapter.setData(listOrders);
|
||||||
|
|
||||||
LAST_PAGE = response.body().getPage().isLast();
|
LAST_PAGE = response.body().getPage().isLast();
|
||||||
|
|
||||||
if(LAST_PAGE)
|
|
||||||
hideProgressBarAndShowEndOfListText();
|
if(listOrders.size() == 0){
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
|
end_of_list_text_view.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
no_order_text.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
if(LAST_PAGE)
|
||||||
|
hideProgressBarAndShowEndOfListText();
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getContext(), "Đã có lỗi hệ thống! Mã lỗi: " + response.code(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "Đã có lỗi hệ thống! Mã lỗi: " + response.code(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
@@ -112,6 +142,10 @@ public class CompletedOrder extends Fragment {
|
|||||||
end_of_list_text_view.setVisibility(View.VISIBLE);
|
end_of_list_text_view.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void defaultLayout(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void dataLoadMore() {
|
private void dataLoadMore() {
|
||||||
if(!LAST_PAGE){
|
if(!LAST_PAGE){
|
||||||
getListOrder();
|
getListOrder();
|
||||||
|
|||||||
+4
-6
@@ -5,9 +5,6 @@ import androidx.fragment.app.Fragment;
|
|||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||||
|
|
||||||
import com.capstone.foodify.shipper.Fragment.OrderFragment;
|
|
||||||
import com.capstone.foodify.shipper.Fragment.ProfileFragment;
|
|
||||||
|
|
||||||
public class OrderViewPagerAdapter extends FragmentStateAdapter {
|
public class OrderViewPagerAdapter extends FragmentStateAdapter {
|
||||||
|
|
||||||
public OrderViewPagerAdapter(@NonNull FragmentActivity fragmentActivity) {
|
public OrderViewPagerAdapter(@NonNull FragmentActivity fragmentActivity) {
|
||||||
@@ -18,13 +15,14 @@ public class OrderViewPagerAdapter extends FragmentStateAdapter {
|
|||||||
@Override
|
@Override
|
||||||
public Fragment createFragment(int position) {
|
public Fragment createFragment(int position) {
|
||||||
switch(position) {
|
switch(position) {
|
||||||
case 1: return new CompletedOrder();
|
case 1: return new ShippingFragment();
|
||||||
default: return new ShippingOrder();
|
case 2: return new CompletedOrder();
|
||||||
|
default: return new AwaitingOrder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return 2;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+43
-10
@@ -7,6 +7,7 @@ import androidx.core.widget.NestedScrollView;
|
|||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -29,30 +30,32 @@ import retrofit2.Call;
|
|||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
public class ShippingOrder extends Fragment {
|
public class ShippingFragment extends Fragment {
|
||||||
private static int CURRENT_PAGE = 0;
|
private static int CURRENT_PAGE = 0;
|
||||||
private static int PAGE_SIZE = 8;
|
private static final int PAGE_SIZE = 8;
|
||||||
private static String SORT_BY = "id";
|
private static final String SORT_BY = "id";
|
||||||
private static String SORT_DIR = "asc";
|
private static final String SORT_DIR = "asc";
|
||||||
private static boolean LAST_PAGE = false;
|
private static boolean LAST_PAGE = false;
|
||||||
private List<Order> listOrders = new ArrayList<>();
|
private final List<Order> listOrders = new ArrayList<>();
|
||||||
RecyclerView recyclerView;
|
RecyclerView recyclerView;
|
||||||
OrderAdapter orderAdapter;
|
OrderAdapter orderAdapter;
|
||||||
TextView end_of_list_text_view;
|
TextView end_of_list_text_view, no_order_text;
|
||||||
NestedScrollView list_order_layout;
|
NestedScrollView list_order_layout;
|
||||||
ProgressBar progressBar;
|
ProgressBar progressBar;
|
||||||
|
SwipeRefreshLayout swipeRefreshLayout;
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
View view = inflater.inflate(R.layout.fragment_shipping_order, container, false);
|
View view = inflater.inflate(R.layout.fragment_waiting_order, container, false);
|
||||||
|
|
||||||
//Init component
|
//Init component
|
||||||
recyclerView = view.findViewById(R.id.rcv_list_order);
|
recyclerView = view.findViewById(R.id.rcv_list_order);
|
||||||
list_order_layout = view.findViewById(R.id.list_order_layout);
|
list_order_layout = view.findViewById(R.id.list_order_layout);
|
||||||
progressBar = view.findViewById(R.id.progress_bar);
|
progressBar = view.findViewById(R.id.progress_bar);
|
||||||
end_of_list_text_view = view.findViewById(R.id.end_of_list_text);
|
end_of_list_text_view = view.findViewById(R.id.end_of_list_text);
|
||||||
|
no_order_text = view.findViewById(R.id.no_oder_text);
|
||||||
|
swipeRefreshLayout = view.findViewById(R.id.swipe_refresh);
|
||||||
|
|
||||||
orderAdapter = new OrderAdapter(getActivity());
|
orderAdapter = new OrderAdapter(getActivity());
|
||||||
|
|
||||||
@@ -76,6 +79,23 @@ public class ShippingOrder extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh() {
|
||||||
|
listOrders.clear();
|
||||||
|
CURRENT_PAGE = 0;
|
||||||
|
getListOrder();
|
||||||
|
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
no_order_text.setVisibility(View.GONE);
|
||||||
|
end_of_list_text_view.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,8 +113,17 @@ public class ShippingOrder extends Fragment {
|
|||||||
|
|
||||||
LAST_PAGE = response.body().getPage().isLast();
|
LAST_PAGE = response.body().getPage().isLast();
|
||||||
|
|
||||||
if(LAST_PAGE)
|
|
||||||
hideProgressBarAndShowEndOfListText();
|
if(listOrders.size() == 0){
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
|
end_of_list_text_view.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
no_order_text.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
if(LAST_PAGE)
|
||||||
|
hideProgressBarAndShowEndOfListText();
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getContext(), "Đã có lỗi hệ thống! Mã lỗi: " + response.code(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "Đã có lỗi hệ thống! Mã lỗi: " + response.code(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
@@ -113,6 +142,10 @@ public class ShippingOrder extends Fragment {
|
|||||||
end_of_list_text_view.setVisibility(View.VISIBLE);
|
end_of_list_text_view.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void defaultLayout(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void dataLoadMore() {
|
private void dataLoadMore() {
|
||||||
if(!LAST_PAGE){
|
if(!LAST_PAGE){
|
||||||
getListOrder();
|
getListOrder();
|
||||||
+4
-2
@@ -43,7 +43,7 @@ public class GeofenceBroadcastReceiver extends BroadcastReceiver {
|
|||||||
if(transitionType == Geofence.GEOFENCE_TRANSITION_ENTER){
|
if(transitionType == Geofence.GEOFENCE_TRANSITION_ENTER){
|
||||||
notificationHelper.sendHighPriorityNotification("Đã tới khu vực giao!", "Nhấp vào đây để quay về app!", OrderDetailActivity.class);
|
notificationHelper.sendHighPriorityNotification("Đã tới khu vực giao!", "Nhấp vào đây để quay về app!", OrderDetailActivity.class);
|
||||||
|
|
||||||
if(Common.FCM_TOKEN_USER != null)
|
if(Common.FCM_TOKEN_CUSTOMER != null)
|
||||||
sendNotification();
|
sendNotification();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +53,9 @@ public class GeofenceBroadcastReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
Notification notification = new Notification("Thông báo!", "Đơn hàng đang gần đến bạn!");
|
Notification notification = new Notification("Thông báo!", "Đơn hàng đang gần đến bạn!");
|
||||||
FirebaseMessaging firebaseMessaging = new FirebaseMessaging();
|
FirebaseMessaging firebaseMessaging = new FirebaseMessaging();
|
||||||
firebaseMessaging.setTo(Common.FCM_TOKEN_USER);
|
|
||||||
|
|
||||||
|
firebaseMessaging.setTo(Common.FCM_TOKEN_CUSTOMER);
|
||||||
firebaseMessaging.setNotification(notification);
|
firebaseMessaging.setNotification(notification);
|
||||||
FirebaseMessagingAPI.apiService.sendNotification(firebaseMessaging).enqueue(new Callback<FirebaseMessaging>() {
|
FirebaseMessagingAPI.apiService.sendNotification(firebaseMessaging).enqueue(new Callback<FirebaseMessaging>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -348,23 +348,50 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/btn_shipping"
|
android:id="@+id/btn_call"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="250dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:backgroundTint="@color/green"
|
android:backgroundTint="@color/colorGrey"
|
||||||
|
android:layout_gravity="center"
|
||||||
android:fontFamily="@font/opensans"
|
android:fontFamily="@font/opensans"
|
||||||
android:text="Giao đến địa chỉ này!"
|
android:gravity="center"
|
||||||
|
android:text="Gọi điện thoại"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
|
android:textStyle="bold"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
|
app:iconGravity="textStart"
|
||||||
|
android:drawableLeft="@drawable/baseline_phone_24"
|
||||||
|
android:drawableTint="@color/white"
|
||||||
android:layout_marginTop="30dp"
|
android:layout_marginTop="30dp"
|
||||||
android:layout_marginStart="60dp"
|
android:layout_marginStart="100dp"
|
||||||
android:layout_marginEnd="60dp"
|
android:layout_marginEnd="100dp"
|
||||||
app:layout_constraintTop_toBottomOf="@id/total_cost_layout"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:drawableLeft="@drawable/baseline_local_shipping_24"
|
app:layout_constraintTop_toBottomOf="@id/total_cost_layout"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btn_confirm_ship_complete"
|
||||||
|
android:layout_width="250dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginStart="100dp"
|
||||||
|
android:layout_marginEnd="100dp"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:text="Đã giao"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:iconGravity="textStart"
|
||||||
|
android:drawableLeft="@drawable/baseline_verified_24"
|
||||||
android:drawableTint="@color/white"
|
android:drawableTint="@color/white"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btn_call"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:visibility="gone"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -372,52 +399,30 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toBottomOf="@id/total_cost_layout"
|
app:layout_constraintTop_toBottomOf="@id/btn_call"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:layout_marginTop="20dp"
|
android:visibility="visible"
|
||||||
android:visibility="gone"
|
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/btn_call"
|
android:id="@+id/btn_shipping"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="250dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:backgroundTint="@color/colorGrey"
|
android:backgroundTint="@color/green"
|
||||||
android:layout_gravity="center"
|
|
||||||
android:fontFamily="@font/opensans"
|
android:fontFamily="@font/opensans"
|
||||||
android:gravity="center"
|
android:text="Giao đến địa chỉ này!"
|
||||||
android:text="Gọi điện thoại"
|
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
app:iconGravity="textStart"
|
android:layout_marginTop="10dp"
|
||||||
android:drawableLeft="@drawable/baseline_phone_24"
|
android:drawableLeft="@drawable/baseline_local_shipping_24"
|
||||||
android:drawableTint="@color/white"
|
android:drawableTint="@color/white"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/btn_confirm_ship_complete"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:fontFamily="@font/opensans"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="Đã giao"
|
|
||||||
android:textAllCaps="false"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
app:iconGravity="textStart"
|
|
||||||
android:drawableLeft="@drawable/baseline_verified_24"
|
|
||||||
android:drawableTint="@color/white"/>
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/btn_cancel_order"
|
android:id="@+id/btn_cancel_order"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="250dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:backgroundTint="@color/red"
|
android:backgroundTint="@color/red"
|
||||||
|
|||||||
@@ -1,49 +1,79 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
tools:context=".Fragment.Order.ShippingOrder"
|
tools:context=".Fragment.Order.AwaitingOrder"
|
||||||
android:id="@+id/list_order_layout"
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/swipe_refresh"
|
||||||
|
>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.core.widget.NestedScrollView
|
||||||
android:id="@+id/rcv_list_order"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
tools:listitem="@layout/item_order"
|
android:id="@+id/list_order_layout"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
>
|
||||||
/>
|
|
||||||
|
|
||||||
<ProgressBar
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/progress_bar"
|
android:layout_width="match_parent"
|
||||||
android:indeterminateTint="@color/primaryColor"
|
android:layout_height="match_parent">
|
||||||
app:layout_constraintTop_toBottomOf="@id/rcv_list_order"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/end_of_list_text"
|
android:id="@+id/rcv_list_order"
|
||||||
android:text="Đã hết"
|
android:layout_width="match_parent"
|
||||||
android:fontFamily="@font/opensans"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/grayLight"
|
tools:listitem="@layout/item_order"
|
||||||
android:visibility="gone"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
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>
|
<ProgressBar
|
||||||
|
android:id="@+id/progress_bar"
|
||||||
|
android:indeterminateTint="@color/primaryColor"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/rcv_list_order"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
<TextView
|
||||||
|
android:id="@+id/end_of_list_text"
|
||||||
|
android:text="Đã hết"
|
||||||
|
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"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/no_oder_text"
|
||||||
|
android:text="Không có đơn hàng nào ở đây cả!"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:textColor="@color/grayLight"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -70,6 +70,11 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabItem
|
||||||
|
android:text="ĐANG GIAO"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabItem
|
<com.google.android.material.tabs.TabItem
|
||||||
android:text="ĐÃ GIAO"
|
android:text="ĐÃ GIAO"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".Fragment.Order.ShippingFragment"
|
||||||
|
>
|
||||||
|
|
||||||
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/swipe_refresh"
|
||||||
|
>
|
||||||
|
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/list_order_layout"
|
||||||
|
>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rcv_list_order"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:listitem="@layout/item_order"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progress_bar"
|
||||||
|
android:indeterminateTint="@color/primaryColor"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/rcv_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="Đã hết"
|
||||||
|
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"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/no_oder_text"
|
||||||
|
android:text="Không có đơn hàng nào ở đây cả!"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:textColor="@color/grayLight"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<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"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
tools:context=".Fragment.Order.ShippingOrder"
|
|
||||||
android:id="@+id/list_order_layout"
|
|
||||||
>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/rcv_list_order"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
tools:listitem="@layout/item_order"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
android:id="@+id/progress_bar"
|
|
||||||
android:indeterminateTint="@color/primaryColor"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/rcv_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="Đã hết"
|
|
||||||
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>
|
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
tools:context=".Fragment.Order.AwaitingOrder"
|
||||||
|
|
||||||
|
>
|
||||||
|
|
||||||
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/swipe_refresh"
|
||||||
|
>
|
||||||
|
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/list_order_layout"
|
||||||
|
>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rcv_list_order"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:listitem="@layout/item_order"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progress_bar"
|
||||||
|
android:indeterminateTint="@color/primaryColor"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/rcv_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="Đã hết"
|
||||||
|
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"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/no_oder_text"
|
||||||
|
android:text="Không có đơn hàng nào ở đây cả!"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:textColor="@color/grayLight"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Reference in New Issue
Block a user