mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-22 13:38:41 +00:00
Add calculate shipper cost depend on distance
This commit is contained in:
@@ -50,6 +50,7 @@ dependencies {
|
||||
implementation 'com.google.firebase:firebase-storage:20.1.0'
|
||||
implementation 'com.google.android.gms:play-services-auth:20.4.1'
|
||||
implementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1'
|
||||
implementation 'com.google.android.gms:play-services-maps:18.1.0'
|
||||
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
@@ -61,6 +62,7 @@ dependencies {
|
||||
implementation 'com.google.android.material:material:1.8.0'
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
|
||||
|
||||
implementation 'com.github.denzcoskun:ImageSlideshow:0.1.0'
|
||||
implementation 'com.makeramen:roundedimageview:2.3.0'
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.capstone.foodify.API;
|
||||
|
||||
import com.capstone.foodify.Model.GoogleMap.GoogleMapResponse;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface GoogleMapApi {
|
||||
|
||||
Gson gson = new GsonBuilder().setDateFormat("HH:mm:ss dd-MM-yyyy").setLenient().create();
|
||||
|
||||
GoogleMapApi apiService = new Retrofit.Builder()
|
||||
.baseUrl("https://maps.googleapis.com/").addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build()
|
||||
.create(GoogleMapApi.class);
|
||||
|
||||
@GET("maps/api/geocode/json")
|
||||
Call<GoogleMapResponse> getGeoCode(@Query("address") String address, @Query("key") String key);
|
||||
}
|
||||
@@ -130,7 +130,15 @@ public class AddressManagerActivity extends AppCompatActivity {
|
||||
|
||||
private void initDefaultAddress(){
|
||||
//Create a full address string
|
||||
String fullAddress = defaultAddress.getAddress() + ", " + defaultAddress.getWard() + ", " + defaultAddress.getDistrict();
|
||||
|
||||
String fullAddress;
|
||||
//If user choice "Huyện Hoàng Sa" District
|
||||
if(defaultAddress.getWard().equals("---Phường")){
|
||||
//Create a full address string
|
||||
fullAddress = defaultAddress.getAddress() + ", " + defaultAddress.getDistrict();
|
||||
} else {
|
||||
fullAddress = defaultAddress.getAddress() + ", " + defaultAddress.getWard() + ", " + defaultAddress.getDistrict();
|
||||
}
|
||||
|
||||
//Bind data to component
|
||||
txt_Address.setText(fullAddress);
|
||||
@@ -164,11 +172,13 @@ public class AddressManagerActivity extends AppCompatActivity {
|
||||
|
||||
CustomResponse responseData = response.body();
|
||||
|
||||
if(responseData.getTitle().equals("Create address")){
|
||||
if(response.code() == 200){
|
||||
Toast.makeText(AddressManagerActivity.this, "Đã thêm địa chỉ thành công!", Toast.LENGTH_SHORT).show();
|
||||
|
||||
//Update data user
|
||||
updateUser(isChecked);
|
||||
} else {
|
||||
Toast.makeText(AddressManagerActivity.this, "Đã có lỗi từ hệ thống, vui lòng thử lại sau!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
package com.capstone.foodify.Activity;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
@@ -22,16 +17,24 @@ import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.capstone.foodify.API.FoodApi;
|
||||
import com.capstone.foodify.API.GoogleMapApi;
|
||||
import com.capstone.foodify.Adapter.OrderDetailAdapter;
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.Model.Address;
|
||||
import com.capstone.foodify.Model.Basket;
|
||||
import com.capstone.foodify.Model.DistrictWardResponse;
|
||||
import com.capstone.foodify.Model.OrderDetail;
|
||||
import com.capstone.foodify.Model.GoogleMap.GoogleMapResponse;
|
||||
import com.capstone.foodify.R;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -40,18 +43,21 @@ import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class OrderCheckOutActivity extends AppCompatActivity {
|
||||
private static final Double LAT_SHOP = 16.0500622;
|
||||
private static final Double LNG_SHOP = 108.2351611;
|
||||
private static String finalAddress = null;
|
||||
ImageView back_image;
|
||||
OrderDetailAdapter adapter;
|
||||
RecyclerView recyclerView;
|
||||
TextView txt_userName, txt_phone, edt_address_detect, errorTextDistrictWard, txt_total;
|
||||
TextView txt_userName, txt_phone, edt_address_detect, errorTextDistrictWard, txt_total, txt_distance, txt_ship_cost;
|
||||
TextInputLayout textInput_address;
|
||||
EditText edt_address;
|
||||
Spinner spn_list_address, spn_district, spn_ward;
|
||||
ConstraintLayout manual_input_address_layout;
|
||||
Button change_address_button, confirm_address_button;
|
||||
RadioButton list_address_input, auto_detect_location, manual_input_address, radio_button_selected;
|
||||
RadioButton list_address_input, auto_detect_location, manual_input_address, radio_button_selected, take_food_from_shop;
|
||||
RadioGroup address_option;
|
||||
ConstraintLayout progress_layout;
|
||||
float total;
|
||||
private static final ArrayList<String> wardList = new ArrayList<>();
|
||||
private static final ArrayList<String> districtList = new ArrayList<>();
|
||||
@@ -87,6 +93,11 @@ public class OrderCheckOutActivity extends AppCompatActivity {
|
||||
errorTextDistrictWard = findViewById(R.id.errorTextDistrictWard);
|
||||
textInput_address = findViewById(R.id.textInput_address);
|
||||
txt_total = findViewById(R.id.txt_total);
|
||||
take_food_from_shop = findViewById(R.id.take_food_from_shop);
|
||||
progress_layout = findViewById(R.id.progress_layout);
|
||||
txt_distance = findViewById(R.id.txt_distance);
|
||||
txt_ship_cost = findViewById(R.id.txt_ship_cost);
|
||||
|
||||
|
||||
if(getIntent() != null){
|
||||
total = getIntent().getFloatExtra("total", 0);
|
||||
@@ -152,12 +163,13 @@ public class OrderCheckOutActivity extends AppCompatActivity {
|
||||
if(finalAddress == null){
|
||||
Toast.makeText(OrderCheckOutActivity.this, "Bạn chưa chọn địa chỉ!", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(OrderCheckOutActivity.this, finalAddress, Toast.LENGTH_SHORT).show();
|
||||
|
||||
progress_layout.setVisibility(View.VISIBLE);
|
||||
confirm_address_button.setEnabled(false);
|
||||
change_address_button.setVisibility(View.VISIBLE);
|
||||
|
||||
disableAllInputAddressOption();
|
||||
|
||||
getDistanceAndCalculateShipCost(finalAddress);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -171,6 +183,76 @@ public class OrderCheckOutActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void getDistanceAndCalculateShipCost(String address) {
|
||||
//Get location from address
|
||||
|
||||
GoogleMapApi.apiService.getGeoCode(address, Common.MAP_API).enqueue(new Callback<GoogleMapResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<GoogleMapResponse> call, Response<GoogleMapResponse> response) {
|
||||
GoogleMapResponse jsonResponse = response.body();
|
||||
|
||||
Double lat = jsonResponse.getResults().get(0).getGeometry().getLocation().getLat();
|
||||
Double lng = jsonResponse.getResults().get(0).getGeometry().getLocation().getLng();
|
||||
|
||||
LatLng addressFrom = new LatLng(lat, lng);
|
||||
LatLng addressTo = new LatLng(LAT_SHOP, LNG_SHOP);
|
||||
|
||||
double distance = CalculationByDistance(addressFrom, addressTo);
|
||||
|
||||
double roundDistance = Math.round(distance * 100.0) / 100.0;
|
||||
|
||||
//Show distance to user
|
||||
txt_distance.setText(roundDistance + " km");
|
||||
|
||||
//Calculate ship cost
|
||||
float shipCost = 0;
|
||||
if(roundDistance <= 3){
|
||||
shipCost = 15000;
|
||||
} else if(roundDistance > 3 && roundDistance <= 10){
|
||||
shipCost = 5000 * (float) roundDistance;
|
||||
} else {
|
||||
shipCost = 3000 * (float) roundDistance;
|
||||
}
|
||||
|
||||
txt_ship_cost.setText(Common.changeCurrencyUnit(shipCost));
|
||||
|
||||
//Update total order
|
||||
total = total + shipCost;
|
||||
txt_total.setText(Common.changeCurrencyUnit(total));
|
||||
|
||||
progress_layout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<GoogleMapResponse> call, Throwable t) {
|
||||
Toast.makeText(OrderCheckOutActivity.this, "Error: " + t, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public double CalculationByDistance(LatLng from, LatLng to) {
|
||||
int Radius = 6371;// radius of earth in Km
|
||||
double lat1 = from.latitude;
|
||||
double lat2 = to.latitude;
|
||||
double lon1 = from.longitude;
|
||||
double lon2 = to.longitude;
|
||||
double dLat = Math.toRadians(lat2 - lat1);
|
||||
double dLon = Math.toRadians(lon2 - lon1);
|
||||
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2)
|
||||
+ Math.cos(Math.toRadians(lat1))
|
||||
* Math.cos(Math.toRadians(lat2)) * Math.sin(dLon / 2)
|
||||
* Math.sin(dLon / 2);
|
||||
double c = 2 * Math.asin(Math.sqrt(a));
|
||||
double valueResult = Radius * c;
|
||||
double km = valueResult / 1;
|
||||
DecimalFormat newFormat = new DecimalFormat("####");
|
||||
int kmInDec = Integer.valueOf(newFormat.format(km));
|
||||
double meter = valueResult % 1000;
|
||||
int meterInDec = Integer.valueOf(newFormat.format(meter));
|
||||
|
||||
return Radius * c;
|
||||
}
|
||||
|
||||
private boolean validForm(){
|
||||
//Valid data
|
||||
boolean dataHasValidate = true;
|
||||
@@ -226,6 +308,7 @@ public class OrderCheckOutActivity extends AppCompatActivity {
|
||||
list_address_input.setEnabled(false);
|
||||
auto_detect_location.setEnabled(false);
|
||||
manual_input_address.setEnabled(false);
|
||||
take_food_from_shop.setEnabled(false);
|
||||
|
||||
spn_list_address.setEnabled(false);
|
||||
edt_address.setEnabled(false);
|
||||
@@ -237,6 +320,7 @@ public class OrderCheckOutActivity extends AppCompatActivity {
|
||||
list_address_input.setEnabled(true);
|
||||
auto_detect_location.setEnabled(true);
|
||||
manual_input_address.setEnabled(true);
|
||||
take_food_from_shop.setEnabled(true);
|
||||
|
||||
spn_list_address.setEnabled(true);
|
||||
edt_address.setEnabled(true);
|
||||
@@ -317,6 +401,13 @@ public class OrderCheckOutActivity extends AppCompatActivity {
|
||||
finalAddress = null;
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.take_food_from_shop:
|
||||
if(checked){
|
||||
manual_input_address_layout.setVisibility(View.GONE);
|
||||
spn_list_address.setVisibility(View.GONE);
|
||||
edt_address_detect.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class Common {
|
||||
public static final String MAP_API = "AIzaSyCR46ZE1kbE7zkTehhflB9jZgDjDT_2944";
|
||||
public static final String IS_FORGOT_PASSWORD = "isForgotPassword";
|
||||
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}$";
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
|
||||
package com.capstone.foodify.Model.GoogleMap;
|
||||
|
||||
import java.util.List;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class AddressComponent {
|
||||
|
||||
@SerializedName("long_name")
|
||||
@Expose
|
||||
private String longName;
|
||||
@SerializedName("short_name")
|
||||
@Expose
|
||||
private String shortName;
|
||||
@SerializedName("types")
|
||||
@Expose
|
||||
private List<String> types;
|
||||
|
||||
public String getLongName() {
|
||||
return longName;
|
||||
}
|
||||
|
||||
public void setLongName(String longName) {
|
||||
this.longName = longName;
|
||||
}
|
||||
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
public void setShortName(String shortName) {
|
||||
this.shortName = shortName;
|
||||
}
|
||||
|
||||
public List<String> getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
public void setTypes(List<String> types) {
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
|
||||
package com.capstone.foodify.Model.GoogleMap;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Geometry {
|
||||
|
||||
@SerializedName("location")
|
||||
@Expose
|
||||
private Location location;
|
||||
@SerializedName("location_type")
|
||||
@Expose
|
||||
private String locationType;
|
||||
@SerializedName("viewport")
|
||||
@Expose
|
||||
private Viewport viewport;
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(Location location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getLocationType() {
|
||||
return locationType;
|
||||
}
|
||||
|
||||
public void setLocationType(String locationType) {
|
||||
this.locationType = locationType;
|
||||
}
|
||||
|
||||
public Viewport getViewport() {
|
||||
return viewport;
|
||||
}
|
||||
|
||||
public void setViewport(Viewport viewport) {
|
||||
this.viewport = viewport;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
package com.capstone.foodify.Model.GoogleMap;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GoogleMapResponse {
|
||||
|
||||
@SerializedName("results")
|
||||
@Expose
|
||||
private List<Result> results;
|
||||
@SerializedName("status")
|
||||
@Expose
|
||||
private String status;
|
||||
|
||||
public List<Result> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(List<Result> results) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
package com.capstone.foodify.Model.GoogleMap;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Location {
|
||||
|
||||
@SerializedName("lat")
|
||||
@Expose
|
||||
private Double lat;
|
||||
@SerializedName("lng")
|
||||
@Expose
|
||||
private Double lng;
|
||||
|
||||
public Double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(Double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public Double getLng() {
|
||||
return lng;
|
||||
}
|
||||
|
||||
public void setLng(Double lng) {
|
||||
this.lng = lng;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
package com.capstone.foodify.Model.GoogleMap;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Northeast {
|
||||
|
||||
@SerializedName("lat")
|
||||
@Expose
|
||||
private Double lat;
|
||||
@SerializedName("lng")
|
||||
@Expose
|
||||
private Double lng;
|
||||
|
||||
public Double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(Double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public Double getLng() {
|
||||
return lng;
|
||||
}
|
||||
|
||||
public void setLng(Double lng) {
|
||||
this.lng = lng;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
|
||||
package com.capstone.foodify.Model.GoogleMap;
|
||||
|
||||
import java.util.List;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Result {
|
||||
|
||||
@SerializedName("address_components")
|
||||
@Expose
|
||||
private List<AddressComponent> addressComponents;
|
||||
@SerializedName("formatted_address")
|
||||
@Expose
|
||||
private String formattedAddress;
|
||||
@SerializedName("geometry")
|
||||
@Expose
|
||||
private Geometry geometry;
|
||||
@SerializedName("place_id")
|
||||
@Expose
|
||||
private String placeId;
|
||||
@SerializedName("types")
|
||||
@Expose
|
||||
private List<String> types;
|
||||
|
||||
public List<AddressComponent> getAddressComponents() {
|
||||
return addressComponents;
|
||||
}
|
||||
|
||||
public void setAddressComponents(List<AddressComponent> addressComponents) {
|
||||
this.addressComponents = addressComponents;
|
||||
}
|
||||
|
||||
public String getFormattedAddress() {
|
||||
return formattedAddress;
|
||||
}
|
||||
|
||||
public void setFormattedAddress(String formattedAddress) {
|
||||
this.formattedAddress = formattedAddress;
|
||||
}
|
||||
|
||||
public Geometry getGeometry() {
|
||||
return geometry;
|
||||
}
|
||||
|
||||
public void setGeometry(Geometry geometry) {
|
||||
this.geometry = geometry;
|
||||
}
|
||||
|
||||
public String getPlaceId() {
|
||||
return placeId;
|
||||
}
|
||||
|
||||
public void setPlaceId(String placeId) {
|
||||
this.placeId = placeId;
|
||||
}
|
||||
|
||||
public List<String> getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
public void setTypes(List<String> types) {
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
package com.capstone.foodify.Model.GoogleMap;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Southwest {
|
||||
|
||||
@SerializedName("lat")
|
||||
@Expose
|
||||
private Double lat;
|
||||
@SerializedName("lng")
|
||||
@Expose
|
||||
private Double lng;
|
||||
|
||||
public Double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(Double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public Double getLng() {
|
||||
return lng;
|
||||
}
|
||||
|
||||
public void setLng(Double lng) {
|
||||
this.lng = lng;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
package com.capstone.foodify.Model.GoogleMap;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Viewport {
|
||||
|
||||
@SerializedName("northeast")
|
||||
@Expose
|
||||
private Northeast northeast;
|
||||
@SerializedName("southwest")
|
||||
@Expose
|
||||
private Southwest southwest;
|
||||
|
||||
public Northeast getNortheast() {
|
||||
return northeast;
|
||||
}
|
||||
|
||||
public void setNortheast(Northeast northeast) {
|
||||
this.northeast = northeast;
|
||||
}
|
||||
|
||||
public Southwest getSouthwest() {
|
||||
return southwest;
|
||||
}
|
||||
|
||||
public void setSouthwest(Southwest southwest) {
|
||||
this.southwest = southwest;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,433 +1,507 @@
|
||||
<?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:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".Activity.OrderCheckOutActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="false"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_image"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/back_button"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="35dp"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:text="Chi tiết đơn"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/back_image" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/list_order"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView"
|
||||
android:visibility="visible"
|
||||
/>
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<View
|
||||
android:id="@+id/line_view"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="@color/gray"
|
||||
app:layout_constraintTop_toBottomOf="@id/list_order"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:text="Thông tin giao hàng"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/list_order"
|
||||
/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/name_layout"
|
||||
>
|
||||
<TextView
|
||||
android:text="Tên:"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/back_image"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/back_button"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:text="Nguyễn Văn A"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="35dp"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:text="Chi tiết đơn"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/txt_userName"
|
||||
/>
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/back_image" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/name_layout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/phone_layout"
|
||||
>
|
||||
<TextView
|
||||
android:text="Số điện thoại: "
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:text="0987654321"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/txt_phone"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:text="Địa chỉ nhận hàng:"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/phone_layout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
<RadioGroup
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:checkedButton="@id/list_address_input"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/address_option"
|
||||
>
|
||||
<RadioButton android:id="@+id/list_address_input"
|
||||
android:layout_width="wrap_content"
|
||||
android:buttonTint="@color/primaryColor"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Theo danh sách địa chỉ của bạn:"
|
||||
android:onClick="onRadioButtonClicked"
|
||||
/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/list_address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/auto_detect_location"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:buttonTint="@color/primaryColor"
|
||||
android:onClick="onRadioButtonClicked"
|
||||
android:text="Lấy vị trí thiết bị của bạn" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_address_detect"
|
||||
android:hint="Đang lấy vị trí...."
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/list_order"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:enabled="false"
|
||||
android:inputType="textMultiLine"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView"
|
||||
android:visibility="visible"
|
||||
/>
|
||||
|
||||
<RadioButton android:id="@+id/manual_input_address"
|
||||
<View
|
||||
android:id="@+id/line_view"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="@color/gray"
|
||||
app:layout_constraintTop_toBottomOf="@id/list_order"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:text="Thông tin giao hàng"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:buttonTint="@color/primaryColor"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Tự nhập thủ công"
|
||||
android:onClick="onRadioButtonClicked"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/list_order"
|
||||
/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/manual_input_address_layout"
|
||||
android:visibility="gone"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/name_layout"
|
||||
>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textInput_address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Địa chỉ"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:startIconDrawable="@drawable/baseline_home_24"
|
||||
app:startIconTint="@color/primaryColor">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:inputType="text" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout_district_ward"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textInput_address"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/district"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:textAlignment="viewEnd"
|
||||
android:gravity="end"
|
||||
android:paddingEnd="25dp"
|
||||
android:contentDescription="district"
|
||||
android:layout_weight="0.43"
|
||||
/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/ward"
|
||||
android:textAlignment="viewEnd"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="end"
|
||||
android:paddingEnd="25dp"
|
||||
android:contentDescription="ward"
|
||||
android:layout_weight="0.57"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/errorTextDistrictWard"
|
||||
android:text="Bạn chưa chọn quận huyện!"
|
||||
android:text="Tên:"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#b00020"
|
||||
app:layout_constraintTop_toBottomOf="@id/linearLayout_district_ward"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:text="Nguyễn Văn A"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/txt_userName"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/name_layout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/phone_layout"
|
||||
>
|
||||
<TextView
|
||||
android:text="Số điện thoại: "
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:text="0987654321"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/txt_phone"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:text="Địa chỉ nhận hàng:"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/phone_layout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
<RadioGroup
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:checkedButton="@id/list_address_input"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/address_option"
|
||||
>
|
||||
<RadioButton android:id="@+id/list_address_input"
|
||||
android:layout_width="wrap_content"
|
||||
android:buttonTint="@color/primaryColor"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Theo danh sách địa chỉ của bạn:"
|
||||
android:onClick="onRadioButtonClicked"
|
||||
/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/list_address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/auto_detect_location"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:buttonTint="@color/primaryColor"
|
||||
android:onClick="onRadioButtonClicked"
|
||||
android:text="Lấy vị trí thiết bị của bạn" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_address_detect"
|
||||
android:hint="Đang lấy vị trí...."
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:enabled="false"
|
||||
android:inputType="textMultiLine"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</RadioGroup>
|
||||
<RadioButton android:id="@+id/manual_input_address"
|
||||
android:layout_width="wrap_content"
|
||||
android:buttonTint="@color/primaryColor"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Tự nhập thủ công"
|
||||
android:onClick="onRadioButtonClicked"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/confirm_address_button"
|
||||
android:text="Xác nhận"
|
||||
android:textAllCaps="false"
|
||||
android:backgroundTint="@color/primaryColor"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/address_option"
|
||||
/>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/manual_input_address_layout"
|
||||
android:visibility="gone"
|
||||
>
|
||||
|
||||
<Button
|
||||
android:id="@+id/change_address_button"
|
||||
android:text="Thay đổi"
|
||||
android:textAllCaps="false"
|
||||
android:backgroundTint="@color/secondary"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/address_option"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textInput_address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Địa chỉ"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:startIconDrawable="@drawable/baseline_home_24"
|
||||
app:startIconTint="@color/primaryColor">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/confirm_address_button"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/shipper_cost_layout"
|
||||
>
|
||||
<TextView
|
||||
android:text="Phí ship: "
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:inputType="text" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout_district_ward"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textInput_address"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/district"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:textAlignment="viewEnd"
|
||||
android:gravity="end"
|
||||
android:paddingEnd="25dp"
|
||||
android:contentDescription="district"
|
||||
android:layout_weight="0.43"
|
||||
/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/ward"
|
||||
android:textAlignment="viewEnd"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="end"
|
||||
android:paddingEnd="25dp"
|
||||
android:contentDescription="ward"
|
||||
android:layout_weight="0.57"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/errorTextDistrictWard"
|
||||
android:text="Bạn chưa chọn quận huyện!"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#b00020"
|
||||
app:layout_constraintTop_toBottomOf="@id/linearLayout_district_ward"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/take_food_from_shop"
|
||||
android:layout_width="wrap_content"
|
||||
android:buttonTint="@color/primaryColor"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Đến shop lấy"
|
||||
android:onClick="onRadioButtonClicked"
|
||||
/>
|
||||
</RadioGroup>
|
||||
|
||||
<Button
|
||||
android:id="@+id/confirm_address_button"
|
||||
android:text="Xác nhận"
|
||||
android:textAllCaps="false"
|
||||
android:backgroundTint="@color/primaryColor"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/address_option"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:text="30.000 VNĐ"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
<Button
|
||||
android:id="@+id/change_address_button"
|
||||
android:text="Thay đổi"
|
||||
android:textAllCaps="false"
|
||||
android:backgroundTint="@color/secondary"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/address_option"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/confirm_address_button"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/distance_layout"
|
||||
>
|
||||
<TextView
|
||||
android:text="Khoảng cách: "
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/shipper_cost_layout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/total_cost_layout"
|
||||
>
|
||||
<TextView
|
||||
android:text="Tổng: "
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/primaryColor"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:textSize="20sp"
|
||||
<TextView
|
||||
android:id="@+id/txt_distance"
|
||||
android:text="- km"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/distance_layout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/shipper_cost_layout"
|
||||
>
|
||||
<TextView
|
||||
android:text="Phí ship: "
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_ship_cost"
|
||||
android:text="0 đ"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/shipper_cost_layout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/total_cost_layout"
|
||||
>
|
||||
<TextView
|
||||
android:text="Tổng: "
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/primaryColor"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:textSize="20sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_total"
|
||||
android:text="500.000 VNĐ"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/primaryColor"
|
||||
android:textSize="20sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btnPaymentMethod"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
app:layout_constraintTop_toBottomOf="@id/total_cost_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginTop="20dp"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_total"
|
||||
android:text="500.000 VNĐ"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/primaryColor"
|
||||
android:textSize="20sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnZaloPay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="center"
|
||||
android:backgroundTint="#008FE5"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:gravity="center"
|
||||
android:text="Thanh toán bằng ZaloPay"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/white"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="10dp"
|
||||
app:iconTint="@null"/>
|
||||
|
||||
</LinearLayout>
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnPay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="center"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:gravity="center"
|
||||
android:text="Thanh toán khi nhận hàng"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/white"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="10dp"
|
||||
app:iconTint="@null"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btnPaymentMethod"
|
||||
android:orientation="vertical"
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#80000000"
|
||||
android:id="@+id/progress_layout"
|
||||
android:clickable="true"
|
||||
android:visibility="gone"
|
||||
>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBarLoadData"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/total_cost_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:indeterminateTint="@color/primaryColor"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginTop="20dp"
|
||||
>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnZaloPay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="center"
|
||||
android:backgroundTint="#008FE5"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:gravity="center"
|
||||
android:text="Thanh toán bằng ZaloPay"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/white"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="10dp"
|
||||
app:iconTint="@null"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnPay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_gravity="center"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:gravity="center"
|
||||
android:text="Thanh toán khi nhận hàng"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/white"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="10dp"
|
||||
app:iconTint="@null"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user