mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-22 13:38:41 +00:00
Update app
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<dimen name="ic_delete">30dp</dimen>
|
||||
|
||||
<dimen name="popup_width">300dp</dimen>
|
||||
<dimen name="popup_height">310dp</dimen>
|
||||
<dimen name="popup_height">320dp</dimen>
|
||||
|
||||
<dimen name="popup_height_toaster">100dp</dimen>
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ android {
|
||||
minSdk 26
|
||||
targetSdk 32
|
||||
versionCode 1
|
||||
versionName "0.5.4"
|
||||
versionName "1.0.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
signingConfig signingConfigs.release
|
||||
|
||||
Binary file not shown.
@@ -12,7 +12,7 @@
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 1,
|
||||
"versionName": "0.5.4",
|
||||
"versionName": "1.0.0",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -30,7 +30,9 @@
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:replace="android:theme"
|
||||
tools:targetApi="31">
|
||||
|
||||
<activity
|
||||
android:name=".Activity.WebViewActivity"
|
||||
android:exported="false" />
|
||||
<!--
|
||||
TODO: Before you run your application, you need a Google Maps API key.
|
||||
|
||||
@@ -45,25 +47,24 @@
|
||||
<meta-data
|
||||
android:name="com.google.android.geo.API_KEY"
|
||||
android:value="AIzaSyAY14Ic32UP26Hg6GILznOfbBihiY5BUxw" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_channel_id"
|
||||
android:value="foodify-notification"/>
|
||||
|
||||
<service android:name=".Service.RefreshTokenService"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE"
|
||||
/>
|
||||
android:value="foodify-notification" />
|
||||
|
||||
<service
|
||||
android:name=".Service.RefreshTokenService"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE" />
|
||||
|
||||
<activity
|
||||
android:name=".Activity.TrackingOrderActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"
|
||||
android:label="@string/title_activity_tracking_order" />
|
||||
android:label="@string/title_activity_tracking_order"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Activity.OrderCheckOutActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:launchMode="singleTask">
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
@@ -77,59 +78,59 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".Activity.FavoriteFoodActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false" />
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Activity.ShopDetailActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false" />
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Activity.OrderDetailActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false" />
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Activity.OrderActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false" />
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Activity.AddressManagerActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false" />
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Activity.ChangePasswordActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false" />
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Activity.AccountAndProfileActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false" />
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Activity.FoodDetailActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false"
|
||||
android:noHistory="true" />
|
||||
android:noHistory="true"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Activity.VerifyAccountActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false" />
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Activity.ForgotPasswordActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false"
|
||||
android:noHistory="true" />
|
||||
android:noHistory="true"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Activity.SignInActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false" />
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Activity.SignUpActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false"
|
||||
android:noHistory="true" />
|
||||
android:noHistory="true"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".Activity.MainActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.Foodify.SplashScreen">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -215,19 +215,22 @@ public class AccountAndProfileActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void deleteOldImage() {
|
||||
StorageReference storageReference = FirebaseStorage.getInstance().getReferenceFromUrl(Common.CURRENT_USER.getImageUrl());
|
||||
//Check avatar user if image default, don't delete it!
|
||||
if(!Common.CURRENT_USER.getImageUrl().equals(Common.DEFAULT_IMAGE_URL)){
|
||||
StorageReference storageReference = FirebaseStorage.getInstance().getReferenceFromUrl(Common.CURRENT_USER.getImageUrl());
|
||||
|
||||
storageReference.delete().addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<Void> task) {
|
||||
storageReference.delete().addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<Void> task) {
|
||||
|
||||
}
|
||||
}).addOnFailureListener(new OnFailureListener() {
|
||||
@Override
|
||||
public void onFailure(@NonNull Exception e) {
|
||||
Toast.makeText(AccountAndProfileActivity.this, "Can't delete old image!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).addOnFailureListener(new OnFailureListener() {
|
||||
@Override
|
||||
public void onFailure(@NonNull Exception e) {
|
||||
Toast.makeText(AccountAndProfileActivity.this, "Can't delete old image!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private String getFileExtension(Uri fileUri){
|
||||
|
||||
@@ -541,13 +541,21 @@ public class FoodDetailActivity extends AppCompatActivity {
|
||||
description_content_txt.setText(food.getDescription());
|
||||
ratingBar.setRating(food.getAverageRating());
|
||||
|
||||
//Set image for user
|
||||
if(Common.CURRENT_USER.getImageUrl().isEmpty()){
|
||||
profile_avatar.setImageResource(R.drawable.profile_avatar);
|
||||
//Set avatar user when have comment
|
||||
if(Common.CURRENT_USER != null){
|
||||
if(Common.CURRENT_USER.getImageUrl().isEmpty()){
|
||||
profile_avatar.setImageResource(R.drawable.profile_avatar);
|
||||
} else {
|
||||
Picasso.get().load(Common.CURRENT_USER.getImageUrl()).into(profile_avatar);
|
||||
}
|
||||
} else {
|
||||
Picasso.get().load(Common.CURRENT_USER.getImageUrl()).into(profile_avatar);
|
||||
//Hide layout when not login
|
||||
user_comment_layout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(food.getReviewCount() == null || Integer.parseInt(food.getReviewCount()) == 0){
|
||||
countRating_txt.setText("Chưa có bình luận nào!");
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.capstone.foodify.Activity;
|
||||
|
||||
import static com.capstone.foodify.Common.firebaseAppDistribution;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.job.JobInfo;
|
||||
@@ -65,6 +67,7 @@ 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.appdistribution.AppDistributionRelease;
|
||||
import com.google.firebase.appdistribution.InterruptionLevel;
|
||||
import com.google.firebase.appdistribution.OnProgressListener;
|
||||
import com.google.firebase.appdistribution.UpdateProgress;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
@@ -170,8 +173,15 @@ public class MainActivity extends AppCompatActivity {
|
||||
//Initialize Firebase Auth
|
||||
mAuth = FirebaseAuth.getInstance();
|
||||
|
||||
// firebaseAppDistribution.showFeedbackNotification(
|
||||
// // Text providing notice to your testers about collection and
|
||||
// // processing of their feedback data
|
||||
// "Cảm ơn đóng góp ý kiến của các bạn.",
|
||||
// // The level of interruption for the notification
|
||||
// InterruptionLevel.HIGH);
|
||||
|
||||
if(Common.firebaseAppDistribution.isTesterSignedIn()){
|
||||
|
||||
if(firebaseAppDistribution.isTesterSignedIn()){
|
||||
|
||||
//Customise progress dialog
|
||||
ProgressDialog progressDialog = new ProgressDialog(this);
|
||||
@@ -183,7 +193,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
progressDialog.setProgressTintList(getColorStateList(R.color.primaryColor));
|
||||
progressDialog.setSecondaryProgressTintList(getColorStateList(R.color.primaryLightColor));
|
||||
|
||||
Common.firebaseAppDistribution.checkForNewRelease().addOnCompleteListener(new OnCompleteListener<AppDistributionRelease>() {
|
||||
firebaseAppDistribution.checkForNewRelease().addOnCompleteListener(new OnCompleteListener<AppDistributionRelease>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<AppDistributionRelease> task) {
|
||||
if(task.isSuccessful()){
|
||||
@@ -196,7 +206,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
Common.firebaseAppDistribution.updateIfNewReleaseAvailable().addOnProgressListener(new OnProgressListener() {
|
||||
firebaseAppDistribution.updateIfNewReleaseAvailable().addOnProgressListener(new OnProgressListener() {
|
||||
@Override
|
||||
public void onProgressUpdate(@NonNull UpdateProgress updateProgress) {
|
||||
double totalBytes = updateProgress.getApkFileTotalBytes();
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ShopDetailActivity extends AppCompatActivity {
|
||||
private static boolean LAST_PAGE = false;
|
||||
private int shopId;
|
||||
private List<Food> listFood = new ArrayList<>();
|
||||
private TextView content_description_text_view, student_shop_text_view, end_of_list_text_view, txt_shop_name;
|
||||
private TextView content_description_text_view, student_shop_text_view, end_of_list_text_view, txt_shop_name, phone_number_shop;
|
||||
private ImageView imageShop, back_image;
|
||||
private RecyclerView recycler_view_food_shop;
|
||||
private FoodShopAdapter adapter;
|
||||
@@ -160,6 +160,7 @@ public class ShopDetailActivity extends AppCompatActivity {
|
||||
txt_shop_name = findViewById(R.id.txt_shop_name);
|
||||
empty_layout = findViewById(R.id.empty_layout);
|
||||
swipeRefreshLayout = findViewById(R.id.swipe_refresh);
|
||||
phone_number_shop = findViewById(R.id.phone_number_shop);
|
||||
}
|
||||
|
||||
private void getListFood(int shopId){
|
||||
@@ -231,6 +232,7 @@ public class ShopDetailActivity extends AppCompatActivity {
|
||||
Picasso.get().load(shop.getImageUrl()).into(imageShop);
|
||||
txt_shop_name.setText(shop.getName());
|
||||
content_description_text_view.setText(shop.getDescription());
|
||||
phone_number_shop.setText("SĐT: " + shop.getUser().getPhoneNumber());
|
||||
|
||||
//If shop is studentShop, enable tag student shop
|
||||
if(shop.isStudent()){
|
||||
|
||||
@@ -2,10 +2,12 @@ package com.capstone.foodify.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -28,6 +30,10 @@ import com.google.firebase.auth.FirebaseAuth;
|
||||
import com.google.firebase.auth.FirebaseUser;
|
||||
import com.google.firebase.auth.GetTokenResult;
|
||||
import com.google.firebase.auth.SignInMethodQueryResult;
|
||||
import com.thecode.aestheticdialogs.AestheticDialog;
|
||||
import com.thecode.aestheticdialogs.DialogStyle;
|
||||
import com.thecode.aestheticdialogs.DialogType;
|
||||
import com.thecode.aestheticdialogs.OnDialogClickListener;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -46,6 +52,22 @@ public class SignInActivity extends AppCompatActivity {
|
||||
private ImageView back_image;
|
||||
private ConstraintLayout progressLayout;
|
||||
private String email, password = null;
|
||||
private TextView txt_countdown, txt_verify_email;
|
||||
private LinearLayout countdown_layout;
|
||||
|
||||
private final CountDownTimer count = new CountDownTimer(60000, 1000) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
txt_countdown.setText(millisUntilFinished / 1000 + " giây");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
countdown_layout.setVisibility(View.GONE);
|
||||
|
||||
txt_verify_email.setVisibility(View.VISIBLE);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -189,69 +211,102 @@ public class SignInActivity extends AppCompatActivity {
|
||||
// Sign in success, update UI with the signed-in user's information
|
||||
FirebaseUser user = mAuth.getCurrentUser();
|
||||
|
||||
assert user != null;
|
||||
if(user.isEmailVerified()){
|
||||
//Email verify already
|
||||
user.getIdToken(true)
|
||||
.addOnCompleteListener(new OnCompleteListener<GetTokenResult>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<GetTokenResult> task) {
|
||||
if(task.isSuccessful()){
|
||||
Common.TOKEN = task.getResult().getToken();
|
||||
|
||||
user.getIdToken(true)
|
||||
.addOnCompleteListener(new OnCompleteListener<GetTokenResult>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<GetTokenResult> task) {
|
||||
if(task.isSuccessful()){
|
||||
Common.TOKEN = task.getResult().getToken();
|
||||
//Get user from database
|
||||
FoodApiToken.apiService.getUserFromEmail(user.getEmail()).enqueue(new Callback<User>() {
|
||||
@Override
|
||||
public void onResponse(Call<User> call, Response<User> response) {
|
||||
if(response.code() == 200){
|
||||
|
||||
//Get user from database
|
||||
FoodApiToken.apiService.getUserFromEmail(user.getEmail()).enqueue(new Callback<User>() {
|
||||
@Override
|
||||
public void onResponse(Call<User> call, Response<User> response) {
|
||||
if(response.code() == 200){
|
||||
User userData = response.body();
|
||||
if(userData != null){
|
||||
|
||||
User userData = response.body();
|
||||
if(userData != null){
|
||||
//Check user is lock or not
|
||||
if(!userData.isLocked()){
|
||||
|
||||
//Check user is lock or not
|
||||
if(!userData.isLocked()){
|
||||
//Check role account
|
||||
if(userData.getRole().getRoleName().equals("ROLE_USER")){
|
||||
Common.CURRENT_USER = userData;
|
||||
|
||||
//Check role account
|
||||
if(userData.getRole().getRoleName().equals("ROLE_USER")){
|
||||
Common.CURRENT_USER = userData;
|
||||
//Dismiss progress bar
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
|
||||
//Dismiss progress bar
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
startActivity(new Intent(SignInActivity.this, MainActivity.class));
|
||||
finish();
|
||||
} else {
|
||||
Toast.makeText(SignInActivity.this, "Tài khoản không hợp lệ! Vui lòng kiểm tra lại!", Toast.LENGTH_SHORT).show();
|
||||
FirebaseAuth.getInstance().signOut();
|
||||
|
||||
startActivity(new Intent(SignInActivity.this, MainActivity.class));
|
||||
finish();
|
||||
} else {
|
||||
Toast.makeText(SignInActivity.this, "Tài khoản không hợp lệ! Vui lòng kiểm tra lại!", Toast.LENGTH_SHORT).show();
|
||||
//Dismiss progress bar
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
else{
|
||||
showNotification(DialogStyle.RAINBOW, DialogType.ERROR, "Tài khoản của bạn bị khoá!");
|
||||
FirebaseAuth.getInstance().signOut();
|
||||
|
||||
//Dismiss progress bar
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
else{
|
||||
Toast.makeText(SignInActivity.this, "Tài khoản của bạn đã bị khoá!", Toast.LENGTH_SHORT).show();
|
||||
FirebaseAuth.getInstance().signOut();
|
||||
|
||||
//Dismiss progress bar
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<User> call, Throwable t) {
|
||||
System.out.println("ERROR: " + t);
|
||||
Common.showErrorServerNotification(SignInActivity.this, "Không thể đăng nhập tài khoản! Vui lòng thử lại sau!");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Toast.makeText(SignInActivity.this, "Error when taking token!", Toast.LENGTH_SHORT).show();
|
||||
@Override
|
||||
public void onFailure(Call<User> call, Throwable t) {
|
||||
System.out.println("ERROR: " + t);
|
||||
Common.showErrorServerNotification(SignInActivity.this, "Không thể đăng nhập tài khoản! Vui lòng thử lại sau!");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Toast.makeText(SignInActivity.this, "Error when taking token!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
//Email user not verify
|
||||
|
||||
//Count down resend code
|
||||
countdown_layout.setVisibility(View.VISIBLE);
|
||||
count.start();
|
||||
//Send email verify
|
||||
user.sendEmailVerification();
|
||||
|
||||
txt_verify_email.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
//When user click on the text
|
||||
|
||||
//Count down resend code
|
||||
countdown_layout.setVisibility(View.VISIBLE);
|
||||
count.start();
|
||||
|
||||
//Send email verify
|
||||
user.sendEmailVerification();
|
||||
|
||||
txt_verify_email.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
//Log out user
|
||||
mAuth.signOut();
|
||||
|
||||
showNotification(DialogStyle.FLAT, DialogType.WARNING, "Tài khoản chưa được xác thực, vui lòng kiểm tra email và làm theo hướng dẫn để tiếp tục!");
|
||||
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
// If sign in fails, display a message to the user.
|
||||
Toast.makeText(SignInActivity.this, "Thông tin đăng nhập không đúng! Vui lòng kiểm tra và thử lại!",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
|
||||
showNotification(DialogStyle.RAINBOW, DialogType.WARNING, "Thông tin đăng nhập không đúng! Vui lòng kiểm tra và thử lại!");
|
||||
|
||||
//Dismiss progress bar
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
@@ -273,6 +328,11 @@ public class SignInActivity extends AppCompatActivity {
|
||||
|
||||
progressLayout = findViewById(R.id.progress_layout);
|
||||
|
||||
txt_countdown = findViewById(R.id.textview_countdown);
|
||||
txt_verify_email = findViewById(R.id.textview_verify_email);
|
||||
|
||||
countdown_layout = findViewById(R.id.countdown_layout);
|
||||
|
||||
}
|
||||
private void setFontUI() {
|
||||
textInput_email.setTypeface(Common.setFontKohoBold(getAssets()));
|
||||
@@ -281,4 +341,17 @@ public class SignInActivity extends AppCompatActivity {
|
||||
|
||||
// this event will enable the back
|
||||
// function to the button on press
|
||||
|
||||
private void showNotification(DialogStyle dialogStyle, DialogType dialogType, String message){
|
||||
new AestheticDialog.Builder(SignInActivity.this, dialogStyle, dialogType)
|
||||
.setTitle("THÔNG BÁO!")
|
||||
.setMessage(message)
|
||||
.setCancelable(false)
|
||||
.setOnClickListener(new OnDialogClickListener() {
|
||||
@Override
|
||||
public void onClick(@NonNull AestheticDialog.Builder builder) {
|
||||
builder.dismiss();
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
}
|
||||
@@ -290,9 +290,11 @@ public class SignUpActivity extends AppCompatActivity {
|
||||
public void onResponse(Call<CustomResponse> call, Response<CustomResponse> response) {
|
||||
CustomResponse dataTemp = response.body();
|
||||
|
||||
loadCompleted();
|
||||
|
||||
assert dataTemp != null;
|
||||
if(dataTemp.isTrue()){
|
||||
loadCompleted();
|
||||
|
||||
textInput_phone.setError("Số điện thoại đã được đăng ký!");
|
||||
validPhone = false;
|
||||
} else {
|
||||
@@ -352,11 +354,11 @@ public class SignUpActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
//Check identified Code
|
||||
if(identifiedCode.length() < 8 || identifiedCode.length() > 11){
|
||||
if(identifiedCode.length() == 9 || identifiedCode.length() == 12){
|
||||
textInput_id_card.setErrorEnabled(false);
|
||||
} else {
|
||||
textInput_id_card.setError("CCCD / CMND không hợp lệ!");
|
||||
dataHasValidate = false;
|
||||
} else {
|
||||
textInput_id_card.setErrorEnabled(false);
|
||||
}
|
||||
|
||||
//Check birthday
|
||||
|
||||
@@ -46,6 +46,10 @@ 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.thecode.aestheticdialogs.AestheticDialog;
|
||||
import com.thecode.aestheticdialogs.DialogStyle;
|
||||
import com.thecode.aestheticdialogs.DialogType;
|
||||
import com.thecode.aestheticdialogs.OnDialogClickListener;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -278,10 +282,21 @@ public class VerifyAccountActivity extends AppCompatActivity {
|
||||
if(response.code() == 200){
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
//Create user success;
|
||||
Toast.makeText(VerifyAccountActivity.this, "Tạo tài khoản thành công!", Toast.LENGTH_SHORT).show();
|
||||
FirebaseAuth.getInstance().signOut();
|
||||
startActivity(new Intent(VerifyAccountActivity.this, SignInActivity.class));
|
||||
finish();
|
||||
|
||||
new AestheticDialog.Builder(VerifyAccountActivity.this, DialogStyle.FLAT, DialogType.SUCCESS)
|
||||
.setTitle("Thông báo!")
|
||||
.setMessage("Đã tạo tài khoản thành công!")
|
||||
.setCancelable(false)
|
||||
.setOnClickListener(new OnDialogClickListener() {
|
||||
@Override
|
||||
public void onClick(@NonNull AestheticDialog.Builder dialog) {
|
||||
dialog.dismiss();
|
||||
FirebaseAuth.getInstance().signOut();
|
||||
startActivity(new Intent(VerifyAccountActivity.this, SignInActivity.class));
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
} else {
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
Toast.makeText(VerifyAccountActivity.this, "Lỗi hệ thống! Code: " + response.code(), Toast.LENGTH_SHORT).show();
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.capstone.foodify.Activity;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.webkit.WebResourceError;
|
||||
import android.webkit.WebResourceRequest;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.capstone.foodify.R;
|
||||
|
||||
public class WebViewActivity extends Activity {
|
||||
|
||||
private WebView mWebview ;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mWebview = new WebView(this);
|
||||
|
||||
mWebview.getSettings().setJavaScriptEnabled(true); // enable javascript
|
||||
|
||||
final Activity activity = this;
|
||||
|
||||
mWebview.setWebViewClient(new WebViewClient() {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
|
||||
Toast.makeText(activity, description, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@TargetApi(android.os.Build.VERSION_CODES.M)
|
||||
@Override
|
||||
public void onReceivedError(WebView view, WebResourceRequest req, WebResourceError rerr) {
|
||||
// Redirect to deprecated method, so you can use it in all SDK versions
|
||||
onReceivedError(view, rerr.getErrorCode(), rerr.getDescription().toString(), req.getUrl().toString());
|
||||
}
|
||||
});
|
||||
|
||||
mWebview .loadUrl("https://appdistribution.firebase.dev/i/89ca8a40d3c91fa6");
|
||||
setContentView(mWebview );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -48,10 +48,8 @@ public class CommentAdapter extends RecyclerView.Adapter<CommentAdapter.CommentV
|
||||
holder.content.setText(comment.getContent());
|
||||
|
||||
//Bind image avatar user
|
||||
if(comment.getUser().getImageUrl() == null){
|
||||
holder.profile_avatar.setImageResource(R.drawable.profile_avatar);
|
||||
} else {
|
||||
Picasso.get().load(Common.CURRENT_USER.getImageUrl()).into(holder.profile_avatar);
|
||||
if(comment.getUser().getImageUrl() != null){
|
||||
Picasso.get().load(comment.getUser().getImageUrl()).into(holder.profile_avatar);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ public class Common {
|
||||
public static String FCM_TOKEN = null;
|
||||
public static Location CURRENT_LOCATION = null;
|
||||
public static FirebaseUser FIREBASE_USER = null;
|
||||
public static final String DEFAULT_IMAGE_URL = "https://firebasestorage.googleapis.com/v0/b/foodify-55954.appspot.com/o/Admin%2Fuser-default-01.png?alt=media&token=b13f27da-b39a-4d89-9cba-acba869d60ce";
|
||||
public static final String DEFAULT_IMAGE_URL = "https://firebasestorage.googleapis.com/v0/b/foodify-55954.appspot.com/o/Admin%2Fdefault-ava-01.png?alt=media&token=90202711-4b1a-4665-a941-a65bf6c2002e";
|
||||
public static final String MAP_API = "AIzaSyAY14Ic32UP26Hg6GILznOfbBihiY5BUxw";
|
||||
public static final String FORMAT_DATE="dd-MM-yyyy";
|
||||
public static final String FORMAT_DATE="yyyy-MM-dd";
|
||||
public static final String VALID_EMAIL_ADDRESS_REGEX = "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$";
|
||||
public static final String PHONE_CODE = "+84";
|
||||
public static final String PASSWORD_PATTERN = "^(?=.*[0-9])(?=.*[A-Z])(?=.*[@#$%^&+=!_])(?=\\S+$).{4,}$";
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.capstone.foodify.Fragment;
|
||||
|
||||
import static com.capstone.foodify.Common.firebaseAppDistribution;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
@@ -18,6 +16,7 @@ import com.capstone.foodify.Activity.AddressManagerActivity;
|
||||
import com.capstone.foodify.Activity.FavoriteFoodActivity;
|
||||
import com.capstone.foodify.Activity.MainActivity;
|
||||
import com.capstone.foodify.Activity.OrderActivity;
|
||||
import com.capstone.foodify.Activity.WebViewActivity;
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.R;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
@@ -29,7 +28,7 @@ import com.squareup.picasso.Picasso;
|
||||
|
||||
public class ProfileFragment extends Fragment {
|
||||
private static final String TAG = "ProfileFragment";
|
||||
LinearLayout account_and_profile, manage_address, favorite_food, order_history, feed_back, log_out;
|
||||
LinearLayout account_and_profile, manage_address, favorite_food, order_history, register_beta_app, log_out;
|
||||
PopupDialog popupDialog;
|
||||
TextView user_name;
|
||||
RoundedImageView profile_avatar;
|
||||
@@ -84,10 +83,10 @@ public class ProfileFragment extends Fragment {
|
||||
}
|
||||
});
|
||||
|
||||
feed_back.setOnClickListener(new View.OnClickListener() {
|
||||
register_beta_app.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
firebaseAppDistribution.startFeedback("Cảm ơn vì sự đóng góp ý kiến từ các bạn!");
|
||||
startActivity(new Intent(getActivity(), WebViewActivity.class));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -135,7 +134,7 @@ public class ProfileFragment extends Fragment {
|
||||
log_out = rootView.findViewById(R.id.log_out);
|
||||
user_name = rootView.findViewById(R.id.user_name);
|
||||
profile_avatar = rootView.findViewById(R.id.profile_avatar);
|
||||
feed_back = rootView.findViewById(R.id.feedback);
|
||||
register_beta_app = rootView.findViewById(R.id.feedback);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,7 @@ 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;
|
||||
@@ -139,6 +140,11 @@ public class SearchFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
|
||||
if(newText.length() == 0){
|
||||
searchQuery = "";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -12,6 +12,7 @@ public class Shop implements Serializable {
|
||||
private int userId;
|
||||
private double lat;
|
||||
private double lng;
|
||||
private User user;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
@@ -84,4 +85,12 @@ public class Shop implements Serializable {
|
||||
public void setLng(double lng) {
|
||||
this.lng = lng;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M10,4h4v4h-4z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M4,16h4v4h-4z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M4,10h4v4h-4z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M4,4h4v4h-4z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M14,12.42l0,-2.42l-4,0l0,4l2.42,0z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M20.88,11.29l-1.17,-1.17c-0.16,-0.16 -0.42,-0.16 -0.58,0L18.25,11L20,12.75l0.88,-0.88C21.04,11.71 21.04,11.45 20.88,11.29z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M11,18.25l0,1.75l1.75,0l6.67,-6.67l-1.75,-1.75z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M16,4h4v4h-4z"/>
|
||||
</vector>
|
||||
@@ -109,13 +109,26 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/phone_number_shop"
|
||||
android:text="SĐT: "
|
||||
android:textSize="15sp"
|
||||
android:fontFamily="@font/koho_bold"
|
||||
android:textColor="@color/gray"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/content_description_text_view"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/line"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="#c0c0c0"
|
||||
android:layout_marginTop="5dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/content_description_text_view"
|
||||
app:layout_constraintTop_toBottomOf="@id/phone_number_shop"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
@@ -127,7 +140,7 @@
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/content_description_text_view"
|
||||
app:layout_constraintTop_toBottomOf="@id/line"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
|
||||
@@ -93,6 +93,51 @@
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="20dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/textInput_email"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:id="@+id/countdown_layout"
|
||||
android:visibility="gone"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/textview_resendCode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="13sp"
|
||||
android:text="Gửi lại sau: "
|
||||
android:fontFamily="@font/koho"
|
||||
android:textColor="@color/black"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview_countdown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/koho"
|
||||
android:text="00:35"
|
||||
android:textColor="@color/secondary"
|
||||
android:textSize="13sp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview_verify_email"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:text="Xác thực"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:fontFamily="@font/koho"
|
||||
android:textColor="@color/primaryColor"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textInput_email"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textInput_password"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -234,11 +234,12 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ic_feedback"
|
||||
android:src="@drawable/feedback"
|
||||
android:src="@drawable/baseline_app_registration_24"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
tools:ignore="ContentDescription"
|
||||
@@ -252,10 +253,11 @@
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/koho"
|
||||
android:text="Đóng góp ý kiến"
|
||||
android:text="Đăng ký người dùng thử nghiệm"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
tools:ignore="HardcodedText" />
|
||||
tools:ignore="HardcodedText"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
|
||||
Reference in New Issue
Block a user