Add comment and show detail order

This commit is contained in:
phanhuuloi27
2022-06-13 21:23:26 +07:00
parent 6f1439e375
commit f26cacbfa5
11 changed files with 420 additions and 38 deletions
@@ -9,6 +9,7 @@ import androidx.recyclerview.widget.RecyclerView;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
@@ -18,6 +19,7 @@ import android.widget.Toast;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.rengwuxian.materialedittext.MaterialEditText;
import com.waterbase.foodify.Common.Common;
import com.waterbase.foodify.Database.Database;
import com.waterbase.foodify.Model.Order;
@@ -85,19 +87,20 @@ public class Cart extends AppCompatActivity {
private void showAlertDialog() {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(Cart.this);
alertDialog.setTitle("One more step!");
alertDialog.setMessage("Enter your address: ");
alertDialog.setTitle("Còn 1 bước nữa!");
alertDialog.setMessage("Xin vui lòng điền thông tin dưới đây: ");
final EditText edtAddress = new EditText(Cart.this);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT
);
edtAddress.setLayoutParams(lp);
alertDialog.setView(edtAddress); //Add edit text to Dialog
LayoutInflater inflater = this.getLayoutInflater();
View order_address_comment = inflater.inflate(R.layout.order_address_comment, null);
MaterialEditText edtAddress = (MaterialEditText) order_address_comment.findViewById(R.id.edtAddress);
MaterialEditText edtComment = (MaterialEditText) order_address_comment.findViewById(R.id.edtComment);
alertDialog.setView(order_address_comment);
alertDialog.setIcon(R.drawable.ic_baseline_shopping_cart_24);
alertDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() {
alertDialog.setPositiveButton("Đặt", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//Create new Request
@@ -106,6 +109,8 @@ public class Cart extends AppCompatActivity {
Common.currentUser.getName(),
edtAddress.getText().toString(),
txtTotalPrice.getText().toString(),
"0",
edtComment.getText().toString(),
cart
);
@@ -120,7 +125,7 @@ public class Cart extends AppCompatActivity {
}
});
alertDialog.setNegativeButton("NO", new DialogInterface.OnClickListener() {
alertDialog.setNegativeButton("Thoát", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();