create order

This commit is contained in:
cimenmus
2017-10-22 00:28:45 +03:00
parent 1283fbb631
commit 5157398536
21 changed files with 373 additions and 118 deletions

View File

@@ -20,6 +20,10 @@ import ch.pizzalink.android.fragment.order.PaymentMethodFragment;
import ch.pizzalink.android.fragment.order.ShippingAddressFragment; import ch.pizzalink.android.fragment.order.ShippingAddressFragment;
import ch.pizzalink.android.fragment.order.ShippingMethodFragment; import ch.pizzalink.android.fragment.order.ShippingMethodFragment;
import ch.pizzalink.android.helper.SharedPrefsHelper; import ch.pizzalink.android.helper.SharedPrefsHelper;
import ch.pizzalink.android.model.AddressModel;
import ch.pizzalink.android.model.PaymentMethodModel;
import ch.pizzalink.android.model.ShippingMethodModel;
import ch.pizzalink.android.model.cart.CartInfoModel;
import ch.pizzalink.android.view.NoSwipeViewPager; import ch.pizzalink.android.view.NoSwipeViewPager;
import ch.pizzalink.android.view.PizzalinkToolbar; import ch.pizzalink.android.view.PizzalinkToolbar;
@@ -30,14 +34,24 @@ public class OrderActivity extends BaseActivity {
private FragmentManager fragmentManager; private FragmentManager fragmentManager;
private CartInfoModel cartInfoModel;
private ShippingMethodModel selectedShippingMethod;
private AddressModel selectedShippingAddress;
private PaymentMethodModel selectedPaymentMethod;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_order); setContentView(R.layout.activity_order);
ButterKnife.bind(this); ButterKnife.bind(this);
getDataFromIntent();
initViews(); initViews();
} }
private void getDataFromIntent(){
cartInfoModel = (CartInfoModel) getIntent().getSerializableExtra("cartInfoModel");
}
private void initViews(){ private void initViews(){
orderToolbar.setBackIconClickListener(new View.OnClickListener() { orderToolbar.setBackIconClickListener(new View.OnClickListener() {
@Override @Override
@@ -129,27 +143,31 @@ public class OrderActivity extends BaseActivity {
} }
} }
public void setShippingInfo(){ public CartInfoModel getCartInfo(){
return cartInfoModel;
} }
public void getShippingMethodTitle(){ public ShippingMethodModel getSelectedShippingMethod(){
return selectedShippingMethod;
} }
public void getShippingMethodCode(){ public void setSelectedShippingMethod(ShippingMethodModel selectedShippingMethod){
this.selectedShippingMethod = selectedShippingMethod;
} }
public void setPaymentInfo(){ public AddressModel getSelectedShippingAddress(){
return selectedShippingAddress;
} }
public void getPaymentMethodTitle(){ public void setSelectedShippingAddress(AddressModel selectedShippingAddress){
this.selectedShippingAddress = selectedShippingAddress;
} }
public void getPaymentMethodCode(){ public PaymentMethodModel getSelectedPaymentMethod(){
return selectedPaymentMethod;
}
public void setSelectedPaymentMethod(PaymentMethodModel selectedPaymentMethod){
this.selectedPaymentMethod = selectedPaymentMethod;
} }
} }

View File

@@ -32,19 +32,10 @@ public class OrderHistoryRecyclerAdapter extends RecyclerView.Adapter<RecyclerVi
@BindView(R.id.orderDateTextView) TextView orderDateTextView; @BindView(R.id.orderDateTextView) TextView orderDateTextView;
@BindView(R.id.orderTotalTextView) TextView orderTotalTextView; @BindView(R.id.orderTotalTextView) TextView orderTotalTextView;
@BindView(R.id.orderStatusTextView) TextView orderStatusTextView; @BindView(R.id.orderStatusTextView) TextView orderStatusTextView;
@BindView(R.id.cancelOrderImageView) ImageView cancelOrderImageView;
public OrderViewHolder(final View view, final RecyclerItemClickListener recyclerItemClickListener) { public OrderViewHolder(final View view, final RecyclerItemClickListener recyclerItemClickListener) {
super(view); super(view);
ButterKnife.bind(this, view); ButterKnife.bind(this, view);
cancelOrderImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(recyclerItemClickListener != null)
recyclerItemClickListener.onItemClick(cancelOrderImageView, getAdapterPosition());
}
});
} }
} }

