mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-22 13:38:41 +00:00
Show rating bar food and list comment user
This commit is contained in:
Generated
+1
-1
@@ -7,7 +7,7 @@
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="JDK" />
|
||||
<option name="gradleJvm" value="jbr-17" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
||||
Generated
+2
-1
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17_PREVIEW" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.capstone.foodify.API;
|
||||
import com.capstone.foodify.Model.Category;
|
||||
import com.capstone.foodify.Model.DistrictWardResponse;
|
||||
import com.capstone.foodify.Model.Food;
|
||||
import com.capstone.foodify.Model.Response.Comments;
|
||||
import com.capstone.foodify.Model.Response.CustomResponse;
|
||||
import com.capstone.foodify.Model.Response.Foods;
|
||||
import com.capstone.foodify.Model.Response.Shops;
|
||||
@@ -29,7 +30,7 @@ public interface FoodApi {
|
||||
Gson gson = new GsonBuilder().setDateFormat("HH:mm:ss dd-MM-yyyy").setLenient().create();
|
||||
|
||||
FoodApi apiService = new Retrofit.Builder()
|
||||
.baseUrl("https://foodify-backend-production.up.railway.app/api/").addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.baseUrl("http://192.168.1.183:8080/api/").addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build()
|
||||
.create(FoodApi.class);
|
||||
|
||||
@@ -78,4 +79,7 @@ public interface FoodApi {
|
||||
|
||||
@POST("auth/check")
|
||||
Call<CustomResponse> checkEmailOrPhoneExist (@Body User user);
|
||||
|
||||
@GET("products/{productId}/comments")
|
||||
Call<Comments> getCommentByProductId(@Path("productId") int productId, @Query("pageNo") int pageNo, @Query("pageSize") int pageSize, @Query("sortBy") String sortBy, @Query("sortDir") String sortDir);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import com.capstone.foodify.Model.Address;
|
||||
import com.capstone.foodify.Model.Food;
|
||||
import com.capstone.foodify.Model.Order;
|
||||
import com.capstone.foodify.Model.Response.Addresses;
|
||||
import com.capstone.foodify.Model.Response.Comments;
|
||||
import com.capstone.foodify.Model.Response.CustomResponse;
|
||||
import com.capstone.foodify.Model.Response.Foods;
|
||||
import com.capstone.foodify.Model.User;
|
||||
@@ -46,7 +48,7 @@ public interface FoodApiToken {
|
||||
|
||||
FoodApiToken apiService = new Retrofit.Builder()
|
||||
.client(client)
|
||||
.baseUrl("https://foodify-backend-production.up.railway.app/api/").addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.baseUrl("http://192.168.1.183:8080/api/").addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build()
|
||||
.create(FoodApiToken.class);
|
||||
|
||||
@@ -77,4 +79,7 @@ public interface FoodApiToken {
|
||||
|
||||
@DELETE("users/{userId}/addresses/{addressId}")
|
||||
Call<CustomResponse> deleteAddressUser(@Path("userId") int userId, @Path("addressId") int addressId);
|
||||
|
||||
@POST("user/{userId}/orders")
|
||||
Call<Order> createOrder(@Path("userId") int userId, @Body Order order);
|
||||
}
|
||||
|
||||
@@ -13,23 +13,27 @@ import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.capstone.foodify.API.FoodApi;
|
||||
import com.capstone.foodify.API.FoodApiToken;
|
||||
import com.capstone.foodify.Adapter.ReviewAdapter;
|
||||
import com.capstone.foodify.Adapter.CommentAdapter;
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.Model.Basket;
|
||||
import com.capstone.foodify.Model.Food;
|
||||
import com.capstone.foodify.Model.Image;
|
||||
import com.capstone.foodify.Model.Response.Comments;
|
||||
import com.capstone.foodify.Model.Response.CustomResponse;
|
||||
import com.capstone.foodify.Model.Review;
|
||||
import com.capstone.foodify.Model.Comment;
|
||||
import com.capstone.foodify.R;
|
||||
import com.denzcoskun.imageslider.ImageSlider;
|
||||
import com.denzcoskun.imageslider.constants.ScaleTypes;
|
||||
@@ -38,6 +42,7 @@ import com.mcdev.quantitizerlibrary.AnimationStyle;
|
||||
import com.mcdev.quantitizerlibrary.HorizontalQuantitizer;
|
||||
import com.mcdev.quantitizerlibrary.QuantitizerListener;
|
||||
import com.willy.ratingbar.RotationRatingBar;
|
||||
import com.willy.ratingbar.ScaleRatingBar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -47,20 +52,27 @@ import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class FoodDetailActivity extends AppCompatActivity {
|
||||
|
||||
private static int CURRENT_PAGE = 0;
|
||||
private static final int PAGE_SIZE = 8;
|
||||
private static final String SORT_BY = "id";
|
||||
private static final String SORT_DIR = "asc";
|
||||
private static boolean LAST_PAGE;
|
||||
private HorizontalQuantitizer horizontalQuantitizer;
|
||||
private ImageSlider imageSlider;
|
||||
private ImageView back_image, not_favorite, is_favorite;
|
||||
private String foodId = "";
|
||||
private Food food;
|
||||
private TextView foodName_txt, shopName_txt, discount_txt, price_txt, countRating_txt, description_content_txt;
|
||||
private TextView foodName_txt, shopName_txt, discount_txt, price_txt, countRating_txt, description_content_txt, endOfListText;
|
||||
private ConstraintLayout content_view;
|
||||
private Button add_to_basket_button;
|
||||
private float totalPrice, price;
|
||||
private RecyclerView recyclerView_review;
|
||||
private ReviewAdapter reviewAdapter;
|
||||
private RecyclerView recyclerView_comment;
|
||||
private CommentAdapter commentAdapter;
|
||||
private Button rating_button;
|
||||
private ScaleRatingBar ratingBar;
|
||||
private ConstraintLayout progressLayout;
|
||||
private NestedScrollView nestedScrollView;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -81,18 +93,26 @@ public class FoodDetailActivity extends AppCompatActivity {
|
||||
is_favorite = findViewById(R.id.is_favorite);
|
||||
countRating_txt = findViewById(R.id.count_rating_text_view);
|
||||
description_content_txt = findViewById(R.id.content_description_text_view);
|
||||
recyclerView_review = findViewById(R.id.recycler_view_review);
|
||||
recyclerView_comment = findViewById(R.id.recycler_view_comment);
|
||||
rating_button = findViewById(R.id.rating_button);
|
||||
content_view = findViewById(R.id.content_view);
|
||||
progressLayout = findViewById(R.id.progress_layout);
|
||||
nestedScrollView = findViewById(R.id.food_detail);
|
||||
endOfListText = findViewById(R.id.end_of_list_text);
|
||||
progressBar = findViewById(R.id.progress_bar);
|
||||
ratingBar = findViewById(R.id.rating_bar);
|
||||
|
||||
reviewAdapter = new ReviewAdapter(this);
|
||||
commentAdapter = new CommentAdapter(this);
|
||||
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, RecyclerView.VERTICAL, false);
|
||||
recyclerView_review.setLayoutManager(linearLayoutManager);
|
||||
recyclerView_comment.setLayoutManager(linearLayoutManager);
|
||||
|
||||
reviewAdapter.setData(getListReview());
|
||||
recyclerView_review.setAdapter(reviewAdapter);
|
||||
//Get data
|
||||
if (getIntent() != null)
|
||||
foodId = getIntent().getStringExtra("FoodId");
|
||||
|
||||
commentAdapter.setData(getListComment(0));
|
||||
recyclerView_comment.setAdapter(commentAdapter);
|
||||
|
||||
|
||||
hideUI();
|
||||
@@ -127,10 +147,6 @@ public class FoodDetailActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
//Get data
|
||||
if (getIntent() != null)
|
||||
foodId = getIntent().getStringExtra("FoodId");
|
||||
|
||||
getFoodById(foodId);
|
||||
|
||||
//Turn previous action when click
|
||||
@@ -141,11 +157,11 @@ public class FoodDetailActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
//Open dialog review
|
||||
//Open dialog comment
|
||||
rating_button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
openReviewDialog(Gravity.CENTER);
|
||||
openCommentDialog(Gravity.CENTER);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -180,6 +196,19 @@ public class FoodDetailActivity extends AppCompatActivity {
|
||||
removeFavoriteFood();
|
||||
}
|
||||
});
|
||||
|
||||
//Set event when user scroll down
|
||||
if (nestedScrollView != null) {
|
||||
nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
|
||||
@Override
|
||||
public void onScrollChange(@NonNull NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
|
||||
if (scrollY == (v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight())) {
|
||||
//When user scroll to bottom, load more data
|
||||
dataLoadMore();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void isFavoriteIcon(){
|
||||
@@ -261,16 +290,40 @@ public class FoodDetailActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private List<Review> getListReview() {
|
||||
ArrayList<Review> listReview = new ArrayList<>();
|
||||
private List<Comment> getListComment(int page) {
|
||||
ArrayList<Comment> listComment = new ArrayList<>();
|
||||
|
||||
listReview.add(new Review("User A", 5, "Very Good!"));
|
||||
listReview.add(new Review("User B", 1, "Bad!"));
|
||||
listReview.add(new Review("User C", 4, "Delicious!"));
|
||||
listReview.add(new Review("User D", 3, "OK!"));
|
||||
listReview.add(new Review("User E", 5, "Awesome!"));
|
||||
FoodApi.apiService.getCommentByProductId(Integer.parseInt(foodId), page, PAGE_SIZE, SORT_BY, SORT_DIR).enqueue(new Callback<Comments>() {
|
||||
@Override
|
||||
public void onResponse(Call<Comments> call, Response<Comments> response) {
|
||||
if(response.code() == 200){
|
||||
List<Comment> tempCommentList = response.body().getComments();
|
||||
|
||||
return listReview;
|
||||
//Init data
|
||||
listComment.addAll(tempCommentList);
|
||||
LAST_PAGE = response.body().getPage().isLast();
|
||||
|
||||
if(LAST_PAGE){
|
||||
progressBar.setVisibility(View.GONE);
|
||||
endOfListText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if(listComment.size() == 0)
|
||||
endOfListText.setVisibility(View.GONE);
|
||||
|
||||
commentAdapter.notifyDataSetChanged();
|
||||
} else {
|
||||
Toast.makeText(FoodDetailActivity.this, "Mã lỗi: " + response.code(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<Comments> call, Throwable t) {
|
||||
Toast.makeText(FoodDetailActivity.this, "Đã có lỗi từ hệ thống!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
return listComment;
|
||||
}
|
||||
|
||||
private void hideUI() {
|
||||
@@ -288,7 +341,14 @@ public class FoodDetailActivity extends AppCompatActivity {
|
||||
foodName_txt.setText(food.getName());
|
||||
shopName_txt.setText(food.getShop().getName());
|
||||
description_content_txt.setText(food.getDescription());
|
||||
countRating_txt.setText(food.getReviewCount() + " rating");
|
||||
ratingBar.setRating(food.getAverageRating());
|
||||
|
||||
if(food.getCommentCount() == null || Integer.parseInt(food.getCommentCount()) == 0){
|
||||
countRating_txt.setText("Chưa có bình luận nào!");
|
||||
} else {
|
||||
countRating_txt.setText(food.getCommentCount() + " rating");
|
||||
}
|
||||
|
||||
|
||||
add_to_basket_button.setText("ADD TO BASKET - " + Common.changeCurrencyUnit(0));
|
||||
|
||||
@@ -371,10 +431,10 @@ public class FoodDetailActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void openReviewDialog(int gravity){
|
||||
private void openCommentDialog(int gravity){
|
||||
final Dialog dialog = new Dialog(this);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setContentView(R.layout.dialog_review);
|
||||
dialog.setContentView(R.layout.dialog_comment);
|
||||
|
||||
Window window = dialog.getWindow();
|
||||
if(window == null)
|
||||
@@ -393,7 +453,7 @@ public class FoodDetailActivity extends AppCompatActivity {
|
||||
dialog.setCancelable(false);
|
||||
}
|
||||
|
||||
EditText review_content = dialog.findViewById(R.id.edit_text_review);
|
||||
EditText comment_content = dialog.findViewById(R.id.edit_text_comment);
|
||||
RotationRatingBar ratingBar = dialog.findViewById(R.id.rating_bar);
|
||||
Button confirm = dialog.findViewById(R.id.confirm_button);
|
||||
Button cancel = dialog.findViewById(R.id.cancel_button);
|
||||
@@ -405,8 +465,17 @@ public class FoodDetailActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
//TODO: Update review dialog
|
||||
//TODO: Update comment dialog
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void dataLoadMore() {
|
||||
if(!LAST_PAGE){
|
||||
getListComment(++CURRENT_PAGE);
|
||||
} else {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
endOfListText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,16 +32,19 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.capstone.foodify.API.FoodApi;
|
||||
import com.capstone.foodify.API.FoodApiToken;
|
||||
import com.capstone.foodify.API.GoogleMapApi;
|
||||
import com.capstone.foodify.Adapter.OrderDetailAdapter;
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.Model.Address;
|
||||
import com.capstone.foodify.Model.DistrictWardResponse;
|
||||
import com.capstone.foodify.Model.GoogleMap.GoogleMapResponse;
|
||||
import com.capstone.foodify.Model.Order;
|
||||
import com.capstone.foodify.R;
|
||||
import com.capstone.foodify.ZaloPay.Api.CreateOrder;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
import com.thecode.aestheticdialogs.AestheticDialog;
|
||||
import com.thecode.aestheticdialogs.DialogStyle;
|
||||
import com.thecode.aestheticdialogs.DialogType;
|
||||
@@ -118,6 +121,9 @@ public class OrderCheckOutActivity extends AppCompatActivity {
|
||||
txt_ship_cost = findViewById(R.id.txt_ship_cost);
|
||||
btn_ZaloPay = findViewById(R.id.btnZaloPay);
|
||||
|
||||
//Reload user data
|
||||
Common.reloadUser(this);
|
||||
|
||||
|
||||
if(getIntent() != null){
|
||||
total = getIntent().getFloatExtra("total", 0);
|
||||
@@ -187,6 +193,11 @@ public class OrderCheckOutActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
if(radio_button_selected == take_food_from_shop){
|
||||
//Action 4
|
||||
finalAddress = "Đến shop lấy";
|
||||
}
|
||||
|
||||
if(finalAddress == null){
|
||||
Toast.makeText(OrderCheckOutActivity.this, "Bạn chưa chọn địa chỉ!", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
@@ -221,86 +232,118 @@ public class OrderCheckOutActivity extends AppCompatActivity {
|
||||
public void onClick(View v) {
|
||||
progress_layout.setVisibility(View.VISIBLE);
|
||||
|
||||
//Check address is null or not
|
||||
if(finalAddress != null){
|
||||
|
||||
CreateOrder orderApi = new CreateOrder();
|
||||
if(!Common.CURRENT_USER.isLocked()){
|
||||
//Create order
|
||||
|
||||
try {
|
||||
JSONObject data = orderApi.createOrder(String.valueOf((int) total));
|
||||
String code = data.getString("return_code");
|
||||
//Check address is null or not
|
||||
if(finalAddress != null){
|
||||
|
||||
CreateOrder orderApi = new CreateOrder();
|
||||
|
||||
try {
|
||||
JSONObject data = orderApi.createOrder(String.valueOf((int) total));
|
||||
String code = data.getString("return_code");
|
||||
|
||||
|
||||
if (code.equals("1")) {
|
||||
//Success create order
|
||||
String token = data.getString("zp_trans_token");
|
||||
if (code.equals("1")) {
|
||||
//Success create order
|
||||
String token = data.getString("zp_trans_token");
|
||||
|
||||
ZaloPaySDK.getInstance().payOrder(OrderCheckOutActivity.this, token, "demozpdk://app", new PayOrderListener() {
|
||||
@Override
|
||||
public void onPaymentSucceeded(final String transactionId, final String transToken, final String appTransID) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new AestheticDialog.Builder(OrderCheckOutActivity.this, DialogStyle.FLAT, DialogType.SUCCESS)
|
||||
.setTitle("Thành công!")
|
||||
.setMessage("Bạn đã thanh toán thành công cho đơn hàng #" + transactionId)
|
||||
.setCancelable(true)
|
||||
.setOnClickListener(new OnDialogClickListener() {
|
||||
@Override
|
||||
public void onClick(@NonNull AestheticDialog.Builder builder) {
|
||||
Common.LIST_BASKET_FOOD.clear();
|
||||
startActivity(new Intent(OrderCheckOutActivity.this, MainActivity.class));
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
ZaloPaySDK.getInstance().payOrder(OrderCheckOutActivity.this, token, "demozpdk://app", new PayOrderListener() {
|
||||
@Override
|
||||
public void onPaymentSucceeded(final String transactionId, final String transToken, final String appTransID) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new AestheticDialog.Builder(OrderCheckOutActivity.this, DialogStyle.FLAT, DialogType.SUCCESS)
|
||||
.setTitle("Thành công!")
|
||||
.setMessage("Bạn đã thanh toán thành công cho đơn hàng #" + transactionId)
|
||||
.setCancelable(true)
|
||||
.setOnClickListener(new OnDialogClickListener() {
|
||||
@Override
|
||||
public void onClick(@NonNull AestheticDialog.Builder builder) {
|
||||
|
||||
progress_layout.setVisibility(View.GONE);
|
||||
}
|
||||
createOrderFood(transactionId);
|
||||
|
||||
});
|
||||
}
|
||||
Common.LIST_BASKET_FOOD.clear();
|
||||
startActivity(new Intent(OrderCheckOutActivity.this, MainActivity.class));
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
|
||||
@Override
|
||||
public void onPaymentCanceled(String zpTransToken, String appTransID) {
|
||||
new AestheticDialog.Builder(OrderCheckOutActivity.this, DialogStyle.RAINBOW, DialogType.INFO)
|
||||
.setTitle("Thông báo!")
|
||||
.setMessage("Huỷ thanh toán thành công!")
|
||||
.setCancelable(true)
|
||||
.show();
|
||||
progress_layout.setVisibility(View.GONE);
|
||||
}
|
||||
progress_layout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPaymentError(ZaloPayError zaloPayError, String zpTransToken, String appTransID) {
|
||||
new AestheticDialog.Builder(OrderCheckOutActivity.this, DialogStyle.FLAT, DialogType.ERROR)
|
||||
.setTitle("Thanh toán chưa thành công!")
|
||||
.setMessage("Xin vui lòng thử lại!")
|
||||
.setCancelable(true)
|
||||
.setOnClickListener(new OnDialogClickListener() {
|
||||
@Override
|
||||
public void onClick(@NonNull AestheticDialog.Builder builder) {
|
||||
startActivity(new Intent(OrderCheckOutActivity.this, MainActivity.class));
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
progress_layout.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPaymentCanceled(String zpTransToken, String appTransID) {
|
||||
new AestheticDialog.Builder(OrderCheckOutActivity.this, DialogStyle.RAINBOW, DialogType.INFO)
|
||||
.setTitle("Thông báo!")
|
||||
.setMessage("Huỷ thanh toán thành công!")
|
||||
.setCancelable(true)
|
||||
.show();
|
||||
progress_layout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPaymentError(ZaloPayError zaloPayError, String zpTransToken, String appTransID) {
|
||||
new AestheticDialog.Builder(OrderCheckOutActivity.this, DialogStyle.FLAT, DialogType.ERROR)
|
||||
.setTitle("Thanh toán chưa thành công!")
|
||||
.setMessage("Xin vui lòng thử lại!")
|
||||
.setCancelable(true)
|
||||
.setOnClickListener(new OnDialogClickListener() {
|
||||
@Override
|
||||
public void onClick(@NonNull AestheticDialog.Builder builder) {
|
||||
startActivity(new Intent(OrderCheckOutActivity.this, MainActivity.class));
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
progress_layout.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} else {
|
||||
Toast.makeText(OrderCheckOutActivity.this, "Bạn chưa chọn địa chỉ!", Toast.LENGTH_SHORT).show();
|
||||
progress_layout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
} else {
|
||||
Toast.makeText(OrderCheckOutActivity.this, "Bạn chưa chọn địa chỉ!", Toast.LENGTH_SHORT).show();
|
||||
progress_layout.setVisibility(View.GONE);
|
||||
//Show notification account locked
|
||||
FirebaseAuth.getInstance().signOut();
|
||||
Common.showErrorServerNotification(OrderCheckOutActivity.this, "Tài khoản của bạn đã bị khoá!");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void createOrderFood(String transactionId) {
|
||||
|
||||
// //Create order object
|
||||
// Order order = new Order(transactionId, "");
|
||||
//
|
||||
// FoodApiToken.apiService.createOrder(Common.CURRENT_USER.getId()).enqueue(new Callback<Order>() {
|
||||
// @Override
|
||||
// public void onResponse(Call<Order> call, Response<Order> response) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFailure(Call<Order> call, Throwable t) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
private void getDistanceAndCalculateShipCost(String address) {
|
||||
//Get location from address
|
||||
|
||||
@@ -525,6 +568,9 @@ public class OrderCheckOutActivity extends AppCompatActivity {
|
||||
manual_input_address_layout.setVisibility(View.GONE);
|
||||
spn_list_address.setVisibility(View.GONE);
|
||||
edt_address_detect.setVisibility(View.GONE);
|
||||
|
||||
//Reset address;
|
||||
finalAddress = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,21 +164,33 @@ public class SignInActivity extends AppCompatActivity {
|
||||
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) {
|
||||
User userData = response.body();
|
||||
if(userData != null){
|
||||
Common.CURRENT_USER = userData;
|
||||
if(response.code() == 200){
|
||||
User userData = response.body();
|
||||
if(userData != null){
|
||||
|
||||
//Check user is lock or not
|
||||
if(!userData.isLocked()){
|
||||
|
||||
Common.CURRENT_USER = userData;
|
||||
|
||||
//Dismiss progress bar
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
|
||||
startActivity(new Intent(SignInActivity.this, MainActivity.class));
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Dismiss progress bar
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
|
||||
startActivity(new Intent(SignInActivity.this, MainActivity.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -163,16 +163,7 @@ public class SignUpActivity extends AppCompatActivity {
|
||||
|
||||
private void checkEmailOrPhoneExist(){
|
||||
//Create user object
|
||||
User user = new User();
|
||||
user.setAddress(new Address(address, ward, district));
|
||||
user.setDateOfBirth(dateOfBirth);
|
||||
user.setEmail(email);
|
||||
user.setFullName(name);
|
||||
user.setIdentifiedCode(identifiedCode);
|
||||
user.setImageUrl("");
|
||||
user.setLocked(false);
|
||||
user.setPhoneNumber(phone);
|
||||
user.setRoleName("ROLE_USER");
|
||||
User user = new User(new Address(address, ward, district), dateOfBirth, email, name, identifiedCode, phone);
|
||||
|
||||
FoodApi.apiService.checkEmailOrPhoneExist(user).enqueue(new Callback<CustomResponse>() {
|
||||
@Override
|
||||
|
||||
@@ -251,6 +251,7 @@ public class VerifyAccountActivity extends AppCompatActivity {
|
||||
startActivity(new Intent(VerifyAccountActivity.this, SignInActivity.class));
|
||||
finish();
|
||||
} else {
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
Toast.makeText(VerifyAccountActivity.this, "Lỗi hệ thống! Code: " + response.code(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
+18
-18
@@ -9,55 +9,55 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.capstone.foodify.Model.Review;
|
||||
import com.capstone.foodify.Model.Comment;
|
||||
import com.capstone.foodify.R;
|
||||
import com.willy.ratingbar.ScaleRatingBar;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ReviewAdapter extends RecyclerView.Adapter<ReviewAdapter.ReviewViewHolder> {
|
||||
public class CommentAdapter extends RecyclerView.Adapter<CommentAdapter.CommentViewHolder> {
|
||||
|
||||
private List<Review> listReview;
|
||||
private List<Comment> listComment;
|
||||
private Context context;
|
||||
|
||||
public ReviewAdapter(Context context) {
|
||||
public CommentAdapter(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void setData(List<Review> listReview){
|
||||
this.listReview = listReview;
|
||||
public void setData(List<Comment> listComment){
|
||||
this.listComment = listComment;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ReviewViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_review, parent, false);
|
||||
return new ReviewViewHolder(view);
|
||||
public CommentViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_comment, parent, false);
|
||||
return new CommentViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ReviewViewHolder holder, int position) {
|
||||
Review review = listReview.get(position);
|
||||
public void onBindViewHolder(@NonNull CommentViewHolder holder, int position) {
|
||||
Comment comment = listComment.get(position);
|
||||
|
||||
holder.name.setText(review.getName());
|
||||
holder.ratingScore.setRating(review.getRatingScore());
|
||||
holder.content.setText(review.getContent());
|
||||
holder.name.setText(comment.getUser().getFullName());
|
||||
holder.ratingScore.setRating(comment.getRating());
|
||||
holder.content.setText(comment.getContent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if(listReview != null)
|
||||
return listReview.size();
|
||||
if(listComment != null)
|
||||
return listComment.size();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public class ReviewViewHolder extends RecyclerView.ViewHolder{
|
||||
public class CommentViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
private TextView name, content;
|
||||
private ScaleRatingBar ratingScore;
|
||||
|
||||
public ReviewViewHolder(@NonNull View itemView) {
|
||||
public CommentViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
|
||||
name = itemView.findViewById(R.id.user_name_text_view);
|
||||
@@ -7,12 +7,14 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.capstone.foodify.Activity.FoodDetailActivity;
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.Model.Basket;
|
||||
import com.capstone.foodify.Model.Food;
|
||||
import com.capstone.foodify.R;
|
||||
import com.squareup.picasso.Picasso;
|
||||
@@ -80,7 +82,41 @@ public class FoodAdapter extends RecyclerView.Adapter<FoodAdapter.FoodViewHolder
|
||||
|
||||
holder.price.setText(Common.changeCurrencyUnit(cost));
|
||||
|
||||
holder.basket_icon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Basket foodInBasket = Common.getFoodExistInBasket(food.getId());
|
||||
if(foodInBasket == null){
|
||||
//If item is not exist in basket
|
||||
|
||||
//Check food image is null or not
|
||||
String imageTemp = null;
|
||||
if(food.getImages().size() > 0)
|
||||
imageTemp = food.getImages().get(0).getImageUrl();
|
||||
|
||||
Common.LIST_BASKET_FOOD.add(new Basket(food.getId(), imageTemp, food.getName(), food.getCost(), food.getShop().getName(),
|
||||
"1", food.getDiscountPercent()));
|
||||
} else {
|
||||
//If item is exist in basket
|
||||
|
||||
for(int i = 0; i < Common.LIST_BASKET_FOOD.size(); i++){
|
||||
String foodId = Common.LIST_BASKET_FOOD.get(i).getId();
|
||||
//Find foodId exist
|
||||
if(foodId.equals(food.getId())){
|
||||
//Get quantity food from basket
|
||||
String quantity = Common.LIST_BASKET_FOOD.get(i).getQuantity();
|
||||
|
||||
//Change quantity food from basket
|
||||
int quantityInt = Integer.parseInt(quantity) + 1;
|
||||
Common.LIST_BASKET_FOOD.get(i).setQuantity(String.valueOf(quantityInt));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Toast.makeText(context, "Đã thêm " + food.getName() + " vào giỏ hàng!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -102,7 +138,7 @@ public class FoodAdapter extends RecyclerView.Adapter<FoodAdapter.FoodViewHolder
|
||||
|
||||
public class FoodViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
private ImageView image;
|
||||
private ImageView image, basket_icon;
|
||||
private TextView name, price, discount;
|
||||
|
||||
public FoodViewHolder(@NonNull View itemView) {
|
||||
@@ -112,6 +148,7 @@ public class FoodAdapter extends RecyclerView.Adapter<FoodAdapter.FoodViewHolder
|
||||
name = itemView.findViewById(R.id.title);
|
||||
price = itemView.findViewById(R.id.price);
|
||||
discount = itemView.findViewById(R.id.discount);
|
||||
basket_icon = itemView.findViewById(R.id.basket_icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,26 @@ package com.capstone.foodify;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.AssetManager;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.IntRange;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.capstone.foodify.API.FoodApiToken;
|
||||
import com.capstone.foodify.Activity.MainActivity;
|
||||
import com.capstone.foodify.Activity.SignInActivity;
|
||||
import com.capstone.foodify.Fragment.HomeFragment;
|
||||
import com.capstone.foodify.Model.Basket;
|
||||
import com.capstone.foodify.Model.User;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
import com.google.firebase.auth.FirebaseUser;
|
||||
import com.thecode.aestheticdialogs.AestheticDialog;
|
||||
import com.thecode.aestheticdialogs.DialogStyle;
|
||||
@@ -57,6 +63,26 @@ public class Common {
|
||||
return Typeface.createFromAsset(assetManager, "font/opensans.ttf");
|
||||
}
|
||||
|
||||
public static void reloadUser(Activity activity){
|
||||
FoodApiToken.apiService.getUserFromEmail(Common.CURRENT_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){
|
||||
Common.CURRENT_USER = userData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<User> call, Throwable t) {
|
||||
System.out.println("ERROR: " + t);
|
||||
Common.showErrorServerNotification(activity, "Lỗi kết nối hệ thống!");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@IntRange(from = 0, to = 3)
|
||||
public static int getConnectionType(Context context) {
|
||||
int result = 0; // Returns connection type. 0: none; 1: mobile data; 2: wifi
|
||||
@@ -125,6 +151,7 @@ public class Common {
|
||||
.setOnClickListener(new OnDialogClickListener() {
|
||||
@Override
|
||||
public void onClick(@NonNull AestheticDialog.Builder builder) {
|
||||
|
||||
activity.finishAffinity();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.capstone.foodify.Model;
|
||||
|
||||
public class Comment {
|
||||
private int id;
|
||||
private String content;
|
||||
private float rating;
|
||||
private User user;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public float getRating() {
|
||||
return rating;
|
||||
}
|
||||
|
||||
public void setRating(float rating) {
|
||||
this.rating = rating;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ public class Food implements Comparable<Food>{
|
||||
private float discountPercent;
|
||||
private float cost;
|
||||
private float averageRating;
|
||||
private String reviewCount;
|
||||
private String commentCount;
|
||||
private Shop shop;
|
||||
private List<Category> categories;
|
||||
private List<Image> images;
|
||||
@@ -73,12 +73,12 @@ public class Food implements Comparable<Food>{
|
||||
this.averageRating = averageRating;
|
||||
}
|
||||
|
||||
public String getReviewCount() {
|
||||
return reviewCount;
|
||||
public String getCommentCount() {
|
||||
return commentCount;
|
||||
}
|
||||
|
||||
public void setReviewCount(String reviewCount) {
|
||||
this.reviewCount = reviewCount;
|
||||
public void setCommentCount(String commentCount) {
|
||||
this.commentCount = commentCount;
|
||||
}
|
||||
|
||||
public Shop getShop() {
|
||||
@@ -123,7 +123,7 @@ public class Food implements Comparable<Food>{
|
||||
", discountPercent=" + discountPercent +
|
||||
", cost=" + cost +
|
||||
", averageRating=" + averageRating +
|
||||
", reviewCount='" + reviewCount + '\'' +
|
||||
", commentCount='" + commentCount + '\'' +
|
||||
", shop=" + shop +
|
||||
", categories=" + categories +
|
||||
", images=" + images +
|
||||
|
||||
@@ -5,18 +5,21 @@ import java.util.List;
|
||||
public class Order {
|
||||
private int id;
|
||||
private String orderTrackingNumber;
|
||||
private int userId;
|
||||
private int shipperId;
|
||||
private String paymentMethod;
|
||||
private float productCost;
|
||||
private float shippingCost;
|
||||
private float total;
|
||||
private String status;
|
||||
private int address_id;
|
||||
private String address;
|
||||
private List<OrderDetail> orderDetails;
|
||||
|
||||
public Order(String orderTrackingNumber) {
|
||||
public Order(String orderTrackingNumber, int shipperId, String paymentMethod, float shippingCost, String status, String address, List<OrderDetail> orderDetails) {
|
||||
this.orderTrackingNumber = orderTrackingNumber;
|
||||
this.shipperId = shipperId;
|
||||
this.paymentMethod = paymentMethod;
|
||||
this.shippingCost = shippingCost;
|
||||
this.status = status;
|
||||
this.address = address;
|
||||
this.orderDetails = orderDetails;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
@@ -27,6 +30,9 @@ public class Order {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Order(String orderTrackingNumber) {
|
||||
this.orderTrackingNumber = orderTrackingNumber;
|
||||
}
|
||||
public String getOrderTrackingNumber() {
|
||||
return orderTrackingNumber;
|
||||
}
|
||||
@@ -35,14 +41,6 @@ public class Order {
|
||||
this.orderTrackingNumber = orderTrackingNumber;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public int getShipperId() {
|
||||
return shipperId;
|
||||
}
|
||||
@@ -59,14 +57,6 @@ public class Order {
|
||||
this.paymentMethod = paymentMethod;
|
||||
}
|
||||
|
||||
public float getProductCost() {
|
||||
return productCost;
|
||||
}
|
||||
|
||||
public void setProductCost(float productCost) {
|
||||
this.productCost = productCost;
|
||||
}
|
||||
|
||||
public float getShippingCost() {
|
||||
return shippingCost;
|
||||
}
|
||||
@@ -75,14 +65,6 @@ public class Order {
|
||||
this.shippingCost = shippingCost;
|
||||
}
|
||||
|
||||
public float getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(float total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
@@ -91,12 +73,20 @@ public class Order {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public int getAddress_id() {
|
||||
return address_id;
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress_id(int address_id) {
|
||||
this.address_id = address_id;
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public List<OrderDetail> getOrderDetails() {
|
||||
return orderDetails;
|
||||
}
|
||||
|
||||
public void setOrderDetails(List<OrderDetail> orderDetails) {
|
||||
this.orderDetails = orderDetails;
|
||||
}
|
||||
|
||||
public List<OrderDetail> getListOrderDetail() {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.capstone.foodify.Model.Response;
|
||||
|
||||
import com.capstone.foodify.Model.Comment;
|
||||
import com.capstone.foodify.Model.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Comments {
|
||||
private List<Comment> comments;
|
||||
private Page page;
|
||||
|
||||
public List<Comment> getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
public void setComments(List<Comment> comments) {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
public Page getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(Page page) {
|
||||
this.page = page;
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.capstone.foodify.Model;
|
||||
|
||||
public class Review {
|
||||
private String name;
|
||||
private int ratingScore;
|
||||
private String content;
|
||||
|
||||
public Review() {
|
||||
}
|
||||
|
||||
public Review(String name, int ratingScore, String content) {
|
||||
this.name = name;
|
||||
this.ratingScore = ratingScore;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getRatingScore() {
|
||||
return ratingScore;
|
||||
}
|
||||
|
||||
public void setRatingScore(int ratingScore) {
|
||||
this.ratingScore = ratingScore;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
@@ -20,9 +20,19 @@ public class User implements Serializable {
|
||||
private int defaultAddress;
|
||||
private List<Address> addresses;
|
||||
|
||||
public User() {
|
||||
public User(Address address, String dateOfBirth, String email, String fullName, String identifiedCode, String phoneNumber) {
|
||||
this.address = address;
|
||||
this.dateOfBirth = dateOfBirth;
|
||||
this.email = email;
|
||||
this.fullName = fullName;
|
||||
this.identifiedCode = identifiedCode;
|
||||
this.imageUrl = "";
|
||||
this.phoneNumber = phoneNumber;
|
||||
this.roleName = "ROLE_USER";
|
||||
this.isLocked = false;
|
||||
}
|
||||
|
||||
public User(){}
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -87,14 +97,6 @@ public class User implements Serializable {
|
||||
this.imageUrl = imageUrl;
|
||||
}
|
||||
|
||||
public boolean getIsLocked() {
|
||||
return isLocked;
|
||||
}
|
||||
|
||||
public void setIsLocked(boolean isLocked) {
|
||||
this.isLocked = isLocked;
|
||||
}
|
||||
|
||||
public String getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
@@ -152,12 +152,45 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rating_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/content_description_text_view"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
>
|
||||
<TextView
|
||||
android:text="Đánh giá:"
|
||||
android:textSize="17sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="10dp"
|
||||
/>
|
||||
|
||||
<com.willy.ratingbar.ScaleRatingBar
|
||||
android:id="@+id/rating_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:srb_starPadding="5dp"
|
||||
app:srb_clickable="false"
|
||||
app:srb_starWidth="22dp"
|
||||
app:srb_starHeight="22dp"
|
||||
app:srb_numStars="5"
|
||||
app:srb_scrollable="false"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/content_description_text_view"
|
||||
app:layout_constraintTop_toBottomOf="@id/rating_layout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
>
|
||||
|
||||
@@ -278,14 +311,39 @@
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view_review"
|
||||
tools:listitem="@layout/item_review"
|
||||
android:id="@+id/recycler_view_comment"
|
||||
tools:listitem="@layout/item_comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/linear_layout_2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
android:indeterminateTint="@color/primaryColor"
|
||||
app:layout_constraintTop_toBottomOf="@id/recycler_view_comment"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/end_of_list_text"
|
||||
android:text="End of list"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/grayLight"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="5dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/progress_bar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
@@ -309,13 +367,4 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|center_vertical"
|
||||
android:visibility="gone"
|
||||
android:indeterminateTint="@color/primaryColor"
|
||||
/>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
+3
-3
@@ -48,7 +48,7 @@
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_text_review"
|
||||
android:id="@+id/edit_text_comment"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -76,7 +76,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_primary_color_dark_corner"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/edit_text_review"
|
||||
app:layout_constraintTop_toBottomOf="@id/edit_text_comment"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/cancel_button"
|
||||
/>
|
||||
@@ -91,7 +91,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_grey_color_corner"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/edit_text_review"
|
||||
app:layout_constraintTop_toBottomOf="@id/edit_text_comment"
|
||||
app:layout_constraintStart_toEndOf="@id/confirm_button"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
Reference in New Issue
Block a user