├── .gitignore ├── .idea ├── codeStyles │ └── Project.xml └── gradle.xml ├── LICENSE ├── README.md ├── README_Res ├── CartAdapter.png ├── cartlayout-1.0.6.aar └── release │ └── app-release.apk ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── ocnyang │ │ └── cartlayoutdemo │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── ic_app-web.png │ ├── java │ │ └── com │ │ │ └── ocnyang │ │ │ └── cartlayoutdemo │ │ │ ├── MainActivity.java │ │ │ ├── MainAdapter.java │ │ │ ├── bean │ │ │ ├── GoodsBean.java │ │ │ ├── NormalBean.java │ │ │ └── ShopBean.java │ │ │ └── viewholder │ │ │ ├── ChildViewHolder.java │ │ │ ├── GroupViewHolder.java │ │ │ └── NormalViewHolder.java │ └── res │ │ ├── drawable-v24 │ │ ├── ic_launcher_foreground.xml │ │ └── shape_divider_1_v.xml │ │ ├── drawable │ │ ├── ic_app_background.xml │ │ ├── ic_app_foreground.xml │ │ ├── ic_close.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_logo.xml │ │ ├── ic_notifications_none.xml │ │ ├── shape_cart_item_add_cut_border.xml │ │ ├── shape_divider_1_v.xml │ │ └── shape_item_normal_bg.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── activity_main_item_child.xml │ │ ├── activity_main_item_group.xml │ │ └── activity_main_item_normal.xml │ │ ├── menu │ │ └── main_contextmenu.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_app.xml │ │ └── ic_app_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_app.png │ │ └── ic_app_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_app.png │ │ └── ic_app_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_app.png │ │ └── ic_app_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_app.png │ │ └── ic_app_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_app.png │ │ └── ic_app_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── ocnyang │ └── cartlayoutdemo │ └── ExampleUnitTest.java ├── build.gradle ├── cartlayout ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── ocnyang │ │ └── cartlayout │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── ocnyang │ │ │ └── cartlayout │ │ │ ├── CartAdapter.java │ │ │ ├── ParseHelper.java │ │ │ ├── RecyclerViewWithContextMenu.java │ │ │ ├── bean │ │ │ ├── CartItemBean.java │ │ │ ├── ChildItemBean.java │ │ │ ├── GroupItemBean.java │ │ │ ├── ICartItem.java │ │ │ ├── IChildItem.java │ │ │ └── IGroupItem.java │ │ │ ├── listener │ │ │ ├── CartOnCheckChangeListener.java │ │ │ ├── OnCheckChangeListener.java │ │ │ ├── OnChildCollapsingChangeListener.java │ │ │ └── OnItemChangeListener.java │ │ │ └── viewholder │ │ │ └── CartViewHolder.java │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── ocnyang │ └── cartlayout │ └── ExampleUnitTest.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | .idea 4 | .DS_Store 5 | /build 6 | /captures 7 | .externalNativeBuild 8 | app/release/output.json 9 | /local.properties 10 | README_Res/release/output.json 11 | /.idea/ 12 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | xmlns:android 14 | 15 | ^$ 16 | 17 | 18 | 19 |
20 |
21 | 22 | 23 | 24 | xmlns:.* 25 | 26 | ^$ 27 | 28 | 29 | BY_NAME 30 | 31 |
32 |
33 | 34 | 35 | 36 | .*:id 37 | 38 | http://schemas.android.com/apk/res/android 39 | 40 | 41 | 42 |
43 |
44 | 45 | 46 | 47 | .*:name 48 | 49 | http://schemas.android.com/apk/res/android 50 | 51 | 52 | 53 |
54 |
55 | 56 | 57 | 58 | name 59 | 60 | ^$ 61 | 62 | 63 | 64 |
65 |
66 | 67 | 68 | 69 | style 70 | 71 | ^$ 72 | 73 | 74 | 75 |
76 |
77 | 78 | 79 | 80 | .* 81 | 82 | ^$ 83 | 84 | 85 | BY_NAME 86 | 87 |
88 |
89 | 90 | 91 | 92 | .* 93 | 94 | http://schemas.android.com/apk/res/android 95 | 96 | 97 | ANDROID_ATTRIBUTE_ORDER 98 | 99 |
100 |
101 | 102 | 103 | 104 | .* 105 | 106 | .* 107 | 108 | 109 | BY_NAME 110 | 111 |
112 |
113 |
114 |
115 |
116 |
-------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CartLayout(严格说应该叫 CartAdapter 的,现在将错就错吧 :grinning:) 2 | 3 | [![GitHub issues](https://img.shields.io/github/issues/OCNYang/CartLayout.svg)](https://github.com/OCNYang/CartLayout/issues)   4 | [![GitHub forks](https://img.shields.io/github/forks/OCNYang/CartLayout.svg)](https://github.com/OCNYang/CartLayout/network)   5 | [![GitHub stars](https://img.shields.io/github/stars/OCNYang/CartLayout.svg)](https://github.com/OCNYang/CartLayout/stargazers) 6 | 7 | 使用纯原生 RecyclerView 实现购物车效果(高仿京东购物车、淘宝购物车、天猫购物车)。不要问我为什么不使用 ExpandableListView (爱过,被坑的次数多了,就不爱了)。 8 | 9 | **Demo 中主要实现以下功能(基本上购物车的功能全实现了):** 10 | 11 | - [x] 商品列表通过店铺进行分组显示; 12 | - [x] 勾选店铺,联动店铺下的所有商品勾选;勾选商品,联动店铺的勾选; 13 | - [x] 全选功能实现:联动商品、店铺的勾选按钮,反向联动亦然; 14 | - [x] 实现编辑购物车商品的功能:点击编辑 > 删除勾选的商品; 15 | - [x] 实现商品 item 长按弹出选项菜单,进行单个商品删除等操作功能; 16 | - [x] 支持列表头部添加 tips ; 17 | - [x] 统计勾选商品的个数、勾选商品价格等; 18 | - [x] **折叠功能** 点击店铺标题,折叠起对应的商品条目; 19 | - [ ] 添加折叠效果的动画效果 20 | 21 | [![Version Code](https://img.shields.io/badge/Version%20Code-1.0.7-brightgreen.svg)](https://github.com/OCNYang/CartLayout/releases) 22 | 23 | CartAdapter效果图 24 | 25 | 26 | ## 导入方法: 27 | To get a Git project into your build: 28 | 29 | ### Step 1. Add the JitPack repository to your build file 30 | 31 | Add it in your root build.gradle at the end of repositories: 32 | 33 | allprojects { 34 | repositories { 35 | ... 36 | maven { url 'https://jitpack.io' } 37 | } 38 | } 39 | 40 | 41 | ### Step 2. Add the dependency 42 | 43 | dependencies { 44 | implementation 'com.github.OCNYang:CartLayout:v1.0.7' 45 | } 46 | 47 | ## 使用方法: 48 | 49 | 创建 Adapter: 50 | 51 | ``` 52 | // 创建你自己的 Adapter 继承 CartAdapter 并实现对应方法。 53 | public class MyAdapter extends CartAdapter { 54 | 55 | public MainAdapter(...) { 56 | super(...); 57 | } 58 | 59 | // 返回对应的 itemViewHolder 60 | @Override 61 | protected CartViewHolder getXXXViewHolder(View itemView) {} 62 | 63 | // 返回对应的 item 布局文件 64 | @Override 65 | protected int getXXXItemLayout() { return R.layout.activity_main_item_XXX; } 66 | 67 | // 根据布局类型渲染不同的布局 68 | @Override 69 | public void onBindViewHolder(@NonNull CartViewHolder holder, final int position) { 70 | super.onBindViewHolder(holder, position); 71 | if (holder instanceof ChildViewHolder) { 72 | ... 73 | } else if (holder instanceof GroupViewHolder) { 74 | ... 75 | } else if (holder instanceof NormalViewHolder) { 76 | ... 77 | } 78 | } 79 | } 80 | ``` 81 | 82 | 将 Adapter 设置给 RecyclerView: 83 | 84 | ``` 85 | recyclerView.setLayoutManager(new LinearLayoutManager(this)); 86 | mAdapter = new MyAdapter(this, getData()); 87 | // 设置是否可以折叠,默认不可折叠; (建议使用)也可以通过 Adapter 的构造方法传入 mAdapter = new MyAdapter(this, getData(), true); 88 | mAdapter.setCanCollapsing(true); 89 | // 设置勾选状态变化的监听器,用来统计总价等逻辑,(必须要设置) 90 | mAdapter.setOnCheckChangeListener(new CartOnCheckChangeListener(recyclerView, mAdapter) { 91 | @Override 92 | public void onCalculateChanged(ICartItem cartItemBean) { 93 | calculate(); 94 | } 95 | }); 96 | recyclerView.setAdapter(mAdapter); 97 | 98 | // 给列表注册 ContextMenu 事件。 99 | registerForContextMenu(recyclerView); 100 | ``` 101 | 102 | > 更详细的使用方法请查看 Demo,Demo 中实现方式和各方法的作用在注释中写的很详细。 103 | 104 | [APK下载地址](./README_Res/release/app-release.apk) 105 | 106 | [直接下载 aar 包使用](./README_Res/cartlayout-1.0.6.aar) 107 | -------------------------------------------------------------------------------- /README_Res/CartAdapter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCNYang/CartLayout/af91716c1c86a90fd4c9449c84c004249f0c0466/README_Res/CartAdapter.png -------------------------------------------------------------------------------- /README_Res/cartlayout-1.0.6.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCNYang/CartLayout/af91716c1c86a90fd4c9449c84c004249f0c0466/README_Res/cartlayout-1.0.6.aar -------------------------------------------------------------------------------- /README_Res/release/app-release.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCNYang/CartLayout/af91716c1c86a90fd4c9449c84c004249f0c0466/README_Res/release/app-release.apk -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | group='com.github.OCNYang' 4 | 5 | android { 6 | compileSdkVersion 31 7 | defaultConfig { 8 | applicationId "com.ocnyang.cartlayoutdemo" 9 | minSdkVersion 14 10 | targetSdkVersion 31 11 | versionCode 2 12 | versionName "1.0.1" 13 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | implementation fileTree(include: ['*.jar'], dir: 'libs') 25 | implementation 'androidx.appcompat:appcompat:1.0.0' 26 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 27 | testImplementation 'junit:junit:4.12' 28 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 29 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' 30 | implementation 'androidx.recyclerview:recyclerview:1.0.0' 31 | implementation project(':cartlayout') 32 | // implementation 'com.github.OCNYang:CartLayout:v1.0.5' 33 | } 34 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/ocnyang/cartlayoutdemo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.ocnyang.cartlayoutdemo; 2 | 3 | import android.content.Context; 4 | import androidx.test.platform.app.InstrumentationRegistry; 5 | import androidx.test.ext.junit.runners.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.ocnyang.cartlayoutdemo", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/ic_app-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCNYang/CartLayout/af91716c1c86a90fd4c9449c84c004249f0c0466/app/src/main/ic_app-web.png -------------------------------------------------------------------------------- /app/src/main/java/com/ocnyang/cartlayoutdemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.ocnyang.cartlayoutdemo; 2 | 3 | import android.os.Bundle; 4 | import androidx.appcompat.app.AppCompatActivity; 5 | import androidx.recyclerview.widget.LinearLayoutManager; 6 | import androidx.recyclerview.widget.RecyclerView; 7 | import android.util.Log; 8 | import android.view.ContextMenu; 9 | import android.view.MenuItem; 10 | import android.view.View; 11 | import android.widget.Button; 12 | import android.widget.CheckBox; 13 | import android.widget.TextView; 14 | import android.widget.Toast; 15 | 16 | import com.ocnyang.cartlayout.RecyclerViewWithContextMenu; 17 | import com.ocnyang.cartlayout.bean.CartItemBean; 18 | import com.ocnyang.cartlayout.bean.ICartItem; 19 | import com.ocnyang.cartlayout.listener.CartOnCheckChangeListener; 20 | import com.ocnyang.cartlayoutdemo.bean.GoodsBean; 21 | import com.ocnyang.cartlayoutdemo.bean.NormalBean; 22 | import com.ocnyang.cartlayoutdemo.bean.ShopBean; 23 | 24 | import java.util.ArrayList; 25 | import java.util.List; 26 | 27 | public class MainActivity extends AppCompatActivity implements View.OnClickListener { 28 | 29 | private RecyclerView recyclerView; 30 | private TextView mTvTitle; 31 | private TextView mTvEdit; 32 | private CheckBox mCheckBoxAll; 33 | private TextView mTvTotal; 34 | private Button mBtnSubmit; 35 | 36 | MainAdapter mAdapter; 37 | 38 | private boolean isEditing;//是否处于编辑状态 39 | private int totalCount;//购物车商品ChildItem的总数量,店铺条目不计算在内 40 | private int totalCheckedCount;//勾选的商品总数量,店铺条目不计算在内 41 | private double totalPrice;//勾选的商品总价格 42 | 43 | @Override 44 | protected void onCreate(Bundle savedInstanceState) { 45 | super.onCreate(savedInstanceState); 46 | setContentView(R.layout.activity_main); 47 | 48 | recyclerView = ((RecyclerView) findViewById(R.id.recycler)); 49 | mTvTitle = ((TextView) findViewById(R.id.tv_title)); 50 | mTvEdit = ((TextView) findViewById(R.id.tv_edit)); 51 | mCheckBoxAll = ((CheckBox) findViewById(R.id.checkbox_all)); 52 | mTvTotal = ((TextView) findViewById(R.id.tv_total_price)); 53 | mBtnSubmit = ((Button) findViewById(R.id.btn_go_to_pay)); 54 | 55 | mTvEdit.setOnClickListener(this); 56 | mCheckBoxAll.setOnClickListener(this); 57 | mBtnSubmit.setOnClickListener(this); 58 | 59 | mTvTitle.setText(getString(R.string.cart, 0)); 60 | mBtnSubmit.setText(getString(R.string.go_settle_X, 0)); 61 | mTvTotal.setText(getString(R.string.rmb_X, 0.00)); 62 | 63 | recyclerView.setLayoutManager(new LinearLayoutManager(this)); 64 | mAdapter = new MainAdapter(this, getData()); 65 | mAdapter.setCanCollapsing(true); 66 | mAdapter.setOnCheckChangeListener(new CartOnCheckChangeListener(recyclerView, mAdapter) { 67 | @Override 68 | public void onCalculateChanged(ICartItem cartItemBean) { 69 | calculate(); 70 | } 71 | }); 72 | recyclerView.setAdapter(mAdapter); 73 | 74 | // 给列表注册 ContextMenu 事件。 75 | // 同时如果想让ItemView响应长按弹出菜单,需要在item xml布局中设置 android:longClickable="true" 76 | registerForContextMenu(recyclerView); 77 | } 78 | 79 | /** 80 | * 添加选项菜单 81 | * 82 | * @param menu 83 | * @param v 84 | * @param menuInfo 85 | */ 86 | @Override 87 | public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { 88 | super.onCreateContextMenu(menu, v, menuInfo); 89 | getMenuInflater().inflate(R.menu.main_contextmenu, menu); 90 | } 91 | 92 | /** 93 | * 选项菜单点击事件 94 | * 95 | * @param item 96 | * @return 97 | */ 98 | @Override 99 | public boolean onContextItemSelected(MenuItem item) { 100 | //获取到的是 listView 里的条目信息 101 | RecyclerViewWithContextMenu.RecyclerViewContextInfo info = (RecyclerViewWithContextMenu.RecyclerViewContextInfo) item.getMenuInfo(); 102 | Log.d("ContentMenu", "onCreateContextMenu position = " + (info != null ? info.getPosition() : "-1")); 103 | if (info != null && info.getPosition() != -1) { 104 | switch (item.getItemId()) { 105 | case R.id.action_remove: 106 | mAdapter.removeChild(info.getPosition()); 107 | Toast.makeText(this, "成功移入收藏", Toast.LENGTH_SHORT).show(); 108 | break; 109 | case R.id.action_findmore: 110 | Toast.makeText(this, "查找与" + ((GoodsBean) mAdapter.getData().get(info.getPosition())).getGoods_name() + "相似的产品", Toast.LENGTH_SHORT).show(); 111 | break; 112 | case R.id.action_delete: 113 | mAdapter.removeChild(info.getPosition()); 114 | break; 115 | default: 116 | break; 117 | } 118 | } 119 | return super.onContextItemSelected(item); 120 | } 121 | 122 | /** 123 | * 统计操作
124 | * 1.先清空全局计数器
125 | * 2.遍历所有子元素,只要是被选中状态的,就进行相关的计算操作
126 | * 3.给相关的 textView 进行数据填充 127 | */ 128 | private void calculate() { 129 | totalCheckedCount = 0; 130 | totalCount = 0; 131 | totalPrice = 0.00; 132 | int notChildTotalCount = 0; 133 | if (mAdapter.getData() != null) { 134 | for (ICartItem iCartItem : mAdapter.getData()) { 135 | if (iCartItem.getItemType() == ICartItem.TYPE_CHILD) { 136 | totalCount++; 137 | if (iCartItem.isChecked()) { 138 | totalCheckedCount++; 139 | totalPrice += ((GoodsBean) iCartItem).getGoods_price() * ((GoodsBean) iCartItem).getGoods_amount(); 140 | } 141 | } else { 142 | notChildTotalCount++; 143 | } 144 | } 145 | } 146 | 147 | mTvTitle.setText(getString(R.string.cart, totalCount)); 148 | mBtnSubmit.setText(getString(isEditing ? R.string.delete_X : R.string.go_settle_X, totalCheckedCount)); 149 | mTvTotal.setText(getString(R.string.rmb_X, totalPrice)); 150 | if (mCheckBoxAll.isChecked() && (totalCheckedCount == 0 || (totalCheckedCount + notChildTotalCount) != mAdapter.getData().size())) { 151 | mCheckBoxAll.setChecked(false); 152 | } 153 | if (totalCheckedCount != 0 && (!mCheckBoxAll.isChecked()) && (totalCheckedCount + notChildTotalCount) == mAdapter.getData().size()) { 154 | mCheckBoxAll.setChecked(true); 155 | } 156 | } 157 | 158 | @Override 159 | public void onClick(View v) { 160 | switch (v.getId()) { 161 | //编辑按钮事件 162 | case R.id.tv_edit: 163 | isEditing = !isEditing; 164 | mTvEdit.setText(getString(isEditing ? R.string.edit_done : R.string.edit)); 165 | mBtnSubmit.setText(getString(isEditing ? R.string.delete_X : R.string.go_settle_X, totalCheckedCount)); 166 | break; 167 | //提交订单 & 删除选中(编辑状态) 168 | case R.id.btn_go_to_pay: 169 | submitEvent(); 170 | break; 171 | case R.id.checkbox_all: 172 | mAdapter.checkedAll(((CheckBox) v).isChecked()); 173 | break; 174 | default: 175 | break; 176 | } 177 | } 178 | 179 | private void submitEvent() { 180 | if (isEditing) { 181 | if (totalCheckedCount == 0) { 182 | Toast.makeText(this, "请勾选你要删除的商品", Toast.LENGTH_SHORT).show(); 183 | } else { 184 | mAdapter.removeChecked(); 185 | } 186 | 187 | } else { 188 | if (totalCheckedCount == 0) { 189 | Toast.makeText(this, "你还没有选择任何商品", Toast.LENGTH_SHORT).show(); 190 | } else { 191 | Toast.makeText(this, 192 | new StringBuilder().append("你选择了").append(totalCheckedCount).append("件商品") 193 | .append("共计 ").append(totalPrice).append("元"), 194 | Toast.LENGTH_SHORT).show(); 195 | } 196 | } 197 | } 198 | 199 | /** 200 | * 数据初始化尤其重要 201 | * 1. childItem 数据全部在 GroupItem 数据的下方,数据顺序严格按照对应关系; 202 | * 2. GroupItem 下的 ChildItem 数据不能为空; 203 | * 3. 初始化时如果不需要,所有类型的条目都可以不设置ID,GroupItem也不用设置setChilds(); 204 | *

205 | * 列表操作时数据动态的变化设置: 206 | * 1. 通过 CartAdapter 的 addData、setNewData; 207 | * 2. 单个添加各个条目可以通过对应的 add 方法; 208 | * 3. 单独添加一个 GroupItem ,可以把它的 ChildItem 数据放到 setChilds 中。 209 | * 210 | * @return 211 | */ 212 | private List getData() { 213 | ArrayList cartItemBeans = new ArrayList<>(); 214 | 215 | NormalBean normalBean = new NormalBean(); 216 | normalBean.setMarkdownNumber(6); 217 | cartItemBeans.add(normalBean); 218 | 219 | for (int i = 0; i < 10; i++) { 220 | ShopBean shopBean = new ShopBean(); 221 | shopBean.setShop_name("解忧杂货铺 第" + (i + 1) + "分店"); 222 | shopBean.setItemType(CartItemBean.TYPE_GROUP); 223 | cartItemBeans.add(shopBean); 224 | 225 | for (int j = 0; j < (i + 5); j++) { 226 | GoodsBean goodsBean = new GoodsBean(); 227 | goodsBean.setGoods_name("忘忧水 " + (j + 1) + " 代"); 228 | goodsBean.setItemType(CartItemBean.TYPE_CHILD); 229 | goodsBean.setItemId((j + 1) * 10 + j); 230 | goodsBean.setGoods_price(j + 1); 231 | goodsBean.setGroupId(i); 232 | cartItemBeans.add(goodsBean); 233 | } 234 | } 235 | return cartItemBeans; 236 | } 237 | 238 | } 239 | -------------------------------------------------------------------------------- /app/src/main/java/com/ocnyang/cartlayoutdemo/MainAdapter.java: -------------------------------------------------------------------------------- 1 | package com.ocnyang.cartlayoutdemo; 2 | 3 | import android.content.Context; 4 | import androidx.annotation.NonNull; 5 | import android.view.View; 6 | 7 | import com.ocnyang.cartlayout.CartAdapter; 8 | import com.ocnyang.cartlayout.viewholder.CartViewHolder; 9 | import com.ocnyang.cartlayoutdemo.bean.GoodsBean; 10 | import com.ocnyang.cartlayoutdemo.bean.NormalBean; 11 | import com.ocnyang.cartlayoutdemo.bean.ShopBean; 12 | import com.ocnyang.cartlayoutdemo.viewholder.ChildViewHolder; 13 | import com.ocnyang.cartlayoutdemo.viewholder.GroupViewHolder; 14 | import com.ocnyang.cartlayoutdemo.viewholder.NormalViewHolder; 15 | 16 | import java.util.List; 17 | 18 | public class MainAdapter extends CartAdapter { 19 | 20 | public MainAdapter(Context context, List datas) { 21 | super(context, datas); 22 | } 23 | 24 | @Override 25 | protected CartViewHolder getNormalViewHolder(View itemView) { 26 | return new NormalViewHolder(itemView, -1); 27 | } 28 | 29 | @Override 30 | protected CartViewHolder getGroupViewHolder(View itemView) { 31 | return (CartViewHolder) new GroupViewHolder(itemView, R.id.checkbox); 32 | } 33 | 34 | @Override 35 | protected CartViewHolder getChildViewHolder(View itemView) { 36 | return (CartViewHolder) (new ChildViewHolder(itemView, R.id.checkbox) { 37 | @Override 38 | public void onNeedCalculate() { 39 | if (onCheckChangeListener != null) { 40 | onCheckChangeListener.onCalculateChanged(null); 41 | } 42 | } 43 | }); 44 | } 45 | 46 | @Override 47 | protected int getChildItemLayout() { 48 | return R.layout.activity_main_item_child; 49 | } 50 | 51 | @Override 52 | protected int getGroupItemLayout() { 53 | return R.layout.activity_main_item_group; 54 | } 55 | 56 | @Override 57 | protected int getNormalItemLayout() { 58 | return R.layout.activity_main_item_normal; 59 | } 60 | 61 | @Override 62 | public void onBindViewHolder(@NonNull CartViewHolder holder, final int position) { 63 | super.onBindViewHolder(holder, position); 64 | if (holder instanceof ChildViewHolder) { 65 | ChildViewHolder childViewHolder = (ChildViewHolder) holder; 66 | childViewHolder.textView.setText(((GoodsBean) mData.get(position)).getGoods_name()); 67 | childViewHolder.textViewPrice.setText( 68 | mContext.getString(R.string.rmb_X, ((GoodsBean) mData.get(position)).getGoods_price())); 69 | childViewHolder.textViewNum.setText(String.valueOf(((GoodsBean) mData.get(position)).getGoods_amount())); 70 | } else if (holder instanceof GroupViewHolder) { 71 | GroupViewHolder groupViewHolder = (GroupViewHolder) holder; 72 | groupViewHolder.textView.setText(((ShopBean) mData.get(position)).getShop_name()); 73 | } else if (holder instanceof NormalViewHolder) { 74 | NormalViewHolder normalViewHolder = (NormalViewHolder) holder; 75 | normalViewHolder.imgViewClose.setOnClickListener(new View.OnClickListener() { 76 | @Override 77 | public void onClick(View v) { 78 | mData.remove(position); 79 | notifyItemRemoved(position); 80 | notifyItemRangeChanged(position, mData.size()); 81 | } 82 | }); 83 | normalViewHolder.textView.setText(mContext.getString(R.string.normal_tip_X, 84 | ((NormalBean) mData.get(position)).getMarkdownNumber())); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /app/src/main/java/com/ocnyang/cartlayoutdemo/bean/GoodsBean.java: -------------------------------------------------------------------------------- 1 | package com.ocnyang.cartlayoutdemo.bean; 2 | import com.ocnyang.cartlayout.bean.ChildItemBean; 3 | 4 | public class GoodsBean extends ChildItemBean { 5 | private String goods_name; 6 | private double goods_price; 7 | private int goods_amount = 1; 8 | 9 | public int getGoods_amount() { 10 | return goods_amount; 11 | } 12 | 13 | public void setGoods_amount(int goods_amount) { 14 | this.goods_amount = goods_amount; 15 | } 16 | 17 | public double getGoods_price() { 18 | return goods_price; 19 | } 20 | 21 | public void setGoods_price(double goods_price) { 22 | this.goods_price = goods_price; 23 | } 24 | 25 | public String getGoods_name() { 26 | return goods_name; 27 | } 28 | 29 | public void setGoods_name(String goods_name) { 30 | this.goods_name = goods_name; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/ocnyang/cartlayoutdemo/bean/NormalBean.java: -------------------------------------------------------------------------------- 1 | package com.ocnyang.cartlayoutdemo.bean; 2 | 3 | import com.ocnyang.cartlayout.bean.CartItemBean; 4 | 5 | /******************************************************************* 6 | * * * * * * * * * * * Created by OCN.Yang 7 | * * * * * * * Time: 2018/6/23 14:03. 8 | * * * * * * * Email address: ocnyang@gmail.com 9 | * * * * * * * * * * *.Yang Web site: www.ocnyang.com 10 | *******************************************************************/ 11 | 12 | public class NormalBean extends CartItemBean{ 13 | int markdownNumber; 14 | 15 | public int getMarkdownNumber() { 16 | return markdownNumber; 17 | } 18 | 19 | public void setMarkdownNumber(int markdownNumber) { 20 | this.markdownNumber = markdownNumber; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/ocnyang/cartlayoutdemo/bean/ShopBean.java: -------------------------------------------------------------------------------- 1 | package com.ocnyang.cartlayoutdemo.bean; 2 | 3 | 4 | import com.ocnyang.cartlayout.bean.GroupItemBean; 5 | 6 | public class ShopBean extends GroupItemBean { 7 | String shop_name; 8 | 9 | public String getShop_name() { 10 | return shop_name; 11 | } 12 | 13 | public void setShop_name(String shop_name) { 14 | this.shop_name = shop_name; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/ocnyang/cartlayoutdemo/viewholder/ChildViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.ocnyang.cartlayoutdemo.viewholder; 2 | 3 | import android.view.View; 4 | import android.widget.TextView; 5 | import android.widget.Toast; 6 | 7 | import com.ocnyang.cartlayout.viewholder.CartViewHolder; 8 | import com.ocnyang.cartlayoutdemo.R; 9 | import com.ocnyang.cartlayoutdemo.bean.GoodsBean; 10 | 11 | public abstract class ChildViewHolder extends CartViewHolder implements View.OnClickListener { 12 | public TextView textViewReduce; 13 | public TextView textView; 14 | public TextView textViewPrice; 15 | public TextView textViewNum; 16 | public TextView textViewAdd; 17 | 18 | public ChildViewHolder(View itemView, int chekbox_id) { 19 | super(itemView, chekbox_id); 20 | 21 | textView = itemView.findViewById(R.id.tv); 22 | textViewPrice = itemView.findViewById(R.id.tv_price); 23 | textViewReduce = ((TextView) itemView.findViewById(R.id.tv_reduce)); 24 | textViewNum = itemView.findViewById(R.id.tv_num); 25 | textViewAdd = itemView.findViewById(R.id.tv_add); 26 | 27 | itemView.setOnClickListener(this); 28 | textViewReduce.setOnClickListener(this); 29 | textViewAdd.setOnClickListener(this); 30 | } 31 | 32 | @Override 33 | public void onClick(View v) { 34 | switch (v.getId()) { 35 | case R.id.item: 36 | Toast.makeText(v.getContext(), ((GoodsBean) mICartItem).getGoods_name(), Toast.LENGTH_SHORT).show(); 37 | break; 38 | case R.id.tv_reduce: 39 | int intValue = Integer.valueOf(textViewNum.getText().toString()).intValue(); 40 | if (intValue > 1) { 41 | intValue--; 42 | textViewNum.setText(String.valueOf(intValue)); 43 | ((GoodsBean) mICartItem).setGoods_amount(intValue); 44 | onNeedCalculate(); 45 | } 46 | break; 47 | case R.id.tv_add: 48 | int intValue2 = Integer.valueOf(textViewNum.getText().toString()).intValue(); 49 | intValue2++; 50 | textViewNum.setText(String.valueOf(intValue2)); 51 | ((GoodsBean) mICartItem).setGoods_amount(intValue2); 52 | onNeedCalculate(); 53 | break; 54 | default: 55 | break; 56 | } 57 | } 58 | 59 | /** 60 | * 这里因为把 ViewHolder 没有写到 adapter 中作为内部类,所以对事件写了一个回调的抽象方法。 61 | * 如果不想这样写,你可以在以下方式中选其一: 62 | * 1. 将 ViewHolder 写到 Adapter 中作为内部类,这样你就可以访问 Adapter 中的一些方法属性了; 63 | * 2. 或者,你把 ItemView & ItemChildView 的事件放到 Adapter 中的 onBindViewHolder() 方法中设置。 64 | */ 65 | public abstract void onNeedCalculate(); 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/ocnyang/cartlayoutdemo/viewholder/GroupViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.ocnyang.cartlayoutdemo.viewholder; 2 | 3 | import android.view.View; 4 | import android.widget.TextView; 5 | 6 | import com.ocnyang.cartlayout.viewholder.CartViewHolder; 7 | import com.ocnyang.cartlayoutdemo.R; 8 | 9 | public class GroupViewHolder extends CartViewHolder { 10 | public TextView textView; 11 | 12 | public GroupViewHolder(View itemView, int chekbox_id) { 13 | super(itemView, chekbox_id); 14 | textView = itemView.findViewById(R.id.tv); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/ocnyang/cartlayoutdemo/viewholder/NormalViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.ocnyang.cartlayoutdemo.viewholder; 2 | 3 | import android.view.View; 4 | import android.widget.ImageView; 5 | import android.widget.TextView; 6 | 7 | import com.ocnyang.cartlayout.viewholder.CartViewHolder; 8 | import com.ocnyang.cartlayoutdemo.R; 9 | 10 | public class NormalViewHolder extends CartViewHolder { 11 | public TextView textView; 12 | public ImageView imgViewClose; 13 | 14 | public NormalViewHolder(View itemView, int chekbox_id) { 15 | super(itemView, chekbox_id); 16 | textView = itemView.findViewById(R.id.tv); 17 | imgViewClose = itemView.findViewById(R.id.img_close); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/shape_divider_1_v.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 10 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_app_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 11 | 16 | 21 | 26 | 31 | 36 | 41 | 46 | 51 | 56 | 61 | 66 | 71 | 76 | 81 | 86 | 91 | 96 | 101 | 106 | 111 | 116 | 121 | 126 | 131 | 136 | 141 | 146 | 151 | 156 | 161 | 166 | 171 | 172 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_app_foreground.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 11 | 14 | 17 | 20 | 23 | 26 | 29 | 32 | 35 | 38 | 41 | 44 | 47 | 48 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_close.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 11 | 16 | 21 | 26 | 31 | 36 | 41 | 46 | 51 | 56 | 61 | 66 | 71 | 76 | 81 | 86 | 91 | 96 | 101 | 106 | 111 | 116 | 121 | 126 | 131 | 136 | 141 | 146 | 151 | 156 | 161 | 166 | 171 | 172 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_logo.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 14 | 17 | 20 | 23 | 26 | 29 | 32 | 35 | 38 | 41 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_notifications_none.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_cart_item_add_cut_border.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_divider_1_v.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 10 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_item_normal_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 10 | 11 | 12 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 16 | 17 | 24 | 25 | 34 | 35 | 46 | 47 | 52 | 53 | 54 | 55 | 56 | 61 | 62 | 71 | 72 | 77 | 78 | 85 | 86 | 94 | 95 |