order summary page changes
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
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.model.cart.CartTotalModel;
|
||||
|
||||
public class OrderPriceRecyclerAdapter extends RecyclerView.Adapter<OrderPriceRecyclerAdapter.ViewHolder> {
|
||||
|
||||
private ArrayList<CartTotalModel> cartTotalList;
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
@BindView(R.id.totalNameTextView) TextView totalNameTextView;
|
||||
@BindView(R.id.totalPriceTextView) TextView totalPriceTextView;
|
||||
|
||||
public ViewHolder(final View view) {
|
||||
super(view);
|
||||
ButterKnife.bind(this, view);
|
||||
}
|
||||
}
|
||||
|
||||
public OrderPriceRecyclerAdapter(ArrayList<CartTotalModel> cartTotalList){
|
||||
this.cartTotalList = cartTotalList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderPriceRecyclerAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
|
||||
View root = LayoutInflater.from(BaseActivity.currentActivity).inflate(R.layout.row_price_total, viewGroup, false);
|
||||
return new OrderPriceRecyclerAdapter.ViewHolder(root);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(OrderPriceRecyclerAdapter.ViewHolder holder, int position) {
|
||||
holder.totalNameTextView.setText(cartTotalList.get(position).getTitle());
|
||||
holder.totalPriceTextView.setText(cartTotalList.get(position).getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return cartTotalList.size();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -32,6 +34,7 @@ import ch.pizzapp.android.R;
|
||||
import ch.pizzapp.android.activity.BaseActivity;
|
||||
import ch.pizzapp.android.activity.CampaignProductListActivity;
|
||||
import ch.pizzapp.android.activity.CreateOrderActivity;
|
||||
import ch.pizzapp.android.adapter.recycler.OrderPriceRecyclerAdapter;
|
||||
import ch.pizzapp.android.api.ApiConstants;
|
||||
import ch.pizzapp.android.api.ApiEndPoints;
|
||||
import ch.pizzapp.android.api.ApiErrorUtils;
|
||||
@@ -59,18 +62,13 @@ import static android.app.Activity.RESULT_OK;
|
||||
|
||||
public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
|
||||
@BindView(R.id.orderPersonFullnamePizzalinkInfoLayout)
|
||||
AppInfoView orderPersonFullnamePizzalinkInfoLayout;
|
||||
@BindView(R.id.orderShippingMethodPizzalinkInfoLayout)
|
||||
AppInfoView orderShippingMethodPizzalinkInfoLayout;
|
||||
@BindView(R.id.orderShippingAddressPizzalinkInfoLayout)
|
||||
AppInfoView orderShippingAddressPizzalinkInfoLayout;
|
||||
@BindView(R.id.orderPaymentMethodPizzalinkInfoLayout)
|
||||
AppInfoView orderPaymentMethodPizzalinkInfoLayout;
|
||||
@BindView(R.id.orderTotalPizzalinkInfoLayout)
|
||||
AppInfoView orderTotalPizzalinkInfoLayout;
|
||||
@BindView(R.id.orderNotePizzalinkInfoLayout)
|
||||
AppInfoView orderNotePizzalinkInfoLayout;
|
||||
@BindView(R.id.orderPersonFullnamePizzalinkInfoLayout) AppInfoView orderPersonFullnamePizzalinkInfoLayout;
|
||||
@BindView(R.id.orderShippingMethodPizzalinkInfoLayout) AppInfoView orderShippingMethodPizzalinkInfoLayout;
|
||||
@BindView(R.id.orderShippingAddressPizzalinkInfoLayout) AppInfoView orderShippingAddressPizzalinkInfoLayout;
|
||||
@BindView(R.id.orderPaymentMethodPizzalinkInfoLayout) AppInfoView orderPaymentMethodPizzalinkInfoLayout;
|
||||
//@BindView(R.id.orderTotalPizzalinkInfoLayout) AppInfoView orderTotalPizzalinkInfoLayout;
|
||||
@BindView(R.id.orderPriceRecyclerView) RecyclerView orderPriceRecyclerView;
|
||||
@BindView(R.id.orderNotePizzalinkInfoLayout) AppInfoView orderNotePizzalinkInfoLayout;
|
||||
|
||||
@BindString(R.string.confirm_order) String confirmOrderText;
|
||||
@BindString(R.string.slice_pizza) String slicePizzaText;
|
||||
@@ -92,6 +90,8 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
private final int REQUEST_CODE_BRAINTREE_PAYMENT = 3784;
|
||||
private CreateOrderActivity createOrderActivity;
|
||||
private String dateOfOrder, timeOfOrder;
|
||||
private ArrayList<CartTotalModel> cartTotalList = new ArrayList<>();
|
||||
private OrderPriceRecyclerAdapter orderPriceRecyclerAdapter;
|
||||
|
||||
public CreateOrderSummaryFragment() {}
|
||||
|
||||
@@ -169,6 +169,13 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
orderNotePizzalinkInfoLayout.setVisibility(View.VISIBLE);
|
||||
orderNotePizzalinkInfoLayout.setText(createOrderActivity.getOrderNote());
|
||||
}
|
||||
|
||||
|
||||
orderPriceRecyclerAdapter = new OrderPriceRecyclerAdapter(cartTotalList);
|
||||
|
||||
orderPriceRecyclerView.setLayoutManager(new LinearLayoutManager(BaseActivity.currentActivity));
|
||||
orderPriceRecyclerView.setNestedScrollingEnabled(false);
|
||||
orderPriceRecyclerView.setAdapter(orderPriceRecyclerAdapter);
|
||||
}
|
||||
|
||||
private void checkPizzapassCampaign(){
|
||||
@@ -724,8 +731,13 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
if(response.isSuccessful() &&
|
||||
response.body().getData() != null &&
|
||||
response.body().isSuccess()){
|
||||
//createOrderActivity.setCartInfo(response.body().getData());
|
||||
setOrderTotalText(response.body().getData());
|
||||
CartInfoModel cartInfoModel = response.body().getData();
|
||||
cartInfoModel.checkNull();
|
||||
createOrderActivity.setCartInfo(cartInfoModel);
|
||||
//setOrderTotalText(response.body().getData());
|
||||
cartTotalList.clear();
|
||||
cartTotalList.addAll(cartInfoModel.getTotalsList());
|
||||
orderPriceRecyclerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
else
|
||||
ApiErrorUtils.parseError(response);
|
||||
@@ -837,6 +849,7 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
.build();
|
||||
}
|
||||
|
||||
/*
|
||||
private void setOrderTotalText(CartInfoModel cartInfoModel){
|
||||
|
||||
CartTotalModel subtotalModel = new CartTotalModel("","");
|
||||
@@ -879,8 +892,9 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
//.append(PriceHelper.roundFractions(totalModel.getText()))
|
||||
.toString();
|
||||
}
|
||||
orderTotalPizzalinkInfoLayout.setText(totalText);
|
||||
//orderTotalPizzalinkInfoLayout.setText(totalText);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
android:background="@color/white"
|
||||
tools:ignore="MissingPrefix">
|
||||
|
||||
<ScrollView
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentTop="true"
|
||||
@@ -44,21 +47,45 @@
|
||||
android:layout_height="wrap_content"
|
||||
app:description="@string/order_payment_method" />
|
||||
|
||||
<!--
|
||||
<ch.pizzapp.android.view.AppInfoView
|
||||
android:id="@+id/orderTotalPizzalinkInfoLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:description="@string/order_total" />
|
||||
-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/descriptionTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/order_total"
|
||||
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/orderPriceRecyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none"/>
|
||||
|
||||
<ch.pizzapp.android.view.AppInfoView
|
||||
android:id="@+id/orderNotePizzalinkInfoLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
app:description="@string/order_notee" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
|
||||
<include layout="@layout/layout_orders_bottom"/>
|
||||
|
||||
|
||||
38
app/src/main/res/layout/row_price_total.xml
Normal file
38
app/src/main/res/layout/row_price_total.xml
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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:paddingLeft="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="4dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/totalNameTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
fontPath="fonts/Quicksand-Bold.ttf"
|
||||
android:textColor="@color/red"
|
||||
android:layout_toLeftOf="@+id/totalPriceTextView"
|
||||
android:layout_toStartOf="@+id/totalPriceTextView"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginRight="24dp"
|
||||
android:layout_marginEnd="24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/totalPriceTextView"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="wrap_content"
|
||||
fontPath="fonts/Quicksand-Bold.ttf"
|
||||
android:textColor="@color/red"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -169,7 +169,7 @@
|
||||
<string name="order_shipping_method">LIEFERUNGSMETHODE</string>
|
||||
<string name="order_shipping_address">LIEFERUNGSADRESSE</string>
|
||||
<string name="order_payment_method">ZAHLUNGSWEISE</string>
|
||||
<string name="order_total">ZWISCHENSUMME</string>
|
||||
<string name="order_total">KASSE</string>
|
||||
<string name="order_notee">NACHRICHT</string>
|
||||
<string name="delivery_date">Lieferungsdatum:</string>
|
||||
<string name="delivery_time">Lieferungszeit:</string>
|
||||
|
||||
Reference in New Issue
Block a user