├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── vcs.xml ├── encodings.xml ├── modules.xml ├── gradle.xml ├── compiler.xml ├── misc.xml └── findbugs-idea.xml ├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable-xhdpi │ │ │ │ ├── x.png │ │ │ │ ├── book_1.jpeg │ │ │ │ ├── book_2.jpg │ │ │ │ ├── book_3.jpg │ │ │ │ ├── book_4.jpg │ │ │ │ ├── book_5.jpg │ │ │ │ ├── book_6.jpg │ │ │ │ ├── book_7.jpg │ │ │ │ ├── book_8.jpg │ │ │ │ ├── pill_1.jpg │ │ │ │ ├── pill_2.jpg │ │ │ │ ├── pill_3.jpg │ │ │ │ ├── pill_4.jpg │ │ │ │ ├── pill_5.jpg │ │ │ │ ├── book_icon.png │ │ │ │ ├── category.png │ │ │ │ ├── foot_icon.png │ │ │ │ ├── foot_wash.jpg │ │ │ │ ├── healthy_1.jpg │ │ │ │ ├── healthy_2.jpg │ │ │ │ ├── healthy_3.jpg │ │ │ │ ├── healthy_4.jpg │ │ │ │ ├── healthy_5.jpg │ │ │ │ ├── healthy_6.jpg │ │ │ │ ├── healthy_7.jpg │ │ │ │ ├── pill_icon.png │ │ │ │ ├── healthy_book.jpg │ │ │ │ ├── shoppingcart.png │ │ │ │ └── detail_shopping_cart.png │ │ │ ├── drawable-hdpi │ │ │ │ └── sms_item.9.png │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_shopping_cart_black_48dp.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_shopping_cart_black_48dp.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_shopping_cart_black_48dp.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_shopping_cart_black_48dp.png │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ ├── layout │ │ │ │ ├── activity_base.xml │ │ │ │ ├── fragment_healthy.xml │ │ │ │ ├── activity_all.xml │ │ │ │ ├── activity_category_details.xml │ │ │ │ ├── activity_shopping_cart.xml │ │ │ │ ├── item_fragment_healthy.xml │ │ │ │ ├── item_category.xml │ │ │ │ ├── item_shopping_cart.xml │ │ │ │ ├── activity_product_details.xml │ │ │ │ └── popup_add_to_cart.xml │ │ │ ├── menu │ │ │ │ ├── menu_main.xml │ │ │ │ ├── menu_base.xml │ │ │ │ ├── menu_shopping_cart.xml │ │ │ │ ├── menu_category_details.xml │ │ │ │ └── menu_product_details.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── drawable │ │ │ │ └── shape_pop.xml │ │ │ └── anim │ │ │ │ ├── activity_bottom_to_top.xml │ │ │ │ ├── activity_top_to_bottom.xml │ │ │ │ └── cart.xml │ │ ├── java │ │ │ └── io │ │ │ │ └── github │ │ │ │ └── sunxu3074 │ │ │ │ └── shoppoingdemo │ │ │ │ ├── db │ │ │ │ ├── ProductReaderContract.java │ │ │ │ └── ProductReadDbHelper.java │ │ │ │ ├── consts │ │ │ │ └── ConstUtils.java │ │ │ │ ├── adapter │ │ │ │ ├── PagerAdapter.java │ │ │ │ ├── CategoryAdapter.java │ │ │ │ └── HealthyAdapter.java │ │ │ │ ├── Entity │ │ │ │ ├── ShoppingCartEntity.java │ │ │ │ ├── HealthyEntity.java │ │ │ │ └── CategoryEntity.java │ │ │ │ ├── activity │ │ │ │ ├── BaseActivity.java │ │ │ │ ├── AllActivity.java │ │ │ │ ├── CategoryDetailsActivity.java │ │ │ │ ├── ShoppingCartActivity.java │ │ │ │ └── ProductDetailsActivity.java │ │ │ │ └── fragment │ │ │ │ ├── FootWashFragment.java │ │ │ │ ├── PillFragment.java │ │ │ │ └── BookFragment.java │ │ └── AndroidManifest.xml │ └── androidTest │ │ └── java │ │ └── io │ │ └── github │ │ └── sunxu3074 │ │ └── shoppoingdemo │ │ └── ApplicationTest.java ├── proguard-rules.pro ├── build.gradle └── app.iml ├── settings.gradle ├── preview.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── README.md ├── .gitattributes ├── gradle.properties ├── LICENSE ├── gradlew.bat ├── gradlew └── ShoppingDemo.iml /.idea/.name: -------------------------------------------------------------------------------- 1 | ShoppingDemo -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /preview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/preview.gif -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/x.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/book_1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/book_1.jpeg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/book_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/book_2.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/book_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/book_3.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/book_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/book_4.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/book_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/book_5.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/book_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/book_6.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/book_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/book_7.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/book_8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/book_8.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/pill_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/pill_1.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/pill_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/pill_2.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/pill_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/pill_3.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/pill_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/pill_4.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/pill_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/pill_5.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/sms_item.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-hdpi/sms_item.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/book_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/book_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/category.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/category.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/foot_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/foot_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/foot_wash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/foot_wash.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/healthy_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/healthy_1.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/healthy_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/healthy_2.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/healthy_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/healthy_3.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/healthy_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/healthy_4.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/healthy_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/healthy_5.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/healthy_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/healthy_6.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/healthy_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/healthy_7.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/pill_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/pill_icon.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/healthy_book.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/healthy_book.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/shoppingcart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/shoppingcart.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #a10c0002 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/detail_shopping_cart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/drawable-xhdpi/detail_shopping_cart.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_shopping_cart_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/mipmap-hdpi/ic_shopping_cart_black_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_shopping_cart_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/mipmap-mdpi/ic_shopping_cart_black_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_shopping_cart_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/mipmap-xhdpi/ic_shopping_cart_black_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_shopping_cart_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunxu3074/ShoppingCartDemo/HEAD/app/src/main/res/mipmap-xxhdpi/ic_shopping_cart_black_48dp.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ShoppingDemo 2 | 简单实现类似于淘宝的购物车功能 3 | 4 | ### 效果图 5 | 6 | 7 | 8 | ### 功能实现 9 | 10 | - 数据存储在手机数据库内 11 | - UI用到了TabLayout,CardView 12 | 13 | ### TODO 14 | 15 | - 图片展示的滚动效果实现 16 | - 美化UI 17 | - 自定义ActionBar 18 | 19 | ### 用法 20 | 21 | - File->New-> Import Project即可. 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_base.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_pop.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /app/src/main/res/anim/activity_bottom_to_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/anim/activity_top_to_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 12 | -------------------------------------------------------------------------------- /app/src/androidTest/java/io/github/sunxu3074/shoppoingdemo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package io.github.sunxu3074.shoppoingdemo; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_base.xml: -------------------------------------------------------------------------------- 1 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_shopping_cart.xml: -------------------------------------------------------------------------------- 1 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_category_details.xml: -------------------------------------------------------------------------------- 1 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ShoppoingDemo 3 | 4 | 健康产品 5 | 设置 6 | 产品列表 7 | 产品详情 8 | AddToCartActivity 9 | 我的购物车 10 | BaseActivity 11 | 设置 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Users\zhangyan\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_healthy.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_product_details.xml: -------------------------------------------------------------------------------- 1 | 5 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_all.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.0" 6 | 7 | defaultConfig { 8 | applicationId "io.github.sunxu3074.shoppoingdemo" 9 | minSdkVersion 16 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:appcompat-v7:23.0.0' 25 | compile 'com.android.support:cardview-v7:23.1.0' 26 | compile 'com.android.support:design:22.2.0' 27 | compile 'com.android.support:support-v4:23.1.0' 28 | } 29 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /app/src/main/java/io/github/sunxu3074/shoppoingdemo/db/ProductReaderContract.java: -------------------------------------------------------------------------------- 1 | package io.github.sunxu3074.shoppoingdemo.db; 2 | 3 | import android.provider.BaseColumns; 4 | 5 | /** 6 | * Created by zhangyan on 2015/10/29. 7 | */ 8 | public final class ProductReaderContract { 9 | 10 | public ProductReaderContract() { 11 | } 12 | 13 | public static abstract class ProductEntry implements BaseColumns { 14 | public static final String TABLE_NAME = "entry"; 15 | public static final String COLUMN_NAME_ENTRY_ID = "product_id"; 16 | public static final String COLUMN_NAME_CATEGORY = "category"; 17 | public static final String COLUMN_NAME_NUMBER = "number"; 18 | public static final String COLUMN_NAME_PRICE = "price"; 19 | public static final String COLUMN_NAME_NAME = "name"; 20 | // public static final String COLUMN_NAME_IMG = "imgurl"; 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/sunxu3074/shoppoingdemo/consts/ConstUtils.java: -------------------------------------------------------------------------------- 1 | package io.github.sunxu3074.shoppoingdemo.consts; 2 | 3 | import io.github.sunxu3074.shoppoingdemo.R; 4 | 5 | /** 6 | * Created by zhangyan on 2015/10/26. 7 | */ 8 | public class ConstUtils { 9 | 10 | public static final String ALLACTIVITY_KEY_POSITION = "allactivity_key_position"; 11 | 12 | public static final int[] CATEGORY_PICTURES = { 13 | R.drawable.foot_wash, 14 | R.drawable.healthy_5, 15 | R.drawable.healthy_book, 16 | }; 17 | 18 | public static final int[][] PICTURES = {{R.drawable.foot_wash}, {R.drawable.pill_1, R 19 | .drawable.pill_2, R.drawable.pill_3, R.drawable.pill_4, R.drawable.pill_5,}, 20 | {R.drawable.book_1, R.drawable.book_2, R.drawable.book_3, R.drawable.book_4, R 21 | .drawable.book_5, R.drawable.book_6, R.drawable.book_7, R.drawable.book_8,}}; 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 taken 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_category_details.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 21 | 22 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/sunxu3074/shoppoingdemo/adapter/PagerAdapter.java: -------------------------------------------------------------------------------- 1 | package io.github.sunxu3074.shoppoingdemo.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentStatePagerAdapter; 6 | 7 | import io.github.sunxu3074.shoppoingdemo.fragment.BookFragment; 8 | import io.github.sunxu3074.shoppoingdemo.fragment.FootWashFragment; 9 | import io.github.sunxu3074.shoppoingdemo.fragment.PillFragment; 10 | 11 | /** 12 | * Created by zhangyan on 2015/11/3. 13 | */ 14 | public class PagerAdapter extends FragmentStatePagerAdapter { 15 | 16 | private int number; 17 | 18 | public PagerAdapter(FragmentManager fm,int number) { 19 | super(fm); 20 | this.number = number; 21 | } 22 | 23 | @Override 24 | public Fragment getItem(int position) { 25 | switch (position) { 26 | case 0: 27 | FootWashFragment tab1 = new FootWashFragment(); 28 | return tab1; 29 | case 1: 30 | PillFragment tab2 = new PillFragment(); 31 | return tab2; 32 | case 2: 33 | BookFragment tab3 = new BookFragment(); 34 | return tab3; 35 | } 36 | return null; 37 | } 38 | 39 | @Override 40 | public int getCount() { 41 | return number; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 22 | 23 | 24 | 25 | 26 | 1.7 27 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/anim/cart.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 13 | 22 | 23 | 24 | 31 | 32 | 37 | 38 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 25 | 26 | 31 | 32 | 36 | 37 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/sunxu3074/shoppoingdemo/Entity/ShoppingCartEntity.java: -------------------------------------------------------------------------------- 1 | package io.github.sunxu3074.shoppoingdemo.Entity; 2 | 3 | /** 4 | * Created by zhangyan on 2015/10/29. 5 | */ 6 | public class ShoppingCartEntity { 7 | 8 | private String id ; 9 | private String name; 10 | private String category; 11 | private int price; 12 | private int number ; 13 | private int imgUrl; 14 | 15 | public ShoppingCartEntity(String id, String name, String category, int price, int number, 16 | int imgUrl) { 17 | this.id = id; 18 | this.name = name; 19 | this.category = category; 20 | this.price = price; 21 | this.number = number; 22 | this.imgUrl = imgUrl; 23 | } 24 | 25 | public String getId() { 26 | return id; 27 | } 28 | 29 | public void setId(String id) { 30 | this.id = id; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public void setName(String name) { 38 | this.name = name; 39 | } 40 | 41 | public String getCategory() { 42 | return category; 43 | } 44 | 45 | public void setCategory(String category) { 46 | this.category = category; 47 | } 48 | 49 | public int getPrice() { 50 | return price; 51 | } 52 | 53 | public void setPrice(int price) { 54 | this.price = price; 55 | } 56 | 57 | public int getNumber() { 58 | return number; 59 | } 60 | 61 | public void setNumber(int number) { 62 | this.number = number; 63 | } 64 | 65 | public int getImgUrl() { 66 | return imgUrl; 67 | } 68 | 69 | public void setImgUrl(int imgUrl) { 70 | this.imgUrl = imgUrl; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/sunxu3074/shoppoingdemo/Entity/HealthyEntity.java: -------------------------------------------------------------------------------- 1 | package io.github.sunxu3074.shoppoingdemo.Entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by zhangyan on 2015/10/27. 7 | */ 8 | public class HealthyEntity implements Serializable{ 9 | private String id; 10 | private String name; 11 | private String details; 12 | private int price; 13 | private int number; 14 | private int imgUrl ; 15 | //TODO 加一个产品种类 16 | // private String category; 17 | 18 | public int getImgUrl() { 19 | return imgUrl; 20 | } 21 | 22 | public void setImgUrl(int imgUrl) { 23 | this.imgUrl = imgUrl; 24 | } 25 | 26 | public HealthyEntity(String id, String name, String details, int price, int number, int 27 | imgUrl) { 28 | this.id = id; 29 | this.name = name; 30 | this.details = details; 31 | this.price = price; 32 | this.number = number; 33 | this.imgUrl = imgUrl; 34 | } 35 | 36 | public String getId() { 37 | return id; 38 | } 39 | 40 | public void setId(String id) { 41 | this.id = id; 42 | } 43 | 44 | public String getName() { 45 | return name; 46 | } 47 | 48 | public void setName(String name) { 49 | this.name = name; 50 | } 51 | 52 | public String getDetails() { 53 | return details; 54 | } 55 | 56 | public void setDetails(String details) { 57 | this.details = details; 58 | } 59 | 60 | public int getPrice() { 61 | return price; 62 | } 63 | 64 | public void setPrice(int price) { 65 | this.price = price; 66 | } 67 | 68 | public int getNumber() { 69 | return number; 70 | } 71 | 72 | public void setNumber(int number) { 73 | this.number = number; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/sunxu3074/shoppoingdemo/activity/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package io.github.sunxu3074.shoppoingdemo.activity; 2 | 3 | import android.graphics.drawable.ColorDrawable; 4 | import android.os.Bundle; 5 | import android.support.v7.app.ActionBar; 6 | import android.support.v7.app.ActionBarActivity; 7 | import android.view.Menu; 8 | import android.view.MenuItem; 9 | 10 | import io.github.sunxu3074.shoppoingdemo.R; 11 | 12 | public class BaseActivity extends ActionBarActivity { 13 | 14 | private static final int ACTIONBAR_BACKGROUND = R.color.actionbar_background; 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.activity_base); 20 | 21 | initActionBar(); 22 | 23 | } 24 | 25 | private void initActionBar() { 26 | 27 | ActionBar actionBar = getSupportActionBar(); 28 | actionBar.setBackgroundDrawable(new ColorDrawable(ACTIONBAR_BACKGROUND)); 29 | //google的actionbar是分为上下两栏显示的,上面的代码只能设置顶部actionbar的背景色, 30 | //为了让下面的背景色一致,还需要添加一行代码: 31 | actionBar.setSplitBackgroundDrawable(new ColorDrawable(ACTIONBAR_BACKGROUND)); 32 | } 33 | 34 | @Override 35 | public boolean onCreateOptionsMenu(Menu menu) { 36 | // Inflate the menu; this adds items to the action bar if it is present. 37 | getMenuInflater().inflate(R.menu.menu_base, menu); 38 | return true; 39 | } 40 | 41 | @Override 42 | public boolean onOptionsItemSelected(MenuItem item) { 43 | // Handle action bar item clicks here. The action bar will 44 | // automatically handle clicks on the Home/Up button, so long 45 | // as you specify a parent activity in AndroidManifest.xml. 46 | int id = item.getItemId(); 47 | 48 | //noinspection SimplifiableIfStatement 49 | if (id == R.id.action_settings) { 50 | return true; 51 | } 52 | 53 | return super.onOptionsItemSelected(item); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/sunxu3074/shoppoingdemo/db/ProductReadDbHelper.java: -------------------------------------------------------------------------------- 1 | package io.github.sunxu3074.shoppoingdemo.db; 2 | 3 | import android.content.Context; 4 | import android.database.sqlite.SQLiteDatabase; 5 | import android.database.sqlite.SQLiteOpenHelper; 6 | 7 | /** 8 | * Created by zhangyan on 2015/10/29. 9 | */ 10 | public class ProductReadDbHelper extends SQLiteOpenHelper { 11 | 12 | public static final int DATABASE_VERSION = 1; 13 | public static final String DATABASE_NAME = "ProductReader.db"; 14 | 15 | private static final String TEXT_TYPE = " TEXT"; 16 | private static final String COMMA_SEP = ","; 17 | private static final String SQL_CREATE_ENTRIES = 18 | "CREATE TABLE " + ProductReaderContract.ProductEntry.TABLE_NAME + " (" + 19 | ProductReaderContract.ProductEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT" + 20 | COMMA_SEP + 21 | ProductReaderContract.ProductEntry.COLUMN_NAME_ENTRY_ID + TEXT_TYPE + 22 | COMMA_SEP + 23 | ProductReaderContract.ProductEntry.COLUMN_NAME_CATEGORY + TEXT_TYPE + 24 | " default 健康产品" + 25 | COMMA_SEP + 26 | ProductReaderContract.ProductEntry.COLUMN_NAME_NUMBER + TEXT_TYPE + " default " + 27 | "0" + 28 | COMMA_SEP + 29 | ProductReaderContract.ProductEntry.COLUMN_NAME_PRICE + TEXT_TYPE + " default " + 30 | "1000" + 31 | COMMA_SEP + 32 | ProductReaderContract.ProductEntry.COLUMN_NAME_NAME + TEXT_TYPE + " default " + 33 | "健康产品系列1" + 34 | " )"; 35 | 36 | 37 | public ProductReadDbHelper(Context context) { 38 | super(context, DATABASE_NAME, null, DATABASE_VERSION); 39 | } 40 | 41 | @Override 42 | public void onCreate(SQLiteDatabase db) { 43 | db.execSQL(SQL_CREATE_ENTRIES); 44 | } 45 | 46 | @Override 47 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/sunxu3074/shoppoingdemo/Entity/CategoryEntity.java: -------------------------------------------------------------------------------- 1 | package io.github.sunxu3074.shoppoingdemo.Entity; 2 | 3 | /** 4 | * Created by zhangyan on 2015/10/21. 5 | */ 6 | public class CategoryEntity { 7 | 8 | private String name; 9 | private String imgUrl; 10 | private String details; 11 | private String id ; 12 | 13 | @Override 14 | public String toString() { 15 | return "CategoryEntity{" + 16 | "name='" + name + '\'' + 17 | ", imgUrl='" + imgUrl + '\'' + 18 | ", details='" + details + '\'' + 19 | ", id='" + id + '\'' + 20 | ", price=" + price + 21 | ", number=" + number + 22 | '}'; 23 | } 24 | 25 | private int price; 26 | 27 | public CategoryEntity() { 28 | 29 | } 30 | 31 | private int number; 32 | 33 | public CategoryEntity(String name, String imgUrl, String details, String id, int price, int 34 | number) { 35 | this.name = name; 36 | this.imgUrl = imgUrl; 37 | this.details = details; 38 | this.id = id; 39 | this.price = price; 40 | this.number = number; 41 | } 42 | 43 | public void setName(String name) { 44 | this.name = name; 45 | } 46 | 47 | public void setImgUrl(String imgUrl) { 48 | this.imgUrl = imgUrl; 49 | } 50 | 51 | public void setDetails(String details) { 52 | this.details = details; 53 | } 54 | 55 | public void setId(String id) { 56 | this.id = id; 57 | } 58 | 59 | public void setPrice(int price) { 60 | this.price = price; 61 | } 62 | 63 | public void setNumber(int number) { 64 | this.number = number; 65 | } 66 | 67 | public String getName() { 68 | return name; 69 | } 70 | 71 | public String getImgUrl() { 72 | return imgUrl; 73 | } 74 | 75 | public String getDetails() { 76 | return details; 77 | } 78 | 79 | public String getId() { 80 | return id; 81 | } 82 | 83 | public int getPrice() { 84 | return price; 85 | } 86 | 87 | public int getNumber() { 88 | return number; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 12 | 13 | 19 | 20 | 24 | 25 | 26 | 35 | 36 | 47 | 48 | 51 | 52 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_shopping_cart.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 22 | 23 | 30 | 37 | 43 | 52 |