bugs fixed
This commit is contained in:
@@ -10,6 +10,7 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import butterknife.BindString;
|
||||
import butterknife.BindView;
|
||||
@@ -324,8 +325,23 @@ public class CampaignProductDetailsActivity extends BaseActivity {
|
||||
|
||||
|
||||
private void getCartItemCount(){
|
||||
|
||||
|
||||
/*
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken());
|
||||
*/
|
||||
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
if(SessionHelper.getSelectedCoupon() != null){
|
||||
params.put("coupon", SessionHelper.getSelectedCoupon().getCode());
|
||||
}
|
||||
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken(),
|
||||
params);
|
||||
|
||||
call.enqueue(new Callback<ResponseObject<CartInfoModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseObject<CartInfoModel>> call, Response<ResponseObject<CartInfoModel>> response) {
|
||||
|
||||
@@ -6,6 +6,8 @@ import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import butterknife.BindString;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
@@ -122,8 +124,20 @@ public class LoginActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private void getCartItemCount(){
|
||||
/*
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken());
|
||||
*/
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
if(SessionHelper.getSelectedCoupon() != null){
|
||||
params.put("coupon", SessionHelper.getSelectedCoupon().getCode());
|
||||
}
|
||||
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken(),
|
||||
params);
|
||||
|
||||
call.enqueue(new Callback<ResponseObject<CartInfoModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseObject<CartInfoModel>> call, Response<ResponseObject<CartInfoModel>> response) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import butterknife.BindString;
|
||||
import butterknife.BindView;
|
||||
@@ -328,8 +329,20 @@ public class ProductDetailsActivity extends BaseActivity {
|
||||
|
||||
|
||||
private void getCartItemCount(){
|
||||
/*
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken());
|
||||
*/
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
if(SessionHelper.getSelectedCoupon() != null){
|
||||
params.put("coupon", SessionHelper.getSelectedCoupon().getCode());
|
||||
}
|
||||
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken(),
|
||||
params);
|
||||
|
||||
call.enqueue(new Callback<ResponseObject<CartInfoModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseObject<CartInfoModel>> call, Response<ResponseObject<CartInfoModel>> response) {
|
||||
|
||||
@@ -345,8 +345,20 @@ public class SplashActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private void getCartItemCount(){
|
||||
/*
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken());
|
||||
*/
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
if(SessionHelper.getSelectedCoupon() != null){
|
||||
params.put("coupon", SessionHelper.getSelectedCoupon().getCode());
|
||||
}
|
||||
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken(),
|
||||
params);
|
||||
|
||||
call.enqueue(new Callback<ResponseObject<CartInfoModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseObject<CartInfoModel>> call, Response<ResponseObject<CartInfoModel>> response) {
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package ch.pizzapp.android.adapter.recycler;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ch.pizzapp.android.R;
|
||||
import ch.pizzapp.android.activity.BaseActivity;
|
||||
import ch.pizzapp.android.helper.PriceHelper;
|
||||
import ch.pizzapp.android.helper.TextHelper;
|
||||
import ch.pizzapp.android.model.cart.CartProductModel;
|
||||
|
||||
public class ProductOnOrderSummaryRecyclerAdapter extends RecyclerView.Adapter<ProductOnOrderSummaryRecyclerAdapter.ViewHolder> {
|
||||
|
||||
private ArrayList<CartProductModel> cartProductList;
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
@BindView(R.id.productCountTextView) TextView productCountTextView;
|
||||
@BindView(R.id.productNameTextView) TextView productNameTextView;
|
||||
@BindView(R.id.productPropertiesTextView) TextView productPropertiesTextView;
|
||||
@BindView(R.id.productPriceTextView) TextView productPriceTextView;
|
||||
|
||||
public ViewHolder(final View view) {
|
||||
super(view);
|
||||
ButterKnife.bind(this, view);
|
||||
}
|
||||
}
|
||||
|
||||
public ProductOnOrderSummaryRecyclerAdapter(ArrayList<CartProductModel> cartProductList){
|
||||
this.cartProductList = cartProductList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductOnOrderSummaryRecyclerAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
|
||||
View root = LayoutInflater.from(BaseActivity.currentActivity).inflate(R.layout.row_product_on_order_summary, viewGroup, false);
|
||||
return new ProductOnOrderSummaryRecyclerAdapter.ViewHolder(root);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ProductOnOrderSummaryRecyclerAdapter.ViewHolder holder, int position) {
|
||||
holder.productCountTextView.setText(cartProductList.get(position).getQuantity() + " x ");
|
||||
holder.productNameTextView.setText(cartProductList.get(position).getName());
|
||||
holder.productPriceTextView.setText(PriceHelper.roundFractions(cartProductList.get(position).getTotal()));
|
||||
setCartInfoText(holder.productPropertiesTextView, cartProductList.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return cartProductList.size();
|
||||
}
|
||||
|
||||
private void setCartInfoText(TextView textView, CartProductModel cartProductModel){
|
||||
|
||||
if(cartProductModel.getOption() == null || cartProductModel.getOption().size() == 0){
|
||||
textView.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
|
||||
textView.setVisibility(View.VISIBLE);
|
||||
TextHelper.setTextFromHTML(textView, getCartInfoText(cartProductModel));
|
||||
}
|
||||
|
||||
private String getCartInfoText(CartProductModel cartProductModel){
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
for(int i = 0; i < cartProductModel.getOption().size(); i++){
|
||||
|
||||
if(!stringBuilder.toString().contains(cartProductModel.getOption().get(i).getName())){
|
||||
|
||||
/*
|
||||
if(!stringBuilder.toString().isEmpty()){
|
||||
stringBuilder.append("<br/>");
|
||||
}
|
||||
*/
|
||||
stringBuilder
|
||||
.append("<b>")
|
||||
.append("<u>")
|
||||
.append(cartProductModel.getOption().get(i).getName())
|
||||
.append("</u>")
|
||||
.append("</b>")
|
||||
//.append("<br/>")
|
||||
.append("<br/>");
|
||||
}
|
||||
stringBuilder
|
||||
.append(cartProductModel.getOption().get(i).getValue())
|
||||
.append("<br/>");
|
||||
}
|
||||
|
||||
return stringBuilder.toString().trim();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -72,6 +72,7 @@ public interface ApiInterface {
|
||||
Call<ResponseArray<OrderHistoryModel>> getOrderHistory(@Path("storeName") String storeName,
|
||||
@Query("token") String token);
|
||||
|
||||
/*
|
||||
// OK
|
||||
@POST
|
||||
Call<ResponseObject<CartInfoModel>> getCartProducts(@Url String url);
|
||||
@@ -83,6 +84,17 @@ public interface ApiInterface {
|
||||
@Field("payment_method") String paymentMethodCode,
|
||||
@Field("shipping_method") String shippingMethodCode);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST
|
||||
Call<ResponseObject<CartInfoModel>> getCartProductsWithCoupon(@Url String url,
|
||||
@FieldMap HashMap<String, Object> body);
|
||||
*/
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST
|
||||
Call<ResponseObject<CartInfoModel>> getCartProducts(@Url String url,
|
||||
@FieldMap HashMap<String, Object> body);
|
||||
|
||||
@GET("{storeName}" + ApiEndPoints.API_GET_CLEAR_CART)
|
||||
Call<ResponseObject> clearCart(@Path("storeName") String storeName,
|
||||
@Query("token") String token);
|
||||
|
||||
@@ -335,8 +335,20 @@ public class ProductPropertiesBottomSheetDialog extends BottomSheetDialogFragmen
|
||||
}
|
||||
|
||||
private void getCartItemCount(){
|
||||
/*
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken());
|
||||
*/
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
if(SessionHelper.getSelectedCoupon() != null){
|
||||
params.put("coupon", SessionHelper.getSelectedCoupon().getCode());
|
||||
}
|
||||
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken(),
|
||||
params);
|
||||
|
||||
call.enqueue(new Callback<ResponseObject<CartInfoModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseObject<CartInfoModel>> call, Response<ResponseObject<CartInfoModel>> response) {
|
||||
|
||||
@@ -192,8 +192,20 @@ public class CartFragment extends BaseFragment {
|
||||
|
||||
private void getCartProducts(){
|
||||
DialogHelper.showLoadingDialog();
|
||||
/*
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken());
|
||||
*/
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
if(SessionHelper.getSelectedCoupon() != null){
|
||||
params.put("coupon", SessionHelper.getSelectedCoupon().getCode());
|
||||
}
|
||||
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken(),
|
||||
params);
|
||||
|
||||
call.enqueue(new Callback<ResponseObject<CartInfoModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseObject<CartInfoModel>> call, Response<ResponseObject<CartInfoModel>> response) {
|
||||
@@ -362,8 +374,20 @@ public class CartFragment extends BaseFragment {
|
||||
}
|
||||
|
||||
private void getCartItemCount(){
|
||||
/*
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken());
|
||||
*/
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
if(SessionHelper.getSelectedCoupon() != null){
|
||||
params.put("coupon", SessionHelper.getSelectedCoupon().getCode());
|
||||
}
|
||||
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken(),
|
||||
params);
|
||||
|
||||
call.enqueue(new Callback<ResponseObject<CartInfoModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseObject<CartInfoModel>> call, final Response<ResponseObject<CartInfoModel>> response) {
|
||||
@@ -515,7 +539,8 @@ public class CartFragment extends BaseFragment {
|
||||
DialogHelper.showLoadingDialog();
|
||||
checkChampagneCampaign();
|
||||
}
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
@@ -589,7 +614,8 @@ public class CartFragment extends BaseFragment {
|
||||
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import ch.pizzapp.android.R;
|
||||
import ch.pizzapp.android.activity.CreateOrderActivity;
|
||||
import ch.pizzapp.android.helper.SessionHelper;
|
||||
import ch.pizzapp.android.helper.SharedPrefsHelper;
|
||||
|
||||
/**
|
||||
@@ -50,6 +51,7 @@ public class CreateOrderResultFragment extends CreateOrderBaseFragment {
|
||||
private void initViews(){
|
||||
SharedPrefsHelper.setCartItemCount(0);
|
||||
SharedPrefsHelper.setCartTotalPrice("0");
|
||||
SessionHelper.clearSelectedCoupon();
|
||||
previousTextView.setVisibility(View.GONE);
|
||||
nextTextView.setText(doneOrderText);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import ch.pizzapp.android.R;
|
||||
import ch.pizzapp.android.activity.BaseActivity;
|
||||
import ch.pizzapp.android.activity.CreateOrderActivity;
|
||||
import ch.pizzapp.android.adapter.recycler.OrderPriceRecyclerAdapter;
|
||||
import ch.pizzapp.android.adapter.recycler.ProductOnOrderSummaryRecyclerAdapter;
|
||||
import ch.pizzapp.android.api.ApiConstants;
|
||||
import ch.pizzapp.android.api.ApiEndPoints;
|
||||
import ch.pizzapp.android.api.ApiErrorUtils;
|
||||
@@ -65,6 +66,7 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
@BindView(R.id.orderPaymentMethodPizzalinkInfoLayout) AppInfoView orderPaymentMethodPizzalinkInfoLayout;
|
||||
//@BindView(R.id.orderTotalPizzalinkInfoLayout) AppInfoView orderTotalPizzalinkInfoLayout;
|
||||
@BindView(R.id.orderPriceRecyclerView) RecyclerView orderPriceRecyclerView;
|
||||
@BindView(R.id.orderProductsRecyclerView) RecyclerView orderProductsRecyclerView;
|
||||
@BindView(R.id.orderNotePizzalinkInfoLayout) AppInfoView orderNotePizzalinkInfoLayout;
|
||||
|
||||
@BindString(R.string.confirm_order) String confirmOrderText;
|
||||
@@ -89,6 +91,7 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
private Calendar dateOfOrder;
|
||||
private ArrayList<CartTotalModel> cartTotalList = new ArrayList<>();
|
||||
private OrderPriceRecyclerAdapter orderPriceRecyclerAdapter;
|
||||
private ProductOnOrderSummaryRecyclerAdapter productOnOrderSummaryRecyclerAdapter;
|
||||
private StoreShiftModel storeShiftModel;
|
||||
|
||||
public CreateOrderSummaryFragment() {}
|
||||
@@ -156,7 +159,7 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
orderShippingAddressPizzalinkInfoLayout.setText(createOrderActivity.getSelectedShippingAddress().getAddress());
|
||||
orderPaymentMethodPizzalinkInfoLayout.setText(createOrderActivity.getSelectedPaymentMethod().getTitle());
|
||||
//orderTotalPizzalinkInfoLayout.setText(PriceHelper.roundFractions(createOrderActivity.getCartInfo().getCartTotalModel().getText()));
|
||||
if(createOrderActivity.getOrderNote().isEmpty()){
|
||||
if(createOrderActivity.getOrderNote().trim().isEmpty()){
|
||||
orderNotePizzalinkInfoLayout.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
@@ -164,14 +167,25 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
orderNotePizzalinkInfoLayout.setText(createOrderActivity.getOrderNote());
|
||||
}
|
||||
|
||||
initOrderPriceRecyclerView();
|
||||
initOrderProductsRecyclerView();
|
||||
|
||||
}
|
||||
|
||||
private void initOrderPriceRecyclerView(){
|
||||
orderPriceRecyclerAdapter = new OrderPriceRecyclerAdapter(cartTotalList);
|
||||
|
||||
orderPriceRecyclerView.setLayoutManager(new LinearLayoutManager(BaseActivity.currentActivity));
|
||||
orderPriceRecyclerView.setNestedScrollingEnabled(false);
|
||||
orderPriceRecyclerView.setAdapter(orderPriceRecyclerAdapter);
|
||||
}
|
||||
|
||||
private void initOrderProductsRecyclerView(){
|
||||
productOnOrderSummaryRecyclerAdapter = new ProductOnOrderSummaryRecyclerAdapter(createOrderActivity.getCartInfo().getProducts());
|
||||
orderProductsRecyclerView.setLayoutManager(new LinearLayoutManager(BaseActivity.currentActivity));
|
||||
orderProductsRecyclerView.setNestedScrollingEnabled(false);
|
||||
orderProductsRecyclerView.setAdapter(productOnOrderSummaryRecyclerAdapter);
|
||||
}
|
||||
|
||||
private void checkDeliveryTime(){
|
||||
ApiService
|
||||
.apiInterface
|
||||
@@ -571,8 +585,19 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
|
||||
private void getCartProducts(){
|
||||
DialogHelper.showLoadingDialog();
|
||||
/*
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken());
|
||||
*/
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
if(SessionHelper.getSelectedCoupon() != null){
|
||||
params.put("coupon", SessionHelper.getSelectedCoupon().getCode());
|
||||
}
|
||||
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken(),
|
||||
params);
|
||||
|
||||
call.enqueue(new Callback<ResponseObject<CartInfoModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseObject<CartInfoModel>> call, Response<ResponseObject<CartInfoModel>> response) {
|
||||
@@ -597,10 +622,24 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
|
||||
private void getCartProductsWithCommission(){
|
||||
DialogHelper.showLoadingDialog();
|
||||
/*
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProductsForCommission(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken(),
|
||||
createOrderActivity.getSelectedPaymentMethod().getCode(),
|
||||
createOrderActivity.getSelectedShippingMethod().getCode());
|
||||
*/
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
if(SessionHelper.getSelectedCoupon() != null){
|
||||
params.put("coupon", SessionHelper.getSelectedCoupon().getCode());
|
||||
}
|
||||
params.put("payment_method", createOrderActivity.getSelectedPaymentMethod().getCode());
|
||||
params.put("shipping_method",createOrderActivity.getSelectedShippingMethod().getCode());
|
||||
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken(),
|
||||
params);
|
||||
|
||||
call.enqueue(new Callback<ResponseObject<CartInfoModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseObject<CartInfoModel>> call, Response<ResponseObject<CartInfoModel>> response) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.view.ViewGroup;
|
||||
import com.google.android.gms.common.api.Api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import butterknife.BindString;
|
||||
import butterknife.BindView;
|
||||
@@ -95,6 +96,7 @@ public class PaymentMethodFragment extends CreateOrderBaseFragment {
|
||||
}
|
||||
|
||||
if(couponCodeAppEditText.isEmpty()){
|
||||
SessionHelper.clearSelectedCoupon();
|
||||
createOrderActivity.setSelectedPaymentMethod(selectedPaymentMethod);
|
||||
createOrderActivity.onNextClicked(FRAGMENT_NAME);
|
||||
}
|
||||
@@ -243,7 +245,9 @@ public class PaymentMethodFragment extends CreateOrderBaseFragment {
|
||||
response.body().getData() != null &&
|
||||
response.body().isSuccess()){
|
||||
couponModel = response.body().getData();
|
||||
couponModel.setStoreName(SessionHelper.getSelectedStore().getStoreName());
|
||||
couponModel.checkNull();
|
||||
SessionHelper.saveSelectedCoupon(couponModel);
|
||||
if(couponModel.isActive()){
|
||||
DialogHelper.showDialogWithPositiveButton(
|
||||
couponUsedDialogTitle,
|
||||
@@ -271,8 +275,17 @@ public class PaymentMethodFragment extends CreateOrderBaseFragment {
|
||||
}
|
||||
|
||||
private void getCartProducts(){
|
||||
/*
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProductsWithCoupon(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken(),
|
||||
couponModel.getCode());
|
||||
*/
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
params.put("coupon", couponModel.getCode());
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken());
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken(),
|
||||
params);
|
||||
call.enqueue(new Callback<ResponseObject<CartInfoModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseObject<CartInfoModel>> call, Response<ResponseObject<CartInfoModel>> response) {
|
||||
|
||||
@@ -157,6 +157,23 @@ public class DialogHelper {
|
||||
MaterialDialog.SingleButtonCallback positiveButtonCallback,
|
||||
int negativeTextResId,
|
||||
MaterialDialog.SingleButtonCallback negativeButtonCallback){
|
||||
showTwoButtonsDialog(
|
||||
title,
|
||||
message,
|
||||
positiveTextResId,
|
||||
positiveButtonCallback,
|
||||
negativeTextResId,
|
||||
negativeButtonCallback,
|
||||
true);
|
||||
}
|
||||
|
||||
public static void showTwoButtonsDialog(String title,
|
||||
String message,
|
||||
int positiveTextResId,
|
||||
MaterialDialog.SingleButtonCallback positiveButtonCallback,
|
||||
int negativeTextResId,
|
||||
MaterialDialog.SingleButtonCallback negativeButtonCallback,
|
||||
boolean isCancelable){
|
||||
new MaterialDialog.Builder(BaseActivity.currentActivity)
|
||||
.title(title)
|
||||
.content(message)
|
||||
@@ -166,6 +183,7 @@ public class DialogHelper {
|
||||
.onPositive(positiveButtonCallback)
|
||||
.negativeText(negativeTextResId)
|
||||
.onNegative(negativeButtonCallback)
|
||||
.cancelable(isCancelable)
|
||||
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
|
||||
.show();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import ch.pizzapp.android.model.CheckCouponModel;
|
||||
import ch.pizzapp.android.model.CustomerTokenModel;
|
||||
import ch.pizzapp.android.model.StoreModel;
|
||||
import ch.pizzapp.android.model.UserModel;
|
||||
@@ -73,6 +74,18 @@ public class SessionHelper {
|
||||
clearCustomerInfo();
|
||||
}
|
||||
|
||||
public static void saveSelectedCoupon(CheckCouponModel couponModel){
|
||||
SharedPrefsHelper.saveSelectedCoupon(couponModel);
|
||||
}
|
||||
|
||||
public static CheckCouponModel getSelectedCoupon(){
|
||||
return SharedPrefsHelper.getSelectedCoupon();
|
||||
}
|
||||
|
||||
public static void clearSelectedCoupon(){
|
||||
SharedPrefsHelper.clearSelectedCoupon();
|
||||
}
|
||||
|
||||
public static Calendar getTokenDeathDate(String tokenDeathTime){
|
||||
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.Locale;
|
||||
|
||||
import ch.pizzapp.android.activity.BaseActivity;
|
||||
import ch.pizzapp.android.model.CategoryModel;
|
||||
import ch.pizzapp.android.model.CheckCouponModel;
|
||||
import ch.pizzapp.android.model.CustomerTokenModel;
|
||||
import ch.pizzapp.android.model.StoreModel;
|
||||
import ch.pizzapp.android.model.UserModel;
|
||||
@@ -37,6 +38,7 @@ public class SharedPrefsHelper {
|
||||
private static final String PREF_KEY_CART_TOTAL_PRICE = SHARED_PREFS_NAME + "cartTotalPrice";
|
||||
private static final String PREF_KEY_USER_SELECTED_STORE = SHARED_PREFS_NAME + "selectedStore";
|
||||
private static final String PREF_KEY_IS_FIRST_TIME = SHARED_PREFS_NAME + "isFirstTime";
|
||||
private static final String PREF_KEY_SELECTED_COUPON = SHARED_PREFS_NAME + "selectedCoupon";
|
||||
|
||||
private static SharedPreferences sharedPreferences =
|
||||
BaseActivity.currentActivity
|
||||
@@ -92,6 +94,7 @@ public class SharedPrefsHelper {
|
||||
editor.remove(PREF_KEY_CUSTOMER_TOKEN);
|
||||
editor.remove(PREF_KEY_CART_ITEM_COUNT);
|
||||
editor.remove(PREF_KEY_CART_TOTAL_PRICE);
|
||||
editor.remove(PREF_KEY_SELECTED_COUPON);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
@@ -164,6 +167,29 @@ public class SharedPrefsHelper {
|
||||
return sharedPreferences.getBoolean(PREF_KEY_IS_FIRST_TIME, true);
|
||||
}
|
||||
|
||||
public static void saveSelectedCoupon(CheckCouponModel couponModel){
|
||||
editor.putString(PREF_KEY_SELECTED_COUPON, gson.toJson(couponModel));
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static CheckCouponModel getSelectedCoupon(){
|
||||
CheckCouponModel selectedCouponModel = gson.fromJson(sharedPreferences.getString(PREF_KEY_SELECTED_COUPON, ""), CheckCouponModel.class);
|
||||
if(selectedCouponModel != null &&
|
||||
selectedCouponModel.getStoreName().toLowerCase().equals(SessionHelper.getSelectedStore().getStoreName().toLowerCase())){
|
||||
return selectedCouponModel;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearSelectedCoupon(){
|
||||
editor.remove(PREF_KEY_SELECTED_COUPON);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
public static void saveCategoryList(ArrayList<Category> cats){
|
||||
|
||||
|
||||
@@ -54,6 +54,9 @@ public class CheckCouponModel {
|
||||
private String total;
|
||||
private String status;
|
||||
|
||||
|
||||
private String storeName;
|
||||
|
||||
public void checkNull(){
|
||||
|
||||
if(couponId == null){
|
||||
@@ -111,6 +114,10 @@ public class CheckCouponModel {
|
||||
if(productIdList == null){
|
||||
productIdList = new ArrayList<>();
|
||||
}
|
||||
|
||||
if(storeName == null){
|
||||
storeName = "";
|
||||
}
|
||||
}
|
||||
|
||||
public enum CouponDiscountType {
|
||||
@@ -273,4 +280,12 @@ public class CheckCouponModel {
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStoreName() {
|
||||
return storeName;
|
||||
}
|
||||
|
||||
public void setStoreName(String storeName) {
|
||||
this.storeName = storeName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,27 @@
|
||||
app:description="@string/order_total" />
|
||||
-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/productsTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/order_product_list"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
fontPath="fonts/Quicksand-Bold.ttf" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/orderProductsRecyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/descriptionTextView"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -62,7 +83,7 @@
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/order_total"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingTop="24dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingStart="16dp"
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
android:background="@color/white"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingEnd="4dp"
|
||||
android:paddingBottom="4dp">
|
||||
|
||||
<TextView
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/totalPriceTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="76dp"
|
||||
android:layout_height="wrap_content"
|
||||
fontPath="fonts/Quicksand-Bold.ttf"
|
||||
android:textColor="@color/red"
|
||||
|
||||
65
app/src/main/res/layout/row_product_on_order_summary.xml
Normal file
65
app/src/main/res/layout/row_product_on_order_summary.xml
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:ignore="MissingPrefix"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingEnd="4dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/productCountTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/red"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
fontPath="fonts/Quicksand-Bold.ttf" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_toRightOf="@+id/productCountTextView"
|
||||
android:layout_toEndOf="@+id/productCountTextView"
|
||||
android:layout_toLeftOf="@+id/productPriceTextView"
|
||||
android:layout_toStartOf="@+id/productPriceTextView"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginRight="24dp"
|
||||
android:layout_marginEnd="24dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/productNameTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/red"
|
||||
fontPath="fonts/Quicksand-Bold.ttf" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/productPropertiesTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/red"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_marginStart="24dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/productPriceTextView"
|
||||
android:layout_width="76dp"
|
||||
android:layout_height="wrap_content"
|
||||
fontPath="fonts/Quicksand-Bold.ttf"
|
||||
android:textColor="@color/red"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -178,6 +178,7 @@
|
||||
<string name="order_shipping_method">LIEFERUNGSART</string>
|
||||
<string name="order_shipping_address">LIEFERUNGSADRESSE</string>
|
||||
<string name="order_payment_method">ZAHLUNGSART</string>
|
||||
<string name="order_product_list">WARENKORB</string>
|
||||
<string name="order_total">KASSE</string>
|
||||
<string name="order_notee">BEMERKUNGEN</string>
|
||||
<string name="slice_pizza_for_store">Die Pizza zu schneiden</string>
|
||||
|
||||
Reference in New Issue
Block a user