Open Source Library Undobar Simple usage parsing

Source: Internet
Author: User

Reprint please indicate the source: Wang 亟亟 's way of Daniel
Recently not busy in git to find this custom toast (toast) Open Source Library, write this blog post I share to everyone, say not much on the line (seemingly a lot of screenshots of the app is root, testing machine lazy to get, have to know other methods of small partners to help recommend ha)



Some custom toast and animation, when not applicable dialog want to use toast the provincial time is a good choice Oh!

Package Directory

A demo package, a Lib package, the Lib package is actually not many things, you can put it out in their own project directory, the readability is slightly higher.

Example Analysis:
This is one of the effects of the activity is, let's analyze what to do when we do what to do?

//must implement Undobarcontroller.advancedundolistener to handle the click events within the Toast Public  class undostyle extends appcompatactivity  implements  Undobarcontroller. Advancedundolistener, adapterview. Onitemclicklistener {    PrivateArrayadapter<string> Madapter;@Override    protected void onCreate(FinalBundle savedinstancestate) {Super. OnCreate (Savedinstancestate);        Setcontentview (R.layout.ui_main); Getsupportactionbar (). sethomebuttonenabled (true); Getsupportactionbar (). setdisplayhomeasupenabled (true);        ListView ListView = (ListView) Findviewbyid (R.id.listview); Listview.setadapter (Madapter =NewArrayadapter<> ( ThisAndroid. R.layout.simple_list_item_1, Android. R.id.text1, Arrays.aslist (Newstring[]{"Item 1","Item 2","Item 3","Item 4","Item 5","Item 6","Item 7","Item 8","Item 9","Item Ten","Item One","Item","Item","Item","Item",})        )); Listview.setonitemclicklistener ( This); }@Override     Public Boolean Oncreateoptionsmenu(Menu menu) {MenuItem item = menu.add (0,0,0,"Clear"); Menuitemcompat.setshowasaction (item, menuitemcompat.show_as_action_always);return Super. Oncreateoptionsmenu (menu); }@Override     Public Boolean onoptionsitemselected(MenuItem Item) {if(Item.getitemid () = = Android. R.id.home) finish ();Else            NewUndobarcontroller.undobar ( This). Clear ();return true; }@Override    protected void OnPause() {Super. OnPause (); }////The methods implemented by the listener events mentioned above are the specific logic in the process of onundo,onhide,onclear processing, respectively .    @Override     Public void OnUndo(FinalParcelable token) {if(Token! =NULL) {Final intPosition = (Bundle) token. GETINT ("Index"); Toast.maketext ( This,"Undo clicked, Index"+ position, Toast.length_short). Show (); }    }@Override     Public void Onhide(Parcelable token) {if(Token! =NULL) {Final intPosition = (Bundle) token. GETINT ("Index"); Toast.maketext ( This,"Undobar hided! Index "+ position, Toast.length_short). Show (); }    }@Override     Public void OnClear(@Nullable parcelable[] tokens) { for(Parcelable Token:tokens) {Final intPosition = (Bundle) token. GETINT ("Index"); Toast.maketext ( This. Getapplicationcontext (),"Undobar cleared! Index "+ position, Toast.length_short). Show (); }    }//Distribute bundle objects in the monitor event of the ListView to give the above 3 methods for business processing    @Override     Public void Onitemclick(adapterview<?> parent, view view,intPositionLongID) {FinalBundle B =NewBundle (); B.putint ("Index", position);NewUndobarcontroller.undobar ( This). Message (Madapter.getitem (position) +"was selected"). Listener ( This). Token (b). Show (); }}

: Http://yunpan.cn/ccyQUMpwUqUvL access Password FADC
Because in the build process may have gradle build's egg ache situation, if encountered the related question, can click Gradle build those things, hoped can help you.

Thank you, sir. Welcome +q 452270579 Please indicate the origin and source

Open Source Library Undobar Simple usage parsing

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.