Complete cart page
This commit is contained in:
parent
a19c3e24e3
commit
25f090c49e
@ -15,7 +15,7 @@ import java.util.List;
|
|||||||
public class CartAdapter extends RecyclerView.Adapter<CartViewHolder> {
|
public class CartAdapter extends RecyclerView.Adapter<CartViewHolder> {
|
||||||
private List<CartLineItem> cartLineItems;
|
private List<CartLineItem> cartLineItems;
|
||||||
|
|
||||||
public CartAdapter(List<CartLineItem> categories) {
|
public CartAdapter(List<CartLineItem> cartLineItems) {
|
||||||
this.cartLineItems = cartLineItems;
|
this.cartLineItems = cartLineItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,10 +15,14 @@ import android.text.SpannableString
|
|||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import kotlinx.android.synthetic.main.content_product.*
|
import kotlinx.android.synthetic.main.content_product.*
|
||||||
import me.gilo.wc.R
|
import me.gilo.wc.R
|
||||||
|
import me.gilo.wc.events.AddQuantityEvent
|
||||||
|
import me.gilo.wc.events.LessQuantityEvent
|
||||||
|
import me.gilo.wc.events.ProductEvent
|
||||||
import me.gilo.wc.models.CartLineItem
|
import me.gilo.wc.models.CartLineItem
|
||||||
import me.gilo.wc.ui.coupon.CouponActivity
|
import me.gilo.wc.ui.coupon.CouponActivity
|
||||||
import me.gilo.wc.ui.product.ProductActivity
|
import me.gilo.wc.ui.product.ProductActivity
|
||||||
import me.gilo.woodroid.models.CartItem
|
import me.gilo.woodroid.models.CartItem
|
||||||
|
import org.greenrobot.eventbus.EventBus
|
||||||
|
|
||||||
|
|
||||||
class CartViewHolder(val context: Context, itemView: View) :
|
class CartViewHolder(val context: Context, itemView: View) :
|
||||||
@ -27,15 +31,35 @@ class CartViewHolder(val context: Context, itemView: View) :
|
|||||||
fun renderView(cartLineItem: CartLineItem) {
|
fun renderView(cartLineItem: CartLineItem) {
|
||||||
val ivImage = itemView.findViewById<ImageView>(R.id.ivImage)
|
val ivImage = itemView.findViewById<ImageView>(R.id.ivImage)
|
||||||
val tvTitle = itemView.findViewById<TextView>(R.id.tvTitle)
|
val tvTitle = itemView.findViewById<TextView>(R.id.tvTitle)
|
||||||
|
val tvDescription = itemView.findViewById<TextView>(R.id.tvDescription)
|
||||||
val tvPrice = itemView.findViewById<TextView>(R.id.tvPrice)
|
val tvPrice = itemView.findViewById<TextView>(R.id.tvPrice)
|
||||||
|
|
||||||
tvTitle.text = cartLineItem.name
|
val tvAdd = itemView.findViewById<TextView>(R.id.tvAdd)
|
||||||
|
val tvQty = itemView.findViewById<TextView>(R.id.tvQty)
|
||||||
|
val tvLess = itemView.findViewById<TextView>(R.id.tvReduce)
|
||||||
|
|
||||||
if (cartLineItem.imageUrl.isNotEmpty()){
|
|
||||||
Picasso.with(context).load(cartLineItem.imageUrl).into(ivImage)
|
tvQty.text = "" + cartLineItem.quantity
|
||||||
|
|
||||||
|
var product = cartLineItem.product
|
||||||
|
|
||||||
|
tvTitle.text = cartLineItem.name
|
||||||
|
tvDescription.text = Html.fromHtml(product.description)
|
||||||
|
|
||||||
|
if (product.images != null && product.images.isNotEmpty()){
|
||||||
|
Picasso.with(context).load(product.images[0].src).into(ivImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
tvPrice.text = cartLineItem.priceString;
|
tvTitle.text = product.name
|
||||||
|
|
||||||
|
val regularPrice = product.regular_price
|
||||||
|
val salePrice = product.sale_price
|
||||||
|
|
||||||
|
if (product.isOn_sale) {
|
||||||
|
tvPrice.text = SpannableString("$$salePrice")
|
||||||
|
}else{
|
||||||
|
tvPrice.text = SpannableString("$$regularPrice")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
itemView.setOnClickListener{
|
itemView.setOnClickListener{
|
||||||
@ -45,6 +69,14 @@ class CartViewHolder(val context: Context, itemView: View) :
|
|||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tvAdd.setOnClickListener{
|
||||||
|
EventBus.getDefault().post(AddQuantityEvent(cartLineItem))
|
||||||
|
}
|
||||||
|
|
||||||
|
tvLess.setOnClickListener{
|
||||||
|
EventBus.getDefault().post(LessQuantityEvent(cartLineItem))
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
21
app/src/main/java/me/gilo/wc/events/AddQuantityEvent.java
Normal file
21
app/src/main/java/me/gilo/wc/events/AddQuantityEvent.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package me.gilo.wc.events;
|
||||||
|
|
||||||
|
import me.gilo.wc.models.CartLineItem;
|
||||||
|
import me.gilo.woodroid.models.ProductReview;
|
||||||
|
|
||||||
|
public class AddQuantityEvent {
|
||||||
|
|
||||||
|
CartLineItem cartLineItem;
|
||||||
|
|
||||||
|
public AddQuantityEvent(CartLineItem cartLineItem) {
|
||||||
|
this.cartLineItem = cartLineItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CartLineItem getCartLineItem() {
|
||||||
|
return cartLineItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCartLineItem(CartLineItem cartLineItem) {
|
||||||
|
this.cartLineItem = cartLineItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
21
app/src/main/java/me/gilo/wc/events/LessQuantityEvent.java
Normal file
21
app/src/main/java/me/gilo/wc/events/LessQuantityEvent.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package me.gilo.wc.events;
|
||||||
|
|
||||||
|
import me.gilo.wc.models.CartLineItem;
|
||||||
|
import me.gilo.woodroid.models.ProductReview;
|
||||||
|
|
||||||
|
public class LessQuantityEvent {
|
||||||
|
|
||||||
|
CartLineItem cartLineItem;
|
||||||
|
|
||||||
|
public LessQuantityEvent(CartLineItem cartLineItem) {
|
||||||
|
this.cartLineItem = cartLineItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CartLineItem getCartLineItem() {
|
||||||
|
return cartLineItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCartLineItem(CartLineItem cartLineItem) {
|
||||||
|
this.cartLineItem = cartLineItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ package me.gilo.wc.models;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import me.gilo.woodroid.models.Metum;
|
import me.gilo.woodroid.models.Metum;
|
||||||
|
import me.gilo.woodroid.models.Product;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -13,6 +14,8 @@ public class CartLineItem extends Model{
|
|||||||
public int quantity;
|
public int quantity;
|
||||||
public int productId;
|
public int productId;
|
||||||
|
|
||||||
|
Product product;
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
String imageUrl;
|
String imageUrl;
|
||||||
String priceString;
|
String priceString;
|
||||||
@ -64,4 +67,12 @@ public class CartLineItem extends Model{
|
|||||||
public void setPriceString(String priceString) {
|
public void setPriceString(String priceString) {
|
||||||
this.priceString = priceString;
|
this.priceString = priceString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setProduct(Product product) {
|
||||||
|
this.product = product;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Product getProduct() {
|
||||||
|
return product;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import me.gilo.wc.models.CartLineItem;
|
|||||||
import me.gilo.wc.utils.AppUtils;
|
import me.gilo.wc.utils.AppUtils;
|
||||||
import me.gilo.woodroid.Woocommerce;
|
import me.gilo.woodroid.Woocommerce;
|
||||||
import me.gilo.woodroid.models.LineItem;
|
import me.gilo.woodroid.models.LineItem;
|
||||||
|
import me.gilo.woodroid.models.Product;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
@ -88,12 +89,12 @@ public class CartRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public CompletionGenericLiveData<DocumentReference> addToCart(int productId, float price) {
|
public CompletionGenericLiveData<DocumentReference> addToCart(Product product) {
|
||||||
final CompletionGenericLiveData<DocumentReference> completion = new CompletionGenericLiveData();
|
final CompletionGenericLiveData<DocumentReference> completion = new CompletionGenericLiveData();
|
||||||
|
|
||||||
CartLineItem lineItem = new CartLineItem();
|
CartLineItem lineItem = new CartLineItem();
|
||||||
lineItem.setProductId(productId);
|
lineItem.setProductId(product.getId());
|
||||||
lineItem.setPrice(price);
|
lineItem.setProduct(product);
|
||||||
lineItem.setQuantity(1);
|
lineItem.setQuantity(1);
|
||||||
|
|
||||||
cart.add(lineItem).addOnCompleteListener(completion);
|
cart.add(lineItem).addOnCompleteListener(completion);
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import android.content.Context
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.support.design.widget.Snackbar
|
import android.support.design.widget.Snackbar
|
||||||
import android.support.v7.app.AppCompatActivity
|
import android.support.v7.app.AppCompatActivity
|
||||||
|
import android.widget.Toast
|
||||||
import io.github.inflationx.viewpump.ViewPumpContextWrapper
|
import io.github.inflationx.viewpump.ViewPumpContextWrapper
|
||||||
import me.gilo.wc.R
|
import me.gilo.wc.R
|
||||||
|
|
||||||
@ -27,6 +28,10 @@ abstract class WooDroidActivity<T : ViewModel> : BaseActivity() {
|
|||||||
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase))
|
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun showLoading() {
|
||||||
|
showLoading("Please wait", "This will only take a second")
|
||||||
|
}
|
||||||
|
|
||||||
fun showLoading(title: String, message: String) {
|
fun showLoading(title: String, message: String) {
|
||||||
val manager = supportFragmentManager
|
val manager = supportFragmentManager
|
||||||
progressDialog = ProgressDialogFragment.newInstance(title, message)
|
progressDialog = ProgressDialogFragment.newInstance(title, message)
|
||||||
@ -38,4 +43,8 @@ abstract class WooDroidActivity<T : ViewModel> : BaseActivity() {
|
|||||||
progressDialog.dismiss()
|
progressDialog.dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun toast(text : String){
|
||||||
|
Toast.makeText(baseContext, text, Toast.LENGTH_LONG).show()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,13 +2,24 @@ package me.gilo.wc.ui.product
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.support.v7.widget.LinearLayoutManager
|
||||||
|
import android.text.SpannableString
|
||||||
import io.github.inflationx.viewpump.ViewPumpContextWrapper
|
import io.github.inflationx.viewpump.ViewPumpContextWrapper
|
||||||
import kotlinx.android.synthetic.main.activity_cart.*
|
import kotlinx.android.synthetic.main.activity_cart.*
|
||||||
|
import kotlinx.android.synthetic.main.content_cart.*
|
||||||
|
import kotlinx.android.synthetic.main.single_cart_item.*
|
||||||
import me.gilo.wc.R
|
import me.gilo.wc.R
|
||||||
|
import me.gilo.wc.adapter.CartAdapter
|
||||||
import me.gilo.wc.common.Status
|
import me.gilo.wc.common.Status
|
||||||
|
import me.gilo.wc.events.AddQuantityEvent
|
||||||
|
import me.gilo.wc.events.LessQuantityEvent
|
||||||
|
import me.gilo.wc.events.ProductEvent
|
||||||
import me.gilo.wc.models.CartLineItem
|
import me.gilo.wc.models.CartLineItem
|
||||||
import me.gilo.wc.ui.WooDroidActivity
|
import me.gilo.wc.ui.WooDroidActivity
|
||||||
import me.gilo.wc.viewmodels.CartViewModel
|
import me.gilo.wc.viewmodels.CartViewModel
|
||||||
|
import org.greenrobot.eventbus.EventBus
|
||||||
|
import org.greenrobot.eventbus.Subscribe
|
||||||
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
|
|
||||||
class CartActivity : WooDroidActivity<CartViewModel>() {
|
class CartActivity : WooDroidActivity<CartViewModel>() {
|
||||||
|
|
||||||
@ -16,6 +27,8 @@ class CartActivity : WooDroidActivity<CartViewModel>() {
|
|||||||
override lateinit var viewModel: CartViewModel
|
override lateinit var viewModel: CartViewModel
|
||||||
var cartItems: ArrayList<CartLineItem> = ArrayList()
|
var cartItems: ArrayList<CartLineItem> = ArrayList()
|
||||||
|
|
||||||
|
lateinit var adapter: CartAdapter
|
||||||
|
|
||||||
override fun attachBaseContext(newBase: Context) {
|
override fun attachBaseContext(newBase: Context) {
|
||||||
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase))
|
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase))
|
||||||
}
|
}
|
||||||
@ -29,24 +42,123 @@ class CartActivity : WooDroidActivity<CartViewModel>() {
|
|||||||
viewModel = getViewModel(CartViewModel::class.java)
|
viewModel = getViewModel(CartViewModel::class.java)
|
||||||
title = "Cart"
|
title = "Cart"
|
||||||
|
|
||||||
|
val layoutManager = LinearLayoutManager(baseContext, LinearLayoutManager.VERTICAL, false)
|
||||||
|
rvCart.layoutManager = layoutManager
|
||||||
|
rvCart.isNestedScrollingEnabled = false
|
||||||
|
|
||||||
|
cartItems = ArrayList()
|
||||||
|
|
||||||
|
adapter = CartAdapter(cartItems)
|
||||||
|
rvCart.adapter = adapter
|
||||||
|
|
||||||
cart()
|
cart()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun cart() {
|
private fun cart() {
|
||||||
viewModel.cart().observe(this, android.arch.lifecycle.Observer { response ->
|
viewModel.cart().observe(this, android.arch.lifecycle.Observer { response ->
|
||||||
when (response!!.status()) {
|
when (response!!.status()) {
|
||||||
Status.LOADING -> {
|
Status.LOADING -> {
|
||||||
|
showLoading()
|
||||||
}
|
}
|
||||||
|
|
||||||
Status.SUCCESS -> {
|
Status.SUCCESS -> {
|
||||||
cartItems.clear()
|
cartItems.clear()
|
||||||
|
stopShowingLoading()
|
||||||
|
|
||||||
for (cartItem in response.data()) {
|
for (cartItem in response.data()) {
|
||||||
cartItems.add(cartItem)
|
cartItems.add(cartItem)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
adapter.notifyDataSetChanged()
|
||||||
|
|
||||||
|
setUpPage()
|
||||||
|
}
|
||||||
|
|
||||||
|
Status.ERROR -> {
|
||||||
|
stopShowingLoading()
|
||||||
|
}
|
||||||
|
|
||||||
|
Status.EMPTY -> {
|
||||||
|
stopShowingLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setUpPage() {
|
||||||
|
var itemCount = cartItems.size
|
||||||
|
var total = 0
|
||||||
|
|
||||||
|
for (cartitem in cartItems){
|
||||||
|
var price = if (cartitem.product.isOn_sale) {
|
||||||
|
cartitem.product.sale_price.toInt()
|
||||||
|
}else{
|
||||||
|
cartitem.product.regular_price.toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
var qty = cartitem.quantity
|
||||||
|
|
||||||
|
total += price * qty
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemCount == 1){
|
||||||
|
tvTotalItemCountTitle.text = "Item ($itemCount)"
|
||||||
|
}else{
|
||||||
|
tvTotalItemCountTitle.text = "Items ($itemCount)"
|
||||||
|
}
|
||||||
|
|
||||||
|
tvTotalItemCost.text = "$$total"
|
||||||
|
tvTotal.text = "$$total"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
EventBus.getDefault().register(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStop() {
|
||||||
|
super.onStop()
|
||||||
|
EventBus.getDefault().unregister(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
fun onMessageEvent(event: AddQuantityEvent) {
|
||||||
|
var cartLineItem = event.cartLineItem
|
||||||
|
var quantity = cartLineItem.quantity + 1
|
||||||
|
|
||||||
|
updateCart(cartLineItem, quantity)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
fun onMessageEvent(event: LessQuantityEvent) {
|
||||||
|
var cartLineItem = event.cartLineItem
|
||||||
|
var quantity = cartLineItem.quantity - 1
|
||||||
|
|
||||||
|
if (quantity == 0) {
|
||||||
|
delete(cartLineItem)
|
||||||
|
} else {
|
||||||
|
updateCart(cartLineItem, quantity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateCart(cartLineItem: CartLineItem, quantity: Int) {
|
||||||
|
viewModel.setQuantity(cartLineItem, quantity).observe(this, android.arch.lifecycle.Observer { response ->
|
||||||
|
when (response!!.status()) {
|
||||||
|
Status.LOADING -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Status.SUCCESS -> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Status.ERROR -> {
|
Status.ERROR -> {
|
||||||
@ -63,6 +175,29 @@ class CartActivity : WooDroidActivity<CartViewModel>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun delete(cartLineItem: CartLineItem) {
|
||||||
|
viewModel.deleteItem(cartLineItem).observe(this, android.arch.lifecycle.Observer { response ->
|
||||||
|
when (response!!.status()) {
|
||||||
|
Status.LOADING -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Status.SUCCESS -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Status.ERROR -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Status.EMPTY -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,8 +60,8 @@ class ProductActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun addToCart(productId: Int, price : Float) {
|
private fun addToCart(product: Product) {
|
||||||
viewModel.addToCart(productId, price).observe(this, android.arch.lifecycle.Observer { response ->
|
viewModel.addToCart(product).observe(this, android.arch.lifecycle.Observer { response ->
|
||||||
when (response!!.status()) {
|
when (response!!.status()) {
|
||||||
Status.LOADING -> {
|
Status.LOADING -> {
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ class ProductActivity : BaseActivity() {
|
|||||||
if (productInCart){
|
if (productInCart){
|
||||||
removeFromCart(currentCartItem)
|
removeFromCart(currentCartItem)
|
||||||
}else {
|
}else {
|
||||||
addToCart(productId, product.price.toFloat())
|
addToCart(product)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,8 +29,8 @@ public final class CartViewModel extends ViewModel {
|
|||||||
this.cartRepository = cartRepository;
|
this.cartRepository = cartRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompletionGenericLiveData<DocumentReference> addToCart(int productId, float price) {
|
public CompletionGenericLiveData<DocumentReference> addToCart(Product product) {
|
||||||
return cartRepository.addToCart(productId, price);
|
return cartRepository.addToCart(product);
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryLiveData<CartLineItem> cart() {
|
public QueryLiveData<CartLineItem> cart() {
|
||||||
|
|||||||
@ -39,8 +39,8 @@ public final class ProductViewModel extends ViewModel {
|
|||||||
return productRepository.products();
|
return productRepository.products();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompletionGenericLiveData<DocumentReference> addToCart(int productId, float price) {
|
public CompletionGenericLiveData<DocumentReference> addToCart(Product product) {
|
||||||
return cartRepository.addToCart(productId, price);
|
return cartRepository.addToCart(product);
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryLiveData<CartLineItem> cart() {
|
public QueryLiveData<CartLineItem> cart() {
|
||||||
|
|||||||
@ -23,4 +23,46 @@
|
|||||||
|
|
||||||
<include layout="@layout/content_cart"/>
|
<include layout="@layout/content_cart"/>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
|
android:layout_margin="16dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:elevation="2dp"
|
||||||
|
android:id="@+id/flSave"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/bNext"
|
||||||
|
fontPath="@string/font_regular"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:text="Proceed to checkout"
|
||||||
|
android:padding="12dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textSize="16sp"
|
||||||
|
tools:ignore="MissingPrefix"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:src="@drawable/ic_action_navigation_arrow_back_inverted"
|
||||||
|
android:tint="#ffffff"
|
||||||
|
android:layout_gravity="right|center"
|
||||||
|
android:rotation="180"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
@ -1,42 +1,23 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<android.support.v4.widget.NestedScrollView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:background="@color/bg"
|
android:background="@color/bg"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:ignore="MissingPrefix"
|
tools:ignore="MissingPrefix"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
>
|
>
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
fontPath="@string/font_medium"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:background="@color/bg"
|
||||||
android:gravity="left"
|
android:orientation="vertical"
|
||||||
android:layout_marginLeft="16dp"
|
android:paddingBottom="80dp"
|
||||||
android:layout_marginTop="16dp"
|
>
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:text="Your cart items"
|
|
||||||
android:textColor="@color/text_black_2"
|
|
||||||
android:textSize="20sp"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
fontPath="@string/font_regular"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="left"
|
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:text="Review and edit"
|
|
||||||
android:maxLines="6"
|
|
||||||
android:lineSpacingMultiplier="1.2"
|
|
||||||
android:textColor="@color/text_black_9"
|
|
||||||
android:textSize="16sp"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -57,45 +38,135 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
|
android:background="#d8d8d8"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/colorPrimary"
|
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingTop="4dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingBottom="4dp"
|
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="16dp"
|
||||||
android:layout_margin="16dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:elevation="2dp"
|
|
||||||
android:id="@+id/flSave"
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/bNext"
|
android:id="@+id/tvTotalItemCountTitle"
|
||||||
fontPath="@string/font_regular"
|
fontPath="@string/font_regular"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:gravity="left"
|
||||||
android:background="@color/colorPrimary"
|
android:text="Item (1)"
|
||||||
android:text="Proceed to checkout"
|
android:layout_weight="1"
|
||||||
android:padding="12dp"
|
android:textColor="@color/text_black_9"
|
||||||
android:gravity="center"
|
android:textSize="14sp"
|
||||||
android:textAllCaps="false"
|
|
||||||
android:textColor="#ffffff"
|
|
||||||
android:textSize="16sp"
|
|
||||||
tools:ignore="MissingPrefix"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="32dp"
|
|
||||||
android:layout_height="32dp"
|
|
||||||
android:src="@drawable/ic_action_navigation_arrow_back_inverted"
|
|
||||||
android:tint="#ffffff"
|
|
||||||
android:layout_gravity="right|center"
|
|
||||||
android:rotation="180"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</FrameLayout>
|
<TextView
|
||||||
|
android:id="@+id/tvTotalItemCost"
|
||||||
|
fontPath="@string/font_medium"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="right"
|
||||||
|
android:text="$0"
|
||||||
|
android:textColor="@color/text_black_9"
|
||||||
|
android:textSize="14sp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvShippingTitle"
|
||||||
|
fontPath="@string/font_regular"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="left"
|
||||||
|
android:text="Shipping within San Fransisco"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textColor="@color/text_black_9"
|
||||||
|
android:textSize="14sp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvShippingCost"
|
||||||
|
fontPath="@string/font_medium"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="right"
|
||||||
|
android:text="$0"
|
||||||
|
android:textColor="@color/text_black_9"
|
||||||
|
android:textSize="14sp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
|
android:background="#d8d8d8"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="16dp"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
fontPath="@string/font_medium"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="left"
|
||||||
|
android:text="Total"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textColor="@color/text_black_2"
|
||||||
|
android:textSize="20sp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvTotal"
|
||||||
|
fontPath="@string/font_medium"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="right"
|
||||||
|
android:text="$0"
|
||||||
|
android:textColor="@color/text_black_2"
|
||||||
|
android:textSize="20sp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
|
android:background="#d8d8d8"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</android.support.v4.widget.NestedScrollView>
|
||||||
@ -1,30 +1,44 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="#ffffff"
|
android:background="#ffffff"
|
||||||
android:paddingTop="8dp"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="8dp"
|
tools:ignore="MissingPrefix"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="16dp"
|
||||||
android:layout_margin="4dp"
|
|
||||||
android:gravity="top"
|
android:gravity="top"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
tools:ignore="MissingPrefix"
|
|
||||||
android:elevation="2dp"
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="40dp"
|
android:layout_width="80dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="80dp"
|
||||||
android:background="@color/bg"
|
android:background="@color/bg"
|
||||||
android:elevation="1dp"
|
android:elevation="1dp"
|
||||||
android:id="@+id/ivImage"
|
android:id="@+id/ivImage"
|
||||||
android:scaleType="centerCrop"/>
|
android:scaleType="centerCrop"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -34,6 +48,7 @@
|
|||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginRight="16dp"
|
android:layout_marginRight="16dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvTitle"
|
android:id="@+id/tvTitle"
|
||||||
fontPath="@string/font_medium"
|
fontPath="@string/font_medium"
|
||||||
@ -42,42 +57,53 @@
|
|||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:text="Title"
|
android:text="Title"
|
||||||
android:textColor="@color/text"
|
android:textColor="@color/text"
|
||||||
android:textSize="18sp"
|
android:textSize="16sp"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvPrice"
|
android:id="@+id/tvPrice"
|
||||||
fontPath="@string/font_regular"
|
fontPath="@string/font_medium"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginRight="0dp"
|
android:layout_marginRight="0dp"
|
||||||
android:layout_marginBottom="0dp"
|
android:layout_marginBottom="0dp"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:text="$20.00"
|
android:text="$20.00"
|
||||||
android:textColor="#1c5c9a"
|
android:layout_gravity="left"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="14sp"/>
|
android:textSize="14sp"/>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<FrameLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="88dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/cylinderical"
|
android:background="@drawable/cylinderical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvMyCart_single_item_service_less"
|
android:id="@+id/tvReduce"
|
||||||
android:layout_width="24dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="4dp"
|
android:padding="4dp"
|
||||||
|
android:layout_weight="1"
|
||||||
android:text="–"
|
android:text="–"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="18sp"/>
|
android:textSize="18sp"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvMyCart_single_item_service_quantity"
|
android:id="@+id/tvQty"
|
||||||
android:layout_width="32dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
android:background="@color/colorPrimary"
|
android:background="@color/colorPrimary"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="1"
|
android:text="1"
|
||||||
@ -85,9 +111,10 @@
|
|||||||
android:textSize="14sp"/>
|
android:textSize="14sp"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvMyCart_single_item_service_more"
|
android:id="@+id/tvAdd"
|
||||||
android:layout_width="24dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="4dp"
|
android:padding="4dp"
|
||||||
android:text="+"
|
android:text="+"
|
||||||
@ -96,4 +123,38 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvDescription"
|
||||||
|
fontPath="@string/font_regular"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:gravity="left"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:text="@string/lorem"
|
||||||
|
android:lineSpacingMultiplier="1.2"
|
||||||
|
android:textColor="@color/text_black_5"
|
||||||
|
android:textSize="14sp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/bg"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user