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> {
|
||||
private List<CartLineItem> cartLineItems;
|
||||
|
||||
public CartAdapter(List<CartLineItem> categories) {
|
||||
public CartAdapter(List<CartLineItem> cartLineItems) {
|
||||
this.cartLineItems = cartLineItems;
|
||||
}
|
||||
|
||||
|
||||
@ -15,10 +15,14 @@ import android.text.SpannableString
|
||||
import android.graphics.Color
|
||||
import kotlinx.android.synthetic.main.content_product.*
|
||||
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.ui.coupon.CouponActivity
|
||||
import me.gilo.wc.ui.product.ProductActivity
|
||||
import me.gilo.woodroid.models.CartItem
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
|
||||
class CartViewHolder(val context: Context, itemView: View) :
|
||||
@ -27,15 +31,35 @@ class CartViewHolder(val context: Context, itemView: View) :
|
||||
fun renderView(cartLineItem: CartLineItem) {
|
||||
val ivImage = itemView.findViewById<ImageView>(R.id.ivImage)
|
||||
val tvTitle = itemView.findViewById<TextView>(R.id.tvTitle)
|
||||
val tvDescription = itemView.findViewById<TextView>(R.id.tvDescription)
|
||||
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{
|
||||
@ -45,6 +69,14 @@ class CartViewHolder(val context: Context, itemView: View) :
|
||||
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 me.gilo.woodroid.models.Metum;
|
||||
import me.gilo.woodroid.models.Product;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -13,6 +14,8 @@ public class CartLineItem extends Model{
|
||||
public int quantity;
|
||||
public int productId;
|
||||
|
||||
Product product;
|
||||
|
||||
String name;
|
||||
String imageUrl;
|
||||
String priceString;
|
||||
@ -64,4 +67,12 @@ public class CartLineItem extends Model{
|
||||
public void setPriceString(String 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.woodroid.Woocommerce;
|
||||
import me.gilo.woodroid.models.LineItem;
|
||||
import me.gilo.woodroid.models.Product;
|
||||
|
||||
import javax.inject.Inject;
|
||||
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();
|
||||
|
||||
CartLineItem lineItem = new CartLineItem();
|
||||
lineItem.setProductId(productId);
|
||||
lineItem.setPrice(price);
|
||||
lineItem.setProductId(product.getId());
|
||||
lineItem.setProduct(product);
|
||||
lineItem.setQuantity(1);
|
||||
|
||||
cart.add(lineItem).addOnCompleteListener(completion);
|
||||
|
||||
@ -5,6 +5,7 @@ import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.support.design.widget.Snackbar
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.widget.Toast
|
||||
import io.github.inflationx.viewpump.ViewPumpContextWrapper
|
||||
import me.gilo.wc.R
|
||||
|
||||
@ -27,6 +28,10 @@ abstract class WooDroidActivity<T : ViewModel> : BaseActivity() {
|
||||
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase))
|
||||
}
|
||||
|
||||
fun showLoading() {
|
||||
showLoading("Please wait", "This will only take a second")
|
||||
}
|
||||
|
||||
fun showLoading(title: String, message: String) {
|
||||
val manager = supportFragmentManager
|
||||
progressDialog = ProgressDialogFragment.newInstance(title, message)
|
||||
@ -38,4 +43,8 @@ abstract class WooDroidActivity<T : ViewModel> : BaseActivity() {
|
||||
progressDialog.dismiss()
|
||||
}
|
||||
|
||||
fun toast(text : String){
|
||||
Toast.makeText(baseContext, text, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,19 +2,32 @@ package me.gilo.wc.ui.product
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.text.SpannableString
|
||||
import io.github.inflationx.viewpump.ViewPumpContextWrapper
|
||||
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.adapter.CartAdapter
|
||||
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.ui.WooDroidActivity
|
||||
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>() {
|
||||
|
||||
|
||||
override lateinit var viewModel : CartViewModel
|
||||
var cartItems : ArrayList<CartLineItem> = ArrayList()
|
||||
override lateinit var viewModel: CartViewModel
|
||||
var cartItems: ArrayList<CartLineItem> = ArrayList()
|
||||
|
||||
lateinit var adapter: CartAdapter
|
||||
|
||||
override fun attachBaseContext(newBase: Context) {
|
||||
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase))
|
||||
@ -29,24 +42,123 @@ class CartActivity : WooDroidActivity<CartViewModel>() {
|
||||
viewModel = getViewModel(CartViewModel::class.java)
|
||||
title = "Cart"
|
||||
|
||||
val layoutManager = LinearLayoutManager(baseContext, LinearLayoutManager.VERTICAL, false)
|
||||
rvCart.layoutManager = layoutManager
|
||||
rvCart.isNestedScrollingEnabled = false
|
||||
|
||||
cartItems = ArrayList()
|
||||
|
||||
adapter = CartAdapter(cartItems)
|
||||
rvCart.adapter = adapter
|
||||
|
||||
cart()
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun cart() {
|
||||
viewModel.cart().observe(this, android.arch.lifecycle.Observer { response ->
|
||||
when (response!!.status()) {
|
||||
Status.LOADING -> {
|
||||
|
||||
showLoading()
|
||||
}
|
||||
|
||||
Status.SUCCESS -> {
|
||||
cartItems.clear()
|
||||
stopShowingLoading()
|
||||
|
||||
for (cartItem in response.data()){
|
||||
for (cartItem in response.data()) {
|
||||
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 -> {
|
||||
@ -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) {
|
||||
viewModel.addToCart(productId, price).observe(this, android.arch.lifecycle.Observer { response ->
|
||||
private fun addToCart(product: Product) {
|
||||
viewModel.addToCart(product).observe(this, android.arch.lifecycle.Observer { response ->
|
||||
when (response!!.status()) {
|
||||
Status.LOADING -> {
|
||||
|
||||
@ -233,7 +233,7 @@ class ProductActivity : BaseActivity() {
|
||||
if (productInCart){
|
||||
removeFromCart(currentCartItem)
|
||||
}else {
|
||||
addToCart(productId, product.price.toFloat())
|
||||
addToCart(product)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,8 +29,8 @@ public final class CartViewModel extends ViewModel {
|
||||
this.cartRepository = cartRepository;
|
||||
}
|
||||
|
||||
public CompletionGenericLiveData<DocumentReference> addToCart(int productId, float price) {
|
||||
return cartRepository.addToCart(productId, price);
|
||||
public CompletionGenericLiveData<DocumentReference> addToCart(Product product) {
|
||||
return cartRepository.addToCart(product);
|
||||
}
|
||||
|
||||
public QueryLiveData<CartLineItem> cart() {
|
||||
|
||||
@ -39,8 +39,8 @@ public final class ProductViewModel extends ViewModel {
|
||||
return productRepository.products();
|
||||
}
|
||||
|
||||
public CompletionGenericLiveData<DocumentReference> addToCart(int productId, float price) {
|
||||
return cartRepository.addToCart(productId, price);
|
||||
public CompletionGenericLiveData<DocumentReference> addToCart(Product product) {
|
||||
return cartRepository.addToCart(product);
|
||||
}
|
||||
|
||||
public QueryLiveData<CartLineItem> cart() {
|
||||
|
||||
@ -23,4 +23,46 @@
|
||||
|
||||
<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>
|
||||
@ -1,101 +1,172 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@color/bg"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="MissingPrefix"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
>
|
||||
|
||||
<TextView
|
||||
fontPath="@string/font_medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left"
|
||||
android:layout_marginLeft="16dp"
|
||||
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
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/bg"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="80dp"
|
||||
>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:id="@+id/rvCart"
|
||||
android:elevation="2dp"
|
||||
android:background="@drawable/rect_white"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
>
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:id="@+id/rvCart"
|
||||
android:elevation="2dp"
|
||||
android:background="@drawable/rect_white"
|
||||
>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
<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:elevation="2dp"
|
||||
android:id="@+id/flSave"
|
||||
>
|
||||
</LinearLayout>
|
||||
|
||||
<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"
|
||||
<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"
|
||||
/>
|
||||
|
||||
</FrameLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTotalItemCountTitle"
|
||||
fontPath="@string/font_regular"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left"
|
||||
android:text="Item (1)"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@color/text_black_9"
|
||||
android:textSize="14sp"
|
||||
/>
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
</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>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
@ -1,99 +1,160 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#ffffff"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:layout_margin="4dp"
|
||||
android:gravity="top"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="MissingPrefix"
|
||||
android:elevation="2dp"
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#ffffff"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="MissingPrefix"
|
||||
android:layout_marginTop="16dp"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@color/bg"
|
||||
android:elevation="1dp"
|
||||
android:id="@+id/ivImage"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
fontPath="@string/font_medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left"
|
||||
android:text="Title"
|
||||
android:textColor="@color/text"
|
||||
android:textSize="18sp"
|
||||
/>
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:gravity="top"
|
||||
android:orientation="horizontal"
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvPrice"
|
||||
fontPath="@string/font_regular"
|
||||
android:layout_width="wrap_content"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:background="@color/bg"
|
||||
android:elevation="1dp"
|
||||
android:id="@+id/ivImage"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="0dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:gravity="left"
|
||||
android:text="$20.00"
|
||||
android:textColor="#1c5c9a"
|
||||
android:textSize="14sp"/>
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
fontPath="@string/font_medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left"
|
||||
android:text="Title"
|
||||
android:textColor="@color/text"
|
||||
android:textSize="16sp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvPrice"
|
||||
fontPath="@string/font_medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="0dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:gravity="left"
|
||||
android:text="$20.00"
|
||||
android:layout_gravity="left"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="88dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/cylinderical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvReduce"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="4dp"
|
||||
android:layout_weight="1"
|
||||
android:text="–"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvQty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/colorPrimary"
|
||||
android:gravity="center"
|
||||
android:text="1"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAdd"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:padding="4dp"
|
||||
android:text="+"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
</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>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/cylinderical"
|
||||
android:orientation="horizontal">
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/bg"
|
||||
android:layout_marginTop="16dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvMyCart_single_item_service_less"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="4dp"
|
||||
android:text="–"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvMyCart_single_item_service_quantity"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorPrimary"
|
||||
android:gravity="center"
|
||||
android:text="1"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvMyCart_single_item_service_more"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="4dp"
|
||||
android:text="+"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user