View File

@@ -18,6 +18,7 @@ public class ApiEndPoints {
public static final String API_GET_SHIPPING_METHODS = PREFIX + "getShippingMethodsArray" + SUFFIX; public static final String API_GET_SHIPPING_METHODS = PREFIX + "getShippingMethodsArray" + SUFFIX;
public static final String API_GET_CUSTOMER_ADDRESSES = PREFIX + "getAddresses" + SUFFIX; public static final String API_GET_CUSTOMER_ADDRESSES = PREFIX + "getAddresses" + SUFFIX;
public static final String API_GET_PAYMENT_METHODS = PREFIX + "getPaymentMethodsArray" + SUFFIX; public static final String API_GET_PAYMENT_METHODS = PREFIX + "getPaymentMethodsArray" + SUFFIX;
public static final String API_CREATE_ORDER = PREFIX + "addOrder" + SUFFIX + "&token=";
} }

View File

@@ -91,4 +91,8 @@ public interface ApiInterface {
@GET(ApiEndPoints.API_GET_PAYMENT_METHODS) @GET(ApiEndPoints.API_GET_PAYMENT_METHODS)
Call<ResponseObject<PaymentMethodsResponseModel>> getPaymentMethods(@Query("token") String token); Call<ResponseObject<PaymentMethodsResponseModel>> getPaymentMethods(@Query("token") String token);
@FormUrlEncoded
@POST
Call<ResponseObject<Integer>> createOrder(@Url String url, @FieldMap HashMap<String, Object> body);
} }

View File

