├── .idea
├── .name
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── modules.xml
├── runConfigurations.xml
├── compiler.xml
├── gradle.xml
└── misc.xml
├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── colors.xml
│ │ │ ├── drawable-xhdpi
│ │ │ │ ├── number.png
│ │ │ │ ├── ic_add_circle_outline_black_24dp.png
│ │ │ │ └── ic_remove_circle_outline_black_24dp.png
│ │ │ ├── drawable-xxhdpi
│ │ │ │ ├── number.png
│ │ │ │ ├── ic_add_circle_outline_black_24dp.png
│ │ │ │ └── ic_remove_circle_outline_black_24dp.png
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── bg_shopcar.png
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── bg_shopcar.png
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── drawable
│ │ │ │ ├── empty.xml
│ │ │ │ ├── rec_red_left_stroke.xml
│ │ │ │ └── shape_data.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── layout
│ │ │ │ ├── shopcart_left_listview.xml
│ │ │ │ ├── activity_goods_detail_item.xml
│ │ │ │ ├── activity_goods_detail.xml
│ │ │ │ ├── layout_bottom_sheet.xml
│ │ │ │ ├── product_item.xml
│ │ │ │ ├── shopcart_right_listview.xml
│ │ │ │ └── activity_main.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── zzti
│ │ │ └── fsuper
│ │ │ └── shopcar
│ │ │ ├── view
│ │ │ ├── MyListView.java
│ │ │ └── MyScrollView.java
│ │ │ ├── bean
│ │ │ ├── ItemBean.java
│ │ │ ├── CatograyBean.java
│ │ │ └── GoodsBean.java
│ │ │ ├── MyApp.java
│ │ │ ├── util
│ │ │ └── StringUtils.java
│ │ │ ├── adapter
│ │ │ ├── GoodsDetailAdapter.java
│ │ │ ├── CatograyAdapter.java
│ │ │ ├── ProductAdapter.java
│ │ │ └── GoodsAdapter.java
│ │ │ └── MainActivity.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── zzti
│ │ │ └── fsuper
│ │ │ └── shopcar
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── zzti
│ │ └── fsuper
│ │ └── shopcar
│ │ └── ApplicationTest.java
├── libs
│ └── universal-image-loader-1.9.3-with-sources.jar
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── screenshot
└── 1.gif
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── README.md
├── gradle.properties
├── gradlew.bat
└── gradlew
/.idea/.name:
--------------------------------------------------------------------------------
1 | shopcar
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/screenshot/1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/screenshot/1.gif
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | shopcar
3 |
4 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/number.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/app/src/main/res/drawable-xhdpi/number.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/number.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/app/src/main/res/drawable-xxhdpi/number.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/bg_shopcar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/app/src/main/res/mipmap-xhdpi/bg_shopcar.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/bg_shopcar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/app/src/main/res/mipmap-xxhdpi/bg_shopcar.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/libs/universal-image-loader-1.9.3-with-sources.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/app/libs/universal-image-loader-1.9.3-with-sources.jar
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 仿饿了么购物车下单效果
2 | ### 效果如图:
3 | 
4 | ### 仿外卖下单,项目可直接引用,欢迎star、fork、如有问题请提issues
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_add_circle_outline_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/app/src/main/res/drawable-xhdpi/ic_add_circle_outline_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_add_circle_outline_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/app/src/main/res/drawable-xxhdpi/ic_add_circle_outline_black_24dp.png
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_remove_circle_outline_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/app/src/main/res/drawable-xhdpi/ic_remove_circle_outline_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_remove_circle_outline_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengyongge/shopcar/HEAD/app/src/main/res/drawable-xxhdpi/ic_remove_circle_outline_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/empty.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
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.10-all.zip
7 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/test/java/com/zzti/fsuper/shopcar/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zzti.fsuper.shopcar;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/zzti/fsuper/shopcar/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.zzti.fsuper.shopcar;
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/drawable/rec_red_left_stroke.xml:
--------------------------------------------------------------------------------
1 |
2 | -
6 |
7 |
8 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_data.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
14 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
8 | #dddddd
9 | #ffffff
10 | #fc404e
11 | #323232
12 | #efeff4
13 | #ecedef
14 | #888888
15 | #f8f8f8
16 |
17 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/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 /Users/fengyongge/android环境/adt-bundle-mac-x86_64-20140702/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 |
--------------------------------------------------------------------------------
/.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/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.3"
6 |
7 | defaultConfig {
8 | applicationId "com.example.fengyongge.shopcar"
9 | minSdkVersion 15
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(include: ['*.jar'], dir: 'libs')
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:23.4.0'
26 | compile 'com.flipboard:bottomsheet-core:1.5.1'
27 | compile files('libs/universal-image-loader-1.9.3-with-sources.jar')
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/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/com/zzti/fsuper/shopcar/view/MyListView.java:
--------------------------------------------------------------------------------
1 | package com.zzti.fsuper.shopcar.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.ListView;
6 |
7 |
8 | /**
9 | * @Description: 自定义ListView ,解决ScrollView中嵌套ListView 显示不正常的问题
10 | * @date 2014-7-16 上午10:14:19
11 | *
12 | */
13 | public class MyListView extends ListView {
14 | public MyListView(Context context, AttributeSet attrs) {
15 | super(context, attrs);
16 | }
17 |
18 | public MyListView(Context context) {
19 | super(context);
20 | }
21 |
22 | public MyListView(Context context, AttributeSet attrs, int defStyle) {
23 | super(context, attrs, defStyle);
24 | }
25 |
26 | @Override
27 | public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
28 |
29 | int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
30 | MeasureSpec.AT_MOST);
31 | super.onMeasure(widthMeasureSpec, expandSpec);
32 | }
33 |
34 |
35 |
36 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/zzti/fsuper/shopcar/bean/ItemBean.java:
--------------------------------------------------------------------------------
1 | package com.zzti.fsuper.shopcar.bean;
2 |
3 | /**
4 | * Created by fengyongge on 2016/7/6 0006.
5 | */
6 | public class ItemBean {
7 |
8 | public String key; // required
9 | public String value; // required
10 | public String note1; // required
11 | public String note2; // required
12 |
13 | public String getKey() {
14 | return key;
15 | }
16 |
17 | public void setKey(String key) {
18 | this.key = key;
19 | }
20 |
21 | public String getValue() {
22 | return value;
23 | }
24 |
25 | public void setValue(String value) {
26 | this.value = value;
27 | }
28 |
29 | public String getNote1() {
30 | return note1;
31 | }
32 |
33 | public void setNote1(String note1) {
34 | this.note1 = note1;
35 | }
36 |
37 | public String getNote2() {
38 | return note2;
39 | }
40 |
41 | public void setNote2(String note2) {
42 | this.note2 = note2;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zzti/fsuper/shopcar/view/MyScrollView.java:
--------------------------------------------------------------------------------
1 | package com.zzti.fsuper.shopcar.view;
2 |
3 | import android.content.Context;
4 | import android.graphics.Rect;
5 | import android.util.AttributeSet;
6 | import android.widget.ScrollView;
7 |
8 | public class MyScrollView extends ScrollView {
9 |
10 | private MyScrollView scrollViewListener = null;
11 |
12 | public MyScrollView(Context context) {
13 | super(context);
14 | }
15 |
16 | public MyScrollView(Context context, AttributeSet attrs, int defStyle) {
17 | super(context, attrs, defStyle);
18 | }
19 |
20 | public MyScrollView(Context context, AttributeSet attrs) {
21 | super(context, attrs);
22 | }
23 |
24 | public void setScrollViewListener(MyScrollView scrollViewListener) {
25 | this.scrollViewListener = scrollViewListener;
26 | }
27 |
28 | @Override
29 | protected int computeScrollDeltaToGetChildRectOnScreen(Rect rect) {
30 |
31 | return 0;
32 | }
33 |
34 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/zzti/fsuper/shopcar/bean/CatograyBean.java:
--------------------------------------------------------------------------------
1 | package com.zzti.fsuper.shopcar.bean;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by fengyongge on 2016/7/6 0006.
7 | */
8 | public class CatograyBean {
9 | private String kind;
10 | private List list;
11 | private int count;
12 | public String getKind() {
13 | return kind;
14 | }
15 |
16 | public void setKind(String kind) {
17 | this.kind = kind;
18 | }
19 |
20 | public List getList() {
21 | return list;
22 | }
23 |
24 | public void setList(List list) {
25 | this.list = list;
26 | }
27 |
28 | public int getCount() {
29 | return count;
30 | }
31 |
32 | public void setCount(int count) {
33 | this.count = count;
34 | }
35 |
36 | @Override
37 | public String toString() {
38 | return "CatograyBean{" +
39 | "kind='" + kind + '\'' +
40 | ", list=" + list +
41 | ", count=" + count +
42 | '}';
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/shopcart_left_listview.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
16 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zzti/fsuper/shopcar/MyApp.java:
--------------------------------------------------------------------------------
1 | package com.zzti.fsuper.shopcar;
2 |
3 | import android.app.Activity;
4 | import android.app.Application;
5 | import android.content.SharedPreferences;
6 |
7 | import com.nostra13.universalimageloader.core.DisplayImageOptions;
8 | import com.nostra13.universalimageloader.core.ImageLoader;
9 | import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
10 |
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | /**
15 | * Created by fengyongge on 2016/5/19 0019.
16 | */
17 | public class MyApp extends Application {
18 |
19 | private static List con_list = new ArrayList();
20 | private static MyApp instance;
21 | private SharedPreferences sp;
22 |
23 | @Override
24 | public void onCreate() {
25 | super.onCreate();
26 | instance = (MyApp) getApplicationContext();
27 |
28 | //imageload初始化
29 | DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
30 | .cacheInMemory(true).cacheOnDisc(true).build();
31 | ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
32 | getApplicationContext()).defaultDisplayImageOptions(
33 | defaultOptions).build();
34 | ImageLoader.getInstance().init(config);
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_goods_detail_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
18 |
19 |
20 |
21 |
28 |
29 |
30 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zzti/fsuper/shopcar/util/StringUtils.java:
--------------------------------------------------------------------------------
1 | package com.zzti.fsuper.shopcar.util;
2 |
3 | import android.widget.TextView;
4 |
5 | /**
6 | * Created by fengyongge on 2016/5/20 0020.
7 | */
8 | public class StringUtils {
9 |
10 | public static boolean isEmpty(CharSequence cs) {
11 | return (cs == null) || (cs.length() == 0);
12 | }
13 |
14 | public static boolean isNotEmpty(CharSequence cs) {
15 | return !isEmpty(cs);
16 | }
17 |
18 | public static void filtNull(TextView textView,String s) {
19 | if (s != null) {
20 | textView.setText(s);
21 | } else {
22 | textView.setText(filtNull(s));
23 | }
24 | }
25 |
26 |
27 | public static void filtNull(TextView textView,String s1,String s2) {
28 | if (s1 != null&&s2!=null) {
29 | textView.setText(s1+" "+s2);
30 | } else {
31 | textView.setText(filtNull(s1)+filtNull(s2));
32 | }
33 |
34 | }
35 |
36 | //判断过滤单个string为null
37 | public static String filtNull(String s) {
38 | if (s!=null) {
39 | return s;
40 | } else {
41 | s="null";
42 | }
43 | return s;
44 | }
45 |
46 |
47 | //判断单个对象不为null
48 | public static boolean filtObjectNull(Object object) {
49 | if (object != null) {
50 | return false;
51 | } else {
52 | return true;
53 | }
54 | }
55 |
56 |
57 |
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_goods_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
13 |
21 |
22 |
31 |
32 |
33 |
38 |
39 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zzti/fsuper/shopcar/adapter/GoodsDetailAdapter.java:
--------------------------------------------------------------------------------
1 | package com.zzti.fsuper.shopcar.adapter;
2 |
3 | import android.app.Activity;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.BaseAdapter;
8 | import android.widget.TextView;
9 |
10 | import com.zzti.fsuper.shopcar.MainActivity;
11 | import com.zzti.fsuper.shopcar.R;
12 | import com.zzti.fsuper.shopcar.bean.ItemBean;
13 |
14 | import java.util.List;
15 |
16 | /**
17 | * Created by fengyongge on 2016/5/24 0024.
18 | */
19 | public class GoodsDetailAdapter extends BaseAdapter {
20 | private List list;
21 | private Activity activity;
22 | public GoodsDetailAdapter(MainActivity activity, List list2) {
23 | this.activity=activity;
24 | this.list=list2;
25 | }
26 |
27 | @Override
28 | public int getCount() {
29 | return list.size();
30 | }
31 |
32 | @Override
33 | public Object getItem(int position) {
34 | return list.get(position);
35 | }
36 |
37 | @Override
38 | public long getItemId(int position) {
39 | return position;
40 | }
41 |
42 | @Override
43 | public View getView(final int position, View convertView, ViewGroup parent) {
44 | final Viewholder viewholder;
45 | if (convertView==null){
46 | convertView= LayoutInflater.from(activity).inflate(R.layout.activity_goods_detail_item,null);
47 | viewholder=new Viewholder();
48 | viewholder.tv_name= (TextView) convertView.findViewById(R.id.tv_name);
49 | viewholder.tv_price= (TextView) convertView.findViewById(R.id.tv_price);
50 |
51 | convertView.setTag(viewholder);
52 | }else {
53 | viewholder = (Viewholder) convertView.getTag();
54 |
55 | }
56 | viewholder.tv_name.setText(list.get(position).getValue()+"*"+list.get(position).getNote2());
57 | viewholder.tv_price.setText("¥"+list.get(position).getNote1());
58 | return convertView;
59 | }
60 | class Viewholder{
61 | TextView tv_name,tv_price;
62 |
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_bottom_sheet.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
19 |
20 |
25 |
31 |
39 |
40 |
41 |
46 |
47 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zzti/fsuper/shopcar/adapter/CatograyAdapter.java:
--------------------------------------------------------------------------------
1 | package com.zzti.fsuper.shopcar.adapter;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.BaseAdapter;
8 | import android.widget.TextView;
9 | import com.zzti.fsuper.shopcar.R;
10 | import com.zzti.fsuper.shopcar.bean.CatograyBean;
11 | import java.util.List;
12 |
13 | /**
14 | * Created by fengyongge on 2016/5/24 0024.
15 | */
16 |
17 | public class CatograyAdapter extends BaseAdapter {
18 | private Context context;
19 | private List list;
20 | int selection = 0;
21 | public CatograyAdapter(Context context, List list) {
22 | this.context = context;
23 | this.list = list;
24 | }
25 |
26 | @Override
27 | public int getCount() {
28 | return list.size();
29 | }
30 |
31 | @Override
32 | public Object getItem(int position) {
33 | return list.get(position);
34 | }
35 |
36 | @Override
37 | public long getItemId(int position) {
38 | return position;
39 | }
40 |
41 | @Override
42 | public View getView(int position, View convertView, ViewGroup parent) {
43 | View view = convertView;
44 | final Viewholder viewholder;
45 | if (view == null) {
46 | view = LayoutInflater.from(context).inflate(R.layout.shopcart_left_listview, null);
47 | viewholder = new Viewholder();
48 | viewholder.tv_catogray = (TextView) view.findViewById(R.id.tv_catogray);
49 | viewholder.tv_count = (TextView) view.findViewById(R.id.tv_count);
50 | view.setTag(viewholder);
51 | } else {
52 | viewholder = (Viewholder) view.getTag();
53 | }
54 |
55 | viewholder.tv_catogray.setText(list.get(position).getKind());
56 | int count = 0;
57 | for (int i = 0; i < list.get(position).getList().size(); i++) {
58 | count += list.get(position).getList().get(i).getNum();
59 | }
60 | list.get(position).setCount(count);
61 |
62 | if (count <= 0) {
63 | viewholder.tv_count.setVisibility(View.INVISIBLE);
64 | } else {
65 |
66 | viewholder.tv_count.setVisibility(View.VISIBLE);
67 | viewholder.tv_count.setText(list.get(position).getCount()+"");
68 | }
69 |
70 | if (position == selection) {
71 | viewholder.tv_catogray.setBackgroundResource(R.drawable.rec_red_left_stroke);
72 | viewholder.tv_catogray.setTextColor(context.getResources().getColor(R.color.black));
73 | } else {
74 |
75 | viewholder.tv_catogray.setBackgroundResource(R.drawable.empty);
76 | viewholder.tv_catogray.setTextColor(context.getResources().getColor(R.color.gray));
77 | }
78 | return view;
79 | }
80 |
81 | public void setSelection(int selection) {
82 | this.selection = selection;
83 | }
84 |
85 | class Viewholder {
86 | TextView tv_catogray;
87 | TextView tv_count;
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/product_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
17 |
18 |
23 |
24 |
32 |
33 |
40 |
41 |
42 |
43 |
51 |
52 |
60 |
61 |
71 |
72 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zzti/fsuper/shopcar/bean/GoodsBean.java:
--------------------------------------------------------------------------------
1 | package com.zzti.fsuper.shopcar.bean;
2 |
3 | /**
4 | * Created by fengyongge on 2016/7/6 0006.
5 | */
6 | public class GoodsBean {
7 |
8 | public int product_id; // required
9 | public int category_id; // required
10 | public String title; // required
11 | public int is_package_status; // required
12 | public String icon; // required
13 | public String original_price; // required
14 | public String price; // required
15 | public String specification; // required
16 | public int num; // required
17 | // public List package_product_info; // required
18 | public int cart_num; // required
19 |
20 | public int getProduct_id() {
21 | return product_id;
22 | }
23 |
24 | public void setProduct_id(int product_id) {
25 | this.product_id = product_id;
26 | }
27 |
28 | public int getCategory_id() {
29 | return category_id;
30 | }
31 |
32 | public void setCategory_id(int category_id) {
33 | this.category_id = category_id;
34 | }
35 |
36 | public String getTitle() {
37 | return title;
38 | }
39 |
40 | public void setTitle(String title) {
41 | this.title = title;
42 | }
43 |
44 | public int getIs_package_status() {
45 | return is_package_status;
46 | }
47 |
48 | public void setIs_package_status(int is_package_status) {
49 | this.is_package_status = is_package_status;
50 | }
51 |
52 | public String getIcon() {
53 | return icon;
54 | }
55 |
56 | public void setIcon(String icon) {
57 | this.icon = icon;
58 | }
59 |
60 | public String getOriginal_price() {
61 | return original_price;
62 | }
63 |
64 | public void setOriginal_price(String original_price) {
65 | this.original_price = original_price;
66 | }
67 |
68 | public String getPrice() {
69 | return price;
70 | }
71 |
72 | public void setPrice(String price) {
73 | this.price = price;
74 | }
75 |
76 | public String getSpecification() {
77 | return specification;
78 | }
79 |
80 | public void setSpecification(String specification) {
81 | this.specification = specification;
82 | }
83 |
84 | public int getNum() {
85 | return num;
86 | }
87 |
88 | public void setNum(int num) {
89 | this.num = num;
90 | }
91 |
92 |
93 | public int getCart_num() {
94 | return cart_num;
95 | }
96 |
97 | public void setCart_num(int cart_num) {
98 | this.cart_num = cart_num;
99 | }
100 |
101 | @Override
102 | public String toString() {
103 | return "GoodsBean{" +
104 | "product_id=" + product_id +
105 | ", category_id=" + category_id +
106 | ", title='" + title + '\'' +
107 | ", is_package_status=" + is_package_status +
108 | ", icon='" + icon + '\'' +
109 | ", original_price='" + original_price + '\'' +
110 | ", price='" + price + '\'' +
111 | ", specification='" + specification + '\'' +
112 | ", num=" + num +
113 | ", cart_num=" + cart_num +
114 | '}';
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zzti/fsuper/shopcar/adapter/ProductAdapter.java:
--------------------------------------------------------------------------------
1 | package com.zzti.fsuper.shopcar.adapter;
2 |
3 | import android.util.SparseArray;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.BaseAdapter;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | import com.zzti.fsuper.shopcar.MainActivity;
12 | import com.zzti.fsuper.shopcar.R;
13 | import com.zzti.fsuper.shopcar.bean.GoodsBean;
14 | import com.zzti.fsuper.shopcar.util.StringUtils;
15 |
16 |
17 |
18 | /**
19 | * Created by fengyongge on 2016/5/24 0024.
20 | */
21 |
22 | /***
23 | * 底部购物车
24 | */
25 | public class ProductAdapter extends BaseAdapter {
26 | GoodsAdapter goodsAdapter;
27 | private MainActivity activity;
28 | private SparseArray dataList;
29 | public ProductAdapter(MainActivity activity, GoodsAdapter goodsAdapter, SparseArray dataList) {
30 | this.goodsAdapter =goodsAdapter;
31 | this.activity = activity;
32 | this.dataList = dataList;
33 | }
34 |
35 | @Override
36 | public int getCount() {
37 | return dataList.size();
38 | }
39 |
40 | @Override
41 | public Object getItem(int position) {
42 | return dataList.valueAt(position);
43 | }
44 |
45 | @Override
46 | public long getItemId(int position) {
47 | return position;
48 | }
49 |
50 | @Override
51 | public View getView(final int position, View convertView, ViewGroup parent) {
52 | View view = convertView;
53 | final Viewholder viewholder;
54 | if (view == null) {
55 | view = LayoutInflater.from(activity).inflate(R.layout.product_item, null);
56 | viewholder = new Viewholder();
57 | viewholder.tv_name = (TextView) view.findViewById(R.id.tv_name);
58 | viewholder.tv_price = (TextView) view.findViewById(R.id.tv_price);
59 | viewholder.iv_add= (ImageView) view.findViewById(R.id.iv_add);
60 | viewholder.iv_remove= (ImageView) view.findViewById(R.id.iv_remove);
61 | viewholder.tv_count= (TextView) view.findViewById(R.id.tv_count);
62 |
63 | view.setTag(viewholder);
64 | } else {
65 | viewholder = (Viewholder) view.getTag();
66 | }
67 |
68 |
69 | StringUtils.filtNull(viewholder.tv_name,dataList.valueAt(position).getTitle());//商品名称
70 | StringUtils.filtNull(viewholder.tv_price,"¥"+dataList.valueAt(position).getPrice());//商品价格
71 | viewholder.tv_count.setText(String.valueOf(dataList.valueAt(position).getNum()));//商品数量
72 |
73 | viewholder.iv_add.setOnClickListener(new View.OnClickListener() {
74 | @Override
75 | public void onClick(View v) {
76 | activity.handlerCarNum(1,dataList.valueAt(position),true);
77 | goodsAdapter.notifyDataSetChanged();
78 |
79 | }
80 | });
81 | viewholder.iv_remove.setOnClickListener(new View.OnClickListener() {
82 | @Override
83 | public void onClick(View v) {
84 | activity.handlerCarNum(0,dataList.valueAt(position),true);
85 | goodsAdapter.notifyDataSetChanged();
86 | }
87 | });
88 |
89 | return view;
90 | }
91 |
92 | class Viewholder {
93 | TextView tv_price;
94 | TextView tv_name;
95 | ImageView iv_add,iv_remove;
96 | TextView tv_count;
97 | }
98 |
99 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/shopcart_right_listview.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
23 |
24 |
31 |
32 |
33 |
41 |
42 |
43 |
47 |
48 |
53 |
54 |
63 |
64 |
73 |
74 |
75 |
76 |
85 |
86 |
97 |
98 |
106 |
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
16 |
17 |
22 |
23 |
24 |
31 |
32 |
39 |
40 |
53 |
54 |
55 |
66 |
67 |
79 |
80 |
81 |
82 |
90 |
91 |
94 |
95 |
101 |
102 |
109 |
110 |
116 |
117 |
118 |
127 |
128 |
129 |
130 |
136 |
137 |
143 |
144 |
151 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zzti/fsuper/shopcar/adapter/GoodsAdapter.java:
--------------------------------------------------------------------------------
1 | package com.zzti.fsuper.shopcar.adapter;
2 |
3 | import android.content.Context;
4 | import android.graphics.Paint;
5 | import android.util.Log;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.view.animation.AlphaAnimation;
10 | import android.view.animation.Animation;
11 | import android.view.animation.AnimationSet;
12 | import android.view.animation.RotateAnimation;
13 | import android.view.animation.TranslateAnimation;
14 | import android.widget.BaseAdapter;
15 | import android.widget.ImageView;
16 | import android.widget.RelativeLayout;
17 | import android.widget.TextView;
18 |
19 | import com.nostra13.universalimageloader.core.ImageLoader;
20 | import com.zzti.fsuper.shopcar.MainActivity;
21 | import com.zzti.fsuper.shopcar.R;
22 | import com.zzti.fsuper.shopcar.bean.GoodsBean;
23 |
24 | import java.util.List;
25 | /**
26 | * Created by fengyongge on 2016/5/24 0024.
27 | */
28 |
29 | public class GoodsAdapter extends BaseAdapter {
30 | private List list;
31 | private Context context;
32 | private CatograyAdapter catograyAdapter;
33 | public GoodsAdapter(Context context, List list2, CatograyAdapter catograyAdapter) {
34 | this.context=context;
35 | this.list=list2;
36 | this.catograyAdapter=catograyAdapter;
37 | }
38 |
39 | @Override
40 | public int getCount() {
41 | return list.size();
42 | }
43 |
44 | @Override
45 | public Object getItem(int position) {
46 | return list.get(position);
47 | }
48 |
49 | @Override
50 | public long getItemId(int position) {
51 | return position;
52 | }
53 |
54 | @Override
55 | public View getView(final int position, View convertView, ViewGroup parent) {
56 | final Viewholder viewholder;
57 | if (convertView==null){
58 | convertView= LayoutInflater.from(context).inflate(R.layout.shopcart_right_listview,null);
59 | viewholder=new Viewholder();
60 | viewholder.tv_name= (TextView) convertView.findViewById(R.id.tv_name);
61 | viewholder.tv_original_price= (TextView) convertView.findViewById(R.id.tv_original_price);
62 | viewholder.tv_price= (TextView) convertView.findViewById(R.id.tv_price);
63 | viewholder.iv_add= (ImageView) convertView.findViewById(R.id.iv_add);
64 | viewholder.iv_remove= (ImageView) convertView.findViewById(R.id.iv_remove);
65 | viewholder.tv_acount= (TextView) convertView.findViewById(R.id.tv_acount);
66 | viewholder.iv_pic= (ImageView) convertView.findViewById(R.id.iv_pic);
67 | viewholder.rl_item= (RelativeLayout) convertView.findViewById(R.id.rl_item);
68 | convertView.setTag(viewholder);
69 | }else {
70 | viewholder = (Viewholder) convertView.getTag();
71 |
72 | }
73 | viewholder.tv_name.setText(list.get(position).getTitle());
74 | viewholder.tv_original_price.setText("¥"+list.get(position).getOriginal_price());
75 | viewholder.tv_original_price.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG); //中划线
76 | viewholder.tv_price.setText("¥"+list.get(position).getPrice());
77 |
78 |
79 | if(list.get(position)!=null){
80 | //默认进来数量
81 | if (list.get(position).getNum()<1){
82 | viewholder.tv_acount.setVisibility(View.INVISIBLE);
83 | viewholder.iv_remove.setVisibility(View.INVISIBLE);
84 | catograyAdapter.notifyDataSetChanged();
85 | }else{
86 | viewholder.tv_acount.setVisibility(View.VISIBLE);
87 | viewholder.iv_remove.setVisibility(View.VISIBLE);
88 | viewholder.tv_acount.setText(String.valueOf(list.get(position).getNum()));
89 | catograyAdapter.notifyDataSetChanged();
90 | }
91 | }else{
92 | viewholder.tv_acount.setVisibility(View.INVISIBLE);
93 | viewholder.iv_remove.setVisibility(View.INVISIBLE);
94 | }
95 |
96 | //商品图片
97 | if(list.get(position).getIcon()!=null){
98 | ImageLoader.getInstance().displayImage(
99 | list.get(position).getIcon(), viewholder.iv_pic);
100 | }
101 |
102 |
103 | viewholder.iv_add.setOnClickListener(new View.OnClickListener() {
104 | @Override
105 | public void onClick(View v) {
106 | int count = ((MainActivity)context).getSelectedItemCountById(list.get(position).getProduct_id());
107 | Log.i("fyg","iv_add"+String.valueOf(count));
108 | if (count < 1) {
109 | viewholder.iv_remove.setAnimation(getShowAnimation());
110 | viewholder.iv_remove.setVisibility(View.VISIBLE);
111 | viewholder.tv_acount.setVisibility(View.VISIBLE);
112 | }
113 |
114 | ((MainActivity)context).handlerCarNum(1,list.get(position),true);
115 | catograyAdapter.notifyDataSetChanged();
116 |
117 | int[] loc = new int[2];
118 | viewholder.iv_add.getLocationInWindow(loc);
119 | for (int i=0;i list = new ArrayList();
51 | private List list2 = new ArrayList();
52 | private MyApp myApp;
53 | private CatograyAdapter catograyAdapter;//分类的adapter
54 | private GoodsAdapter goodsAdapter;//分类下商品adapter
55 | ProductAdapter productAdapter;//底部购物车的adapter
56 | GoodsDetailAdapter goodsDetailAdapter;//套餐详情的adapter
57 | private static DecimalFormat df;
58 | private LinearLayout ll_shopcar;
59 | //底部数据
60 | private BottomSheetLayout bottomSheetLayout;
61 | private View bottomSheet;
62 | private SparseArray selectedList;
63 | //套餐
64 | private View bottomDetailSheet;
65 | private List list3 = new ArrayList();
66 | private List list4 = new ArrayList();
67 | private List list5 = new ArrayList();
68 |
69 | private Handler mHanlder;
70 | private ViewGroup anim_mask_layout;//动画层
71 |
72 |
73 | @Override
74 | protected void onCreate(Bundle savedInstanceState) {
75 | super.onCreate(savedInstanceState);
76 | setContentView(R.layout.activity_main);
77 | myApp = (MyApp) getApplicationContext();
78 | mHanlder = new Handler(getMainLooper());
79 | initView();
80 | initData();
81 | addListener();
82 | ll_shopcar.setOnClickListener(new View.OnClickListener() {
83 | @Override
84 | public void onClick(View view) {
85 | showBottomSheet();
86 | }
87 | });
88 | }
89 |
90 | public void initView() {
91 | lv_catogary = (ListView) findViewById(R.id.lv_catogary);
92 | lv_good = (ListView) findViewById(R.id.lv_good);
93 | tv_car = (TextView) findViewById(R.id.tv_car);
94 | //底部控件
95 | rl_bottom = (RelativeLayout) findViewById(R.id.rl_bottom);
96 | tv_count = (TextView) findViewById(R.id.tv_count);
97 | bv_unm = (TextView) findViewById(R.id.bv_unm);
98 | tv_totle_money= (TextView) findViewById(R.id.tv_totle_money);
99 | ll_shopcar= (LinearLayout) findViewById(R.id.ll_shopcar);
100 | selectedList = new SparseArray<>();
101 | df = new DecimalFormat("0.00");
102 | }
103 |
104 | //填充数据
105 | private void initData() {
106 | //商品
107 | for (int j=30;j<45;j++){
108 | GoodsBean goodsBean = new GoodsBean();
109 | goodsBean.setTitle("胡辣汤"+j);
110 | goodsBean.setProduct_id(j);
111 | goodsBean.setCategory_id(j);
112 | goodsBean.setIcon("http://c.hiphotos.baidu.com/image/h%3D200/sign=5992ce78530fd9f9bf175269152cd42b/4ec2d5628535e5dd557b44db74c6a7efce1b625b.jpg");
113 | goodsBean.setOriginal_price("200");
114 | goodsBean.setPrice("100");
115 | list3.add(goodsBean);
116 | }
117 |
118 | //商品
119 | for (int j=5;j<10;j++){
120 | GoodsBean goodsBean = new GoodsBean();
121 | goodsBean.setTitle("胡辣汤"+j);
122 | goodsBean.setProduct_id(j);
123 | goodsBean.setCategory_id(j);
124 | goodsBean.setIcon("http://e.hiphotos.baidu.com/image/h%3D200/sign=c898bddf19950a7b6a3549c43ad0625c/14ce36d3d539b600be63e95eed50352ac75cb7ae.jpg");
125 | goodsBean.setOriginal_price("80");
126 | goodsBean.setPrice("60");
127 | list4.add(goodsBean);
128 | }
129 |
130 | //商品
131 | for (int j=10;j<15;j++){
132 | GoodsBean goodsBean = new GoodsBean();
133 | goodsBean.setTitle("胡辣汤"+j);
134 | goodsBean.setProduct_id(j);
135 | goodsBean.setCategory_id(j);
136 | goodsBean.setIcon("http://g.hiphotos.baidu.com/image/pic/item/03087bf40ad162d9ec74553b14dfa9ec8a13cd7a.jpg");
137 | goodsBean.setOriginal_price("40");
138 | goodsBean.setPrice("20");
139 | list5.add(goodsBean);
140 | }
141 |
142 |
143 | CatograyBean catograyBean3 = new CatograyBean();
144 | catograyBean3.setCount(3);
145 | catograyBean3.setKind("江湖餐品"+3);
146 | catograyBean3.setList(list3);
147 | list.add(catograyBean3);
148 |
149 | CatograyBean catograyBean4 = new CatograyBean();
150 | catograyBean4.setCount(4);
151 | catograyBean4.setKind("江湖餐品"+4);
152 | catograyBean4.setList(list4);
153 | list.add(catograyBean4);
154 |
155 | CatograyBean catograyBean5 = new CatograyBean();
156 | catograyBean5.setCount(5);
157 | catograyBean5.setKind("江湖餐品"+5);
158 | catograyBean5.setList(list5);
159 | list.add(catograyBean5);
160 | bottomSheetLayout = (BottomSheetLayout) findViewById(R.id.bottomSheetLayout);
161 |
162 | //默认值
163 | list2.clear();
164 | list2.addAll(list.get(0).getList());
165 |
166 | //分类
167 | catograyAdapter = new CatograyAdapter(this, list);
168 | lv_catogary.setAdapter(catograyAdapter);
169 | catograyAdapter.notifyDataSetChanged();
170 | //商品
171 | goodsAdapter = new GoodsAdapter(this, list2, catograyAdapter);
172 | lv_good.setAdapter(goodsAdapter);
173 | goodsAdapter.notifyDataSetChanged();
174 |
175 | }
176 |
177 |
178 | //添加监听
179 | private void addListener() {
180 | lv_catogary.setOnItemClickListener(new AdapterView.OnItemClickListener() {
181 | @Override
182 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
183 | Log.i("fyg","list.get(position).getList():"+list.get(position).getList());
184 | list2.clear();
185 | list2.addAll(list.get(position).getList());
186 | catograyAdapter.setSelection(position);
187 | catograyAdapter.notifyDataSetChanged();
188 | goodsAdapter.notifyDataSetChanged();
189 |
190 |
191 | }
192 | });
193 | }
194 |
195 |
196 |
197 |
198 |
199 | //创建套餐详情view
200 | public void showDetailSheet(List listItem, String mealName){
201 | bottomDetailSheet = createMealDetailView(listItem,mealName);
202 | if(bottomSheetLayout.isSheetShowing()){
203 | bottomSheetLayout.dismissSheet();
204 | }else {
205 | if(listItem.size()!=0){
206 | bottomSheetLayout.showWithSheetView(bottomDetailSheet);
207 | }
208 | }
209 | }
210 |
211 | //查看套餐详情
212 | private View createMealDetailView(List listItem, String mealName){
213 | View view = LayoutInflater.from(this).inflate(R.layout.activity_goods_detail,(ViewGroup) getWindow().getDecorView(),false);
214 | ListView lv_product = (MyListView) view.findViewById(R.id.lv_product);
215 | TextView tv_meal = (TextView) view.findViewById(R.id.tv_meal);
216 | TextView tv_num = (TextView) view.findViewById(R.id.tv_num);
217 | int count=0;
218 | for(int i=0;i 0) {
269 | for (int j=0;j