属性动画+购物详情+购物车
依赖=======================================================================
apply plugin: 'com.android.application' android {compileSdkVersion 26 defaultConfig {applicationId "com.example.moni3" minSdkVersion 15 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" //添加这行代码 不然会报错 javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }}buildTypes {release {minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }}}dependencies {implementation fileTree(dir: 'libs', include: ['*.jar'])implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.1.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation 'com.jakewharton:butterknife:7.0.1' implementation 'com.android.support:recyclerview-v7:26.1.0' implementation 'com.github.bumptech.glide:glide:3.7.0' implementation 'com.google.code.gson:gson:2.8.2' implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.2' implementation 'com.squareup.okio:okio:1.5.0' implementation 'com.squareup.okhttp3:okhttp:3.9.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1' }
权限=========================================================================
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.moni3"> <uses-permission android:name="android.permission.INTERNET"/> <application android:name=".Modlue.imageLoader.BaseApplication" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".View.activity.SplashActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".View.activity.SecondActivity"></activity> <activity android:name=".View.activity.ThirdActivity"></activity> <activity android:name=".View.activity.MainActivity"></activity> </application> </manifest>
布局=========================================================================
activity_main=================================================================
<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.moni3.View.activity.MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout>
activity_second=================================================================
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="58dp" android:id="@+id/relative01"> <ImageView android:padding="5dp" android:id="@+id/backImage" android:layout_width="38dp" android:layout_height="38dp" android:src="@drawable/icon_back" android:layout_centerVertical="true" android:layout_alignParentLeft="true"/> <TextView android:padding="10dp" android:text="商品详情" android:textSize="26sp" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_centerInParent="true" /> </RelativeLayout> <View android:id="@+id/view" android:background="#000" android:layout_height="1dp" android:visibility="visible" android:layout_width="match_parent" android:layout_below="@+id/relative01"> </View> <RelativeLayout android:layout_width="match_parent" android:layout_below="@+id/view" android:layout_height="288dp" android:id="@+id/relative"> <ImageView android:id="@+id/ProductImage" android:layout_width="match_parent" android:layout_height="match_parent" /> </RelativeLayout> <View android:id="@+id/view01" android:background="#000" android:layout_height="1dp" android:visibility="visible" android:layout_width="match_parent" android:layout_below="@+id/relative"> </View> <LinearLayout android:id="@+id/line1" android:orientation="vertical" android:layout_above="@+id/line2" android:layout_width="match_parent" android:layout_below="@+id/relative" android:layout_height="wrap_content" > <TextView android:textSize="18sp" android:id="@+id/title" android:layout_weight="1" android:layout_height="0dp" android:layout_marginLeft="18dp" android:layout_width="wrap_content" /> <TextView android:textSize="18sp" android:id="@+id/yuanJia" android:layout_weight="1" android:layout_height="0dp" android:layout_marginLeft="18dp" android:layout_width="wrap_content" /> <TextView android:textSize="18sp" android:id="@+id/youHui" android:layout_weight="1" android:layout_height="0dp" android:textColor="#f14d07" android:layout_marginLeft="18dp" android:layout_width="wrap_content" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_above="@+id/line2" android:visibility="visible" android:background="#000" android:layout_height="1dp"> </View> <LinearLayout android:id="@+id/line2" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true"> <Button android:text="购物车" android:gravity="center" android:id="@+id/goToCart" android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content" android:background="@drawable/buttonstyle" > </Button> <Button android:gravity="center" android:text="加入购物车" android:id="@+id/addCart" android:layout_weight="1" android:layout_width="0dp" android:background="@drawable/buttonstyle" android:layout_height="wrap_content"> </Button> </LinearLayout> </RelativeLayout>
activity_splash=================================================================
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/logo_img" android:layout_width="100dp" android:layout_height="100dp" android:src="@mipmap/ic_launcher" android:layout_centerHorizontal="true" /> <com.example.moni3.View.view.ProgressBarView android:visibility="gone" android:id="@+id/my_progess" android:layout_centerVertical="true" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RelativeLayout>
activity_third=================================================================
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:layout_alignParentTop="true" android:layout_width="match_parent" android:layout_height="58dp" android:id="@+id/relative01"> <ImageView android:padding="5dp" android:id="@+id/thirdBackImage" android:layout_width="38dp" android:layout_height="38dp" android:src="@drawable/icon_back" android:layout_centerVertical="true" android:layout_alignParentLeft="true"/> <TextView android:padding="10dp" android:text="购物车" android:textSize="26sp" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_centerInParent="true" /> </RelativeLayout> <android.support.v7.widget.RecyclerView android:id="@+id/third_recyclerview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/third_pay_linear" android:layout_below="@+id/relative01" /> <RelativeLayout android:layout_alignParentBottom="true" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#FFFFFF" android:gravity="center_vertical" android:id="@+id/third_pay_linear" > <CheckBox android:drawablePadding="@dimen/padding_5dp" android:id="@+id/third_allselect" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="全选/反选" /> <TextView android:layout_alignParentRight="true" android:id="@+id/third_totalprice" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:paddingRight="18dp" android:text="总价:¥ 0" android:textColor="@color/main_red_text" android:textSize="@dimen/common_font_size_16" /> </RelativeLayout> </RelativeLayout>
adapter_layout=================================================================
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:id="@+id/ll_shopcart_header" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <View android:background="@color/background_color" android:layout_height="@dimen/margin_10dp" android:layout_width="match_parent" android:id="@+id/view"/> <LinearLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:gravity="center_vertical" > <!-- 商店checkbox --> <CheckBox android:id="@+id/shop_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="@dimen/margin_15dp" android:paddingRight="@dimen/margin_15dp" android:paddingTop="@dimen/margin_10dp" android:paddingBottom="@dimen/margin_10dp" /> <!-- 商店信息 --> <TextView android:id="@+id/tv_item_shopcart_shopname" android:textColor="@color/cblack" android:layout_width="match_parent" android:layout_height="wrap_content" android:drawablePadding="@dimen/padding_5dp" android:text="宝儿家服装" android:padding="@dimen/padding_10dp" /> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <View android:layout_width="match_parent" android:layout_height="@dimen/margin_1dp" android:background="@color/background_color" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="horizontal" > <!-- 商品 checkbox --> <CheckBox android:id="@+id/item_checkbox" android:layout_marginLeft="18dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="@dimen/margin_15dp" /> <!-- 商品图片 --> <ImageView android:id="@+id/item_pic" android:layout_width="60dp" android:layout_height="60dp" android:layout_margin="@dimen/margin_10dp" /> <LinearLayout android:layout_weight="1" android:layout_width="0dp" android:orientation="vertical" android:layout_height="wrap_content"> <TextView android:text="颜色:黑色" android:id="@+id/item_name" android:textColor="@color/cblack" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="@dimen/common_font_size_12" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/margin_5dp" android:layout_marginBottom="@dimen/margin_5dp" > <TextView android:text="¥185" android:id="@+id/item_price" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/main_red_text" android:textSize="@dimen/common_font_size_14" /> </LinearLayout> </LinearLayout> </LinearLayout> </LinearLayout> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="@dimen/margin_1dp" android:background="@color/background_color" /> </LinearLayout>
drawable----buttonstyle=========================================================
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <!-- 连框颜色值 --> <item> <shape> <solid android:color="#8b8686" /> </shape> </item> <!-- 主体背景颜色值 --> <item android:bottom="2dp" android:right="2dp"> <shape> <solid android:color="#ffffff" /> <padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" /> </shape> </item> </layer-list>
colors========================================================================
<?xml version="1.0" encoding="utf-8"?> <resources> <color name="colorPrimary">#3F51B5</color> <color name="colorPrimaryDark">#303F9F</color> <color name="colorAccent">#FF4081</color> <color name="cwhite">#FFFFFF</color> <color name="title_bg">#FDE23D</color> <color name="tab_bg">#FFFFFF</color> <color name="tab_normal_textcolor">#373737</color> <color name="tab_selected_textcolor">#FDE23D</color> <color name="coffer">#442509</color> <color name="pressed_icon_color">#e53e42</color> <color name="background_color">#f6f6f6</color> <color name="main_red_text">#e53e42</color> <dimen name="padding_20dp">20dp</dimen> <color name="splitline_color">#dddddd</color> <color name="cblack">#000000</color> </resources>
dimens=====================================================================
<?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="margin_10dp">10dp</dimen> <dimen name="padding_5dp">5dp</dimen> <dimen name="padding_10dp">10dp</dimen> <dimen name="common_font_size_16">16sp</dimen> <dimen name="common_font_size_14">14sp</dimen> <dimen name="height_200dp">200dp</dimen> <dimen name="margin_30dp">30dp</dimen> <dimen name="margin_15dp">15dp</dimen> <dimen name="margin_1dp">1dp</dimen> <dimen name="margin_5dp">5dp</dimen> <dimen name="common_font_size_12">12sp</dimen> <dimen name="padding_2dp">2dp</dimen> <dimen name="margin_20dp">20dp</dimen> </resources>
功能=======================================================================
SecondBean================================================================
package com.example.moni3.Modlue.bean; /** * Created by DELL on 2018/5/26. */ public class SecondBean {/** * msg : * seller : {"description":"我是商家17","icon":"http://120.27.23.105/images/icon.png","name":"商家17","productNums":999,"score":5,"sellerid":17} * code : 0 * data : {"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","itemtype":1,"pid":1,"price":118,"pscid":1,"salenum":0,"sellerid":17,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"} */ private String msg; private SellerBean seller; private String code; private DataBean data; public String getMsg() {return msg; }public void setMsg(String msg) {this.msg = msg; }public SellerBean getSeller() {return seller; }public void setSeller(SellerBean seller) {this.seller = seller; }public String getCode() {return code; }public void setCode(String code) {this.code = code; }public DataBean getData() {return data; }public void setData(DataBean data) {this.data = data; }public static class SellerBean {/** * description : 我是商家17 * icon : http://120.27.23.105/images/icon.png * name : 商家17 * productNums : 999 * score : 5.0 * sellerid : 17 */ private String description; private String icon; private String name; private int productNums; private double score; private int sellerid; public String getDescription() {return description; }public void setDescription(String description) {this.description = description; }public String getIcon() {return icon; }public void setIcon(String icon) {this.icon = icon; }public String getName() {return name; }public void setName(String name) {this.name = name; }public int getProductNums() {return productNums; }public void setProductNums(int productNums) {this.productNums = productNums; }public double getScore() {return score; }public void setScore(double score) {this.score = score; }public int getSellerid() {return sellerid; }public void setSellerid(int sellerid) {this.sellerid = sellerid; }}public static class DataBean {/** * bargainPrice : 111.99 * createtime : 2017-10-14T21:39:05 * detailUrl : https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends * images : https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg * itemtype : 1 * pid : 1 * price : 118.0 * pscid : 1 * salenum : 0 * sellerid : 17 * subhead : 每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下 * title : 北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g */ private double bargainPrice; private String createtime; private String detailUrl; private String images; private int itemtype; private int pid; private double price; private int pscid; private int salenum; private int sellerid; private String subhead; private String title; public double getBargainPrice() {return bargainPrice; }public void setBargainPrice(double bargainPrice) {this.bargainPrice = bargainPrice; }public String getCreatetime() {return createtime; }public void setCreatetime(String createtime) {this.createtime = createtime; }public String getDetailUrl() {return detailUrl; }public void setDetailUrl(String detailUrl) {this.detailUrl = detailUrl; }public String getImages() {return images; }public void setImages(String images) {this.images = images; }public int getItemtype() {return itemtype; }public void setItemtype(int itemtype) {this.itemtype = itemtype; }public int getPid() {return pid; }public void setPid(int pid) {this.pid = pid; }public double getPrice() {return price; }public void setPrice(double price) {this.price = price; }public int getPscid() {return pscid; }public void setPscid(int pscid) {this.pscid = pscid; }public int getSalenum() {return salenum; }public void setSalenum(int salenum) {this.salenum = salenum; }public int getSellerid() {return sellerid; }public void setSellerid(int sellerid) {this.sellerid = sellerid; }public String getSubhead() {return subhead; }public void setSubhead(String subhead) {this.subhead = subhead; }public String getTitle() {return title; }public void setTitle(String title) {this.title = title; }} }
ShopBean====================================================================
package com.example.moni3.Modlue.bean; import java.util.List; /** * Created by DELL on 2018/5/26. */ public class ShopBean {private int isFirst; // true 表示商家选中 false 相反 private boolean shopSelected; // true 表示 当前商品是选中的 false 相反 private boolean itemSelected; /** * msg : 请求成功 * code : 0 * data : [{"list":[{"bargainPrice":22.9,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/2542855.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t1930/284/2865629620/390243/e3ade9c4/56f0a08fNbd3a1235.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2137/336/2802996626/155915/e5e90d7a/56f0a09cN33e01bd0.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t1882/31/2772215910/389956/c8dbf370/56f0a0a2Na0c86ea6.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2620/166/2703833710/312660/531aa913/57709035N33857877.jpg!q70.jpg","num":4,"pid":24,"price":288,"pscid":2,"selected":0,"sellerid":1,"subhead":"三只松鼠零食特惠,专区满99减50,满199减100,火速抢购》","title":"三只松鼠 坚果炒货 零食奶油味 碧根果225g/袋"},{"bargainPrice":11800,"createtime":"2017-10-10T17:33:37","detailUrl":"https://item.m.jd.com/product/4338107.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6700/155/2098998076/156185/6cf95035/595dd5a5Nc3a7dab5.jpg!q70.jpg","num":2,"pid":57,"price":5199,"pscid":40,"selected":0,"sellerid":1,"subhead":"【i5 MX150 2G显存】全高清窄边框 8G内存 256固态硬盘 支持指纹识别 预装WIN10系统","title":"小米(MI)Air 13.3英寸全金属轻薄笔记本(i5-7200U 8G 256G PCle SSD MX150 2G独显 FHD 指纹识别 Win10)银\r\n"},{"bargainPrice":99,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/4345173.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6037/35/2944615848/95178/6cd6cff0/594a3a10Na4ec7f39.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6607/258/1025744923/75738/da120a2d/594a3a12Ne3e6bc56.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6370/292/1057025420/64655/f87644e3/594a3a12N5b900606.jpg!q70.jpg","num":1,"pid":45,"price":2999,"pscid":39,"selected":0,"sellerid":1,"subhead":"高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽!","title":"一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机"}],"sellerName":"商家1","sellerid":"1"},{"list":[{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/5025518.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t8830/106/1760940277/195595/5cf9412f/59bf2ef5N5ab7dc16.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5428/70/1520969931/274676/b644dd0d/591128e7Nd2f70da0.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5566/365/1519564203/36911/620c750c/591128eaN54ac3363.jpg!q70.jpg","num":1,"pid":58,"price":6399,"pscid":40,"selected":0,"sellerid":2,"subhead":"升级4G大显存!Nvme协议Pcie SSD,速度快人一步】GTX1050Ti就选拯救者!专业游戏键盘&新模具全新设计!","title":"联想(Lenovo)拯救者R720 15.6英寸游戏笔记本电脑(i5-7300HQ 8G 1T+128G SSD GTX1050Ti 4G IPS 黑)"}],"sellerName":"商家2","sellerid":"2"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":2,"pid":10,"price":555.55,"pscid":1,"selected":0,"sellerid":3,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"},{"bargainPrice":399,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/1439822107.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t5887/201/859509257/69994/6bde9bf6/59224c24Ne854e14c.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5641/233/853609022/57374/5c73d281/59224c24N3324d5f4.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5641/233/853609022/57374/5c73d281/59224c24N3324d5f4.jpg!q70.jpg","num":2,"pid":82,"price":333,"pscid":85,"selected":0,"sellerid":3,"subhead":"满2件,总价打6.50折","title":"Gap男装 休闲舒适简约水洗五袋直筒长裤紧身牛仔裤941825 深灰色 33/32(175/84A)"}],"sellerName":"商家3","sellerid":"3"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":5,"pid":11,"price":8989,"pscid":1,"selected":1,"sellerid":4,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家4","sellerid":"4"},{"list":[{"bargainPrice":1999,"createtime":"2017-10-10T16:09:02","detailUrl":"https://item.m.jd.com/product/5025971.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t7210/232/3738666823/232298/9004583e/59c3a9a7N8de42e15.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8356/82/2107423621/109733/c019b8c6/59c3a9a6Ne9a4bdd7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t10219/74/25356012/171379/7d55e296/59c3a9a8N82fa6e02.jpg!q70.jpg","num":17,"pid":49,"price":333,"pscid":39,"selected":1,"sellerid":5,"subhead":"vivo X20 带你开启全面屏时代!逆光也清晰,照亮你的美!","title":"vivo X20 全面屏手机 全网通 4GB+64GB 金色 移动联通电信4G手机 双卡双待"}],"sellerName":"商家5","sellerid":"5"},{"list":[{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","num":1,"pid":51,"price":555,"pscid":39,"selected":1,"sellerid":7,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"}],"sellerName":"商家7","sellerid":"7"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-03T23:53:28","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":3,"pid":17,"price":299,"pscid":1,"selected":1,"sellerid":10,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家10","sellerid":"10"},{"list":[{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","num":7,"pid":55,"price":5999,"pscid":39,"selected":1,"sellerid":11,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"}],"sellerName":"商家11","sellerid":"11"},{"list":[{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","num":1,"pid":56,"price":99,"pscid":39,"selected":1,"sellerid":12,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"}],"sellerName":"商家12","sellerid":"12"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":24,"pid":20,"price":599,"pscid":1,"selected":1,"sellerid":13,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家13","sellerid":"13"},{"list":[{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","num":2,"pid":70,"price":17999,"pscid":40,"selected":1,"sellerid":14,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"}],"sellerName":"商家14","sellerid":"14"},{"list":[{"bargainPrice":11800,"createtime":"2017-10-03T23:53:28","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","num":7,"pid":71,"price":32999,"pscid":40,"selected":0,"sellerid":15,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"}],"sellerName":"商家15","sellerid":"15"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":11,"pid":1,"price":118,"pscid":1,"selected":0,"sellerid":17,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家17","sellerid":"17"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":17,"pid":2,"price":299,"pscid":1,"selected":1,"sellerid":18,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家18","sellerid":"18"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-03T23:53:28","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":3,"pid":3,"price":198,"pscid":1,"selected":1,"sellerid":19,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家19","sellerid":"19"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":5,"pid":4,"price":999,"pscid":1,"selected":0,"sellerid":20,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家20","sellerid":"20"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-14T21:39:05","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":4,"pid":5,"price":88.99,"pscid":1,"selected":1,"sellerid":21,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"},{"bargainPrice":22.9,"createtime":"2017-10-03T23:53:28","detailUrl":"https://item.m.jd.com/product/2542855.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t1930/284/2865629620/390243/e3ade9c4/56f0a08fNbd3a1235.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2137/336/2802996626/155915/e5e90d7a/56f0a09cN33e01bd0.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t1882/31/2772215910/389956/c8dbf370/56f0a0a2Na0c86ea6.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2620/166/2703833710/312660/531aa913/57709035N33857877.jpg!q70.jpg","num":1,"pid":44,"price":789,"pscid":2,"selected":0,"sellerid":21,"subhead":"三只松鼠零食特惠,专区满99减50,满199减100,火速抢购》","title":"三只松鼠 坚果炒货 零食奶油味 碧根果225g/袋"}],"sellerName":"商家21","sellerid":"21"},{"list":[{"bargainPrice":111.99,"createtime":"2017-10-03T23:53:28","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":4,"pid":6,"price":7.99,"pscid":1,"selected":1,"sellerid":22,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}],"sellerName":"商家22","sellerid":"22"},{"list":[{"bargainPrice":11800,"createtime":"2017-10-03T23:53:28","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","num":2,"pid":79,"price":888,"pscid":40,"selected":1,"sellerid":23,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"}],"sellerName":"商家23","sellerid":"23"}] */ private String msg; private String code; private List<DataBean> data; public int getIsFirst() {return isFirst; }public boolean isShopSelected() {return shopSelected; }public boolean isItemSelected() {return itemSelected; }public void setIsFirst(int isFirst) {this.isFirst = isFirst; }public void setShopSelected(boolean shopSelected) {this.shopSelected = shopSelected; }public void setItemSelected(boolean itemSelected) {this.itemSelected = itemSelected; }public String getMsg() {return msg; }public void setMsg(String msg) {this.msg = msg; }public String getCode() {return code; }public void setCode(String code) {this.code = code; }public List<DataBean> getData() {return data; }public void setData(List<DataBean> data) {this.data = data; }public static class DataBean {/** * list : [{"bargainPrice":22.9,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/2542855.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t1930/284/2865629620/390243/e3ade9c4/56f0a08fNbd3a1235.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2137/336/2802996626/155915/e5e90d7a/56f0a09cN33e01bd0.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t1882/31/2772215910/389956/c8dbf370/56f0a0a2Na0c86ea6.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2620/166/2703833710/312660/531aa913/57709035N33857877.jpg!q70.jpg","num":4,"pid":24,"price":288,"pscid":2,"selected":0,"sellerid":1,"subhead":"三只松鼠零食特惠,专区满99减50,满199减100,火速抢购》","title":"三只松鼠 坚果炒货 零食奶油味 碧根果225g/袋"},{"bargainPrice":11800,"createtime":"2017-10-10T17:33:37","detailUrl":"https://item.m.jd.com/product/4338107.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6700/155/2098998076/156185/6cf95035/595dd5a5Nc3a7dab5.jpg!q70.jpg","num":2,"pid":57,"price":5199,"pscid":40,"selected":0,"sellerid":1,"subhead":"【i5 MX150 2G显存】全高清窄边框 8G内存 256固态硬盘 支持指纹识别 预装WIN10系统","title":"小米(MI)Air 13.3英寸全金属轻薄笔记本(i5-7200U 8G 256G PCle SSD MX150 2G独显 FHD 指纹识别 Win10)银\r\n"},{"bargainPrice":99,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/4345173.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6037/35/2944615848/95178/6cd6cff0/594a3a10Na4ec7f39.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6607/258/1025744923/75738/da120a2d/594a3a12Ne3e6bc56.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6370/292/1057025420/64655/f87644e3/594a3a12N5b900606.jpg!q70.jpg","num":1,"pid":45,"price":2999,"pscid":39,"selected":0,"sellerid":1,"subhead":"高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽!","title":"一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机"}] * sellerName : 商家1 * sellerid : 1 */ private String sellerName; private String sellerid; private List<ListBean> list; public String getSellerName() {return sellerName; }public void setSellerName(String sellerName) {this.sellerName = sellerName; }public String getSellerid() {return sellerid; }public void setSellerid(String sellerid) {this.sellerid = sellerid; }public List<ListBean> getList() {return list; }public void setList(List<ListBean> list) {this.list = list; }public static class ListBean {/** * bargainPrice : 22.9 * createtime : 2017-10-14T21:48:08 * detailUrl : https://item.m.jd.com/product/2542855.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends * images : https://m.360buyimg.com/n0/jfs/t1930/284/2865629620/390243/e3ade9c4/56f0a08fNbd3a1235.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2137/336/2802996626/155915/e5e90d7a/56f0a09cN33e01bd0.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t1882/31/2772215910/389956/c8dbf370/56f0a0a2Na0c86ea6.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2620/166/2703833710/312660/531aa913/57709035N33857877.jpg!q70.jpg * num : 4 * pid : 24 * price : 288.0 * pscid : 2 * selected : 0 * sellerid : 1 * subhead : 三只松鼠零食特惠,专区满99减50,满199减100,火速抢购》 * title : 三只松鼠 坚果炒货 零食奶油味 碧根果225g/袋 */ private double bargainPrice; private String createtime; private String detailUrl; private String images; private int num; private int pid; private double price; private int pscid; private int selected; private int sellerid; private String subhead; private String title; private int isFirst; private boolean shopSelected; private boolean itemSelected; public double getBargainPrice() {return bargainPrice; }public void setBargainPrice(double bargainPrice) {this.bargainPrice = bargainPrice; }public String getCreatetime() {return createtime; }public void setCreatetime(String createtime) {this.createtime = createtime; }public String getDetailUrl() {return detailUrl; }public void setDetailUrl(String detailUrl) {this.detailUrl = detailUrl; }public String getImages() {return images; }public void setImages(String images) {this.images = images; }public int getNum() {return num; }public void setNum(int num) {this.num = num; }public int getPid() {return pid; }public void setPid(int pid) {this.pid = pid; }public double getPrice() {return price; }public void setPrice(double price) {this.price = price; }public int getPscid() {return pscid; }public void setPscid(int pscid) {this.pscid = pscid; }public int getSelected() {return selected; }public void setSelected(int selected) {this.selected = selected; }public int getSellerid() {return sellerid; }public void setSellerid(int sellerid) {this.sellerid = sellerid; }public String getSubhead() {return subhead; }public void setSubhead(String subhead) {this.subhead = subhead; }public String getTitle() {return title; }public void setTitle(String title) {this.title = title; }public int getIsFirst() {return isFirst; }public void setIsFirst(int isFirst) {this.isFirst = isFirst; }public boolean isShopSelected() {return shopSelected; }public boolean isItemSelected() {return itemSelected; }public void setShopSelected(boolean shopSelected) {this.shopSelected = shopSelected; }public void setItemSelected(boolean itemSelected) {this.itemSelected = itemSelected; }}} }
BaseAppliaction================================================================
package com.example.moni3.Modlue.imageLoader; import android.app.Application; /** * Created by 你家大林哥 on 2018/5/27. */ public class BaseApplication extends Application {@Override public void onCreate() {super.onCreate(); //配置imageLoader ImageLoaderUtil.init(this); }}
ImageLoaderUtil================================================================
package com.example.moni3.Modlue.imageLoader; import android.graphics.Bitmap; import com.example.moni3.R; import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; import com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; import com.nostra13.universalimageloader.core.assist.ImageScaleType; import com.nostra13.universalimageloader.core.assist.QueueProcessingType; import com.nostra13.universalimageloader.core.decode.BaseImageDecoder; import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer; import com.nostra13.universalimageloader.core.download.BaseImageDownloader; import com.nostra13.universalimageloader.utils.StorageUtils; import java.io.File; /** * Created by 你家大林哥 on 2018/5/27. */ public class ImageLoaderUtil {public static void init(BaseApplication context) {//1.获取配置config对象 File cacheDir = StorageUtils.getCacheDirectory(context); //缓存文件夹路径 ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).threadPoolSize(3) // default 线程池内加载的数量 .threadPriority(Thread.NORM_PRIORITY - 2) // default 设置当前线程的优先级 .tasksProcessingOrder(QueueProcessingType.FIFO) // default .denyCacheImageMultipleSizesInMemory().memoryCache(new LruMemoryCache(2 * 1024 * 1024)) //可以通过自己的内存缓存实现 .memoryCacheSize(2 * 1024 * 1024) // 内存缓存的最大值 .memoryCacheSizePercentage(13) // default .diskCache(new UnlimitedDiscCache(cacheDir)) // default 可以自定义缓存路径 .diskCacheSize(50 * 1024 * 1024) // 50 Mb sd卡(本地)缓存的最大值 .diskCacheFileCount(100) // 可以缓存的文件数量 // default为使用HASHCODE对UIL进行加密命名, 还可以用MD5(new Md5FileNameGenerator())加密 .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()).imageDownloader(new BaseImageDownloader(context)) // default .imageDecoder(new BaseImageDecoder(true)) // default .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default .writeDebugLogs() // 打印debug log .build(); //开始构建 //2.初始化配置...ImageLoader.getInstance()图片加载器的对象,单例模式 ImageLoader.getInstance().init(config); }/** * imageLoader加载图片的默认选项 * @return */ public static DisplayImageOptions getDefaultOption(){DisplayImageOptions options = new DisplayImageOptions.Builder().showImageOnLoading(R.mipmap.ic_launcher) // 设置图片下载期间显示的默认图片 .showImageForEmptyUri(R.mipmap.ic_launcher) // 设置图片Uri为空或是错误的时候显示的图片 .showImageOnFail(R.mipmap.ic_launcher) // 设置图片加载或解码过程中发生错误显示的图片 .resetViewBeforeLoading(true) // default 设置图片在加载前是否重置、复位 .delayBeforeLoading(1000) // 下载前的延迟时间 .cacheInMemory(true) // default 设置下载的图片是否缓存在内存中 .cacheOnDisk(true) // default 设置下载的图片是否缓存在SD卡中 .considerExifParams(true) // default .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) // default 设置图片以如何的编码方式显示 .bitmapConfig(Bitmap.Config.RGB_565) // default 设置图片的解码类型 .displayer(new SimpleBitmapDisplayer()) // default 还可以设置圆角图片new RoundedBitmapDisplayer(20) .build(); return options; }/** * imageLoader加载圆角图片....指定圆角的大小 * @return */ public static DisplayImageOptions getRoundedOption(int corner){DisplayImageOptions options = new DisplayImageOptions.Builder().showImageOnLoading(R.mipmap.ic_launcher) // 设置图片下载期间显示的图片 .showImageForEmptyUri(R.mipmap.ic_launcher) // 设置图片Uri为空或是错误的时候显示的图片 .showImageOnFail(R.mipmap.ic_launcher) // 设置图片加载或解码过程中发生错误显示的图片 .resetViewBeforeLoading(true) // default 设置图片在加载前是否重置、复位 .delayBeforeLoading(1000) // 下载前的延迟时间 .cacheInMemory(true) // default 设置下载的图片是否缓存在内存中 .cacheOnDisk(true) // default 设置下载的图片是否缓存在SD卡中 .considerExifParams(true) // default .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) // default 设置图片以如何的编码方式显示 .bitmapConfig(Bitmap.Config.RGB_565) // default 设置图片的解码类型 .displayer(new RoundedBitmapDisplayer(corner)) // default 还可以设置圆角图片new RoundedBitmapDisplayer(20) .build(); return options; }}
MainModle==================================================================
package com.example.moni3.Modlue.molse; import android.os.Message; import com.example.moni3.Modlue.bean.ShopBean; import com.example.moni3.Modlue.utils.AbstractUiCallBack; import com.example.moni3.Modlue.utils.OkhttpUtils; /** * Created by 你家大林哥 on 2018/5/27. */ public class MainModel {//获取购物车数据请求接口 public void getData(final MainModelCallBack callBack){OkhttpUtils.getInstance().asy(null, "https://www.zhaoapi.cn/product/getCarts?uid=71", new AbstractUiCallBack<ShopBean>() {@Override public boolean handleMessage(Message msg) {return false; }@Override public void success(ShopBean bean) {callBack.success(bean); }@Override public void failure(Exception e) {callBack.failure(e); }}); }}
MainModelCallBack
package com.example.moni3.Modlue.molse; import com.example.moni3.Modlue.bean.ShopBean; /** * Created by 你家大林哥 on 2018/5/27. */ public interface MainModelCallBack {public void success(ShopBean bean); public void failure(Exception e); }
SecondModel
package com.example.moni3.Modlue.molse; import android.os.Message; import com.example.moni3.Modlue.bean.SecondBean; import com.example.moni3.Modlue.utils.AbstractUiCallBack; import com.example.moni3.Modlue.utils.OkhttpUtils; import com.example.moni3.View.view.SecondViewListener; /** * Created by 你家大林哥 on 2018/5/27. */ public class SecondModel {public void getDataModel(final SecondViewListener.ModelSecondInterface modelSecondInterface){OkhttpUtils.getInstance().asy(null, "https://www.zhaoapi.cn/product/getProductDetail?pid=1", new AbstractUiCallBack<SecondBean>() {@Override public boolean handleMessage(Message msg) {return false; }@Override public void success(SecondBean bean) {modelSecondInterface.success(bean); }@Override public void failure(Exception e) {modelSecondInterface.failed(e); }}); }}
AbstractUiCallBack
package com.example.moni3.Modlue.utils; import android.os.Handler; import android.os.Looper; import android.os.Message; import com.google.gson.Gson; import com.google.gson.JsonSyntaxException; import java.io.IOException; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Response; /** * Created by 你家大林哥 on 2018/5/27. */ public abstract class AbstractUiCallBack<T> implements Handler.Callback, Callback {/** * 成功回调 * @param t */ public abstract void success(T t); /** * 失败回调 * @param e */ public abstract void failure(Exception e); private Handler handler = null ; private Class clazz ; public AbstractUiCallBack(){handler = new Handler(Looper.getMainLooper()); // 得到的是一个 AbstractUiCallBack<T> 的Type Type type = getClass().getGenericSuperclass() ; // 得到的是T的实际Type Type [] arr = ((ParameterizedType)type).getActualTypeArguments() ; clazz = (Class) arr[0] ; }public void onFailure(Call call, IOException e) {failure(e); }public void onResponse(Call call, Response response) throws IOException {try {String result = response.body().string(); System.out.println("result = " + result); Gson gson = new Gson(); final T t = (T) gson.fromJson(result,clazz); handler.post(new Runnable() {@Override public void run() {success(t); }}); } catch (IOException e) {e.printStackTrace(); failure(e); } catch (JsonSyntaxException e) {e.printStackTrace(); failure(e); }}@Override public boolean handleMessage(Message msg) {return false; } }
LoggingInterceptor
package com.example.moni3.Modlue.utils; import java.io.IOException; import okhttp3.FormBody; import okhttp3.Interceptor; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; /** * Created by 你家大林哥 on 2018/5/27. */ public class LoggingInterceptor implements Interceptor {@Override public Response intercept(Chain chain) throws IOException {//首先取到Request Request request = chain.request(); Response response = null; Request requestProcess = null; if ("GET".equals(request.method())) {String url = request.url().toString() + "&source=android"; Request.Builder builder = request.newBuilder(); builder.get().url(url); requestProcess = builder.build(); response = chain.proceed(requestProcess); } else {FormBody.Builder builder = new FormBody.Builder(); RequestBody requestBody = request.body(); if (requestBody instanceof FormBody) {FormBody formBody = (FormBody) requestBody; for (int i = 0; i < formBody.size(); i++) {builder.add(formBody.encodedName(i), formBody.encodedValue(i)); }builder.add("source", "android"); }requestProcess = request.newBuilder().url(request.url().toString()).post(builder.build()).build(); response = chain.proceed(requestProcess); }return response; }}
OkhttpUtils
package com.example.moni3.Modlue.utils; import java.io.File; import java.util.Map; import java.util.concurrent.TimeUnit; import okhttp3.Callback; import okhttp3.FormBody; import okhttp3.MediaType; import okhttp3.MultipartBody; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; /** * Created by 你家大林哥 on 2018/5/27. */ public class OkhttpUtils {private static OkhttpUtils okhttpUtils = null ; private OkhttpUtils(){}public static OkhttpUtils getInstance(){if(okhttpUtils == null){okhttpUtils = new OkhttpUtils(); client = new OkHttpClient.Builder().readTimeout(20, TimeUnit.SECONDS).writeTimeout(20,TimeUnit.SECONDS).connectTimeout(20,TimeUnit.SECONDS)//添加拦截器 .addInterceptor(new LoggingInterceptor()).build(); }return okhttpUtils ; }private static OkHttpClient client ; /** * 发起异步请求 * @param params * @param url * @param callBack */ public void asy(Map<String,String> params, String url, AbstractUiCallBack callBack){Request request = null ; if(params != null){// post 请求 FormBody.Builder builder = new FormBody.Builder() ; for(Map.Entry<String,String> entry : params.entrySet()){builder.add(entry.getKey(),entry.getValue()); }FormBody body = builder.build(); request = new Request.Builder().url(url).post(body).build(); } else {// get 请求 request = new Request.Builder().url(url).build(); }client.newCall(request).enqueue(callBack); }private static final MediaType MEDIA_TYPE_PNG = MediaType.parse("image/png"); public static void postFile(Map<String,String> map, String url, File file, AbstractUiCallBack callBack){String [] array = file.getAbsolutePath().split("\\/"); MultipartBody.Builder builder = new MultipartBody.Builder(); builder.setType(MultipartBody.FORM); for(Map.Entry<String,String> entry : map.entrySet()){builder.addFormDataPart(entry.getKey(),entry.getValue()); }builder.addFormDataPart("imageFileName",array[array.length-1]); if(file.exists() && file.length() > 0){builder.addFormDataPart("image",array[array.length-1], RequestBody.create(MEDIA_TYPE_PNG,file)); }MultipartBody body = builder.build() ; Request request = new Request.Builder().url(url).post(body).build(); client.newCall(request).enqueue((Callback) callBack); }}
MainPresenter
package com.example.moni3.Presenter; import com.example.moni3.Modlue.bean.ShopBean; import com.example.moni3.Modlue.molse.MainModel; import com.example.moni3.Modlue.molse.MainModelCallBack; import com.example.moni3.View.view.MainViewListener; /** * Created by 你家大林哥 on 2018/5/27. */ public class MainPresenter {private MainViewListener listener; private MainModel mainModel; public MainPresenter(MainViewListener listener){this.listener = listener ; this.mainModel = new MainModel(); }public void getData(){mainModel.getData(new MainModelCallBack() {@Override public void success(ShopBean bean) {if(listener != null){listener.success(bean); }}@Override public void failure(Exception e) {if(listener != null){listener.failure(e); }}}); }/** * 防止内存泄漏 */ public void detach(){listener = null; }}
SecondPresenter
package com.example.moni3.Presenter; import com.example.moni3.Modlue.bean.SecondBean; import com.example.moni3.Modlue.molse.SecondModel; import com.example.moni3.View.view.SecondViewListener; /** * Created by 你家大林哥 on 2018/5/27. */ public class SecondPresenter {SecondViewListener.PresenterSecondInterface presenterSecondInterface; SecondModel secondModel; public SecondPresenter(SecondViewListener.PresenterSecondInterface presenterSecondInterface) {this.presenterSecondInterface = presenterSecondInterface; this.secondModel = new SecondModel(); }public void getData(){secondModel.getDataModel(new SecondViewListener.ModelSecondInterface() {@Override public void success(SecondBean bean) {presenterSecondInterface.success(bean); }@Override public void failed(Exception e) {presenterSecondInterface.failed(e); }}); }//防止内存泄露 public void detach(){presenterSecondInterface = null; }}
MainActivity
package com.example.moni3.View.activity; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import com.example.moni3.R; public class MainActivity extends AppCompatActivity {@Override protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
SecondActivity
package com.example.moni3.View.activity; import android.content.Intent; import android.graphics.Paint; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.example.moni3.Modlue.bean.SecondBean; import com.example.moni3.Presenter.SecondPresenter; import com.example.moni3.R; import com.example.moni3.View.view.SecondViewListener; import com.nostra13.universalimageloader.core.ImageLoader; import java.io.IOException; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; import okhttp3.Call; import okhttp3.Callback; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; /** * Created by 你家大林哥 on 2018/5/27. */ public class SecondActivity extends AppCompatActivity implements SecondViewListener.PresenterSecondInterface {@Bind(R.id.title)TextView title; @Bind(R.id.yuanJia)TextView yuanJia; @Bind(R.id.youHui)TextView youHui; @Bind(R.id.backImage)ImageView backImage; @Bind(R.id.ProductImage)ImageView ProductImage; private SecondPresenter presenter; @Override protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); ButterKnife.bind(this); //关联p层,获取数据 presenter = new SecondPresenter(this); presenter.getData(); }@OnClick({R.id.backImage, R.id.goToCart, R.id.addCart})public void onViewClicked(View view) {switch (view.getId()) {case R.id.backImage: //点击左上角返回按钮跳转至属性动画页面 Intent intent = new Intent(SecondActivity.this, SplashActivity.class); startActivity(intent); break; case R.id.addCart: //点击加入购物车的方法 //路径 String path = "https://www.zhaoapi.cn/product/addCart?uid=71&pid=1"; OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder().url(path).build(); Call call = client.newCall(request); call.enqueue(new Callback() {@Override public void onFailure(Call call, IOException e) {}@Override public void onResponse(Call call, Response response) throws IOException {final String body = response.body().string(); runOnUiThread(new Runnable() {@Override public void run() {//吐司加入购物车成功 Toast.makeText(SecondActivity.this, "购物车加入商品成功"+body, Toast.LENGTH_SHORT).show(); }}); }}); break; case R.id.goToCart: //点击 购物车 按钮跳转至购物车列表页面 Intent intent1 = new Intent(SecondActivity.this, ThirdActivity.class); startActivity(intent1); break; }}@Override public void success(SecondBean bean) {//设置图片 下标为0的图片数据 String images = bean.getData().getImages(); String[] split = images.split("\\|"); //ImageLoader加载图片数组中的图片 ImageLoader.getInstance().displayImage(split[0],ProductImage); //设置商品信息显示 title.setText(bean.getData().getTitle()); yuanJia.setText("原价:¥" + bean.getData().getPrice()); //设置原价中间横线(删除线) yuanJia.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG); youHui.setText("优惠价:" + bean.getData().getBargainPrice()); }@Override public void failed(Exception e) {Toast.makeText(SecondActivity.this,"数据出错",Toast.LENGTH_SHORT).show(); }//为防止内存泄漏,在view层销毁p层 @Override protected void onDestroy() {super.onDestroy(); presenter.detach(); }}
SplashActivity
package com.example.moni3.View.activity; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v7.app.AppCompatActivity; import android.widget.ImageView; import com.example.moni3.R; import com.example.moni3.View.view.ProgressBarView; /** * Created by 你家大林哥 on 2018/5/27. */ public class SplashActivity extends AppCompatActivity {private ProgressBarView pbv; private int progress = 120; private int time = 3; private Handler handler = new Handler() {@Override public void handleMessage(Message msg) {super.handleMessage(msg); //动画运行时间为3秒钟,动画结束后跳转到商品详情页面。 time--; if (time == 0) {startActivity(new Intent(SplashActivity.this, SecondActivity.class)); finish(); } else {//设置动画播放进程 progress += 120; pbv.setProgress(progress); handler.sendEmptyMessageDelayed(0, 1000); }}}; @Override protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); //查找控件 ImageView imageView = (ImageView) findViewById(R.id.logo_img); pbv = (ProgressBarView) findViewById(R.id.my_progess); setAnimation(imageView); handler.sendEmptyMessage(0); pbv.setProgress(progress); }//执行动画的方法 private void setAnimation(ImageView imageView) {//应用图标从屏幕最上方平移到屏幕中间 ObjectAnimator trans = ObjectAnimator.ofFloat(imageView, "translationY", 0f, 500f).setDuration(1000); //缩放由2倍到1倍 ObjectAnimator scalX = ObjectAnimator.ofFloat(imageView, "scaleX", 2f, 1f).setDuration(1000); ObjectAnimator scalY = ObjectAnimator.ofFloat(imageView, "scaleY", 2f, 1f).setDuration(1000); //渐变从完全透明到完全不透明 ObjectAnimator alpha = ObjectAnimator.ofFloat(imageView, "alpha", 0.0f, 1f).setDuration(1000); // 旋转为旋转一圈 ObjectAnimator rotate = ObjectAnimator.ofFloat(imageView, "rotation", 0f, 360f).setDuration(1000); //动画组合开始执行 AnimatorSet setAnimatior = new AnimatorSet(); setAnimatior.play(trans).before(scalX).before(scalY).before(alpha).before(rotate); setAnimatior.start(); }}
ThirdActivity
package com.example.moni3.View.activity; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.CheckBox; import android.widget.TextView; import android.widget.Toast; import com.example.moni3.Modlue.bean.ShopBean; import com.example.moni3.Presenter.MainPresenter; import com.example.moni3.R; import com.example.moni3.View.adapter.ShopAdapter; import com.example.moni3.View.view.MainViewListener; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; /** * Created by 你家大林哥 on 2018/5/27. */ public class ThirdActivity extends AppCompatActivity implements MainViewListener {@Bind(R.id.third_recyclerview)RecyclerView thirdRecyclerview; @Bind(R.id.third_allselect)CheckBox checkBoxAll; @Bind(R.id.third_totalprice)TextView thirdTotalprice; private MainPresenter presenter; private ShopAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState); setContentView(R.layout.activity_third); ButterKnife.bind(this); //关联p层 presenter = new MainPresenter(this); presenter.getData(); //设置布局管理器以及适配器 adapter = new ShopAdapter(this); LinearLayoutManager manager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false); thirdRecyclerview.setLayoutManager(manager); thirdRecyclerview.setAdapter(adapter); adapter.setListener(new ShopAdapter.UpdateUiListener() {@Override public void setTotal(String total, String num, boolean allCheck) {checkBoxAll.setChecked(allCheck); thirdTotalprice.setText("总价:¥" + total); }}); }@Override public void success(ShopBean bean) {adapter.add(bean); }@Override public void failure(Exception e) {Toast.makeText(this, "error", Toast.LENGTH_SHORT).show(); }//避免内存泄漏 @Override protected void onDestroy() {super.onDestroy(); presenter.detach(); }@OnClick({R.id.thirdBackImage, R.id.third_allselect})public void onViewClicked(View view) {switch (view.getId()) {case R.id.thirdBackImage: //点击左上角返回按钮跳转至购物车详情页面 Intent intent = new Intent(ThirdActivity.this, SecondActivity.class); startActivity(intent); break; case R.id.third_allselect: //全选/反选按钮 adapter.selectAll(checkBoxAll.isChecked()); break; }}}
ShopAdapter
package com.example.moni3.View.adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; import android.widget.ImageView; import android.widget.TextView; import com.example.moni3.Modlue.bean.ShopBean; import com.example.moni3.Modlue.imageLoader.ImageLoaderUtil; import com.example.moni3.R; import com.example.moni3.View.activity.ThirdActivity; import com.nostra13.universalimageloader.core.ImageLoader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import butterknife.Bind; import butterknife.ButterKnife; /** * Created by 你家大林哥 on 2018/5/27. */ public class ShopAdapter extends RecyclerView.Adapter<ShopAdapter.IViewHolder> {private Context context; private List<ShopBean.DataBean.ListBean> list; // 存放 商家的id 和 商家名称 private Map<String, String> map = new HashMap<>(); public ShopAdapter(ThirdActivity context) {this.context = context; }/** * 添加数据 并更新显示 * @param bean */ public void add(ShopBean bean) {if (this.list == null) {this.list = new ArrayList<>(); }// 遍历商家 for (ShopBean.DataBean shop : bean.getData()) {map.put(shop.getSellerid(), shop.getSellerName()); // 遍历商品 for (int i = 0; i < shop.getList().size(); i++) {this.list.add(shop.getList().get(i)); }}setFirst(this.list); notifyDataSetChanged(); }/** * 设置数据源, 控制显示商家 * @param list */ private void setFirst(List<ShopBean.DataBean.ListBean> list) {if (list.size() > 0) {list.get(0).setIsFirst(1); for (int i = 1; i < list.size(); i++) {if (list.get(i).getSellerid() == list.get(i - 1).getSellerid()) {list.get(i).setIsFirst(2); } else {list.get(i).setIsFirst(1); }}}}@Override public IViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {View view = View.inflate(context, R.layout.adapter_layout, null); return new IViewHolder(view); }@Override public void onBindViewHolder(final IViewHolder holder, final int position) {// 显示商品图片 if (list.get(position).getIsFirst() == 1) {//显示商家 holder.shop_checkbox.setVisibility(View.VISIBLE); holder.tvItemShopcartShopname.setVisibility(View.VISIBLE); holder.shop_checkbox.setChecked(list.get(position).isShopSelected()); //显示商家的名称 holder.tvItemShopcartShopname.setText("我是"+map.get(String.valueOf(list.get(position).getSellerid()))); } else {holder.shop_checkbox.setVisibility(View.GONE); holder.tvItemShopcartShopname.setVisibility(View.GONE); }//控制 商品的 checkbox holder.item_checkbox.setChecked(list.get(position).isItemSelected()); String[] url = list.get(position).getImages().split("\\|"); ImageLoader.getInstance().displayImage(url[0], holder.item_pic, ImageLoaderUtil.getDefaultOption()); holder.item_name.setText(list.get(position).getTitle()); holder.item_price.setText("优惠价:¥"+list.get(position).getPrice() + ""); // 商家的checkbox holder.shop_checkbox.setOnClickListener(new View.OnClickListener() {@Override public void onClick(View view) {list.get(position).setShopSelected(holder.shop_checkbox.isChecked()); for (int i = 0; i < list.size(); i++) {if (list.get(position).getSellerid() == list.get(i).getSellerid()) {list.get(i).setItemSelected(holder.shop_checkbox.isChecked()); }}notifyDataSetChanged(); sum(list); }}); // 商品的checkbox holder.item_checkbox.setOnClickListener(new View.OnClickListener() {@Override public void onClick(View view) {list.get(position).setItemSelected(holder.item_checkbox.isChecked()); for (int i = 0; i < list.size(); i++) {for (int j = 0; j < list.size(); j++) {if (list.get(i).getSellerid() == list.get(j).getSellerid() && !list.get(j).isItemSelected()) {list.get(i).setShopSelected(false); break; } else {list.get(i).setShopSelected(true); }}}notifyDataSetChanged(); sum(list); }}); }@Override public int getItemCount() {return list == null ? 0 : list.size(); }/** * 计算总价 * @param list */ private void sum(List<ShopBean.DataBean.ListBean> list) {int totalNum = 0; float totalMoney = 0.0f; boolean allCheck = true; for (int i = 0; i < list.size(); i++) {if (list.get(i).isItemSelected()) {totalNum += list.get(i).getNum(); totalMoney += list.get(i).getNum() * list.get(i).getPrice(); } else {allCheck = false; }}listener.setTotal(totalMoney + "", totalNum + "", allCheck); }public void selectAll(boolean check) {for (int i = 0; i < list.size(); i++) {list.get(i).setShopSelected(check); list.get(i).setItemSelected(check); }notifyDataSetChanged(); sum(list); }static class IViewHolder extends RecyclerView.ViewHolder {@Bind(R.id.shop_checkbox)CheckBox shop_checkbox; @Bind(R.id.tv_item_shopcart_shopname)TextView tvItemShopcartShopname; @Bind(R.id.item_checkbox)CheckBox item_checkbox; @Bind(R.id.item_pic)ImageView item_pic; @Bind(R.id.item_price)TextView item_price; @Bind(R.id.item_name)TextView item_name; IViewHolder(View view) {super(view); ButterKnife.bind(this, view); }}public UpdateUiListener listener; public void setListener(UpdateUiListener listener) {this.listener = listener; }public interface UpdateUiListener {public void setTotal(String total, String num, boolean allCheck); }}
MainViewListener
package com.example.moni3.View.view; import com.example.moni3.Modlue.bean.ShopBean; /** * Created by 你家大林哥 on 2018/5/27. */ public interface MainViewListener {void success(ShopBean bean); public void failure(Exception e); }
ProgressBarView
package com.example.moni3.View.view; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.PointF; import android.graphics.RectF; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.View; /** * Created by 你家大林哥 on 2018/5/27. */ public class ProgressBarView extends View {private Paint paint; private int currentX = 100; private int currentY = 100; private int count; private PointF pointF = new PointF(currentX,currentY); private int mProgress; public ProgressBarView(Context context) {super(context); initpaint(context); }private void initpaint(Context context) {paint = new Paint(); paint.setAntiAlias(true); paint.setStyle(Paint.Style.STROKE); }public ProgressBarView(Context context, @Nullable AttributeSet attrs) {super(context, attrs); initpaint(context); }public ProgressBarView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr); initpaint(context); }@Override protected void onDraw(Canvas canvas) {super.onDraw(canvas); paint.setStrokeWidth(0); paint.setColor(Color.BLACK); canvas.drawCircle(pointF.x,pointF.y,20,paint); canvas.drawCircle(pointF.x,pointF.y,30,paint); paint.setStrokeWidth(10); paint.setColor(Color.RED); RectF recyF = new RectF(75,75,125,125); canvas.drawArc(recyF,-90,mProgress,false,paint); paint.setStrokeWidth(1); paint.setColor(Color.BLUE); canvas.drawText(count+"",98,102,paint); }public void setProgress(int progress){this.mProgress = progress; if (mProgress == 120){count = 2; }if (mProgress == 240){count = 1; }if (mProgress == 360){count = 0; }invalidate(); }}
SecondViewListener
package com.example.moni3.View.view; import com.example.moni3.Modlue.bean.SecondBean; /** * Created by 你家大林哥 on 2018/5/27. */ public interface SecondViewListener {public interface ModelSecondInterface{public void success(SecondBean bean); public void failed(Exception e); }public interface PresenterSecondInterface{public void success(SecondBean bean); public void failed(Exception e); }}
属性动画+购物详情+购物车相关推荐
- 属性动画+购物车+结算
效果图 添加依赖 apply plugin: 'com.android.application' android {compileSdkVersion 26 buildToolsVersion &qu ...
- 动画动画商品详情加购物车
动画的布局 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:andr ...
- 属性动画+购物车+全选反选+选中计算价格+单个删除
效果图 导入依赖 apply plugin: 'com.android.application' android {compileSdkVersion 26 buildToolsVersion &qu ...
- Android 属性动画(Property Animation) ObjectAnimator的介绍
先说下属性动画与视图动画的区别: 视图动画系统仅提供为 View 对象添加动画效果的功能,因此,如果您想为非 对象添加动画效果,则必须实现自己的代码才能做到.视图动画系统也存在一些限制,因为它仅公开 ...
- Android 属性动画(Property Animation) ValueAnimator 的介绍
先说下属性动画与视图动画的区别: 视图动画系统仅提供为 View 对象添加动画效果的功能,因此,如果您想为非 对象添加动画效果,则必须实现自己的代码才能做到.视图动画系统也存在一些限制,因为它仅公开 ...
- android 属性动画失败,AndroidAnimationExercise
AndroidAnimationExercise 这是一个关于Android中各种View的集合,里面包含自己日常开发和博客总结中的代码. 主要内容是Android动画.Android自定义View ...
- 友盟登陆传值+OkHttp+recyclerview展示瀑布流+跳转Intent传值+属性动画
友盟详情见 https://blog.csdn.net/aijaijgnaw/article/details/84203936 分包 友盟第三方登录 MyApp(Application) packag ...
- Android 属性动画(一)新手入门
一.属性动画简介 Android 中动画有很多种,属性动画就是其中的一种.所谓的属性动画,就是在指定的时间内,通过改变对象的属性达到变化效果的动画.在 Android 中,属性动画系统是一个强健的框架 ...
- Android动画案例(三)属性动画
前方高能!!!有大量理论性的知识 Android系统在一开始的时候就提供了两种实现动画的方式,逐帧动画和补间动画 逐帧动画效果非常简单,就是让一张张单独的图片连续起来播放,类似于动画片的工作原理 补间 ...
最新文章
- Sql Server系列:Transact-SQL概述
- linux shell命令分布执行,Linux学习笔记:bash特性之多命令执行,shell脚本
- file.php https,使用HTTPS链接和php方法(file_get_contents,getimagesize)
- uniapp h5 页面 解决 ios 长按无法保存图片问题(安卓支持此功能)--实现移动端长按保存图片
- C++文本操作.Vs.Python
- 高精地图技术专栏 | 基于空间连续性的异常3D点云修复技术
- 电力与计算机科学技术,上海电力大学计算机科学与技术专业
- vscode中vue-cli项目es-lint的配置
- 记一次服务器故障及解决办法
- Android 开发小TIPS
- 品读《你不努力,谁也给不了你想要的生活》
- 笔记三、最大数字(C++)
- dockerMySQL数据库主从一主一从
- cx_Oracle.DatabaseError: ORA-01036: 非法的变量名/编号
- 8B/10B编码原理详解、Verilog实现及在JESD204B中的应用
- Linux,shell与alias
- 阿里研究院启动2017年度淘宝村辅助认证活动(附表格下载)
- 03基础自绘-14滑动日期-tumblerdatetime
- android apk包大小优化详解
- Deeplink跳转提示应用下架