配置文件
<uses-permission android:name=\"android.permission.INTERNET\"/>
<activity android:name=\".view.NiuBi\"></activity>
二级列表的Adapter
public class ShopcartExpandableListViewAdapter extends ExpandableListAdapter
{
private List<GroupInfo> groups;
private Map<String, List<ProductInfo>> children;
private Context context;
//HashMap<Integer, View> groupMap = new HashMap<Integer, View>();
//HashMap<Integer, View> childrenMap = new HashMap<Integer, View>();
private CheckInterface checkInterface;
private ModifyCountInterface modifyCountInterface;
/**
* 构造函数
*
* @param groups
* 组元素列表
* @param children
* 子元素列表
* @param context
*/
public ShopcartExpandableListViewAdapter(List<GroupInfo> groups, Map<String, List<ProductInfo>> children, Context context)
{
super();
this.groups = groups;
this.children = children;
this.context = context;
}
public void setCheckInterface(CheckInterface checkInterface)
{
this.checkInterface = checkInterface;
}
public void setModifyCountInterface(ModifyCountInterface modifyCountInterface)
{
this.modifyCountInterface = modifyCountInterface;
}
@Override
public int getGroupCount()
{
return groups.size();
}
@Override
public int getChildrenCount(int groupPosition)
{
String groupId = groups.get(groupPosition).getId();
return children.get(groupId).size();
}
@Override
public getGroup(int groupPosition)
{
return groups.get(groupPosition);
}
@Override
public getChild(int groupPosition, int childPosition)
{
List<ProductInfo> childs = children.get(groups.get(groupPosition).getId());
return childs.get(childPosition);
}
@Override
public long getGroupId(int groupPosition)
{
return 0;
}
@Override
public long getChildId(int groupPosition, int childPosition)
{
return 0;
}
@Override
public boolean hasStableIds()
{
return false;
}
@Override
public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)
{
GroupHolder gholder;
if (convertView == null)
{
gholder = new GroupHolder();
convertView = View.inflate(context, R.layout.item_shopcart_group, null);
gholder.cb_check = (CheckBox) convertView.findViewById(R.id.determine_chekbox);
gholder.tv_group_name = (TextView) convertView.findViewById(R.id.tv_source_name);
//groupMap.put(groupPosition, convertView);
convertView.setTag(gholder);
} else
{
// convertView = groupMap.get(groupPosition);
gholder = (GroupHolder) convertView.getTag();
}
final GroupInfo group = (GroupInfo) getGroup(groupPosition);
if (group != null)
{
gholder.tv_group_name.setText(group.getName());
gholder.cb_check.set Listener(new View. Listener()
{
@Override
public void (View v)
{
group.setChoosed(((CheckBox) v).isChecked());
checkInterface.checkGroup(groupPosition, ((CheckBox) v).isChecked());// 暴露组选接口
}
});
gholder.cb_check.setChecked(group.isChoosed());
}
return convertView;
}
@Override
public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
{
final ChildHolder cholder;
if (convertView == null)
{
cholder = new ChildHolder();
convertView = View.inflate(context, R.layout.item_shopcart_product, null);
cholder.cb_check = (CheckBox) convertView.findViewById(R.id.check_box);
cholder.tv_product_desc = (TextView) convertView.findViewById(R.id.tv_intro);
cholder.tv_price = (TextView) convertView.findViewById(R.id.tv_price);
cholder.iv_increase = (TextView) convertView.findViewById(R.id.tv_add);
cholder.iv_decrease = (TextView) convertView.findViewById(R.id.tv_reduce);
cholder.tv_count = (TextView) convertView.findViewById(R.id.tv_num);
// childrenMap.put(groupPosition, convertView);
convertView.setTag(cholder);
} else
{
// convertView = childrenMap.get(groupPosition);
cholder = (ChildHolder) convertView.getTag();
}
final ProductInfo product = (ProductInfo) getChild(groupPosition, childPosition);
if (product != null)
{
cholder.tv_product_desc.setText(product.getDesc());
cholder.tv_price.setText(\"¥\" + product.getPrice() + \"\");
cholder.tv_count.setText(product.getCount() + \"\");
cholder.cb_check.setChecked(product.isChoosed());
cholder.cb_check.set Listener(new View. Listener()
{
@Override
public void (View v)
{
product.setChoosed(((CheckBox) v).isChecked());
cholder.cb_check.setChecked(((CheckBox) v).isChecked());
checkInterface.checkChild(groupPosition, childPosition, ((CheckBox) v).isChecked());// 暴露子选接口
}
});
cholder.iv_increase.set Listener(new View. Listener()
{
@Override
public void (View v)
{
modifyCountInterface.doIncrease(groupPosition, childPosition, cholder.tv_count, cholder.cb_check.isChecked());// 暴露增加接口
}
});
cholder.iv_decrease.set Listener(new View. Listener()
{
@Override
public void (View v)
{
modifyCountInterface.doDecrease(groupPosition, childPosition, cholder.tv_count, cholder.cb_check.isChecked());// 暴露删减接口
}
});
}
return convertView;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition)
{
return false;
}
/**
* 组元素绑定器
*
*
*/
private class GroupHolder
{
CheckBox cb_check;
TextView tv_group_name;
}
/**
* 子元素绑定器
*
*
*/
private class ChildHolder
{
CheckBox cb_check;
TextView tv_product_name;
TextView tv_product_desc;
TextView tv_price;
TextView iv_increase;
TextView tv_count;
TextView iv_decrease;
}
/**
* 复选框接口
*
*
*/
public interface CheckInterface
{
/**
* 组选框状态改变触发的事件
*
* @param groupPosition
* 组元素位置
* @param isChecked
* 组元素选中与否
*/
public void checkGroup(int groupPosition, boolean isChecked);
/**
* 子选框状态改变时触发的事件
*
* @param groupPosition
* 组元素位置
* @param childPosition
* 子元素位置
* @param isChecked
* 子元素选中与否
*/
public void checkChild(int groupPosition, int childPosition, boolean isChecked);
}
/**
* 改变数量的接口
*
*
*/
public interface ModifyCountInterface
{
/**
* 增加操作
*
* @param groupPosition
* 组元素位置
* @param childPosition
* 子元素位置
* @param showCountView
* 用于展示变化后数量的View
* @param isChecked
* 子元素选中与否
*/
public void doIncrease(int groupPosition, int childPosition, View showCountView, boolean isChecked);
/**
* 删减操作
*
* @param groupPosition
* 组元素位置
* @param childPosition
* 子元素位置
* @param showCountView
* 用于展示变化后数量的View
* @param isChecked
* 子元素选中与否
*/
public void doDecrease(int groupPosition, int childPosition, View showCountView, boolean isChecked);
}
}
接口
public interface CallBacka<T> {
void onSuccess(Result<T> result);
void onFail(Result<T> result);
}
Presenter
public abstract class Presenter<T> {
private CallBacka callBacka;
public Presenter(CallBacka callBacka){
this.callBacka = callBacka;
}
Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == 1){
Result<T> result = (Result<T>) msg.obj;
if (result.getCode().equals(\"0\")){
callBacka.onSuccess(result);
}else {
callBacka.onFail(result);
}
}
}
};
public void get(final ... ){
new Thread(new Runnable() {
@Override
public void run() {
Result<T> json = getJson( );
Message message = handler.obtainMessage();
message.what = 1;
message.obj = json;
handler.sendMessage(message);
}
}).start();
}
public abstract Result<T> getJson( ... );
}
Model
public class BannerModel {
public Result<List<BannerData>> getJson(String string){
String json = NetUtils.get(string);
Gson gson = new Gson();
Type type = new TypeToken<Result<List<BannerData>>>(){}.getType();
Result result = gson.fromJson(json,type);
return result;
}
}
Presenter
public class BannerPresenter extends Presenter<List<BannerData>> {
public BannerPresenter(CallBacka<List<BannerData>> callBacka) {
super(callBacka);
}
@Override
public Result<List<BannerData>> getJson( ... ) {
BannerModel bannerModel = new BannerModel();
Result<List<BannerData>> json = bannerModel.getJson(\"http://www.zhaoapi.cn/ad/getAd\");
return json;
}
}
MainActivity
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final ImageView qq = findViewById(R.id.qq);
findViewById(R.id.kaiqi).set Listener(new View. Listener() {
@Override
public void (View v) {
Animator rotation = Animator.ofFloat(qq,\"rotation\",0f,180f);
Animator fade = Animator.ofFloat(qq, \"alpha\", 0f,0.8f);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(fade).with(rotation);
animatorSet.setDuration(2000);
animatorSet.start();
animatorSet.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimati (Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
Intent intent = new Intent(MainActivity.this,NiuBi.class);
startActivity(intent);
finish();
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
}
});
}
}
Banner逻辑类
public class Frag_01 extends Fragment implements CallBacka<List<BannerData>> {
private EditText et1;
List<String> bannerList = new ArrayList<String>();
private Banner banner;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.frag_01, container, false);
BannerPresenter bannerPresenter = new BannerPresenter(this);
bannerList.clear();
bannerPresenter.get();
et1 = view.findViewById(R.id.et1);
ImageView sousuo = view.findViewById(R.id.sousuo);
sousuo.set Listener(new View. Listener() {
@Override
public void (View v) {
String trim = et1.getText().toString().trim();
}
});
banner = view.findViewById(R.id.banner);
return view;
}
private void intitBanner() {
banner.setImageLoader(new ImageLoader() {
@Override
public void displayImage(Context context, path, ImageView imageView) {
Glide.with(context).load(path).into(imageView);
}
});
banner.setImages(bannerList);
banner.start();
}
@Override
public void onSuccess(Result<List<BannerData>> result) {
List<BannerData> data = result.getData();
for (int i = 0; i < data.size(); i++) {
bannerList.add(data.get(i).getIcon());
}
intitBanner();
}
@Override
public void onFail(Result<List<BannerData>> result) {
}
}
购买商品的购物车类
public class Frag_02 extends Fragment implements ShopcartExpandableListViewAdapter.CheckInterface, ShopcartExpandableListViewAdapter.ModifyCountInterface, View. Listener {
private ExpandableListView exListView;
private CheckBox cb_check_all;
private TextView tv_total_price;
private TextView tv_delete;
private TextView tv_go_to_pay;
private Context context;
private double totalPrice = 0.00;// 购买的商品总价
private int totalCount = 0;// 购买的商品总数量
private ShopcartExpandableListViewAdapter selva;
private List<GroupInfo> groups = new ArrayList<GroupInfo>();// 组元素数据列表
private Map<String, List<ProductInfo>> children = new HashMap<String, List<ProductInfo>>();// 子元素数据列表
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.frag_02,container,false);
initView(view);
initEvents();
return view;
}
private void initView(View view)
{
context = getContext();
virtualData();
exListView = (ExpandableListView) view.findViewById(R.id.exListView);
cb_check_all = (CheckBox) view.findViewById(R.id.all_chekbox);
tv_total_price = (TextView) view.findViewById(R.id.tv_total_price);
tv_delete = (TextView) view.findViewById(R.id.tv_delete);
tv_go_to_pay = (TextView) view.findViewById(R.id.tv_go_to_pay);
}
private void initEvents()
{
selva = new ShopcartExpandableListViewAdapter(groups, children, getContext());
selva.setCheckInterface(this);// 关键步骤1,设置复选框接口
selva.setModifyCountInterface(this);// 关键步骤2,设置数量增减接口
exListView.setAdapter(selva);
for (int i = 0; i < selva.getGroupCount(); i++)
{
exListView.expandGroup(i);// 关键步骤3,初始化时,将ExpandableListView以展开的方式呈现
}
cb_check_all.set Listener(this);
tv_delete.set Listener(this);
tv_go_to_pay.set Listener(this);
}
/**
* 模拟数据<br>
* 遵循适配器的数据列表填充原则,组元素被放在一个List中,对应的组元素下辖的子元素被放在Map中,<br>
* 其键是组元素的Id(通常是一个唯一指定组元素身份的值)
*/
private void virtualData()
{
for (int i = 0; i < 6; i++)
{
groups.add(new GroupInfo(i + \"\", \"第八号当铺\" + (i + 1) + \"号店\"));
List<ProductInfo> products = new ArrayList<ProductInfo>();
for (int j = 0; j <= i; j++)
{
products.add(new ProductInfo(j + \"\", \"商品\", \"\", groups.get(i).getName() + \"的第\" + (j + 1) + \"个商品\", 120.00 + i * j, 1));
}
children.put(groups.get(i).getId(), products);// 将组元素的一个唯一值,这里取Id,作为子元素List的Key
}
}
@Override
public void (View v)
{
AlertDialog alert;
switch (v.getId())
{
case R.id.all_chekbox:
doCheckAll();
break;
case R.id.tv_go_to_pay:
if (totalCount == 0)
{
Toast.makeText(context, \"请选择要支付的商品\", Toast.LENGTH_LONG).show();
return;
}
alert = new AlertDialog.Builder(context).create();
alert.set (\"操作提示\");
alert.setMessage(\"总计:\\n\" + totalCount + \"种商品\\n\" + totalPrice + \"元\");
alert.setButton(DialogInterface.BUTTON_NEGATIVE, \"取消\", new DialogInterface. Listener()
{
@Override
public void (DialogInterface dialog, int which)
{
return;
}
});
alert.setButton(DialogInterface.BUTTON_POSITIVE, \"确定\", new DialogInterface. Listener()
{
@Override
public void (DialogInterface dialog, int which)
{
return;
}
});
alert.show();
break;
case R.id.tv_delete:
if (totalCount == 0)
{
Toast.makeText(context, \"请选择要移除的商品\", Toast.LENGTH_LONG).show();
return;
}
alert = new AlertDialog.Builder(context).create();
alert.set (\"操作提示\");
alert.setMessage(\"您确定要将这些商品从购物车中移除吗?\");
alert.setButton(DialogInterface.BUTTON_NEGATIVE, \"取消\", new DialogInterface. Listener()
{
@Override
public void (DialogInterface dialog, int which)
{
return;
}
});
alert.setButton(DialogInterface.BUTTON_POSITIVE, \"确定\", new DialogInterface. Listener()
{
@Override
public void (DialogInterface dialog, int which)
{
doDelete();
}
});
alert.show();
break;
}
}
/**
* 删除操作<br>
* 1.不要边遍历边删除,容易出现数组越界的情况<br>
* 2.现将要删除的对象放进相应的列表容器中,待遍历完后,以removeAll的方式进行删除
*/
protected void doDelete()
{
List<GroupInfo> toBeDeleteGroups = new ArrayList<GroupInfo>();// 待删除的组元素列表
for (int i = 0; i < groups.size(); i++)
{
GroupInfo group = groups.get(i);
if (group.isChoosed())
{
toBeDeleteGroups.add(group);
}
List<ProductInfo> toBeDeleteProducts = new ArrayList<ProductInfo>();// 待删除的子元素列表
List<ProductInfo> childs = children.get(group.getId());
for (int j = 0; j < childs.size(); j++)
{
if (childs.get(j).isChoosed())
{
toBeDeleteProducts.add(childs.get(j));
}
}
childs.removeAll(toBeDeleteProducts);
}
groups.removeAll(toBeDeleteGroups);
selva.notifyDataSetChanged();
calculate();
}
@Override
public void doIncrease(int groupPosition, int childPosition, View showCountView, boolean isChecked)
{
ProductInfo product = (ProductInfo) selva.getChild(groupPosition, childPosition);
int currentCount = product.getCount();
currentCount++;
product.setCount(currentCount);
((TextView) showCountView).setText(currentCount + \"\");
selva.notifyDataSetChanged();
calculate();
}
@Override
public void doDecrease(int groupPosition, int childPosition, View showCountView, boolean isChecked)
{
ProductInfo product = (ProductInfo) selva.getChild(groupPosition, childPosition);
int currentCount = product.getCount();
if (currentCount == 1)
return;
currentCount--;
product.setCount(currentCount);
((TextView) showCountView).setText(currentCount + \"\");
selva.notifyDataSetChanged();
calculate();
}
@Override
public void checkGroup(int groupPosition, boolean isChecked)
{
GroupInfo group = groups.get(groupPosition);
List<ProductInfo> childs = children.get(group.getId());
for (int i = 0; i < childs.size(); i++)
{
childs.get(i).setChoosed(isChecked);
}
if (isAllCheck())
cb_check_all.setChecked(true);
else
cb_check_all.setChecked(false);
selva.notifyDataSetChanged();
calculate();
}
@Override
public void checkChild(int groupPosition, int childPosiTion, boolean isChecked)
{
boolean allChildSameState = true;// 判断改组下面的所有子元素是否是同一种状态
GroupInfo group = groups.get(groupPosition);
List<ProductInfo> childs = children.get(group.getId());
for (int i = 0; i < childs.size(); i++)
{
if (childs.get(i).isChoosed() != isChecked)
{
allChildSameState = false;
break;
}
}
if (allChildSameState)
{
group.setChoosed(isChecked);// 如果所有子元素状态相同,那么对应的组元素被设为这种统一状态
} else
{
group.setChoosed(false);// 否则,组元素一律设置为未选中状态
}
if (isAllCheck())
cb_check_all.setChecked(true);
else
cb_check_all.setChecked(false);
selva.notifyDataSetChanged();
calculate();
}
private boolean isAllCheck()
{
for (GroupInfo group : groups)
{
if (!group.isChoosed())
return false;
}
return true;
}
/** 全选与反选 */
private void doCheckAll()
{
for (int i = 0; i < groups.size(); i++)
{
groups.get(i).setChoosed(cb_check_all.isChecked());
GroupInfo group = groups.get(i);
List<ProductInfo> childs = children.get(group.getId());
for (int j = 0; j < childs.size(); j++)
{
childs.get(j).setChoosed(cb_check_all.isChecked());
}
}
selva.notifyDataSetChanged();
}
/**
* 统计操作<br>
* 1.先清空全局计数器<br>
* 2.遍历所有子元素,只要是被选中状态的,就进行相关的计算操作<br>
* 3.给底部的textView进行数据填充
*/
private void calculate()
{
totalCount = 0;
totalPrice = 0.00;
for (int i = 0; i < groups.size(); i++)
{
GroupInfo group = groups.get(i);
List<ProductInfo> childs = children.get(group.getId());
for (int j = 0; j < childs.size(); j++)
{
ProductInfo product = childs.get(j);
if (product.isChoosed())
{
totalCount++;
totalPrice += product.getPrice() * product.getCount();
}
}
}
tv_total_price.setText(\"¥\" + totalPrice);
tv_go_to_pay.setText(\"去支付(\" + totalCount + \")\");
}
}
Bean
public class Info
{
protected String Id;
protected String name;
protected boolean isChoosed;
public Info()
{
super();
}
public Info(String id, String name)
{
super();
Id = id;
this.name = name;
}
public String getId()
{
return Id;
}
public void setId(String id)
{
Id = id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public boolean isChoosed()
{
return isChoosed;
}
public void setChoosed(boolean isChoosed)
{
this.isChoosed = isChoosed;
}
}
GroupInfo
public class GroupInfo extends Info
{
public GroupInfo()
{
super();
}
public GroupInfo(String id, String name)
{
super(id, name);
// TODO Auto-generated constructor stub
}
}
GouwuBean
public class GouWuBean {
/**
* list : [{\"bargainPrice\":111.99,\"createtime\":\"2017-10-03T23:43:53\",\"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\":1,\"pid\":13,\"price\":465,\"pscid\":1,\"selected\":0,\"sellerid\":6,\"subhead\":\"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下\",\" \":\"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g\"}]
* sellerName : 商家6
* sellerid : 6
*/
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 : 111.99
* createtime : 2017-10-03T23:43:53
* 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 : 1
* pid : 13
* price : 465
* pscid : 1
* selected : 0
* sellerid : 6
* subhead : 每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下
* : 北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g
*/
private double bargainPrice;
private String createtime;
private String detailUrl;
private String images;
private int num;
private int pid;
private int price;
private int pscid;
private int selected;
private int sellerid;
private String subhead;
private String ;
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 int getPrice() {
return price;
}
public void setPrice(int 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 get () {
return ;
}
public void set (String ) {
this. = ;
}
}
}
ProductInfo
public class ProductInfo extends Info
{
private String imageUrl;
private String desc;
private double price;
private int count;
private int position;// 绝对位置,只在ListView构造的购物车中,在删除时有效
public ProductInfo()
{
super();
}
public ProductInfo(String id, String name, String imageUrl, String desc, double price, int count)
{
super.Id = id;
super.name = name;
this.imageUrl = imageUrl;
this.desc = desc;
this.price = price;
this.count = count;
}
public String getImageUrl()
{
return imageUrl;
}
public void setImageUrl(String imageUrl)
{
this.imageUrl = imageUrl;
}
public String getDesc()
{
return desc;
}
public void setDesc(String desc)
{
this.desc = desc;
}
public int getCount()
{
return count;
}
public void setCount(int count)
{
this.count = count;
}
public double getPrice()
{
return price;
}
public void setPrice(double price)
{
this.price = price;
}
public int getPosition()
{
return position;
}
public void setPosition(int position)
{
this.position = position;
}
}
继续阅读与本文标签相同的文章
上一篇 :
荣耀猎人游戏路由曝光:低时延手游利器
-
学宏程序编程,这些知识必不可少!
2026-05-14栏目: 教程
-
华为准备卖出“落后”的5G,多家美企极力竞争!任正非格局太大!
2026-05-14栏目: 教程
-
百度:飞桨深度学习平台已累计服务150多万开发者
2026-05-14栏目: 教程
-
滴滴公布安全功能数据:近2亿用户添加紧急联系人
2026-05-14栏目: 教程
-
滴滴自动驾驶或将于年底落地上海
2026-05-14栏目: 教程
