Feature module
The cart feature module includes all the presentation logic required to display the cart screen. If you need to include this module, add it to your build.gradle
:
implementation ("com.poqstudio:checkout.cart:$VERSION_NAME")
Architecture
CartActivity
is the entry point to the Cart screen.CartFragment
handles the action bar menu items (edit/done button).CartView
controls the visibility of the elements in the screen. It also initialisesCartRecyclerViewAdapter
with the information received fromCartViewModel
and handles the navigation of the screen.BaseCartItemViewHolder
is the view holder for the cart item block.CartItemViewModel
is the ViewModel for the cart item block.BaseVoucherTitleCartItemViewHolder
is the view holder for the vouchers section title.BaseAppliedVoucherCartItemViewHolder
is the view holder for the applied vouchers block.AppliedVoucherCartItemViewModel
is the ViewModel for the applied vouchers block.BaseAddVoucherCartItemViewHolder
is the view holder for the add vouchers block.AddVoucherCartItemViewModel
is the ViewModel for the add vouchers block.BaseCustomCartItemViewHolder
is the view holder for your custom blocks.CartViewModel
is the main ViewModel that coordinates the rest of the ViewModels.CartStateViewModel
is responsible for executing the domain interactors and exposes the state of the screen.CheckoutPanelViewModel
receives the cart model and exposes the necessary data to presentCheckoutPanelView
.CartStore
handles the edit mode and its actions, keeping the copy of the edited items.
Views breakdown
The Cart screen is broken down into different views:
View | XML | Alias |
---|---|---|
CartActivity | activity_cart.xml | |
CartFragment | fragment_cart.xml | |
CartView | cart_view.xml | cartViewLayout |
CheckoutPanelView | checkout_panel_view.xml | checkoutPanelViewLayout |
BaseCartItemViewHolder | item_cart_list.xml | itemCartListLayout |
BaseVoucherTitleCartItemViewHolder | item_cart_list_voucher_title.xml | itemCartListLayout |
BaseAppliedVoucherCartItemViewHolder | item_cart_list_applied_voucher.xml | itemCartListAppliedVoucherLayout |
BaseAddVoucherCartItemViewHolder | item_cart_list_add_voucher.xml | itemCartListAddVoucherLayout |
BaseCustomCartItemViewHolder | item_cart_list_custom.xml | itemCartListCustomLayout |
QuantitySelector | quantity_selector.xml | quantitySelectorLayout |
ShimmerCartView | place_holder_cart.xml | shimmerCartLayout |
Styles breakdown
The recommended way of styling Cart screen is by using App Styling. If you need more granular customisation, you can override the specific style and provide your own. The styles for the Cart screen are shown in the images below: