Improve UI

This commit is contained in:
Nezumi
2023-03-24 16:01:56 +07:00
parent a05fc3a5b2
commit f4401ef646
5 changed files with 366 additions and 353 deletions
@@ -29,7 +29,7 @@ public interface FoodApi {
Gson gson = new GsonBuilder().setDateFormat("HH:mm:ss dd-MM-yyyy").setLenient().create(); Gson gson = new GsonBuilder().setDateFormat("HH:mm:ss dd-MM-yyyy").setLenient().create();
FoodApi apiService = new Retrofit.Builder() FoodApi apiService = new Retrofit.Builder()
.baseUrl("http://192.168.1.183:8080/api/").addConverterFactory(GsonConverterFactory.create(gson)) .baseUrl("https://foodify-backend-production.up.railway.app/api/").addConverterFactory(GsonConverterFactory.create(gson))
.build() .build()
.create(FoodApi.class); .create(FoodApi.class);
@@ -46,7 +46,7 @@ public interface FoodApiToken {
FoodApiToken apiService = new Retrofit.Builder() FoodApiToken apiService = new Retrofit.Builder()
.client(client) .client(client)
.baseUrl("http://192.168.1.183:8080/api/").addConverterFactory(GsonConverterFactory.create(gson)) .baseUrl("https://foodify-backend-production.up.railway.app/api/").addConverterFactory(GsonConverterFactory.create(gson))
.build() .build()
.create(FoodApiToken.class); .create(FoodApiToken.class);
@@ -197,8 +197,6 @@ public class OrderCheckOutActivity extends AppCompatActivity {
disableAllInputAddressOption(); disableAllInputAddressOption();
getDistanceAndCalculateShipCost(finalAddress); getDistanceAndCalculateShipCost(finalAddress);
progress_layout.setVisibility(View.GONE);
} }
} }
}); });
@@ -221,6 +219,7 @@ public class OrderCheckOutActivity extends AppCompatActivity {
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
@Override @Override
public void onClick(View v) { public void onClick(View v) {
progress_layout.setVisibility(View.VISIBLE);
//Check address is null or not //Check address is null or not
if(finalAddress != null){ if(finalAddress != null){
@@ -255,6 +254,8 @@ public class OrderCheckOutActivity extends AppCompatActivity {
} }
}) })
.show(); .show();
progress_layout.setVisibility(View.GONE);
} }
}); });
@@ -267,6 +268,7 @@ public class OrderCheckOutActivity extends AppCompatActivity {
.setMessage("Huỷ thanh toán thành công!") .setMessage("Huỷ thanh toán thành công!")
.setCancelable(true) .setCancelable(true)
.show(); .show();
progress_layout.setVisibility(View.GONE);
} }
@Override @Override
@@ -284,6 +286,7 @@ public class OrderCheckOutActivity extends AppCompatActivity {
} }
}) })
.show(); .show();
progress_layout.setVisibility(View.GONE);
} }
}); });
} }
@@ -293,6 +296,7 @@ public class OrderCheckOutActivity extends AppCompatActivity {
} }
} else { } else {
Toast.makeText(OrderCheckOutActivity.this, "Bạn chưa chọn địa chỉ!", Toast.LENGTH_SHORT).show(); Toast.makeText(OrderCheckOutActivity.this, "Bạn chưa chọn địa chỉ!", Toast.LENGTH_SHORT).show();
progress_layout.setVisibility(View.GONE);
} }
} }
}); });
@@ -362,24 +362,22 @@ public class SignUpActivity extends AppCompatActivity {
loadCompleted(); loadCompleted();
showError(e.toString()); showError(e.toString());
} }
}) })
.build(); .build();
PhoneAuthProvider.verifyPhoneNumber(options); PhoneAuthProvider.verifyPhoneNumber(options);
// [END auth_test_phone_verify] // [END auth_test_phone_verify]
} }
private void showError(String msg){ private void showError(String msg){
errorText.setText(msg); errorText.setText(msg);
} }
private void loading(){ private void loading(){
progressLayout.setVisibility(View.VISIBLE); progressLayout.setVisibility(View.VISIBLE);
signUpButton.setEnabled(false);
} }
private void loadCompleted() { private void loadCompleted() {
progressLayout.setVisibility(View.GONE); progressLayout.setVisibility(View.GONE);
signUpButton.setEnabled(true);
} }
private void getListDistrict() { private void getListDistrict() {
+16 -5
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView <androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
@@ -7,6 +7,15 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".Activity.SignUpActivity"> tools:context=".Activity.SignUpActivity">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:clickable="false"
>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@@ -333,13 +342,17 @@
</LinearLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#80000000" android:background="#80000000"
android:id="@+id/progress_layout" android:id="@+id/progress_layout"
android:visibility="gone" android:clickable="true"
android:visibility="visible"
> >
<ProgressBar <ProgressBar
@@ -355,6 +368,4 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>