Android个⼈中⼼界⾯
个⼈中⼼主要代码:
r
2@NonNull
3@Override
lderonCreateViewHolder(@NonNullViewGroupparent,intviewType){
5//Viewview=e(text(),r_recycler_home,null);
6Viewview=e(text(),_favour,null);
7MyViewHoldermyViewHolder=newMyViewHolder(view);
8returnmyViewHolder;
9}
10
11@Override
12publicvoidonBindViewHolder(@lderholder2,intposition){
13GoodsBeangoodsBean=(position);
14MyViewHolderholder=(MyViewHolder)holder2;
15StringgoodsPath=dsPath();
n("goodsPath:"+goodsPath);
17Bitmapbitmap=File(goodsPath);
kground(newBitmapDrawable(bitmap));
t("商品名称:"+dsName());
t("商品价格:"+"¥"+dsPrice());
t("商品分类:"+dsCategory());
t("联系电话:"+dsPhone());
t("发布时间:"+dsTime()+"");
(position);
(position);
26if(flag==1||flag==2){
27if(flag==1){
ibility();
ibility();
30}
31if(flag==2){
32Stringid=_id();
(id);
ibility();
lickListener(listener1);
36}
37}el{
38Stringid=_id();
(id);
ibility();
lickListener(listener);
42}
43}
44
45@Override
46publicintgetItemCount(){
47returnallByUrname==null?0:();
48}
49}
50
kListenerlistener1=kListener(){
52@Override
53publicvoidonClick(Viewv){
54StringgoodsId=(String)();
n("goodsId:"+goodsId);
56intraw=tance().updateGoodsBuyed(goodsId);
57if(raw>0){
("购买成功");
59}el{
("购买失败");
61}
62}
63};
64
kListenerlistener=kListener(){
66@Override
67publicvoidonClick(Viewv){
68StringgoodsId=(String)();
n("goodsId:"+goodsId);
70intraw=tance().updateGoodsBuyedDelete(goodsId);
71if(raw==0){
("删除成功");
73allByUrname=tance().findAllGoodsBeanByUrname();
pter(newMyAdapter());
75}el{
("删除失败");
77}
78}
79};
80
81
lder{
83privateImageViewivGoodsPic;
84privateTextViewtvGoodsName;
85privateTextViewtvGoodsPrice;
86privateTextViewtvGoodsCategory;
87privateTextViewtvGoodsPhone;
88privateTextViewtvGoodsTime;
89privateButtonbtnAddPurcha;
90privateButtonbtnFavourCancel;
91
92
93publicMyViewHolder(@NonNullViewitemView){
94super(itemView);
95ivGoodsPic=ewById(sPic);
96tvGoodsName=ewById(sName);
97tvGoodsPrice=ewById(sPrice);
98tvGoodsCategory=ewById(sCategory);
99tvGoodsPhone=ewById(sPhone);
100tvGoodsTime=ewById(sTime);
101btnFavourCancel=ewById(_favour_cancel);
102btnAddPurcha=ewById(Purcha);
103}
104}
105
106}
本文发布于:2022-12-08 09:13:10,感谢您对本站的认可!
本文链接:http://www.wtabcd.cn/fanwen/fan/88/65120.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |