mirror of
https://github.com/Nezumi-2711/Foodify-Shipper.git
synced 2026-09-22 20:00:51 +00:00
Update function, UI
This commit is contained in:
+13
-2
@@ -19,7 +19,13 @@ android {
|
|||||||
minSdk 26
|
minSdk 26
|
||||||
targetSdk 30
|
targetSdk 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "0.2.1"
|
||||||
|
|
||||||
|
configurations.all {
|
||||||
|
resolutionStrategy {
|
||||||
|
force 'androidx.appcompat:appcompat:1.4.2'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
@@ -43,7 +49,7 @@ dependencies {
|
|||||||
|
|
||||||
implementation 'androidx.core:core-splashscreen:1.0.0'
|
implementation 'androidx.core:core-splashscreen:1.0.0'
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
implementation 'androidx.appcompat:appcompat:1.4.2'
|
||||||
implementation 'com.google.android.material:material:1.6.0'
|
implementation 'com.google.android.material:material:1.6.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
|
|
||||||
@@ -55,6 +61,7 @@ dependencies {
|
|||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||||
|
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
||||||
|
|
||||||
implementation 'com.makeramen:roundedimageview:2.3.0'
|
implementation 'com.makeramen:roundedimageview:2.3.0'
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||||
@@ -63,6 +70,10 @@ dependencies {
|
|||||||
implementation 'com.github.gabriel-TheCode:AestheticDialogs:1.3.6'
|
implementation 'com.github.gabriel-TheCode:AestheticDialogs:1.3.6'
|
||||||
implementation 'com.saadahmedev.popup-dialog:popup-dialog:1.0.2'
|
implementation 'com.saadahmedev.popup-dialog:popup-dialog:1.0.2'
|
||||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||||
|
implementation 'com.github.techinessoverloaded:progress-dialog:1.5.1'
|
||||||
|
|
||||||
implementation 'com.google.android.gms:play-services-location:21.0.1'
|
implementation 'com.google.android.gms:play-services-location:21.0.1'
|
||||||
|
|
||||||
|
// ADD the API-only library to all variants
|
||||||
|
implementation 'com.google.firebase:firebase-appdistribution:16.0.0-beta08'
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
"filters": [],
|
"filters": [],
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"versionCode": 1,
|
"versionCode": 1,
|
||||||
"versionName": "1.0",
|
"versionName": "0.2.1",
|
||||||
"outputFile": "app-release.apk"
|
"outputFile": "app-release.apk"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
@@ -21,6 +21,11 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.FoodifyShipper"
|
android:theme="@style/Theme.FoodifyShipper"
|
||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true">
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".Activity.ForgotPasswordActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".GoogleMap.GeofenceBroadcastReceiver"
|
android:name=".GoogleMap.GeofenceBroadcastReceiver"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
@@ -30,10 +35,10 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<service android:name=".LocationService"
|
<service
|
||||||
|
android:name=".LocationService"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="false"
|
android:exported="false" />
|
||||||
/>
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".Activity.AccountAndProfileActivity"
|
android:name=".Activity.AccountAndProfileActivity"
|
||||||
@@ -56,7 +61,8 @@
|
|||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".Activity.MainActivity"
|
android:name=".Activity.MainActivity"
|
||||||
android:exported="false" />
|
android:exported="false"
|
||||||
|
/>
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".NotificationService"
|
android:name=".NotificationService"
|
||||||
@@ -65,6 +71,10 @@
|
|||||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
|
<service android:name=".RefreshTokenService"
|
||||||
|
android:permission="android.permission.BIND_JOB_SERVICE"
|
||||||
|
/>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -61,7 +61,6 @@ public class AccountAndProfileActivity extends AppCompatActivity {
|
|||||||
final private StorageReference storageReference = FirebaseStorage.getInstance().getReference();
|
final private StorageReference storageReference = FirebaseStorage.getInstance().getReference();
|
||||||
ConstraintLayout progressLayout;
|
ConstraintLayout progressLayout;
|
||||||
FirebaseAuth mAuth;
|
FirebaseAuth mAuth;
|
||||||
FirebaseUser firebaseUser;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|||||||
@@ -0,0 +1,134 @@
|
|||||||
|
package com.capstone.foodify.shipper.Activity;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import com.capstone.foodify.shipper.Common;
|
||||||
|
import com.capstone.foodify.shipper.R;
|
||||||
|
import com.google.android.gms.tasks.OnCompleteListener;
|
||||||
|
import com.google.android.gms.tasks.Task;
|
||||||
|
import com.google.android.material.button.MaterialButton;
|
||||||
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
|
import com.google.firebase.auth.FirebaseAuth;
|
||||||
|
import com.google.firebase.auth.SignInMethodQueryResult;
|
||||||
|
import com.thecode.aestheticdialogs.DialogStyle;
|
||||||
|
import com.thecode.aestheticdialogs.DialogType;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class ForgotPasswordActivity extends AppCompatActivity {
|
||||||
|
private FirebaseAuth mAuth;
|
||||||
|
TextInputLayout textInput_email;
|
||||||
|
EditText edt_email;
|
||||||
|
MaterialButton send_code_button;
|
||||||
|
ConstraintLayout progress_layout;
|
||||||
|
ImageView back_image;
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_forgot_password);
|
||||||
|
|
||||||
|
initComponent();
|
||||||
|
|
||||||
|
mAuth = FirebaseAuth.getInstance();
|
||||||
|
|
||||||
|
//Back button
|
||||||
|
back_image.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
onBackPressed();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
send_code_button.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
progress_layout.setVisibility(View.VISIBLE);
|
||||||
|
if(checkEmailValid()){
|
||||||
|
mAuth.setLanguageCode("vi");
|
||||||
|
|
||||||
|
mAuth.fetchSignInMethodsForEmail(edt_email.getText().toString())
|
||||||
|
.addOnCompleteListener(new OnCompleteListener<SignInMethodQueryResult>() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull Task<SignInMethodQueryResult> task) {
|
||||||
|
|
||||||
|
boolean isNewUser = task.getResult().getSignInMethods().isEmpty();
|
||||||
|
|
||||||
|
if (isNewUser) {
|
||||||
|
|
||||||
|
Common.notificationDialog(ForgotPasswordActivity.this, DialogStyle.FLAT, DialogType.ERROR, "Thông báo!", "Email " +
|
||||||
|
"này chưa được đăng ký ở hệ thống! Vui lòng kiểm tra lại!");
|
||||||
|
|
||||||
|
progress_layout.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
sendEmail();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setFontUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendEmail(){
|
||||||
|
|
||||||
|
mAuth.sendPasswordResetEmail(edt_email.getText().toString()).addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull Task<Void> task) {
|
||||||
|
if(task.isSuccessful()){
|
||||||
|
Common.notificationDialog(ForgotPasswordActivity.this, DialogStyle.FLAT, DialogType.SUCCESS, "Email đã được gửi", "Vui lòng kiểm tra " +
|
||||||
|
"hộp thư và làm theo hướng dẫn để tiếp tục!");
|
||||||
|
|
||||||
|
progress_layout.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkEmailValid() {
|
||||||
|
boolean dataHasValidate = true;
|
||||||
|
|
||||||
|
//Check phone number
|
||||||
|
if (edt_email.getText().toString().isEmpty()) {
|
||||||
|
textInput_email.setError("Email không được bỏ trống!");
|
||||||
|
dataHasValidate = false;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
//Check email valid
|
||||||
|
Pattern patternEmail = Pattern.compile(Common.VALID_EMAIL_ADDRESS_REGEX, Pattern.CASE_INSENSITIVE);
|
||||||
|
Matcher matcherEmail = patternEmail.matcher(edt_email.getText().toString());
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dataHasValidate;
|
||||||
|
}
|
||||||
|
private void setFontUI() {
|
||||||
|
|
||||||
|
textInput_email.setTypeface(Common.setFontBebas(getAssets()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initComponent() {
|
||||||
|
textInput_email = findViewById(R.id.textInput_email);
|
||||||
|
back_image = findViewById(R.id.back_image);
|
||||||
|
send_code_button = findViewById(R.id.send_code_button);
|
||||||
|
edt_email = findViewById(R.id.edt_email);
|
||||||
|
progress_layout = findViewById(R.id.progress_layout);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@ package com.capstone.foodify.shipper.Activity;
|
|||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.job.JobInfo;
|
||||||
|
import android.app.job.JobScheduler;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@@ -26,20 +28,31 @@ import androidx.appcompat.widget.AppCompatCheckBox;
|
|||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.app.NotificationManagerCompat;
|
import androidx.core.app.NotificationManagerCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.viewpager2.widget.ViewPager2;
|
import androidx.viewpager2.widget.ViewPager2;
|
||||||
|
|
||||||
import com.capstone.foodify.shipper.API.FoodApiToken;
|
import com.capstone.foodify.shipper.API.FoodApiToken;
|
||||||
import com.capstone.foodify.shipper.BuildConfig;
|
import com.capstone.foodify.shipper.BuildConfig;
|
||||||
import com.capstone.foodify.shipper.Common;
|
import com.capstone.foodify.shipper.Common;
|
||||||
|
import com.capstone.foodify.shipper.Fragment.OrderFragment;
|
||||||
import com.capstone.foodify.shipper.Model.CustomResponse;
|
import com.capstone.foodify.shipper.Model.CustomResponse;
|
||||||
import com.capstone.foodify.shipper.R;
|
import com.capstone.foodify.shipper.R;
|
||||||
|
import com.capstone.foodify.shipper.RefreshTokenService;
|
||||||
import com.capstone.foodify.shipper.ViewPagerAdapter;
|
import com.capstone.foodify.shipper.ViewPagerAdapter;
|
||||||
import com.google.android.gms.tasks.OnCompleteListener;
|
import com.google.android.gms.tasks.OnCompleteListener;
|
||||||
import com.google.android.gms.tasks.Task;
|
import com.google.android.gms.tasks.Task;
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
import com.google.android.material.navigation.NavigationBarView;
|
import com.google.android.material.navigation.NavigationBarView;
|
||||||
|
import com.google.firebase.appdistribution.AppDistributionRelease;
|
||||||
|
import com.google.firebase.appdistribution.FirebaseAppDistribution;
|
||||||
|
import com.google.firebase.appdistribution.InterruptionLevel;
|
||||||
|
import com.google.firebase.appdistribution.OnProgressListener;
|
||||||
|
import com.google.firebase.appdistribution.UpdateProgress;
|
||||||
import com.google.firebase.messaging.FirebaseMessaging;
|
import com.google.firebase.messaging.FirebaseMessaging;
|
||||||
|
import com.techiness.progressdialoglibrary.ProgressDialog;
|
||||||
|
|
||||||
|
import java.sql.SQLOutput;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -50,10 +63,12 @@ import retrofit2.Response;
|
|||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private static final String TAG = "MainActivity";
|
private static final String TAG = "MainActivity";
|
||||||
|
private static final int JOB_ID = 123;
|
||||||
ViewPager2 viewPager2;
|
ViewPager2 viewPager2;
|
||||||
ViewPagerAdapter viewPagerAdapter;
|
ViewPagerAdapter viewPagerAdapter;
|
||||||
BottomNavigationView bottomNavigationView;
|
BottomNavigationView bottomNavigationView;
|
||||||
|
|
||||||
|
|
||||||
//Location
|
//Location
|
||||||
private static final int LOCATION_REQUEST_CODE = 100;
|
private static final int LOCATION_REQUEST_CODE = 100;
|
||||||
@Override
|
@Override
|
||||||
@@ -61,8 +76,57 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
if(Common.firebaseAppDistribution.isTesterSignedIn()){
|
||||||
|
|
||||||
//Init Component
|
//Customise progress dialog
|
||||||
|
ProgressDialog progressDialog = new ProgressDialog(this);
|
||||||
|
progressDialog.setTheme(ProgressDialog.THEME_LIGHT);
|
||||||
|
progressDialog.setMode(ProgressDialog.MODE_DETERMINATE);
|
||||||
|
progressDialog.setProgress(0);
|
||||||
|
progressDialog.setMessage("Xin vui lòng chờ...");
|
||||||
|
progressDialog.showProgressTextAsFraction(true);
|
||||||
|
progressDialog.setProgressTintList(getColorStateList(R.color.primaryColor));
|
||||||
|
progressDialog.setSecondaryProgressTintList(getColorStateList(R.color.primaryLightColor));
|
||||||
|
|
||||||
|
Common.firebaseAppDistribution.checkForNewRelease().addOnCompleteListener(new OnCompleteListener<AppDistributionRelease>() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull Task<AppDistributionRelease> task) {
|
||||||
|
if(task.isSuccessful()){
|
||||||
|
AppDistributionRelease appDistributionRelease = task.getResult();
|
||||||
|
|
||||||
|
if(appDistributionRelease != null){
|
||||||
|
progressDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Common.firebaseAppDistribution.updateIfNewReleaseAvailable().addOnProgressListener(new OnProgressListener() {
|
||||||
|
@Override
|
||||||
|
public void onProgressUpdate(@NonNull UpdateProgress updateProgress) {
|
||||||
|
double totalBytes = updateProgress.getApkFileTotalBytes();
|
||||||
|
|
||||||
|
double number = (updateProgress.getApkBytesDownloaded() / totalBytes) * 100;
|
||||||
|
|
||||||
|
progressDialog.setProgress((int) number);
|
||||||
|
progressDialog.setSecondaryProgress((int) number + 10);
|
||||||
|
|
||||||
|
if(number == 100){
|
||||||
|
progressDialog.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull Task<Void> task) {
|
||||||
|
if(!task.isSuccessful()){
|
||||||
|
progressDialog.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Init Component
|
||||||
bottomNavigationView = findViewById(R.id.bottom_nav);
|
bottomNavigationView = findViewById(R.id.bottom_nav);
|
||||||
viewPager2 = findViewById(R.id.viewPager);
|
viewPager2 = findViewById(R.id.viewPager);
|
||||||
|
|
||||||
@@ -72,7 +136,25 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
checkNotificationPermission();
|
checkNotificationPermission();
|
||||||
startPowerSaverIntent(this);
|
startPowerSaverIntent(this);
|
||||||
getTokenFCM();
|
getTokenFCM();
|
||||||
|
startRefreshTokenService();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void startRefreshTokenService() {
|
||||||
|
ComponentName componentName = new ComponentName(this, RefreshTokenService.class);
|
||||||
|
|
||||||
|
JobInfo jobInfo = new JobInfo.Builder(JOB_ID, componentName)
|
||||||
|
.setPeriodic(59 * 60 * 1000)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
JobScheduler jobScheduler = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);
|
||||||
|
jobScheduler.schedule(jobInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopRefreshTokenService() {
|
||||||
|
JobScheduler jobScheduler = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);
|
||||||
|
jobScheduler.cancel(JOB_ID);
|
||||||
|
}
|
||||||
|
|
||||||
private void bottomNavigation() {
|
private void bottomNavigation() {
|
||||||
viewPagerAdapter = new ViewPagerAdapter(this);
|
viewPagerAdapter = new ViewPagerAdapter(this);
|
||||||
viewPager2.setAdapter(viewPagerAdapter);
|
viewPager2.setAdapter(viewPagerAdapter);
|
||||||
@@ -288,5 +370,17 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return list.size() > 0;
|
return list.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
Log.e("Tag", "Resume");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
|
||||||
|
stopRefreshTokenService();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ import static com.capstone.foodify.shipper.Common.REQUEST_CHECK_SETTINGS;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
|
import android.app.FragmentManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -35,6 +36,7 @@ import com.capstone.foodify.shipper.API.GoogleMapApi;
|
|||||||
import com.capstone.foodify.shipper.API.TokenFCMFirebaseAPI;
|
import com.capstone.foodify.shipper.API.TokenFCMFirebaseAPI;
|
||||||
import com.capstone.foodify.shipper.Adapter.OrderDetailAdapter;
|
import com.capstone.foodify.shipper.Adapter.OrderDetailAdapter;
|
||||||
import com.capstone.foodify.shipper.Common;
|
import com.capstone.foodify.shipper.Common;
|
||||||
|
import com.capstone.foodify.shipper.Fragment.OrderFragment;
|
||||||
import com.capstone.foodify.shipper.GoogleMap.GeofenceHelper;
|
import com.capstone.foodify.shipper.GoogleMap.GeofenceHelper;
|
||||||
import com.capstone.foodify.shipper.LocationService;
|
import com.capstone.foodify.shipper.LocationService;
|
||||||
import com.capstone.foodify.shipper.Model.CustomResponse;
|
import com.capstone.foodify.shipper.Model.CustomResponse;
|
||||||
@@ -135,23 +137,43 @@ public class OrderDetailActivity extends AppCompatActivity {
|
|||||||
stopLocationService();
|
stopLocationService();
|
||||||
startActivity(new Intent(OrderDetailActivity.this, MainActivity.class));
|
startActivity(new Intent(OrderDetailActivity.this, MainActivity.class));
|
||||||
finish();
|
finish();
|
||||||
|
overridePendingTransition(0,0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
btn_shipping.setOnClickListener(new View.OnClickListener() {
|
btn_shipping.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (Common.CURRENT_ORDER == null) {
|
if (Common.CURRENT_ORDER == null) {
|
||||||
LatLng latLng = new LatLng(order.getLat(), order.getLng());
|
|
||||||
addGeofence(latLng, GEOFENCE_RADIUS);
|
|
||||||
|
|
||||||
Common.CURRENT_ORDER = order;
|
//Change order status
|
||||||
|
FoodApiToken.apiService.changeStatusOrder(order.getUser().getId(), order.getId(), "SHIPPING").enqueue(new Callback<CustomResponse>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<CustomResponse> call, Response<CustomResponse> response) {
|
||||||
|
if(response.code() == 200){
|
||||||
|
//If success
|
||||||
|
|
||||||
startLocationService();
|
LatLng latLng = new LatLng(order.getLat(), order.getLng());
|
||||||
|
addGeofence(latLng, GEOFENCE_RADIUS);
|
||||||
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW,
|
Common.CURRENT_ORDER = order;
|
||||||
Uri.parse("google.navigation:q=" + order.getLat() + "," + order.getLng() + "&mode=l"));
|
|
||||||
intent.setPackage("com.google.android.apps.maps");
|
startLocationService();
|
||||||
startActivity(intent);
|
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW,
|
||||||
|
Uri.parse("google.navigation:q=" + order.getLat() + "," + order.getLng() + "&mode=l"));
|
||||||
|
intent.setPackage("com.google.android.apps.maps");
|
||||||
|
startActivity(intent);
|
||||||
|
} else {
|
||||||
|
//If error
|
||||||
|
Toast.makeText(OrderDetailActivity.this, "", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<CustomResponse> call, Throwable t) {
|
||||||
|
Toast.makeText(OrderDetailActivity.this, Common.ERROR_CONNECT_SERVER, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
} else{
|
} else{
|
||||||
Common.showErrorDialog(OrderDetailActivity.this, "Không thể lấy được thông tin đơn, vui lòng thử lại sau!");
|
Common.showErrorDialog(OrderDetailActivity.this, "Không thể lấy được thông tin đơn, vui lòng thử lại sau!");
|
||||||
}
|
}
|
||||||
@@ -249,6 +271,7 @@ public class OrderDetailActivity extends AppCompatActivity {
|
|||||||
startActivity(new Intent(OrderDetailActivity.this, MainActivity.class));
|
startActivity(new Intent(OrderDetailActivity.this, MainActivity.class));
|
||||||
builder.dismiss();
|
builder.dismiss();
|
||||||
finish();
|
finish();
|
||||||
|
overridePendingTransition(0,0);
|
||||||
}
|
}
|
||||||
}).show();
|
}).show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import android.text.Editable;
|
|||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -43,13 +44,16 @@ import retrofit2.Response;
|
|||||||
public class SignInActivity extends AppCompatActivity {
|
public class SignInActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private FirebaseAuth mAuth;
|
private FirebaseAuth mAuth;
|
||||||
TextInputLayout textInput_email, textInput_password;
|
private TextInputLayout textInput_email, textInput_password;
|
||||||
TextInputEditText edt_email, edt_password;
|
private TextInputEditText edt_email, edt_password;
|
||||||
ConstraintLayout progressLayout;
|
private ConstraintLayout progressLayout;
|
||||||
String email, password = null;
|
private String email, password = null;
|
||||||
MaterialButton btn_sign_in;
|
private MaterialButton btn_sign_in;
|
||||||
private FirebaseUser user;
|
private FirebaseUser user;
|
||||||
|
|
||||||
|
private TextView txt_forgot_password;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
@@ -105,6 +109,12 @@ public class SignInActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
txt_forgot_password.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
startActivity(new Intent(SignInActivity.this, ForgotPasswordActivity.class));
|
||||||
|
}
|
||||||
|
});
|
||||||
edt_password.addTextChangedListener(new TextWatcher() {
|
edt_password.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
@@ -234,6 +244,7 @@ public class SignInActivity extends AppCompatActivity {
|
|||||||
btn_sign_in = findViewById(R.id.sign_in_button);
|
btn_sign_in = findViewById(R.id.sign_in_button);
|
||||||
textInput_email = findViewById(R.id.textInput_email);
|
textInput_email = findViewById(R.id.textInput_email);
|
||||||
textInput_password = findViewById(R.id.textInput_password);
|
textInput_password = findViewById(R.id.textInput_password);
|
||||||
|
txt_forgot_password = findViewById(R.id.txt_forgot_password);
|
||||||
|
|
||||||
edt_email = findViewById(R.id.edt_email);
|
edt_email = findViewById(R.id.edt_email);
|
||||||
edt_password = findViewById(R.id.edt_password);
|
edt_password = findViewById(R.id.edt_password);
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ public class OrderAdapter extends RecyclerView.Adapter<OrderAdapter.OrderViewHol
|
|||||||
Intent intent = new Intent(activity, OrderDetailActivity.class);
|
Intent intent = new Intent(activity, OrderDetailActivity.class);
|
||||||
intent.putExtra("order", order);
|
intent.putExtra("order", order);
|
||||||
activity.startActivity(intent);
|
activity.startActivity(intent);
|
||||||
|
activity.finish();
|
||||||
} else {
|
} else {
|
||||||
new AestheticDialog.Builder(activity, DialogStyle.TOASTER, DialogType.WARNING)
|
new AestheticDialog.Builder(activity, DialogStyle.TOASTER, DialogType.WARNING)
|
||||||
.setTitle("THÔNG BÁO!")
|
.setTitle("THÔNG BÁO!")
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import androidx.annotation.NonNull;
|
|||||||
import com.capstone.foodify.shipper.Model.Order;
|
import com.capstone.foodify.shipper.Model.Order;
|
||||||
import com.capstone.foodify.shipper.Model.Shipper;
|
import com.capstone.foodify.shipper.Model.Shipper;
|
||||||
import com.capstone.foodify.shipper.Model.User;
|
import com.capstone.foodify.shipper.Model.User;
|
||||||
|
import com.google.firebase.appdistribution.FirebaseAppDistribution;
|
||||||
|
import com.google.firebase.auth.FirebaseUser;
|
||||||
import com.thecode.aestheticdialogs.AestheticDialog;
|
import com.thecode.aestheticdialogs.AestheticDialog;
|
||||||
import com.thecode.aestheticdialogs.DialogStyle;
|
import com.thecode.aestheticdialogs.DialogStyle;
|
||||||
import com.thecode.aestheticdialogs.DialogType;
|
import com.thecode.aestheticdialogs.DialogType;
|
||||||
@@ -27,22 +29,19 @@ public class Common {
|
|||||||
public static String TOKEN = null;
|
public static String TOKEN = null;
|
||||||
public static String FCM_TOKEN_SHIPPER = null;
|
public static String FCM_TOKEN_SHIPPER = null;
|
||||||
public static String FCM_TOKEN_CUSTOMER = null;
|
public static String FCM_TOKEN_CUSTOMER = null;
|
||||||
|
public static FirebaseUser FIREBASE_USER = null;
|
||||||
public static Location CURRENT_LOCATION = null;
|
public static Location CURRENT_LOCATION = null;
|
||||||
|
public static final FirebaseAppDistribution firebaseAppDistribution = FirebaseAppDistribution.getInstance();
|
||||||
public static final String BASE_URL = "https://foodify-backend-production.up.railway.app/api/";
|
public static final String BASE_URL = "https://foodify-backend-production.up.railway.app/api/";
|
||||||
public static final String MAP_API = "AIzaSyAY14Ic32UP26Hg6GILznOfbBihiY5BUxw";
|
public static final String MAP_API = "AIzaSyAY14Ic32UP26Hg6GILznOfbBihiY5BUxw";
|
||||||
public static final String FORMAT_DATE="dd-MM-yyyy";
|
public static final String FORMAT_DATE="dd-MM-yyyy";
|
||||||
public static final String VALID_EMAIL_ADDRESS_REGEX = "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$";
|
public static final String VALID_EMAIL_ADDRESS_REGEX = "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$";
|
||||||
public static final String PHONE_CODE = "+84";
|
|
||||||
public static final String PASSWORD_PATTERN = "^(?=.*[0-9])(?=.*[A-Z])(?=.*[@#$%^&+=!_])(?=\\S+$).{4,}$";
|
public static final String PASSWORD_PATTERN = "^(?=.*[0-9])(?=.*[A-Z])(?=.*[@#$%^&+=!_])(?=\\S+$).{4,}$";
|
||||||
public static final String PHONE_PATTERN = "^0[98753]{1}\\d{8}$";
|
|
||||||
public static final String ERROR_CONNECT_SERVER = "Đã có lỗi kết nối đến hệ thống!";
|
public static final String ERROR_CONNECT_SERVER = "Đã có lỗi kết nối đến hệ thống!";
|
||||||
public static final List<Order> LIST_ORDER = new ArrayList<>();
|
|
||||||
public static final String SHIPPING_COMPLETED = "1";
|
|
||||||
public static final int REQUEST_CHECK_SETTINGS = 100;
|
public static final int REQUEST_CHECK_SETTINGS = 100;
|
||||||
public static final long UPDATE_INTERVAL_IN_MILLISECONDS = 10000;
|
public static final long UPDATE_INTERVAL_IN_MILLISECONDS = 10000;
|
||||||
public static final long FASTEST_UPDATE_IN_MILLISECONDS = 3000;
|
public static final long FASTEST_UPDATE_IN_MILLISECONDS = 3000;
|
||||||
public static final long MAX_WAIT_TIME_IN_MILLISECONDS = 1000;
|
public static final long MAX_WAIT_TIME_IN_MILLISECONDS = 1000;
|
||||||
public static final int LOCATION_REQUEST_CODE = 100;
|
|
||||||
public static final int LOCATION_SERVICE_ID = 175;
|
public static final int LOCATION_SERVICE_ID = 175;
|
||||||
public static final String ACTION_START_LOCATION_SERVICE = "startLocationService";
|
public static final String ACTION_START_LOCATION_SERVICE = "startLocationService";
|
||||||
public static final String ACTION_STOP_LOCATION_SERVICE = "stopLocationService";
|
public static final String ACTION_STOP_LOCATION_SERVICE = "stopLocationService";
|
||||||
@@ -75,4 +74,12 @@ public class Common {
|
|||||||
return fmt.format(price);
|
return fmt.format(price);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void notificationDialog(Activity activity, DialogStyle dialogStyle, DialogType dialogType, String title, String message){
|
||||||
|
new AestheticDialog.Builder(activity, dialogStyle, dialogType)
|
||||||
|
.setTitle(title)
|
||||||
|
.setMessage(message)
|
||||||
|
.setCancelable(true)
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -30,7 +30,7 @@ import retrofit2.Call;
|
|||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
public class ShippingFragment extends Fragment {
|
public class CancelOrder extends Fragment {
|
||||||
private static int CURRENT_PAGE = 0;
|
private static int CURRENT_PAGE = 0;
|
||||||
private static final int PAGE_SIZE = 8;
|
private static final int PAGE_SIZE = 8;
|
||||||
private static final String SORT_BY = "id";
|
private static final String SORT_BY = "id";
|
||||||
@@ -47,7 +47,7 @@ public class ShippingFragment extends Fragment {
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
View view = inflater.inflate(R.layout.fragment_waiting_order, container, false);
|
View view = inflater.inflate(R.layout.fragment_cancel, container, false);
|
||||||
|
|
||||||
//Init component
|
//Init component
|
||||||
recyclerView = view.findViewById(R.id.rcv_list_order);
|
recyclerView = view.findViewById(R.id.rcv_list_order);
|
||||||
@@ -47,7 +47,7 @@ public class CompletedOrder extends Fragment {
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
View view = inflater.inflate(R.layout.fragment_waiting_order, container, false);
|
View view = inflater.inflate(R.layout.fragment_confirmed_order, container, false);
|
||||||
|
|
||||||
//Init component
|
//Init component
|
||||||
recyclerView = view.findViewById(R.id.rcv_list_order);
|
recyclerView = view.findViewById(R.id.rcv_list_order);
|
||||||
@@ -80,7 +80,7 @@ public class CompletedOrder extends Fragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
swipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.primaryColor, null));
|
||||||
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
|
|||||||
+4
-9
@@ -24,14 +24,13 @@ import com.capstone.foodify.shipper.Model.Response.Orders;
|
|||||||
import com.capstone.foodify.shipper.R;
|
import com.capstone.foodify.shipper.R;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Currency;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
public class AwaitingOrder extends Fragment {
|
public class ConfirmedOrder extends Fragment {
|
||||||
private static int CURRENT_PAGE = 0;
|
private static int CURRENT_PAGE = 0;
|
||||||
private static final int PAGE_SIZE = 8;
|
private static final int PAGE_SIZE = 8;
|
||||||
private static final String SORT_BY = "id";
|
private static final String SORT_BY = "id";
|
||||||
@@ -48,7 +47,7 @@ public class AwaitingOrder extends Fragment {
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
View view = inflater.inflate(R.layout.fragment_waiting_order, container, false);
|
View view = inflater.inflate(R.layout.fragment_confirmed_order, container, false);
|
||||||
|
|
||||||
//Init component
|
//Init component
|
||||||
recyclerView = view.findViewById(R.id.rcv_list_order);
|
recyclerView = view.findViewById(R.id.rcv_list_order);
|
||||||
@@ -81,7 +80,7 @@ public class AwaitingOrder extends Fragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
swipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.primaryColor, null));
|
||||||
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
@@ -102,7 +101,7 @@ public class AwaitingOrder extends Fragment {
|
|||||||
|
|
||||||
private void getListOrder(){
|
private void getListOrder(){
|
||||||
if(Common.CURRENT_SHIPPER != null){
|
if(Common.CURRENT_SHIPPER != null){
|
||||||
FoodApiToken.apiService.getListOrder(Common.CURRENT_SHIPPER.getId(), "AWAITING", CURRENT_PAGE++, PAGE_SIZE, SORT_BY, SORT_DIR).enqueue(new Callback<Orders>() {
|
FoodApiToken.apiService.getListOrder(Common.CURRENT_SHIPPER.getId(), "CONFIRMED", CURRENT_PAGE++, PAGE_SIZE, SORT_BY, SORT_DIR).enqueue(new Callback<Orders>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<Orders> call, Response<Orders> response) {
|
public void onResponse(Call<Orders> call, Response<Orders> response) {
|
||||||
if(response.code() == 200){
|
if(response.code() == 200){
|
||||||
@@ -143,10 +142,6 @@ public class AwaitingOrder extends Fragment {
|
|||||||
end_of_list_text_view.setVisibility(View.VISIBLE);
|
end_of_list_text_view.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void defaultLayout(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dataLoadMore() {
|
private void dataLoadMore() {
|
||||||
if(!LAST_PAGE){
|
if(!LAST_PAGE){
|
||||||
getListOrder();
|
getListOrder();
|
||||||
+3
-3
@@ -15,9 +15,9 @@ public class OrderViewPagerAdapter extends FragmentStateAdapter {
|
|||||||
@Override
|
@Override
|
||||||
public Fragment createFragment(int position) {
|
public Fragment createFragment(int position) {
|
||||||
switch(position) {
|
switch(position) {
|
||||||
case 1: return new ShippingFragment();
|
case 1: return new CompletedOrder();
|
||||||
case 2: return new CompletedOrder();
|
case 2: return new CancelOrder();
|
||||||
default: return new AwaitingOrder();
|
default: return new ConfirmedOrder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.capstone.foodify.shipper.Fragment;
|
package com.capstone.foodify.shipper.Fragment;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.cardview.widget.CardView;
|
||||||
import androidx.core.widget.NestedScrollView;
|
import androidx.core.widget.NestedScrollView;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
@@ -12,12 +15,14 @@ import androidx.viewpager2.widget.ViewPager2;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.capstone.foodify.shipper.API.FoodApiToken;
|
import com.capstone.foodify.shipper.API.FoodApiToken;
|
||||||
import com.capstone.foodify.shipper.Activity.MainActivity;
|
import com.capstone.foodify.shipper.Activity.MainActivity;
|
||||||
|
import com.capstone.foodify.shipper.Activity.OrderDetailActivity;
|
||||||
import com.capstone.foodify.shipper.Adapter.OrderAdapter;
|
import com.capstone.foodify.shipper.Adapter.OrderAdapter;
|
||||||
import com.capstone.foodify.shipper.Common;
|
import com.capstone.foodify.shipper.Common;
|
||||||
import com.capstone.foodify.shipper.Fragment.Order.OrderViewPagerAdapter;
|
import com.capstone.foodify.shipper.Fragment.Order.OrderViewPagerAdapter;
|
||||||
@@ -27,6 +32,10 @@ import com.capstone.foodify.shipper.R;
|
|||||||
import com.capstone.foodify.shipper.ViewPagerAdapter;
|
import com.capstone.foodify.shipper.ViewPagerAdapter;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
|
import com.thecode.aestheticdialogs.AestheticDialog;
|
||||||
|
import com.thecode.aestheticdialogs.DialogStyle;
|
||||||
|
import com.thecode.aestheticdialogs.DialogType;
|
||||||
|
import com.thecode.aestheticdialogs.OnDialogClickListener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -39,7 +48,13 @@ public class OrderFragment extends Fragment {
|
|||||||
TabLayout tabLayout;
|
TabLayout tabLayout;
|
||||||
ViewPager2 viewPager2;
|
ViewPager2 viewPager2;
|
||||||
OrderViewPagerAdapter orderViewPagerAdapter;
|
OrderViewPagerAdapter orderViewPagerAdapter;
|
||||||
TextView welcome_text;
|
TextView welcome_text, order_tracking_number, user_name, phone, address, orderTime, total;
|
||||||
|
CardView card_view_order_shipping;
|
||||||
|
Order orderShipping;
|
||||||
|
LinearLayout order_shipping_layout;
|
||||||
|
private static final int PAGE_SIZE = 8;
|
||||||
|
private static final String SORT_BY = "id";
|
||||||
|
private static final String SORT_DIR = "asc";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
@@ -48,11 +63,14 @@ public class OrderFragment extends Fragment {
|
|||||||
View view = inflater.inflate(R.layout.fragment_order, container, false);
|
View view = inflater.inflate(R.layout.fragment_order, container, false);
|
||||||
|
|
||||||
//Init Component
|
//Init Component
|
||||||
welcome_text = view.findViewById(R.id.welcome_text);
|
initComponent(view);
|
||||||
|
|
||||||
|
welcome_text = view.findViewById(R.id.welcome_text);
|
||||||
tabLayout = view.findViewById(R.id.tab_layout);
|
tabLayout = view.findViewById(R.id.tab_layout);
|
||||||
viewPager2 = view.findViewById(R.id.view_pager);
|
viewPager2 = view.findViewById(R.id.view_pager);
|
||||||
|
|
||||||
|
getOrderShipping();
|
||||||
|
|
||||||
orderViewPagerAdapter = new OrderViewPagerAdapter(getActivity());
|
orderViewPagerAdapter = new OrderViewPagerAdapter(getActivity());
|
||||||
viewPager2.setAdapter(orderViewPagerAdapter);
|
viewPager2.setAdapter(orderViewPagerAdapter);
|
||||||
|
|
||||||
@@ -82,19 +100,107 @@ public class OrderFragment extends Fragment {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if(Common.CURRENT_USER != null){
|
if(Common.CURRENT_USER != null){
|
||||||
welcome_text.setText("Xin chào, " + Common.CURRENT_USER.getFullName() + "!");
|
setNameUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initComponent(View view) {
|
||||||
|
welcome_text = view.findViewById(R.id.welcome_text);
|
||||||
|
tabLayout = view.findViewById(R.id.tab_layout);
|
||||||
|
viewPager2 = view.findViewById(R.id.view_pager);
|
||||||
|
card_view_order_shipping = view.findViewById(R.id.card_view_order_shipping);
|
||||||
|
order_shipping_layout = view.findViewById(R.id.order_shipping_layout);
|
||||||
|
|
||||||
|
order_tracking_number = view.findViewById(R.id.order_tracking_number);
|
||||||
|
user_name = view.findViewById(R.id.user_name);
|
||||||
|
phone = view.findViewById(R.id.phone);
|
||||||
|
address = view.findViewById(R.id.address);
|
||||||
|
orderTime = view.findViewById(R.id.order_time);
|
||||||
|
total = view.findViewById(R.id.total);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getOrderShipping(){
|
||||||
|
if(Common.CURRENT_SHIPPER != null){
|
||||||
|
FoodApiToken.apiService.getListOrder(Common.CURRENT_SHIPPER.getId(), "SHIPPING", 0, PAGE_SIZE, SORT_BY, SORT_DIR).enqueue(new Callback<Orders>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<Orders> call, Response<Orders> response) {
|
||||||
|
if(response.code() == 200){
|
||||||
|
|
||||||
|
assert response.body() != null;
|
||||||
|
if(response.body().getOrders().size() == 1){
|
||||||
|
//Get order shipping
|
||||||
|
orderShipping = response.body().getOrders().get(0);
|
||||||
|
|
||||||
|
initData();
|
||||||
|
|
||||||
|
order_shipping_layout.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
order_shipping_layout.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getContext(), "Đã có lỗi hệ thống! Mã lỗi: " + response.code(), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<Orders> call, Throwable t) {
|
||||||
|
Toast.makeText(getContext(), Common.ERROR_CONNECT_SERVER, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initData() {
|
||||||
|
order_tracking_number.setText("Order Id: #" + orderShipping.getOrderTrackingNumber());
|
||||||
|
user_name.setText("Tên: " + orderShipping.getUser().getFullName());
|
||||||
|
phone.setText("Số điện thoại: " + orderShipping.getUser().getPhoneNumber());
|
||||||
|
address.setText("Địa chỉ: " + orderShipping.getAddress());
|
||||||
|
orderTime.setText("Thời gian đặt: " + orderShipping.getOrderTime());
|
||||||
|
total.setText("Tổng: " + Common.changeCurrencyUnit(orderShipping.getTotal()));
|
||||||
|
|
||||||
|
Activity activity = getActivity();
|
||||||
|
|
||||||
|
card_view_order_shipping.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
if(activity instanceof MainActivity){
|
||||||
|
if(((MainActivity)activity).checkPermission()){
|
||||||
|
Intent intent = new Intent(activity, OrderDetailActivity.class);
|
||||||
|
intent.putExtra("order", orderShipping);
|
||||||
|
activity.startActivity(intent);
|
||||||
|
} else {
|
||||||
|
new AestheticDialog.Builder(activity, DialogStyle.TOASTER, DialogType.WARNING)
|
||||||
|
.setTitle("THÔNG BÁO!")
|
||||||
|
.setMessage("Bạn cần cấp quyền vị trí cho ứng dụng để có thể tiếp tục!")
|
||||||
|
.setCancelable(false)
|
||||||
|
.setOnClickListener(new OnDialogClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(@NonNull AestheticDialog.Builder builder) {
|
||||||
|
builder.dismiss();
|
||||||
|
}
|
||||||
|
}).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setNameUser(){
|
||||||
|
String[] namePart = Common.CURRENT_USER.getFullName().split(" ");
|
||||||
|
|
||||||
|
welcome_text.setText("Xin chào, " + namePart[namePart.length - 1]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
//Update user name on textview
|
//Update user name on textview
|
||||||
welcome_text.setText("Xin chào, " + Common.CURRENT_USER.getFullName() + "!");
|
setNameUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.capstone.foodify.shipper.Fragment;
|
package com.capstone.foodify.shipper.Fragment;
|
||||||
|
|
||||||
|
import static com.capstone.foodify.shipper.Common.firebaseAppDistribution;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -27,7 +29,7 @@ import com.squareup.picasso.Picasso;
|
|||||||
|
|
||||||
public class ProfileFragment extends Fragment {
|
public class ProfileFragment extends Fragment {
|
||||||
EditText edt_birthday, edt_phone, edt_fullName, edt_email;
|
EditText edt_birthday, edt_phone, edt_fullName, edt_email;
|
||||||
LinearLayout changePasswordLayout, changeInformationLayout, logOutLayout;
|
LinearLayout changePasswordLayout, changeInformationLayout, logOutLayout, feed_back;
|
||||||
RoundedImageView profile_avatar;
|
RoundedImageView profile_avatar;
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
@@ -57,6 +59,13 @@ public class ProfileFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
feed_back.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!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
logOutLayout.setOnClickListener(new View.OnClickListener() {
|
logOutLayout.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@@ -77,6 +86,7 @@ public class ProfileFragment extends Fragment {
|
|||||||
changePasswordLayout = view.findViewById(R.id.change_password);
|
changePasswordLayout = view.findViewById(R.id.change_password);
|
||||||
changeInformationLayout = view.findViewById(R.id.change_information);
|
changeInformationLayout = view.findViewById(R.id.change_information);
|
||||||
logOutLayout = view.findViewById(R.id.log_out);
|
logOutLayout = view.findViewById(R.id.log_out);
|
||||||
|
feed_back = view.findViewById(R.id.feedback);
|
||||||
|
|
||||||
edt_phone = view.findViewById(R.id.edt_phone);
|
edt_phone = view.findViewById(R.id.edt_phone);
|
||||||
edt_birthday = view.findViewById(R.id.edt_birthDay);
|
edt_birthday = view.findViewById(R.id.edt_birthDay);
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.capstone.foodify.shipper;
|
||||||
|
|
||||||
|
import android.app.job.JobParameters;
|
||||||
|
import android.app.job.JobService;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.google.android.gms.tasks.OnCompleteListener;
|
||||||
|
import com.google.android.gms.tasks.Task;
|
||||||
|
import com.google.firebase.auth.GetTokenResult;
|
||||||
|
|
||||||
|
public class RefreshTokenService extends JobService {
|
||||||
|
|
||||||
|
private static final String TAG = "RefreshTokenService";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onStartJob(JobParameters params) {
|
||||||
|
|
||||||
|
Log.d(TAG, "Refresh token service started!");
|
||||||
|
|
||||||
|
refreshToken(params);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshToken(JobParameters params) {
|
||||||
|
|
||||||
|
if(Common.FIREBASE_USER != null){
|
||||||
|
Common.FIREBASE_USER.getIdToken(true).addOnCompleteListener(new OnCompleteListener<GetTokenResult>() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull Task<GetTokenResult> task) {
|
||||||
|
if(task.isSuccessful()){
|
||||||
|
Common.TOKEN = task.getResult().getToken();
|
||||||
|
|
||||||
|
Log.i(TAG, "Refresh token completed!");
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "Error when refresh token!");
|
||||||
|
}
|
||||||
|
|
||||||
|
jobFinished(params, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onStopJob(JobParameters params) {
|
||||||
|
|
||||||
|
Log.d(TAG, "Stop serviced!");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 583 B |
@@ -0,0 +1,119 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<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.ForgotPasswordActivity">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:clickable="false"
|
||||||
|
>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/back_image"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:src="@drawable/back_button"
|
||||||
|
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="90dp"
|
||||||
|
android:fontFamily="@font/bebas"
|
||||||
|
android:text="Quên mật khẩu?"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="50sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/back_image" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/forgot_Password_description"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Vui lòng nhập địa chỉ email vào ô dưới đây để tiến hành đặt lại mật khẩu của bạn."
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:textColor="@color/gray"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:layout_marginTop="25dp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textView"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/textInput_email"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:layout_marginBottom="40dp"
|
||||||
|
android:layout_marginTop="50dp"
|
||||||
|
android:hint="Email"
|
||||||
|
app:boxBackgroundColor="@color/white"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
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.button.MaterialButton
|
||||||
|
android:id="@+id/send_code_button"
|
||||||
|
style="@style/DefaultSolid"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/bebas"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:layout_marginStart="40dp"
|
||||||
|
android:layout_marginEnd="40dp"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:text="Gửi email"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textInput_email" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<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"
|
||||||
|
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>
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
android:fontFamily="@font/bebas"
|
android:fontFamily="@font/bebas"
|
||||||
android:textSize="35sp"
|
android:textSize="35sp"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:layout_marginTop="40dp"
|
android:layout_marginTop="30dp"
|
||||||
android:layout_marginEnd="15dp"
|
android:layout_marginEnd="15dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
android:id="@+id/textInput_email"
|
android:id="@+id/textInput_email"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="50dp"
|
||||||
android:layout_marginRight="20dp"
|
android:layout_marginRight="20dp"
|
||||||
android:layout_marginLeft="20dp"
|
android:layout_marginLeft="20dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
@@ -118,6 +118,19 @@
|
|||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txt_forgot_password"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:text="Quên mật khẩu?"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/textInput_password"
|
||||||
|
/>
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/sign_in_button"
|
android:id="@+id/sign_in_button"
|
||||||
android:text="Đăng nhập"
|
android:text="Đăng nhập"
|
||||||
@@ -125,7 +138,7 @@
|
|||||||
android:fontFamily="@font/bebas"
|
android:fontFamily="@font/bebas"
|
||||||
style="@style/DefaultSolid"
|
style="@style/DefaultSolid"
|
||||||
android:backgroundTint="@color/primaryColor"
|
android:backgroundTint="@color/primaryColor"
|
||||||
android:layout_marginTop="30dp"
|
android:layout_marginTop="80dp"
|
||||||
android:layout_marginStart="50dp"
|
android:layout_marginStart="50dp"
|
||||||
android:layout_marginEnd="50dp"
|
android:layout_marginEnd="50dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
+2
-3
@@ -1,11 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
tools:context=".Fragment.Order.CancelOrder"
|
||||||
tools:context=".Fragment.Order.AwaitingOrder"
|
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
tools:context=".Fragment.Order.AwaitingOrder"
|
tools:context=".Fragment.Order.ConfirmedOrder"
|
||||||
>
|
>
|
||||||
|
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
|
|||||||
+3
-2
@@ -1,10 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".Fragment.Order.ShippingFragment"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
tools:context=".Fragment.Order.ConfirmedOrder"
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
@@ -19,24 +19,158 @@
|
|||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:text="Xin chào, Nguyễn Văn A!"
|
android:text="Xin chào, Nguyễn Văn A!"
|
||||||
android:layout_marginTop="30dp"
|
android:layout_marginTop="30dp"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="15dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/welcome_text"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:id="@+id/order_shipping_layout"
|
||||||
|
android:visibility="gone"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:text="Đơn hàng đang giao"
|
||||||
|
android:fontFamily="@font/bebas"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardElevation="5dp"
|
||||||
|
app:cardUseCompatPadding="true"
|
||||||
|
app:cardCornerRadius="10dp"
|
||||||
|
android:id="@+id/card_view_order_shipping"
|
||||||
|
>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:layout_weight="0.9"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/order_tracking_number"
|
||||||
|
android:text="Order #123456789"
|
||||||
|
android:fontFamily="@font/bebas"
|
||||||
|
android:textColor="@color/primaryColor"
|
||||||
|
android:textSize="23sp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/user_name"
|
||||||
|
android:text="Tên: Nguyễn Văn A"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/order_tracking_number"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/phone"
|
||||||
|
android:text="Số điện thoại: 0987654321"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/user_name"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/address"
|
||||||
|
android:text="Địa chỉ nhận hàng: Hẻm 215, đường Phạm Như Xương, phường Hoà Khánh Nam, quận Liên Chiểu"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/phone"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/order_time"
|
||||||
|
android:text="Thời gian đặt: 14:05 02/02/2023"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:textStyle="italic"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/address"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/total"
|
||||||
|
android:text="Tổng đơn hàng: 1.200.000"
|
||||||
|
android:textSize="17sp"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/order_time"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
/>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:src="@drawable/back_button"
|
||||||
|
android:rotation="180"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.1"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView2"
|
android:id="@+id/textView2"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:fontFamily="@font/bebas"
|
android:fontFamily="@font/bebas"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:text="Danh sách các đơn hàng"
|
android:text="Danh sách các đơn hàng"
|
||||||
android:layout_marginTop="30dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="15dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toBottomOf="@id/welcome_text"
|
app:layout_constraintTop_toBottomOf="@id/order_shipping_layout"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -66,17 +200,17 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabItem
|
<com.google.android.material.tabs.TabItem
|
||||||
android:text="CẦN GIAO"
|
android:text="Cần giao"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabItem
|
<com.google.android.material.tabs.TabItem
|
||||||
android:text="ĐANG GIAO"
|
android:text="Đã giao"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabItem
|
<com.google.android.material.tabs.TabItem
|
||||||
android:text="ĐÃ GIAO"
|
android:text="Đơn huỷ"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
</com.google.android.material.tabs.TabLayout>
|
</com.google.android.material.tabs.TabLayout>
|
||||||
|
|||||||
@@ -225,6 +225,50 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/feedback"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/change_information"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ic_feedback"
|
||||||
|
android:src="@drawable/feedback"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
tools:ignore="ContentDescription"
|
||||||
|
app:tint="@color/primaryColor"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:fontFamily="@font/opensans"
|
||||||
|
android:text="Đóng góp ý kiến"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="18sp"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:rotation="180"
|
||||||
|
android:src="@drawable/back_button"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/log_out"
|
android:id="@+id/log_out"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -234,7 +278,7 @@
|
|||||||
android:layout_marginEnd="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/change_information"
|
app:layout_constraintTop_toBottomOf="@id/feedback"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
<color name="primaryColor">#53BBFF</color>
|
<color name="primaryColor">#53BBFF</color>
|
||||||
<color name="primaryDarkColor">#CF2E33</color>
|
<color name="primaryDarkColor">#CF2E33</color>
|
||||||
|
<color name="primaryLightColor">#78CAFF</color>
|
||||||
<color name="gray">#A3A3A3</color>
|
<color name="gray">#A3A3A3</color>
|
||||||
<color name="secondary">#F99928</color>
|
<color name="secondary">#F99928</color>
|
||||||
<color name="grayLight">#ACA5A5</color>
|
<color name="grayLight">#ACA5A5</color>
|
||||||
|
|||||||
Reference in New Issue
Block a user