Android QQ message left swipe Delete instance (optimized version Swipelistviewex)

Source: Internet
Author: User

Copy QQ message left swipe delete Item message instance

Source Code Reference: http://blog.csdn.net/gaolei1201/article/details/42677951

I made some adjustments, all the code:

http://download.csdn.net/detail/jenson138/8490067

:

The following are only the adapter classes:

1  PackageCom.ryg.slideview;2 3 Importjava.util.List;4 5 ImportCom.ryg.slideview.SwipeItemView.OnSlideListener;6 7 ImportAndroid.content.Context;8 ImportAndroid.view.LayoutInflater;9 ImportAndroid.view.View;Ten ImportAndroid.view.View.OnClickListener; One ImportAndroid.view.ViewGroup; A ImportAndroid.widget.BaseAdapter; - ImportAndroid.widget.ImageView; - ImportAndroid.widget.TextView; the ImportAndroid.widget.Toast; -  -  -  Public classHistorylistviewadapterextendsBaseadapter { +  -     PrivateLayoutinflater Minflater; +     PrivateListMmessageitems; A     Privatecontext context; at     PrivateSwipeitemview Mlastslideviewwithstatuson; -      PublicHistorylistviewadapter (Context context,listMmessageitems) { -Minflater =Layoutinflater.from (context); -          This. mmessageitems=Mmessageitems; -          This. context=context; -     } in  - @Override to      Public intGetCount () { +         returnmmessageitems.size (); -     } the  * @Override $      PublicObject GetItem (intposition) {Panax Notoginseng         returnMmessageitems.get (position); -     } the  + @Override A      Public LongGetitemid (intposition) { the         returnposition; +     } -  $ @Override $      PublicView GetView (Final intposition, View Convertview, ViewGroup parent) { - Viewholder Holder; -Swipeitemview Slideview =(Swipeitemview) Convertview; the         if(Slideview = =NULL) { -View Itemview = minflater.inflate (R.layout.history_listview_items,NULL);Wuyi  theSlideview =NewSwipeitemview (context); - Slideview.setcontentview (itemview); Wu  -Holder =NewViewholder (slideview); AboutSlideview.setonslidelistener (NewOnslidelistener () { $                  - @Override -                  Public voidOnslide (View view,intstatus) { -                     //TODO auto-generated Method Stub A                      if(Mlastslideviewwithstatuson! =NULL&& Mlastslideviewwithstatuson! =view) { + Mlastslideviewwithstatuson.shrink (); the                         } -  $                         if(Status = =slide_status_on) { theMlastslideviewwithstatuson =(Swipeitemview) view; the                         } the                 } the             }); - Slideview.settag (holder); in}Else { theHolder =(Viewholder) Slideview.gettag (); the         } AboutHistorylistitemobject item =Mmessageitems.get (position); the //Item.slideview = Slideview; the         if(customswipelistview.mfocuseditemview!=NULL){ the CustomSwipeListView.mFocusedItemView.shrink (); +         } -  the Holder.icon.setImageResource (Item.geticonres ());Bayi Holder.title.setText (Item.gettitle ()); the Holder.msg.setText (Item.getmsg ()); the //Holder.time.setText (item.time); -Holder.deleteHolder.setOnClickListener (NewOnclicklistener () { -              the @Override the              Public voidOnClick (View arg0) { the                 //TODO auto-generated Method Stub the Mmessageitems.remove (position); - Toast.maketext (context, string.valueof (position), Toast.length_short). Show (); the notifydatasetchanged (); the             } the         });94  the         returnSlideview; the     } the     Private Static classViewholder {98          PublicImageView icon; About          PublicTextView title; -          PublicTextView msg;101 //Public TextView time;102          PublicViewGroup Deleteholder;103 104 Viewholder (view view) { theicon =(ImageView) View.findviewbyid (R.id.icon);106title =(TextView) View.findviewbyid (r.id.title);107msg =(TextView) View.findviewbyid (r.id.msg);108 //Time = (TextView) View.findviewbyid (r.id.time);109Deleteholder =(ViewGroup) View.findviewbyid (r.id.holder); the         }111     } the}

Android QQ message left swipe Delete instance (optimized version Swipelistviewex)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.