Adding a cart page
This commit is contained in:
parent
6d3ee7f2c7
commit
a19c3e24e3
@ -13,6 +13,11 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true">
|
||||||
|
<activity
|
||||||
|
android:name=".ui.product.CartActivity"
|
||||||
|
android:label="@string/title_activity_cart"
|
||||||
|
android:theme="@style/AppTheme.NoActionBar">
|
||||||
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.customer.ProfileActivity"
|
android:name=".ui.customer.ProfileActivity"
|
||||||
android:label="@string/title_activity_profile"
|
android:label="@string/title_activity_profile"
|
||||||
|
|||||||
37
app/src/main/java/me/gilo/wc/adapter/CartAdapter.java
Normal file
37
app/src/main/java/me/gilo/wc/adapter/CartAdapter.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package me.gilo.wc.adapter;
|
||||||
|
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import me.gilo.wc.R;
|
||||||
|
import me.gilo.wc.adapter.viewholder.CartViewHolder;
|
||||||
|
import me.gilo.wc.adapter.viewholder.CategoryViewHolder;
|
||||||
|
import me.gilo.wc.models.CartLineItem;
|
||||||
|
import me.gilo.woodroid.models.CartItem;
|
||||||
|
import me.gilo.woodroid.models.Category;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CartAdapter extends RecyclerView.Adapter<CartViewHolder> {
|
||||||
|
private List<CartLineItem> cartLineItems;
|
||||||
|
|
||||||
|
public CartAdapter(List<CartLineItem> categories) {
|
||||||
|
this.cartLineItems = cartLineItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CartViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
return new CartViewHolder(parent.getContext(), LayoutInflater.from(parent.getContext()).inflate(R.layout.single_cart_item, parent, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(CartViewHolder holder, int position) {
|
||||||
|
holder.renderView(cartLineItems.get(position));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return cartLineItems.size() == 0 ? 0 : cartLineItems.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
package me.gilo.wc.adapter.viewholder
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.support.v7.widget.RecyclerView
|
||||||
|
import android.text.Html
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.ImageView
|
||||||
|
import android.widget.TextView
|
||||||
|
import com.squareup.picasso.Picasso
|
||||||
|
import me.gilo.woodroid.models.Product
|
||||||
|
import android.text.Spannable
|
||||||
|
import android.text.style.ForegroundColorSpan
|
||||||
|
import android.text.SpannableString
|
||||||
|
import android.graphics.Color
|
||||||
|
import kotlinx.android.synthetic.main.content_product.*
|
||||||
|
import me.gilo.wc.R
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
class CartViewHolder(val context: Context, itemView: View) :
|
||||||
|
RecyclerView.ViewHolder(itemView) {
|
||||||
|
|
||||||
|
fun renderView(cartLineItem: CartLineItem) {
|
||||||
|
val ivImage = itemView.findViewById<ImageView>(R.id.ivImage)
|
||||||
|
val tvTitle = itemView.findViewById<TextView>(R.id.tvTitle)
|
||||||
|
val tvPrice = itemView.findViewById<TextView>(R.id.tvPrice)
|
||||||
|
|
||||||
|
tvTitle.text = cartLineItem.name
|
||||||
|
|
||||||
|
if (cartLineItem.imageUrl.isNotEmpty()){
|
||||||
|
Picasso.with(context).load(cartLineItem.imageUrl).into(ivImage)
|
||||||
|
}
|
||||||
|
|
||||||
|
tvPrice.text = cartLineItem.priceString;
|
||||||
|
|
||||||
|
|
||||||
|
itemView.setOnClickListener{
|
||||||
|
val intent = Intent(context, ProductActivity::class.java)
|
||||||
|
intent.putExtra("productId", cartLineItem.productId)
|
||||||
|
|
||||||
|
context.startActivity(intent)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -11,6 +11,7 @@ import me.gilo.wc.ui.customer.BillingAddressActivity;
|
|||||||
import me.gilo.wc.ui.customer.ProfileActivity;
|
import me.gilo.wc.ui.customer.ProfileActivity;
|
||||||
import me.gilo.wc.ui.customer.ShippingAddressActivity;
|
import me.gilo.wc.ui.customer.ShippingAddressActivity;
|
||||||
import me.gilo.wc.ui.home.HomeActivity;
|
import me.gilo.wc.ui.home.HomeActivity;
|
||||||
|
import me.gilo.wc.ui.product.CartActivity;
|
||||||
import me.gilo.wc.ui.product.ProductActivity;
|
import me.gilo.wc.ui.product.ProductActivity;
|
||||||
import me.gilo.wc.ui.product.ShopActivity;
|
import me.gilo.wc.ui.product.ShopActivity;
|
||||||
|
|
||||||
@ -44,6 +45,9 @@ abstract class ActivitiesModule {
|
|||||||
@ContributesAndroidInjector
|
@ContributesAndroidInjector
|
||||||
abstract ShippingAddressActivity contributesShippingAddressActivity();
|
abstract ShippingAddressActivity contributesShippingAddressActivity();
|
||||||
|
|
||||||
|
@ContributesAndroidInjector
|
||||||
|
abstract CartActivity contributesCartActivity();
|
||||||
|
|
||||||
@ContributesAndroidInjector
|
@ContributesAndroidInjector
|
||||||
abstract ProfileActivity contributesProfileActivity();
|
abstract ProfileActivity contributesProfileActivity();
|
||||||
|
|
||||||
|
|||||||
@ -39,6 +39,12 @@ public abstract class ViewModelModule {
|
|||||||
@ViewModelKey(CustomerViewModel.class)
|
@ViewModelKey(CustomerViewModel.class)
|
||||||
abstract ViewModel bindCustomerViewModel(CustomerViewModel viewModel);
|
abstract ViewModel bindCustomerViewModel(CustomerViewModel viewModel);
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@ViewModelKey(CartViewModel.class)
|
||||||
|
abstract ViewModel bindCartViewModel(CartViewModel viewModel);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@IntoMap
|
@IntoMap
|
||||||
|
|||||||
@ -13,6 +13,10 @@ public class CartLineItem extends Model{
|
|||||||
public int quantity;
|
public int quantity;
|
||||||
public int productId;
|
public int productId;
|
||||||
|
|
||||||
|
String name;
|
||||||
|
String imageUrl;
|
||||||
|
String priceString;
|
||||||
|
|
||||||
public float getPrice() {
|
public float getPrice() {
|
||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
@ -36,4 +40,28 @@ public class CartLineItem extends Model{
|
|||||||
public void setProductId(int productId) {
|
public void setProductId(int productId) {
|
||||||
this.productId = productId;
|
this.productId = productId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImageUrl() {
|
||||||
|
return imageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImageUrl(String imageUrl) {
|
||||||
|
this.imageUrl = imageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPriceString() {
|
||||||
|
return priceString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriceString(String priceString) {
|
||||||
|
this.priceString = priceString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
68
app/src/main/java/me/gilo/wc/ui/product/CartActivity.kt
Normal file
68
app/src/main/java/me/gilo/wc/ui/product/CartActivity.kt
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
package me.gilo.wc.ui.product
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Bundle
|
||||||
|
import io.github.inflationx.viewpump.ViewPumpContextWrapper
|
||||||
|
import kotlinx.android.synthetic.main.activity_cart.*
|
||||||
|
import me.gilo.wc.R
|
||||||
|
import me.gilo.wc.common.Status
|
||||||
|
import me.gilo.wc.models.CartLineItem
|
||||||
|
import me.gilo.wc.ui.WooDroidActivity
|
||||||
|
import me.gilo.wc.viewmodels.CartViewModel
|
||||||
|
|
||||||
|
class CartActivity : WooDroidActivity<CartViewModel>() {
|
||||||
|
|
||||||
|
|
||||||
|
override lateinit var viewModel : CartViewModel
|
||||||
|
var cartItems : ArrayList<CartLineItem> = ArrayList()
|
||||||
|
|
||||||
|
override fun attachBaseContext(newBase: Context) {
|
||||||
|
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_cart)
|
||||||
|
|
||||||
|
setSupportActionBar(toolbar)
|
||||||
|
|
||||||
|
viewModel = getViewModel(CartViewModel::class.java)
|
||||||
|
title = "Cart"
|
||||||
|
|
||||||
|
cart()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun cart() {
|
||||||
|
viewModel.cart().observe(this, android.arch.lifecycle.Observer { response ->
|
||||||
|
when (response!!.status()) {
|
||||||
|
Status.LOADING -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Status.SUCCESS -> {
|
||||||
|
cartItems.clear()
|
||||||
|
|
||||||
|
for (cartItem in response.data()){
|
||||||
|
cartItems.add(cartItem)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Status.ERROR -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Status.EMPTY -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,9 +1,9 @@
|
|||||||
package me.gilo.wc.ui.product
|
package me.gilo.wc.ui.product
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.support.v4.content.ContextCompat
|
import android.support.v4.content.ContextCompat
|
||||||
import android.support.v4.view.GravityCompat
|
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
@ -23,7 +23,6 @@ import me.gilo.wc.ui.state.ProgressDialogFragment
|
|||||||
import me.gilo.wc.viewmodels.ProductViewModel
|
import me.gilo.wc.viewmodels.ProductViewModel
|
||||||
import me.gilo.woodroid.models.Product
|
import me.gilo.woodroid.models.Product
|
||||||
import org.greenrobot.eventbus.EventBus
|
import org.greenrobot.eventbus.EventBus
|
||||||
import java.security.AccessController.getContext
|
|
||||||
|
|
||||||
|
|
||||||
class ProductActivity : BaseActivity() {
|
class ProductActivity : BaseActivity() {
|
||||||
@ -263,26 +262,24 @@ class ProductActivity : BaseActivity() {
|
|||||||
var tvCartCounter : TextView? = null
|
var tvCartCounter : TextView? = null
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
menuInflater.inflate(me.gilo.wc.R.menu.home, menu)
|
menuInflater.inflate(me.gilo.wc.R.menu.product, menu)
|
||||||
|
|
||||||
val item = menu.findItem(me.gilo.wc.R.id.menu_cart)
|
val item = menu.findItem(me.gilo.wc.R.id.menu_cart)
|
||||||
val rootView = item.actionView as FrameLayout
|
val rootView = item.actionView as FrameLayout
|
||||||
tvCartCounter = rootView.findViewById<TextView>(me.gilo.wc.R.id.tvCart_counter)
|
tvCartCounter = rootView.findViewById<TextView>(me.gilo.wc.R.id.tvCart_counter)
|
||||||
|
|
||||||
|
rootView.setOnClickListener{startActivity(Intent(baseContext, CartActivity::class.java))}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return when (item.itemId) {
|
return when (item.itemId) {
|
||||||
me.gilo.wc.R.id.action_filter -> {
|
R.id.menu_cart -> {
|
||||||
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
me.gilo.wc.R.id.action_search -> {
|
|
||||||
|
|
||||||
true
|
|
||||||
}
|
|
||||||
else -> super.onOptionsItemSelected(item)
|
else -> super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
56
app/src/main/java/me/gilo/wc/viewmodels/CartViewModel.java
Normal file
56
app/src/main/java/me/gilo/wc/viewmodels/CartViewModel.java
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
package me.gilo.wc.viewmodels;
|
||||||
|
|
||||||
|
import android.arch.lifecycle.ViewModel;
|
||||||
|
import android.content.Context;
|
||||||
|
import com.google.firebase.firestore.DocumentReference;
|
||||||
|
import me.gilo.wc.common.CompletionGenericLiveData;
|
||||||
|
import me.gilo.wc.common.QueryLiveData;
|
||||||
|
import me.gilo.wc.common.WooLiveData;
|
||||||
|
import me.gilo.wc.models.CartLineItem;
|
||||||
|
import me.gilo.wc.repo.CartRepository;
|
||||||
|
import me.gilo.wc.repo.OrderRepository;
|
||||||
|
import me.gilo.wc.repo.ProductRepository;
|
||||||
|
import me.gilo.woodroid.models.LineItem;
|
||||||
|
import me.gilo.woodroid.models.Product;
|
||||||
|
import me.gilo.woodroid.models.ProductReview;
|
||||||
|
import me.gilo.woodroid.models.filters.ProductFilter;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
public final class CartViewModel extends ViewModel {
|
||||||
|
|
||||||
|
private final CartRepository cartRepository;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
CartViewModel(CartRepository cartRepository) {
|
||||||
|
this.cartRepository = cartRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompletionGenericLiveData<DocumentReference> addToCart(int productId, float price) {
|
||||||
|
return cartRepository.addToCart(productId, price);
|
||||||
|
}
|
||||||
|
|
||||||
|
public QueryLiveData<CartLineItem> cart() {
|
||||||
|
return cartRepository.cart();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompletionGenericLiveData<Void> deleteItem(CartLineItem cartLineItem) {
|
||||||
|
return cartRepository.deleteItem(cartLineItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompletionGenericLiveData<Void> deleteAllCartItems() {
|
||||||
|
return cartRepository.deleteItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompletionGenericLiveData<Void> setQuantity(CartLineItem cartLineItem, int quantity) {
|
||||||
|
return cartRepository.setQuantity(cartLineItem, quantity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public WooLiveData<Map<String, LineItem>> cart(Context context) {
|
||||||
|
return cartRepository.cart(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
21
app/src/main/res/drawable/cylinderical.xml
Normal file
21
app/src/main/res/drawable/cylinderical.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle" >
|
||||||
|
|
||||||
|
<padding
|
||||||
|
android:top="0dp"
|
||||||
|
android:left="0dp"
|
||||||
|
android:right="0dp"
|
||||||
|
android:bottom="0dp"/>
|
||||||
|
|
||||||
|
<stroke
|
||||||
|
android:color="@color/colorPrimary"
|
||||||
|
android:width="1dp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<corners
|
||||||
|
android:bottomLeftRadius="16dp"
|
||||||
|
android:bottomRightRadius="16dp"
|
||||||
|
android:topLeftRadius="16dp"
|
||||||
|
android:topRightRadius="16dp" />
|
||||||
|
|
||||||
|
</shape>
|
||||||
26
app/src/main/res/layout/activity_cart.xml
Normal file
26
app/src/main/res/layout/activity_cart.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.design.widget.CoordinatorLayout
|
||||||
|
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:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ui.product.CartActivity">
|
||||||
|
|
||||||
|
<android.support.design.widget.AppBarLayout
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
|
<android.support.v7.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
||||||
|
|
||||||
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
<include layout="@layout/content_cart"/>
|
||||||
|
|
||||||
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
101
app/src/main/res/layout/content_cart.xml
Normal file
101
app/src/main/res/layout/content_cart.xml
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<?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="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.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"
|
||||||
|
>
|
||||||
|
|
||||||
|
</android.support.v7.widget.RecyclerView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<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"
|
||||||
|
>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@ -26,6 +26,7 @@
|
|||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
android:paddingTop="0dp"
|
android:paddingTop="0dp"
|
||||||
android:paddingLeft="0dp"
|
android:paddingLeft="0dp"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_gravity="bottom|right"
|
android:layout_gravity="bottom|right"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
|
|||||||
99
app/src/main/res/layout/single_cart_item.xml
Normal file
99
app/src/main/res/layout/single_cart_item.xml
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
<?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"
|
||||||
|
>
|
||||||
|
|
||||||
|
<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"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvPrice"
|
||||||
|
fontPath="@string/font_regular"
|
||||||
|
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:textColor="#1c5c9a"
|
||||||
|
android:textSize="14sp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/cylinderical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<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>
|
||||||
@ -43,5 +43,6 @@
|
|||||||
United States \n
|
United States \n
|
||||||
(555) 555 555
|
(555) 555 555
|
||||||
</string>
|
</string>
|
||||||
|
<string name="title_activity_cart">CartActivity</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user