Add validator data on sign up screen

This commit is contained in:
Nezumi
2023-03-15 12:04:19 +07:00
parent 134b5cd296
commit 92484ff1d5
48 changed files with 653 additions and 437 deletions
+1 -2
View File
@@ -58,8 +58,7 @@
android:noHistory="true" />
<activity
android:name=".Activity.VerifyAccountActivity"
android:exported="false"
android:noHistory="true" />
android:exported="false" />
<activity
android:name=".Activity.ForgotPasswordActivity"
android:exported="false"
@@ -1,12 +1,13 @@
package com.capstone.foodify.API;
import com.capstone.foodify.Model.Category.Category;
import com.capstone.foodify.Model.DistrictWard.DistrictWardResponse;
import com.capstone.foodify.Model.Food.Food;
import com.capstone.foodify.Model.Category;
import com.capstone.foodify.Model.DistrictWardResponse;
import com.capstone.foodify.Model.Food;
import com.capstone.foodify.Model.Response.Foods;
import com.capstone.foodify.Model.Response.Shops;
import com.capstone.foodify.Model.Shop.Shop;
import com.capstone.foodify.Model.Slider.Slider;
import com.capstone.foodify.Model.Shop;
import com.capstone.foodify.Model.Slider;
import com.capstone.foodify.Model.User;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -15,8 +16,6 @@ import java.util.List;
import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
@@ -69,4 +68,7 @@ public interface FoodApi {
@GET("sliders")
Call<List<Slider>> listSlider();
@POST("api/auth/signup")
Call<User> register(User user);
}
@@ -4,7 +4,7 @@ import static com.capstone.foodify.Common.TOKEN;
import androidx.annotation.NonNull;
import com.capstone.foodify.Model.Food.Food;
import com.capstone.foodify.Model.Food;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -18,7 +18,6 @@ import okhttp3.Response;
import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.POST;
@@ -20,9 +20,9 @@ import android.widget.Toast;
import com.capstone.foodify.API.FoodApi;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Address.Address;
import com.capstone.foodify.Model.Address;
import com.capstone.foodify.Adapter.AddressAdapter;
import com.capstone.foodify.Model.DistrictWard.DistrictWardResponse;
import com.capstone.foodify.Model.DistrictWardResponse;
import com.capstone.foodify.R;
import com.google.android.material.textfield.TextInputLayout;
import com.sjapps.library.customdialog.CustomViewDialog;
@@ -6,7 +6,6 @@ import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
@@ -24,10 +23,10 @@ import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.API.FoodApi;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Basket.Basket;
import com.capstone.foodify.Model.Food.Food;
import com.capstone.foodify.Model.Image.Image;
import com.capstone.foodify.Model.Review.Review;
import com.capstone.foodify.Model.Basket;
import com.capstone.foodify.Model.Food;
import com.capstone.foodify.Model.Image;
import com.capstone.foodify.Model.Review;
import com.capstone.foodify.Adapter.ReviewAdapter;
import com.capstone.foodify.R;
import com.denzcoskun.imageslider.ImageSlider;
@@ -13,25 +13,18 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager2.widget.ViewPager2;
import com.capstone.foodify.API.FoodApi;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Image.Images;
import com.capstone.foodify.R;
import com.capstone.foodify.ViewPagerAdapter;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.navigation.NavigationBarView;
import com.google.firebase.FirebaseApp;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.GetTokenResult;
import com.saadahmedsoft.popupdialog.PopupDialog;
import io.paperdb.Paper;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MainActivity extends AppCompatActivity {
@@ -9,7 +9,7 @@ import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.capstone.foodify.Model.Order.OrderDetail;
import com.capstone.foodify.Model.OrderDetail;
import com.capstone.foodify.Adapter.OrderDetailAdapter;
import com.capstone.foodify.R;
@@ -1,6 +1,5 @@
package com.capstone.foodify.Activity;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
@@ -18,13 +17,11 @@ import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.API.FoodApi;
import com.capstone.foodify.Adapter.FoodShopAdapter;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Food.Food;
import com.capstone.foodify.Model.Food;
import com.capstone.foodify.Model.Response.Foods;
import com.capstone.foodify.Model.Shop.Shop;
import com.capstone.foodify.Model.Shop;
import com.capstone.foodify.R;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.saadahmedsoft.popupdialog.PopupDialog;
import com.saadahmedsoft.popupdialog.Styles;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
@@ -9,6 +9,8 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
@@ -22,7 +24,8 @@ import android.widget.Toast;
import com.capstone.foodify.API.FoodApi;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.DistrictWard.DistrictWardResponse;
import com.capstone.foodify.Model.DistrictWardResponse;
import com.capstone.foodify.Model.User;
import com.capstone.foodify.R;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.textfield.TextInputLayout;
@@ -31,15 +34,18 @@ import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.PhoneAuthCredential;
import com.google.firebase.auth.PhoneAuthOptions;
import com.google.firebase.auth.PhoneAuthProvider;
import com.saadahmedsoft.popupdialog.PopupDialog;
import com.saadahmedsoft.popupdialog.Styles;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import retrofit2.Call;
import retrofit2.Callback;
@@ -48,19 +54,56 @@ import retrofit2.Response;
public class SignUpActivity extends AppCompatActivity {
private static final String PHONE_CODE = "+84";
TextInputLayout textInput_email, textInput_password, textInput_phone,
textInput_address, textInput_repeatPassword, textInput_fullName, textInput_birthDay;
private final String PASSWORD_PATTERN = "^(?=.*[0-9])(?=.*[A-Z])(?=.*[@#$%^&+=!_])(?=\\S+$).{4,}$";
private final String PHONE_PATTERN = "^0[98753]{1}\\d{8}$";
public static final String VALID_EMAIL_ADDRESS_REGEX = "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$";
public static final String FORMAT_DATE="dd/MM/yyyy";
TextInputLayout textInput_password, textInput_phone, textInput_email,
textInput_address, textInput_confirmPassword, textInput_fullName, textInput_birthDay;
final Calendar myCalendar= Calendar.getInstance();
EditText edt_birthday, edt_phone;
TextView signIn_textView, errorText;
Spinner wardSpinner, districtSpinner;
ImageView back_image;
MaterialButton signUpButton;
ConstraintLayout progressLayout;
private EditText edt_birthday, edt_phone, edt_passWord, edt_confirmPassword, edt_fullName, edt_address, edt_email;
private TextView signIn_textView, errorText, errorTextDistrictWard;
private Spinner wardSpinner, districtSpinner;
private ImageView back_image;
private MaterialButton signUpButton;
private ConstraintLayout progressLayout;
private String email, phone, name, dateOfBirth, address, district, ward, password = null;
private static final ArrayList<String> wardList = new ArrayList<>();
private static final ArrayList<String> districtList = new ArrayList<>();
private void initComponent() {
textInput_password = (TextInputLayout) findViewById(R.id.textInput_password);
textInput_phone = (TextInputLayout) findViewById(R.id.textInput_phone);
textInput_address = (TextInputLayout) findViewById(R.id.textInput_address);
textInput_confirmPassword = (TextInputLayout) findViewById(R.id.textInput_confirmPassword);
textInput_fullName = (TextInputLayout) findViewById(R.id.textInput_fullName);
textInput_birthDay = (TextInputLayout) findViewById(R.id.textInput_birthDay);
textInput_email = findViewById(R.id.textInput_email);
signUpButton = findViewById(R.id.sign_up_button);
edt_birthday = (EditText) findViewById(R.id.edt_birthDay);
edt_phone = findViewById(R.id.edt_phone);
edt_confirmPassword = findViewById(R.id.edt_confirmPassword);
edt_passWord = findViewById(R.id.edt_password);
edt_fullName = findViewById(R.id.edt_fullName);
edt_address = findViewById(R.id.edt_address);
edt_email = findViewById(R.id.edt_email);
districtSpinner = (Spinner) findViewById(R.id.district);
wardSpinner = (Spinner) findViewById(R.id.ward);
signIn_textView = (TextView) findViewById(R.id.signIn_textView);
errorText = findViewById(R.id.errorText);
errorTextDistrictWard = findViewById(R.id.errorTextDistrictWard);
back_image = (ImageView) findViewById(R.id.back_image);
progressLayout = findViewById(R.id.progress_layout);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -71,12 +114,17 @@ public class SignUpActivity extends AppCompatActivity {
setFontUI();
chooseDateOfBirth();
//Get list district
if(districtList.size() == 0){
getListDistrict();
} else {
setAdapter(districtList, "---Quận", districtSpinner);
}
//Get list ward
getListWard(0);
//Add event when click on sign in button
signIn_textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -84,6 +132,7 @@ public class SignUpActivity extends AppCompatActivity {
}
});
//Add event when click on back image
back_image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -91,6 +140,7 @@ public class SignUpActivity extends AppCompatActivity {
}
});
//Add event for district spinner
districtSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
@@ -107,12 +157,124 @@ public class SignUpActivity extends AppCompatActivity {
signUpButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loading();
signUp();
if(validateData()){
loading();
signUp();
}
}
});
}
private boolean validateData(){
boolean dataHasValidate = true;
getDataFromForm();
//Check email valid
Pattern patternEmail = Pattern.compile(VALID_EMAIL_ADDRESS_REGEX, Pattern.CASE_INSENSITIVE);
Matcher matcherEmail = patternEmail.matcher(email);
if(!matcherEmail.matches()){
textInput_email.setError("Địa chỉ email không đúng định dạng. Xin vui lòng kiểm tra lại!");
dataHasValidate = false;
} else {
textInput_email.setErrorEnabled(false);
}
//Check phone number
Pattern patternPhone = Pattern.compile(PHONE_PATTERN);
Matcher matcherPhone = patternPhone.matcher(phone);
if(!matcherPhone.find()){
textInput_phone.setError("Số điện thoại không đúng định dạng. Vui lòng kiểm tra lại!");
dataHasValidate = false;
} else {
textInput_phone.setErrorEnabled(false);
}
//Check full name
if(name.length() < 8){
textInput_fullName.setError("Tên của bạn cần phải có 8 ký tự trở lên!");
dataHasValidate = false;
} else {
textInput_fullName.setErrorEnabled(false);
}
//Check birthday
if(dateOfBirth.isEmpty()){
textInput_birthDay.setError("Ngày tháng năm sinh của bạn còn trống!");
dataHasValidate = false;
} else {
//Calculate user age
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(FORMAT_DATE);
LocalDate birthday = LocalDate.parse(edt_birthday.getText().toString(), formatter);
if(calculateAge(birthday, LocalDate.now()) < 16){
textInput_birthDay.setError("Xin lỗi, bạn chưa đủ tuổi đề dùng app này!");
dataHasValidate = false;
} else {
textInput_birthDay.setErrorEnabled(false);
}
}
//Check address
if(address.length() < 8) {
textInput_address.setError("Trường địa chỉ của bạn tối thiếu từ 8 ký tự trở lên");
dataHasValidate = false;
} else {
textInput_address.setErrorEnabled(false);
}
//Check district
if(district.equals("---Quận") || ward.equals("---Phường")){
errorTextDistrictWard.setVisibility(View.VISIBLE);
dataHasValidate = false;
} else {
errorTextDistrictWard.setVisibility(View.GONE);
}
//Check password
Pattern patternPassword = Pattern.compile(PASSWORD_PATTERN);
Matcher matcherPassword = patternPassword.matcher(edt_passWord.getText().toString());
if(!matcherPassword.matches() || edt_passWord.getText().toString().length() < 8) {
textInput_password.setError("Mật khẩu của bạn cần tối thiểu có 8 ký tự, 1 ký tự viết hoa, 1 số và 1 ký tự đặc biệt!");
dataHasValidate = false;
} else {
textInput_password.setErrorEnabled(false);
}
if(!edt_passWord.getText().toString().equals(edt_confirmPassword.getText().toString())){
textInput_confirmPassword.setError("Mật khẩu không giống nhau. Vui lòng kiểm tra lại!");
dataHasValidate = false;
} else {
textInput_confirmPassword.setErrorEnabled(false);
}
return dataHasValidate;
}
private void getDataFromForm(){
email = edt_email.getText().toString();
phone = edt_phone.getText().toString();
name = edt_fullName.getText().toString();
dateOfBirth = edt_birthday.getText().toString();
address = edt_address.getText().toString();
district = districtSpinner.getSelectedItem().toString();
ward = wardSpinner.getSelectedItem().toString();
password = edt_confirmPassword.getText().toString();
}
public static int calculateAge(LocalDate birthDate, LocalDate currentDate) {
if ((birthDate != null) && (currentDate != null)) {
return Period.between(birthDate, currentDate).getYears();
} else {
return 0;
}
}
private void signUp(){
FirebaseAuth auth = FirebaseAuth.getInstance();
PhoneAuthOptions options = PhoneAuthOptions.newBuilder(auth)
@@ -125,6 +287,8 @@ public class SignUpActivity extends AppCompatActivity {
@NonNull PhoneAuthProvider.ForceResendingToken forceResendingToken) {
loadCompleted();
//Create user object
Intent intent = new Intent(SignUpActivity.this, VerifyAccountActivity.class);
intent.putExtra("phone", edt_phone.getText().toString());
intent.putExtra("verificationId", verificationId);
@@ -159,35 +323,10 @@ public class SignUpActivity extends AppCompatActivity {
signUpButton.setEnabled(false);
}
private void loadCompleted(){
private void loadCompleted() {
progressLayout.setVisibility(View.GONE);
signUpButton.setEnabled(true);
}
private void initComponent() {
textInput_email= (TextInputLayout) findViewById(R.id.textInput_email);
textInput_password = (TextInputLayout) findViewById(R.id.textInput_password);
textInput_phone = (TextInputLayout) findViewById(R.id.textInput_phone);
textInput_address = (TextInputLayout) findViewById(R.id.textInput_address);
textInput_repeatPassword = (TextInputLayout) findViewById(R.id.textInput_confirmPassword);
textInput_fullName = (TextInputLayout) findViewById(R.id.textInput_fullName);
textInput_birthDay = (TextInputLayout) findViewById(R.id.textInput_birthDay);
signUpButton = findViewById(R.id.sign_up_button);
edt_birthday = (EditText) findViewById(R.id.edt_birthDay);
edt_phone = findViewById(R.id.edt_phone);
districtSpinner = (Spinner) findViewById(R.id.district);
wardSpinner = (Spinner) findViewById(R.id.ward);
signIn_textView = (TextView) findViewById(R.id.signIn_textView);
errorText = findViewById(R.id.errorText);
back_image = (ImageView) findViewById(R.id.back_image);
progressLayout = findViewById(R.id.progress_layout);
}
private void getListDistrict() {
@@ -309,19 +448,18 @@ public class SignUpActivity extends AppCompatActivity {
}
private void updateLabel(){
String myFormat="dd/MM/yyyy";
SimpleDateFormat dateFormat=new SimpleDateFormat(myFormat, Locale.US);
SimpleDateFormat dateFormat=new SimpleDateFormat(FORMAT_DATE, Locale.US);
edt_birthday.setText(dateFormat.format(myCalendar.getTime()));
}
private void setFontUI() {
textInput_email.setTypeface(Common.setFontBebas(getAssets()));
textInput_password.setTypeface(Common.setFontBebas(getAssets()));
textInput_phone.setTypeface(Common.setFontBebas(getAssets()));
textInput_address.setTypeface(Common.setFontBebas(getAssets()));
textInput_repeatPassword.setTypeface(Common.setFontBebas(getAssets()));
textInput_confirmPassword.setTypeface(Common.setFontBebas(getAssets()));
textInput_fullName.setTypeface(Common.setFontBebas(getAssets()));
textInput_birthDay.setTypeface(Common.setFontBebas(getAssets()));
textInput_email.setTypeface(Common.setFontBebas(getAssets()));
edt_birthday.setTypeface(Common.setFontBebas(getAssets()));
}
@@ -16,6 +16,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.capstone.foodify.API.FoodApi;
import com.capstone.foodify.R;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
@@ -174,6 +175,9 @@ public class VerifyAccountActivity extends AppCompatActivity {
if(task.isSuccessful()) {
//Add information user to server
// FoodApi.apiService.register()
Toast.makeText(VerifyAccountActivity.this, "Tạo tài khoản thành công!", Toast.LENGTH_SHORT).show();
startActivity(new Intent(VerifyAccountActivity.this, SignInActivity.class));
} else {
@@ -9,7 +9,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.Model.Address.Address;
import com.capstone.foodify.Model.Address;
import com.capstone.foodify.R;
import java.util.List;
@@ -14,7 +14,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.Common;
import com.capstone.foodify.Fragment.BasketFragment;
import com.capstone.foodify.Model.Basket.Basket;
import com.capstone.foodify.Model.Basket;
import com.capstone.foodify.R;
import com.cepheuen.elegantnumberbutton.view.ElegantNumberButton;
import com.squareup.picasso.Picasso;
@@ -13,7 +13,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.Activity.FoodDetailActivity;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Food.Food;
import com.capstone.foodify.Model.Food;
import com.capstone.foodify.R;
import com.squareup.picasso.Picasso;
@@ -12,9 +12,8 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.API.FoodApi;
import com.capstone.foodify.API.FoodApiToken;
import com.capstone.foodify.Model.Food.Food;
import com.capstone.foodify.Model.Food;
import com.capstone.foodify.R;
import java.util.List;
@@ -13,10 +13,9 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.Activity.FoodDetailActivity;
import com.capstone.foodify.Activity.MainActivity;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Basket.Basket;
import com.capstone.foodify.Model.Food.Food;
import com.capstone.foodify.Model.Basket;
import com.capstone.foodify.Model.Food;
import com.capstone.foodify.R;
import com.squareup.picasso.Picasso;
@@ -14,8 +14,8 @@ import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.Activity.FoodDetailActivity;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Basket.Basket;
import com.capstone.foodify.Model.Food.Food;
import com.capstone.foodify.Model.Basket;
import com.capstone.foodify.Model.Food;
import com.capstone.foodify.R;
import com.squareup.picasso.Picasso;
@@ -10,7 +10,7 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.Model.Menu.Menu;
import com.capstone.foodify.Model.Menu;
import com.capstone.foodify.R;
import java.util.List;
@@ -11,7 +11,7 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.Activity.OrderDetailActivity;
import com.capstone.foodify.Model.Order.Order;
import com.capstone.foodify.Model.Order;
import com.capstone.foodify.R;
import java.time.LocalDateTime;
@@ -9,7 +9,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.Model.Order.OrderDetail;
import com.capstone.foodify.Model.OrderDetail;
import com.capstone.foodify.R;
import com.squareup.picasso.Picasso;
@@ -9,7 +9,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.Model.Review.Review;
import com.capstone.foodify.Model.Review;
import com.capstone.foodify.R;
import com.willy.ratingbar.ScaleRatingBar;
@@ -11,9 +11,8 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.Activity.FoodDetailActivity;
import com.capstone.foodify.Activity.ShopDetailActivity;
import com.capstone.foodify.Model.Shop.Shop;
import com.capstone.foodify.Model.Shop;
import com.capstone.foodify.R;
import com.squareup.picasso.Picasso;
@@ -6,16 +6,14 @@ import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Typeface;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.os.Build;
import android.widget.Toast;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import com.capstone.foodify.Model.Basket.Basket;
import com.capstone.foodify.Model.Basket;
import com.saadahmedsoft.popupdialog.PopupDialog;
import com.saadahmedsoft.popupdialog.Styles;
import com.saadahmedsoft.popupdialog.listener.OnDialogButtonClickListener;
@@ -17,7 +17,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.Common;
import com.capstone.foodify.ItemTouchHelperListener;
import com.capstone.foodify.Model.Basket.Basket;
import com.capstone.foodify.Model.Basket;
import com.capstone.foodify.Adapter.BasketAdapter;
import com.capstone.foodify.Adapter.RecyclerViewItemTouchHelperBasketFood;
import com.capstone.foodify.R;
@@ -3,7 +3,6 @@ package com.capstone.foodify.Fragment;
import android.graphics.Color;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DividerItemDecoration;
@@ -11,30 +10,20 @@ import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.capstone.foodify.API.FoodApi;
import com.capstone.foodify.API.FoodApiToken;
import com.capstone.foodify.Common;
import com.capstone.foodify.ItemTouchHelperListener;
import com.capstone.foodify.Model.Food.Food;
import com.capstone.foodify.Model.Food;
import com.capstone.foodify.Adapter.FoodFavoriteAdapter;
import com.capstone.foodify.R;
import com.capstone.foodify.Adapter.RecyclerViewItemTouchHelperFavoriteFood;
import com.google.android.material.snackbar.Snackbar;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class FavoriteFragment extends Fragment implements ItemTouchHelperListener {
private RecyclerView recyclerView_favorite_food;
@@ -1,27 +1,24 @@
package com.capstone.foodify.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.API.FoodApi;
import com.capstone.foodify.Activity.MainActivity;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Food.Food;
import com.capstone.foodify.Model.Menu.Menu;
import com.capstone.foodify.Model.Food;
import com.capstone.foodify.Model.Menu;
import com.capstone.foodify.Adapter.MenuAdapter;
import com.capstone.foodify.Model.Response.Foods;
import com.capstone.foodify.Model.Response.Shops;
import com.capstone.foodify.Model.Shop.Shop;
import com.capstone.foodify.Model.Shop;
import com.capstone.foodify.Adapter.ShopAdapter;
import com.capstone.foodify.Model.Slider.Slider;
import com.capstone.foodify.Model.Slider;
import com.capstone.foodify.R;
import com.denzcoskun.imageslider.ImageSlider;
import com.denzcoskun.imageslider.constants.ScaleTypes;
@@ -10,7 +10,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.capstone.foodify.Model.Order.Order;
import com.capstone.foodify.Model.Order;
import com.capstone.foodify.Adapter.OrderAdapter;
import com.capstone.foodify.R;
@@ -10,7 +10,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.capstone.foodify.Model.Order.Order;
import com.capstone.foodify.Model.Order;
import com.capstone.foodify.Adapter.OrderAdapter;
import com.capstone.foodify.R;
@@ -10,7 +10,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.capstone.foodify.Model.Order.Order;
import com.capstone.foodify.Model.Order;
import com.capstone.foodify.Adapter.OrderAdapter;
import com.capstone.foodify.R;
@@ -10,7 +10,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.capstone.foodify.Model.Order.Order;
import com.capstone.foodify.Model.Order;
import com.capstone.foodify.Adapter.OrderAdapter;
import com.capstone.foodify.R;
@@ -1,7 +1,6 @@
package com.capstone.foodify.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -9,7 +8,6 @@ import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.SearchView;
@@ -21,8 +19,8 @@ import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.API.FoodApi;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Category.Category;
import com.capstone.foodify.Model.Food.Food;
import com.capstone.foodify.Model.Category;
import com.capstone.foodify.Model.Food;
import com.capstone.foodify.Adapter.FoodSearchAdapter;
import com.capstone.foodify.Model.Response.Foods;
import com.capstone.foodify.R;
@@ -1,4 +1,4 @@
package com.capstone.foodify.Model.Address;
package com.capstone.foodify.Model;
public class Address {
private int id;
@@ -1,4 +1,4 @@
package com.capstone.foodify.Model.Basket;
package com.capstone.foodify.Model;
public class Basket {
private String id;
@@ -1,4 +1,4 @@
package com.capstone.foodify.Model.Category;
package com.capstone.foodify.Model;
public class Category {
private String id;
@@ -1,4 +1,4 @@
package com.capstone.foodify.Model.DistrictWard;
package com.capstone.foodify.Model;
public class DistrictWardResponse {
private String id;
@@ -1,8 +1,4 @@
package com.capstone.foodify.Model.Food;
import com.capstone.foodify.Model.Category.Category;
import com.capstone.foodify.Model.Image.Image;
import com.capstone.foodify.Model.Shop.Shop;
package com.capstone.foodify.Model;
import java.util.List;
@@ -1,4 +1,4 @@
package com.capstone.foodify.Model.Image;
package com.capstone.foodify.Model;
public class Image {
private int id;
@@ -1,6 +1,4 @@
package com.capstone.foodify.Model.Menu;
import com.capstone.foodify.Model.Food.Food;
package com.capstone.foodify.Model;
import java.util.List;
@@ -1,6 +1,5 @@
package com.capstone.foodify.Model.Order;
package com.capstone.foodify.Model;
import java.util.Date;
import java.util.List;
public class Order {
@@ -1,4 +1,4 @@
package com.capstone.foodify.Model.Order;
package com.capstone.foodify.Model;
public class OrderDetail {
private int id;
@@ -1,6 +1,6 @@
package com.capstone.foodify.Model.Response;
import com.capstone.foodify.Model.Food.Food;
import com.capstone.foodify.Model.Food;
import com.capstone.foodify.Model.Page;
import java.util.List;
@@ -1,5 +1,6 @@
package com.capstone.foodify.Model.Image;
package com.capstone.foodify.Model.Response;
import com.capstone.foodify.Model.Image;
import com.capstone.foodify.Model.Page;
import java.util.List;
@@ -1,7 +1,7 @@
package com.capstone.foodify.Model.Response;
import com.capstone.foodify.Model.Page;
import com.capstone.foodify.Model.Shop.Shop;
import com.capstone.foodify.Model.Shop;
import java.util.List;
@@ -1,4 +1,4 @@
package com.capstone.foodify.Model.Review;
package com.capstone.foodify.Model;
public class Review {
private String name;
@@ -1,4 +1,4 @@
package com.capstone.foodify.Model.Shop;
package com.capstone.foodify.Model;
public class Shop {
private int id;
@@ -1,4 +1,4 @@
package com.capstone.foodify.Model.Slider;
package com.capstone.foodify.Model;
public class Slider {
private int id;
@@ -0,0 +1,87 @@
package com.capstone.foodify.Model;
public class User {
private String dateOfBirth;
private String email;
private String fullName;
private String identifiedCode;
private String imageUrl;
private String isLocked;
private String phoneNumber;
private String roleName;
public User(String dateOfBirth, String email, String fullName, String identifiedCode, String imageUrl, String isLocked, String phoneNumber, String roleName) {
this.dateOfBirth = dateOfBirth;
this.email = email;
this.fullName = fullName;
this.identifiedCode = identifiedCode;
this.imageUrl = imageUrl;
this.isLocked = isLocked;
this.phoneNumber = phoneNumber;
this.roleName = roleName;
}
public String getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(String dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getIdentifiedCode() {
return identifiedCode;
}
public void setIdentifiedCode(String identifiedCode) {
this.identifiedCode = identifiedCode;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public String getIsLocked() {
return isLocked;
}
public void setIsLocked(String isLocked) {
this.isLocked = isLocked;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
}
+319 -293
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
@@ -7,306 +7,332 @@
android:layout_height="match_parent"
tools:context=".Activity.SignUpActivity">
<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="25dp"
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="20dp"
android:layout_marginTop="20dp"
android:fontFamily="@font/bebas"
android:text="@string/sign_up_text"
android:textColor="@color/black"
android:textSize="50sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/back_image" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInput_email"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:layout_marginBottom="10dp"
android:hint="@string/email_text"
app:boxBackgroundColor="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView"
app:startIconDrawable="@drawable/baseline_email_24"
app:startIconTint="@color/primaryColor">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edt_email"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="textEmailAddress" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInput_phone"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:hint="@string/phone_text"
app:boxBackgroundColor="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textInput_email"
app:startIconDrawable="@drawable/baseline_phone_24"
app:startIconTint="@color/primaryColor">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edt_phone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="phone" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInput_fullName"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:hint="@string/full_name"
app:boxBackgroundColor="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textInput_phone"
app:startIconDrawable="@drawable/baseline_abc_24"
app:startIconTint="@color/primaryColor">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edt_fullName"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="phone" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInput_birthDay"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:hint="@string/birthday_text"
app:boxBackgroundColor="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textInput_fullName"
app:startIconDrawable="@drawable/baseline_calendar_month_24"
app:startIconTint="@color/primaryColor">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edt_birthDay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
android:cursorVisible="false"
android:focusable="false"
android:focusableInTouchMode="false"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInput_address"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:layout_marginBottom="10dp"
android:hint="@string/address_text"
app:boxBackgroundColor="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textInput_birthDay"
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"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
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.4"
/>
<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.6"
/>
</LinearLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInput_password"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:hint="@string/password_text"
app:boxBackgroundColor="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout_district_ward"
app:passwordToggleEnabled="true"
app:passwordToggleTint="@color/primaryColor"
app:startIconDrawable="@drawable/baseline_vpn_key_24"
app:startIconTint="@color/primaryColor">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edt_password"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInput_confirmPassword"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:hint="@string/repeat_password_text"
app:boxBackgroundColor="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textInput_password"
app:passwordToggleEnabled="true"
app:passwordToggleTint="@color/primaryColor"
app:startIconDrawable="@drawable/baseline_vpn_key_24"
app:startIconTint="@color/primaryColor">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edt_confirmPassword"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/errorText"
android:textSize="12sp"
android:textColor="@color/red"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/textInput_confirmPassword"
app:layout_constraintStart_toStartOf="parent"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/sign_up_button"
style="@style/DefaultSolid"
android:fontFamily="@font/bebas"
android:text="@string/sign_up_text"
android:textSize="20sp"
android:padding="10dp"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:layout_marginBottom="17dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/linearLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/already_have_account"
android:textColor="@color/gray"
android:textStyle="bold" />
<TextView
android:id="@+id/signIn_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/sign_in_text"
android:textColor="@color/secondary"
android:textStyle="bold" />
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#80000000"
android:id="@+id/progress_layout"
android:visibility="gone"
>
android:layout_height="wrap_content">
<ProgressBar
android:id="@+id/progressBarLoadData"
<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="25dp"
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:indeterminateTint="@color/primaryColor"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:fontFamily="@font/bebas"
android:text="@string/sign_up_text"
android:textColor="@color/black"
android:textSize="50sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/back_image" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInput_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:hint="@string/email_text"
app:boxBackgroundColor="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView"
app:startIconDrawable="@drawable/baseline_email_24"
app:startIconTint="@color/primaryColor">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edt_email"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="textEmailAddress" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInput_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:hint="@string/phone_text"
app:boxBackgroundColor="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textInput_email"
app:startIconDrawable="@drawable/baseline_phone_24"
app:startIconTint="@color/primaryColor">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edt_phone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="phone" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInput_fullName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:hint="@string/full_name"
app:boxBackgroundColor="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textInput_phone"
app:startIconDrawable="@drawable/baseline_abc_24"
app:startIconTint="@color/primaryColor">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edt_fullName"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInput_birthDay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginTop="20dp"
android:hint="@string/birthday_text"
app:boxBackgroundColor="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textInput_fullName"
app:startIconDrawable="@drawable/baseline_calendar_month_24"
app:startIconTint="@color/primaryColor">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edt_birthDay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
android:cursorVisible="false"
android:focusable="false"
android:focusableInTouchMode="false"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInput_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="20dp"
android:hint="@string/address_text"
app:boxBackgroundColor="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textInput_birthDay"
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"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
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.4"
/>
<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.6"
/>
</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"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:visibility="gone"
/>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInput_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginTop="20dp"
android:hint="@string/password_text"
app:boxBackgroundColor="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout_district_ward"
app:passwordToggleEnabled="true"
app:passwordToggleTint="@color/primaryColor"
app:startIconDrawable="@drawable/baseline_vpn_key_24"
app:startIconTint="@color/primaryColor">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edt_password"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInput_confirmPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginTop="20dp"
android:hint="@string/repeat_password_text"
app:boxBackgroundColor="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textInput_password"
app:passwordToggleEnabled="true"
app:passwordToggleTint="@color/primaryColor"
app:startIconDrawable="@drawable/baseline_vpn_key_24"
app:startIconTint="@color/primaryColor">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edt_confirmPassword"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/errorText"
android:textSize="12sp"
android:textColor="@color/red"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/textInput_confirmPassword"
app:layout_constraintStart_toStartOf="parent"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/sign_up_button"
style="@style/DefaultSolid"
android:fontFamily="@font/bebas"
android:text="@string/sign_up_text"
android:textSize="20sp"
android:padding="10dp"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:layout_marginBottom="17dp"
android:layout_marginTop="40dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/errorText"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:layout_marginTop="20dp"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@id/sign_up_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/already_have_account"
android:textColor="@color/gray"
android:textStyle="bold" />
<TextView
android:id="@+id/signIn_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="@string/sign_in_text"
android:textColor="@color/secondary"
android:textStyle="bold" />
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#80000000"
android:id="@+id/progress_layout"
android:visibility="gone"
>
<ProgressBar
android:id="@+id/progressBarLoadData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateTint="@color/primaryColor"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
-1
View File
@@ -9,7 +9,6 @@
<color name="secondary">#F99928</color>
<color name="grayLight">#ACA5A5</color>
<color name="red">#FF0000</color>
<color name="primaryDark">#1EAE94</color>
<color name="green">#A9d440</color>
<color name="darkGreen">#004d40</color>
<color name="yellow">#FFEB3B</color>