@@ -266,7 +266,9 @@ public class ProductPropertiesBottomSheetDialog extends BottomSheetDialogFragmen
private void addProductToCart(){ private void addProductToCart(){
DialogHelper.showLoadingDialog(); DialogHelper.showLoadingDialog();
Call<ResponseObject<AddProductToBasketResponseModel>> call = Call<ResponseObject<AddProductToBasketResponseModel>> call =
ApiService.apiInterface.addProductsToBasket(ApiEndPoints.API_ADD_PRODUCTS_TO_BASKET + SessionHelper.getCustomerToken().getToken(), getAddToCartRequestParams()); ApiService.apiInterface.addProductsToBasket(
ApiEndPoints.API_ADD_PRODUCTS_TO_BASKET + SessionHelper.getCustomerToken().getToken(),
getAddToCartRequestParams());
call.enqueue(new Callback<ResponseObject<AddProductToBasketResponseModel>>() { call.enqueue(new Callback<ResponseObject<AddProductToBasketResponseModel>>() {
@Override @Override
public void onResponse(Call<ResponseObject<AddProductToBasketResponseModel>> call, Response<ResponseObject<AddProductToBasketResponseModel>> response) { public void onResponse(Call<ResponseObject<AddProductToBasketResponseModel>> call, Response<ResponseObject<AddProductToBasketResponseModel>> response) {

View File

@@ -66,6 +66,7 @@ public class CartFragment extends BaseFragment {
public static final java.lang.String FRAGMENT_NAME = "cartFragment"; public static final java.lang.String FRAGMENT_NAME = "cartFragment";
private CartInfoModel cartInfoModel;
private ArrayList<CartProductModel> cartProductList = new ArrayList<>(); private ArrayList<CartProductModel> cartProductList = new ArrayList<>();
private CartRecyclerAdapter cartRecyclerAdapter; private CartRecyclerAdapter cartRecyclerAdapter;
@@ -107,7 +108,9 @@ public class CartFragment extends BaseFragment {
}); });
break; break;
case R.id.continueCartButton: case R.id.continueCartButton:
startActivity(new Intent(BaseActivity.currentActivity, OrderActivity.class)); Intent continueCartIntent = new Intent(BaseActivity.currentActivity, OrderActivity.class);
continueCartIntent.putExtra("cartInfoModel", cartInfoModel);
startActivity(continueCartIntent);
break; break;
} }
} }
@@ -128,8 +131,9 @@ public class CartFragment extends BaseFragment {
if(response.isSuccessful() && if(response.isSuccessful() &&
response.body().getData() != null && response.body().getData() != null &&
response.body().isSuccess()){ response.body().isSuccess()){
setCartTotalFields(response.body().getData().getTotals().get(0)); cartInfoModel = response.body().getData();
fillAndNotifyAdapter(response.body().getData().getProducts()); setCartTotalFields();
fillAndNotifyAdapter();
} }
else else
ApiErrorUtils.parseError(response); ApiErrorUtils.parseError(response);
@@ -172,17 +176,17 @@ public class CartFragment extends BaseFragment {
}); });
} }
private void fillAndNotifyAdapter(ArrayList<CartProductModel> cartList){ private void fillAndNotifyAdapter(){
CartProductModel.checkNull(cartList); CartProductModel.checkNull(cartInfoModel.getProducts());
cartProductList.clear(); cartProductList.clear();
cartProductList.addAll(cartList); cartProductList.addAll(cartInfoModel.getProducts());
cartRecyclerAdapter.notifyDataSetChanged(); cartRecyclerAdapter.notifyDataSetChanged();
setCartLayoutsVisibility(); setCartLayoutsVisibility();
} }
private void setCartTotalFields(CartTotalModel cartTotalModel){ private void setCartTotalFields(){
cartTotalLabelTextView.setText(cartTotalModel.getTitle()); cartTotalLabelTextView.setText(cartInfoModel.getTotals().get(0).getTitle());
cartProductTotalTextView.setText(cartTotalModel.getText()); cartProductTotalTextView.setText(cartInfoModel.getTotals().get(0).getText());
} }
private void initRecyclerView(){ private void initRecyclerView(){

View File

@@ -11,6 +11,7 @@ import butterknife.OnClick;
import ch.pizzalink.android.R; import ch.pizzalink.android.R;
import ch.pizzalink.android.activity.OrderActivity; import ch.pizzalink.android.activity.OrderActivity;
import ch.pizzalink.android.fragment.BaseFragment; import ch.pizzalink.android.fragment.BaseFragment;
import ch.pizzalink.android.helper.SharedPrefsHelper;
/** /**
* Created by cimenmus on 17/10/2017. * Created by cimenmus on 17/10/2017.
@@ -22,8 +23,6 @@ public class OrderResultFragment extends OrderBaseFragment {
public static final java.lang.String FRAGMENT_NAME = "orderResultFragment"; public static final java.lang.String FRAGMENT_NAME = "orderResultFragment";
private boolean isOrderSuccessed;
public OrderResultFragment() {} public OrderResultFragment() {}
public static OrderResultFragment newInstance() { public static OrderResultFragment newInstance() {
@@ -43,23 +42,14 @@ public class OrderResultFragment extends OrderBaseFragment {
return view; return view;
} }
@OnClick({R.id.previousTextView, R.id.nextTextView}) @OnClick( R.id.nextTextView)
protected void onClick(View view){ protected void onClick(){
OrderActivity orderActivity = (OrderActivity) getActivity(); OrderActivity orderActivity = (OrderActivity) getActivity();
switch (view.getId()){ orderActivity.onNextClicked(FRAGMENT_NAME);
case R.id.previousTextView:
orderActivity.onPreviousClicked(FRAGMENT_NAME);
break;
case R.id.nextTextView:
if(isOrderSuccessed){
orderActivity.onNextClicked(FRAGMENT_NAME);
}
break;
}
} }
private void initViews(){ private void initViews(){
isOrderSuccessed = true; SharedPrefsHelper.setCartItemCount(0);
previousTextView.setVisibility(View.GONE); previousTextView.setVisibility(View.GONE);
nextTextView.setText(doneOrderText); nextTextView.setText(doneOrderText);
} }

View File

@@ -4,13 +4,26 @@ import android.os.Bundle;
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.TextView;
import java.util.HashMap;
import butterknife.BindString; import butterknife.BindString;
import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import ch.pizzalink.android.R; import ch.pizzalink.android.R;
import ch.pizzalink.android.activity.OrderActivity; import ch.pizzalink.android.activity.OrderActivity;
import ch.pizzalink.android.fragment.BaseFragment; import ch.pizzalink.android.api.ApiEndPoints;
import ch.pizzalink.android.api.ApiErrorUtils;
import ch.pizzalink.android.api.ApiService;
import ch.pizzalink.android.api.ResponseObject;
import ch.pizzalink.android.helper.DialogHelper;
import ch.pizzalink.android.helper.SessionHelper;
import ch.pizzalink.android.helper.SharedPrefsHelper;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
/** /**
* Created by cimenmus on 17/10/2017. * Created by cimenmus on 17/10/2017.
@@ -18,9 +31,16 @@ import ch.pizzalink.android.fragment.BaseFragment;
public class OrderSummaryFragment extends OrderBaseFragment { public class OrderSummaryFragment extends OrderBaseFragment {
@BindView(R.id.orderPersonFullnameTextView) TextView orderPersonFullnameTextView;
@BindView(R.id.orderShippingMethodTextView) TextView orderShippingMethodTextView;
@BindView(R.id.orderShippingAddressTextView) TextView orderShippingAddressTextView;
@BindView(R.id.orderPaymentMethodTextView) TextView orderPaymentMethodTextView;
@BindView(R.id.orderTotalTextView) TextView orderTotalTextView;
@BindString(R.string.confirm_order) String confirmOrderText; @BindString(R.string.confirm_order) String confirmOrderText;
public static final java.lang.String FRAGMENT_NAME = "orderSummaryFragment"; public static final java.lang.String FRAGMENT_NAME = "orderSummaryFragment";
private OrderActivity orderActivity;
public OrderSummaryFragment() {} public OrderSummaryFragment() {}
@@ -41,13 +61,68 @@ public class OrderSummaryFragment extends OrderBaseFragment {
return view; return view;
} }
@OnClick(R.id.nextTextView) @OnClick({R.id.previousTextView, R.id.nextTextView})
protected void onClick(){ protected void onClick(View view){
OrderActivity orderActivity = (OrderActivity) getActivity(); OrderActivity orderActivity = (OrderActivity) getActivity();
orderActivity.onNextClicked(FRAGMENT_NAME); switch (view.getId()){
case R.id.previousTextView:
orderActivity.onPreviousClicked(FRAGMENT_NAME);
break;
case R.id.nextTextView:
//orderActivity.onNextClicked(FRAGMENT_NAME);
createOrder();
break;
}
} }
private void initViews(){ private void initViews(){
nextTextView.setText(confirmOrderText); nextTextView.setText(confirmOrderText);
orderActivity = (OrderActivity) getActivity();
orderPersonFullnameTextView.setText(SessionHelper.getUser().getFullname());
orderShippingMethodTextView.setText(orderActivity.getSelectedShippingMethod().getTitle());
orderShippingAddressTextView.setText(orderActivity.getSelectedShippingAddress().getAddress());
orderPaymentMethodTextView.setText(orderActivity.getSelectedPaymentMethod().getTitle());
orderTotalTextView.setText(orderActivity.getCartInfo().getTotals().get(0).getText());
}
private void createOrder(){
DialogHelper.showLoadingDialog();
Call<ResponseObject<Integer>> call = ApiService.apiInterface.createOrder(
ApiEndPoints.API_CREATE_ORDER + SessionHelper.getCustomerToken().getToken(), getCreateOrderParams());
call.enqueue(new Callback<ResponseObject<Integer>>() {
@Override
public void onResponse(Call<ResponseObject<Integer>> call, Response<ResponseObject<Integer>> response) {
DialogHelper.hideLoadingDialog();
if(response.isSuccessful() && response.body().isSuccess()){
orderActivity.onNextClicked(FRAGMENT_NAME);
}
else{
//orderActivity.onNextClicked(FRAGMENT_NAME);
ApiErrorUtils.parseError(response);
}
}
@Override
public void onFailure(Call<ResponseObject<Integer>> call, Throwable t) {
DialogHelper.hideLoadingDialog();
DialogHelper.showFailedDialog();
//orderActivity.onNextClicked(FRAGMENT_NAME);
}
});
}
private HashMap<String, Object> getCreateOrderParams(){
HashMap<String, Object> params = new HashMap<>();
params.put("customer_id", SessionHelper.getUser().getId());
params.put("shipping_method_title", orderActivity.getSelectedShippingMethod().getTitle());
params.put("shipping_method_code", orderActivity.getSelectedShippingMethod().getCode());
params.put("address_id", orderActivity.getSelectedShippingAddress().getId());
params.put("payment_method_title", orderActivity.getSelectedPaymentMethod().getTitle());
params.put("payment_method_code", orderActivity.getSelectedPaymentMethod().getCode());
return params;
} }
} }

View File

@@ -44,7 +44,7 @@ public class PaymentMethodFragment extends OrderBaseFragment {
private ArrayList<PaymentMethodModel> paymentMethodList = new ArrayList<>(); private ArrayList<PaymentMethodModel> paymentMethodList = new ArrayList<>();
private PaymentMethodsRecyclerAdapter paymentMethodsRecyclerAdapter; private PaymentMethodsRecyclerAdapter paymentMethodsRecyclerAdapter;
private boolean isPaymentMethodSelected; private PaymentMethodModel selectedPaymentMethod;
public static final java.lang.String FRAGMENT_NAME = "paymentMethodFragment"; public static final java.lang.String FRAGMENT_NAME = "paymentMethodFragment";
@@ -76,12 +76,13 @@ public class PaymentMethodFragment extends OrderBaseFragment {
orderActivity.onPreviousClicked(FRAGMENT_NAME); orderActivity.onPreviousClicked(FRAGMENT_NAME);
break; break;
case R.id.nextTextView: case R.id.nextTextView:
if(isPaymentMethodSelected){
orderActivity.onNextClicked(FRAGMENT_NAME); if(selectedPaymentMethod == null){
}
else {
DialogHelper.showAlertDialog(BaseActivity.currentActivity, choosePaymentMethodText); DialogHelper.showAlertDialog(BaseActivity.currentActivity, choosePaymentMethodText);
break;
} }
orderActivity.setSelectedPaymentMethod(selectedPaymentMethod);
orderActivity.onNextClicked(FRAGMENT_NAME);
break; break;
} }
} }
@@ -123,7 +124,7 @@ public class PaymentMethodFragment extends OrderBaseFragment {
paymentMethodList.addAll(paymentMethodModels); paymentMethodList.addAll(paymentMethodModels);
if(paymentMethodList.size() != 0){ if(paymentMethodList.size() != 0){
paymentMethodList.get(0).setSelected(true); paymentMethodList.get(0).setSelected(true);
isPaymentMethodSelected = true; selectedPaymentMethod = paymentMethodList.get(0);
} }
paymentMethodsRecyclerAdapter.notifyDataSetChanged(); paymentMethodsRecyclerAdapter.notifyDataSetChanged();
} }
@@ -136,7 +137,7 @@ public class PaymentMethodFragment extends OrderBaseFragment {
paymentMethodModel.setSelected(false); paymentMethodModel.setSelected(false);
} }
paymentMethodList.get(position).setSelected(true); paymentMethodList.get(position).setSelected(true);
isPaymentMethodSelected = true; selectedPaymentMethod = paymentMethodList.get(position);
paymentMethodsRecyclerAdapter.notifyDataSetChanged(); paymentMethodsRecyclerAdapter.notifyDataSetChanged();
} }
}); });

View File

@@ -42,7 +42,7 @@ public class ShippingAddressFragment extends OrderBaseFragment {
private ArrayList<AddressModel> addressList = new ArrayList<>(); private ArrayList<AddressModel> addressList = new ArrayList<>();
private ShippingAddressesRecyclerAdapter shippingAddressesRecyclerAdapter; private ShippingAddressesRecyclerAdapter shippingAddressesRecyclerAdapter;
private boolean isShippingAddressSelected; private AddressModel selectedAddress;
public static final java.lang.String FRAGMENT_NAME = "shippingAddressMethod"; public static final java.lang.String FRAGMENT_NAME = "shippingAddressMethod";
@@ -74,12 +74,14 @@ public class ShippingAddressFragment extends OrderBaseFragment {
orderActivity.onPreviousClicked(FRAGMENT_NAME); orderActivity.onPreviousClicked(FRAGMENT_NAME);
break; break;
case R.id.nextTextView: case R.id.nextTextView:
if(isShippingAddressSelected){
orderActivity.onNextClicked(FRAGMENT_NAME); if(selectedAddress == null){
}
else {
DialogHelper.showAlertDialog(BaseActivity.currentActivity, chooseShippingAddressText); DialogHelper.showAlertDialog(BaseActivity.currentActivity, chooseShippingAddressText);
return;
} }
orderActivity.setSelectedShippingAddress(selectedAddress);
orderActivity.onNextClicked(FRAGMENT_NAME);
break; break;
} }
} }
@@ -120,7 +122,7 @@ public class ShippingAddressFragment extends OrderBaseFragment {
addressList.addAll(addressModels); addressList.addAll(addressModels);
if(addressList.size() != 0){ if(addressList.size() != 0){
addressList.get(0).setSelected(true); addressList.get(0).setSelected(true);
isShippingAddressSelected = true; selectedAddress = addressList.get(0);
} }
shippingAddressesRecyclerAdapter.notifyDataSetChanged(); shippingAddressesRecyclerAdapter.notifyDataSetChanged();
} }
@@ -133,7 +135,7 @@ public class ShippingAddressFragment extends OrderBaseFragment {
addressModel.setSelected(false); addressModel.setSelected(false);
} }
addressList.get(position).setSelected(true); addressList.get(position).setSelected(true);
isShippingAddressSelected = true; selectedAddress = addressList.get(position);
shippingAddressesRecyclerAdapter.notifyDataSetChanged(); shippingAddressesRecyclerAdapter.notifyDataSetChanged();
} }
}); });

View File

@@ -45,7 +45,7 @@ public class ShippingMethodFragment extends OrderBaseFragment {
private ArrayList<ShippingMethodModel> shippingMethodList = new ArrayList<>(); private ArrayList<ShippingMethodModel> shippingMethodList = new ArrayList<>();
private ShippingMethodsRecyclerAdapter shippingMethodsRecyclerAdapter; private ShippingMethodsRecyclerAdapter shippingMethodsRecyclerAdapter;
private boolean isShippingMethodSelected; private ShippingMethodModel selectedShippingMethodModel;
public static final java.lang.String FRAGMENT_NAME = "shippingMethodFragment"; public static final java.lang.String FRAGMENT_NAME = "shippingMethodFragment";
@@ -71,13 +71,15 @@ public class ShippingMethodFragment extends OrderBaseFragment {
@OnClick(R.id.nextTextView) @OnClick(R.id.nextTextView)
protected void onClick(){ protected void onClick(){
if(isShippingMethodSelected){
OrderActivity orderActivity = (OrderActivity) getActivity(); if(selectedShippingMethodModel == null){
orderActivity.onNextClicked(FRAGMENT_NAME);
}
else {
DialogHelper.showAlertDialog(BaseActivity.currentActivity, chooseShippingMethodText); DialogHelper.showAlertDialog(BaseActivity.currentActivity, chooseShippingMethodText);
return;
} }
OrderActivity orderActivity = (OrderActivity) getActivity();
orderActivity.setSelectedShippingMethod(selectedShippingMethodModel);
orderActivity.onNextClicked(FRAGMENT_NAME);
} }
private void initViews(){ private void initViews(){
@@ -117,7 +119,7 @@ public class ShippingMethodFragment extends OrderBaseFragment {
shippingMethodList.addAll(shippingMethodModels); shippingMethodList.addAll(shippingMethodModels);
if(shippingMethodList.size() != 0){ if(shippingMethodList.size() != 0){
shippingMethodList.get(0).setSelected(true); shippingMethodList.get(0).setSelected(true);
isShippingMethodSelected = true; selectedShippingMethodModel = shippingMethodList.get(0);
} }
shippingMethodsRecyclerAdapter.notifyDataSetChanged(); shippingMethodsRecyclerAdapter.notifyDataSetChanged();
} }
@@ -130,7 +132,7 @@ public class ShippingMethodFragment extends OrderBaseFragment {
shippingMethodModel.setSelected(false); shippingMethodModel.setSelected(false);
} }
shippingMethodList.get(position).setSelected(true); shippingMethodList.get(position).setSelected(true);
isShippingMethodSelected = true; selectedShippingMethodModel = shippingMethodList.get(position);
shippingMethodsRecyclerAdapter.notifyDataSetChanged(); shippingMethodsRecyclerAdapter.notifyDataSetChanged();
} }
}); });

View File

@@ -37,6 +37,10 @@ public class UserModel {
token.checkNull(); token.checkNull();
} }
public String getFullname(){
return firstname + " " + lastname;
}
public String getId() { public String getId() {
return id; return id;
} }

View File

@@ -1,12 +1,13 @@
package ch.pizzalink.android.model.cart; package ch.pizzalink.android.model.cart;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
* Created by cimenmus on 05/10/2017. * Created by cimenmus on 05/10/2017.
*/ */
public class CartInfoModel { public class CartInfoModel implements Serializable {
private ArrayList<CartProductModel> products; private ArrayList<CartProductModel> products;
private ArrayList<CartTotalModel> totals; private ArrayList<CartTotalModel> totals;

View File

@@ -3,13 +3,14 @@ package ch.pizzalink.android.model.cart;
import com.google.gson.annotations.Expose; import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
* Created by cimenmus on 05/10/2017. * Created by cimenmus on 05/10/2017.
*/ */
public class CartProductModel { public class CartProductModel implements Serializable {
@Expose @SerializedName("cart_id") private String cartId; @Expose @SerializedName("cart_id") private String cartId;
@Expose @SerializedName("product_id") private String productId; @Expose @SerializedName("product_id") private String productId;

View File

@@ -3,11 +3,13 @@ package ch.pizzalink.android.model.cart;
import com.google.gson.annotations.Expose; import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
/** /**
* Created by cimenmus on 05/10/2017. * Created by cimenmus on 05/10/2017.
*/ */
public class CartProductOptionModel { public class CartProductOptionModel implements Serializable {
@Expose @SerializedName("product_option_id") private String id; @Expose @SerializedName("product_option_id") private String id;
@Expose @SerializedName("product_option_value_id") private String valueId; @Expose @SerializedName("product_option_value_id") private String valueId;

View File

@@ -1,10 +1,12 @@
package ch.pizzalink.android.model.cart; package ch.pizzalink.android.model.cart;
import java.io.Serializable;
/** /**
* Created by cimenmus on 05/10/2017. * Created by cimenmus on 05/10/2017.
*/ */
public class CartTotalModel { public class CartTotalModel implements Serializable {
private String title; private String title;
private String text; private String text;

View File

@@ -6,12 +6,21 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"> android:background="@color/white">
<TextView <RelativeLayout
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:text="Order Result" android:layout_above="@+id/ordersBottomLayout">
android:layout_centerInParent="true"
android:layout_above="@+id/ordersBottomLayout"/> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/order_successed"
android:layout_centerInParent="true"
android:gravity="center"
android:padding="16dp"
android:textColor="@color/black" />
</RelativeLayout>
<include layout="@layout/layout_orders_bottom"/> <include layout="@layout/layout_orders_bottom"/>

View File

@@ -6,12 +6,164 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"> android:background="@color/white">
<TextView <ScrollView
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:text="Order Summary" android:layout_alignParentTop="true"
android:layout_centerInParent="true" android:layout_alignParentLeft="true"
android:layout_above="@+id/ordersBottomLayout"/> android:layout_alignParentStart="true"
android:layout_above="@id/ordersBottomLayout">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/order_person_fullname"
android:textStyle="bold"
android:textSize="12sp"
android:textColor="@color/heater"/>
<TextView
android:id="@+id/orderPersonFullnameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Aytaç Cici"
android:layout_marginTop="4dp"
android:textStyle="bold"
android:textColor="@color/black"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingStart="16dp"
android:paddingRight="16dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/order_shipping_method"
android:textStyle="bold"
android:textSize="12sp"
android:textColor="@color/heater"/>
<TextView
android:id="@+id/orderShippingMethodTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Selber Abholen"
android:textColor="@color/black"
android:layout_marginTop="4dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingStart="16dp"
android:paddingRight="16dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/order_shipping_address"
android:textStyle="bold"
android:textSize="12sp"
android:textColor="@color/heater"/>
<TextView
android:id="@+id/orderShippingAddressTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="Aytaç Cici A Street B. Avanue 1004 ABC Schweiz"
android:textColor="@color/black"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingStart="16dp"
android:paddingRight="16dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/order_payment_method"
android:textColor="@color/heater"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/orderPaymentMethodTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Kreditkarten-Kartenzahlung"
android:textColor="@color/black"
android:layout_marginTop="4dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="16dp"
android:paddingStart="16dp"
android:paddingRight="16dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/order_total"
android:textColor="@color/heater"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/orderTotalTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="CHF 30.00"
android:textColor="@color/black"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<include layout="@layout/layout_orders_bottom"/> <include layout="@layout/layout_orders_bottom"/>

View File

@@ -18,37 +18,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout <TextView
android:layout_width="match_parent" android:id="@+id/orderDateTextView"
android:layout_height="wrap_content"> android:layout_width="wrap_content"
android:layout_height="wrap_content"
<TextView android:text="5 Oct. 2017 "
android:id="@+id/orderDateTextView" android:textColor="@color/black"
android:layout_width="wrap_content" android:padding="8dp"
android:layout_height="wrap_content" android:textStyle="bold"
android:text="5 Oct. 2017 " android:textSize="16sp" />
android:textColor="@color/black"
android:padding="8dp"
android:textStyle="bold"
android:layout_centerVertical="true"
android:textSize="16sp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="@+id/cancelOrderImageView"
android:layout_toStartOf="@+id/cancelOrderImageView"/>
<ImageView
android:id="@+id/cancelOrderImageView"
android:layout_width="32dp"
android:layout_height="32dp"
android:padding="8dp"
android:src="@drawable/ic_cancel_2"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"/>
</RelativeLayout>
<TextView <TextView
android:id="@+id/orderTotalTextView" android:id="@+id/orderTotalTextView"

View File

@@ -37,4 +37,8 @@
<color name="background_splash">#F4F4F4</color> <color name="background_splash">#F4F4F4</color>
<color name="heater">#ABB6C2</color>
</resources> </resources>

View File

@@ -140,6 +140,18 @@
<string name="confirm_order">APPROVE</string> <string name="confirm_order">APPROVE</string>
<string name="done_order">DONE</string> <string name="done_order">DONE</string>
<!-- OrderSummaryFragment-->
<string name="order_person_fullname">TO</string>
<string name="order_shipping_method">SHIPPING METHOD</string>
<string name="order_shipping_address">SHIPPING ADDRESS</string>
<string name="order_payment_method">PAYMENT METHOD</string>
<string name="order_total">TOTAL</string>
<!-- OrderSummaryFragment-->
<!-- OrderResultFragment-->
<string name="order_successed">Siparişiniz başarı ile alınmıştır. Siparişinizin detaylarını sipariş geçmişinden görebilir ve siparişinizi takip edebilirsiniz.</string>
<!-- OrderSummaryFragment-->
<string-array name="stepperLabels"> <string-array name="stepperLabels">
<item>Shipping Method</item> <item>Shipping Method</item>
<item>Shipping Address</item> <item>Shipping Address</item>