Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Overview of libraries and tools that make your ...

Overview of libraries and tools that make your Android development easier and faster

Radek Piekarz

June 28, 2013
Tweet

More Decks by Radek Piekarz

Other Decks in Programming

Transcript

  1. • Radek Piekarz • .NET Developer at Making Waves •

    Android fan and developer (Scrobble FM) • Contact: [email protected] 28.06.2013 © MAKING WAVES 2 Few words about me
  2. Maven • Useful for continuous integration • Easy access for

    thousands of Java and Android libraries • Can be used with Eclipse / IntelliJ Idea / Android Studio / Notepad++ etc. 28.06.2013 © MAKING WAVES 6
  3. • Out-of-the-box Feature Set • IntelliJ IDEA includes comprehensive set

    of tools which work out-of-the-box and make your development more productive. • Support for Maven and Gradle • Built-in tools for unit testing and coverage • VCS tools with Git, GitHub, SVN and others • Tasks and context management 28.06.2013 © MAKING WAVES 7
  4. • SDK, Resources, & Native Method Emulation • Run Tests

    Outside of the Emulator • No Mocking Frameworks Required 28.06.2013 © MAKING WAVES 15 Robolectric
  5. • https://github.com/square/retrofit public interface GitHubService { @GET("/users/{user}/repos") List<Repo> listRepos(@Path("user") String

    user); } GitHubService service = restAdapter.create(GitHubService.class); List<Repo> repos = service.listRepos("octocat"); 28.06.2013 © MAKING WAVES 17 retrofit
  6. • https://github.com/square/picasso • Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(i mageView); • Many common pitfalls of

    image loading on Android are handled automatically by Picasso: – Handling ImageView recycling and download cancelation in an adapter. – Complex image transformations with minimal memory use. – Automatic memory and disk caching. 28.06.2013 © MAKING WAVES 18 Picasso
  7. • Android Universal Image Loader by nostra13 – Multithread image

    loading – Possibility of wide tuning ImageLoader's configuration (thread executors, downlaoder, decoder, memory and disc cache, display image options, and others) – Possibility of image caching in memory and/or on device's file sysytem (or SD card) – Possibility to "listen" loading process – Possibility to customize every display image call with separated options – Widget support – Android 2.0+ support 28.06.2013 © MAKING WAVES 19 Other similar libs
  8. • Volley (https://developers.google.com/events/io/sessions/325304728) – Nice and easy API for executing

    REST requests; – unifies the mechanism for REST requests by abstracting the "bottom" layer, i.e. you don't care any more about HttpClient or HttpUrlConnection. On lower versions (<= GINGERBREAD) Volley uses AndroidHttpClient and no higher it uses HttpUrlConnection; – it is very fast. In the I/O presentation the guy states that they tested it at Google with several different apps and Volley was clear winner in all categories; – it is extensible -- you can use it as a basis to create your own custom type of requests (and response handling/parsing) 28.06.2013 © MAKING WAVES 20
  9. //create a stack CardStack stack = new CardStack(); stack.setTitle("title test");

    // add 3 cards to stack stack.add(new MyCard("3 cards")); stack.add(new MyCard("3 cards")); stack.add(new MyCard("3 cards")); // add stack to cardView mCardView.addStack(stack); // draw cards mCardView.refresh(); 28.06.2013 © MAKING WAVES 21 Cards UI https://github.com/nadavfima/cardsui-for-android
  10. UnifiedPreference 28.06.2013 © MAKING WAVES 22 • Easy to use

    • Takes care of most of the boilerplate code • Use a single pane for phones, or headers and fragments for tablets • Binds preference values to summaries according to Android Design Guidelines • Translated to 50 locales (imported from AOSP internal strings) • Uses ActionBarSherlock (optional) https://github.com/saik0/UnifiedPreference
  11. EventBus EventBus Otto Declare event handling methods Name conventions Annotations

    Event inheritance Yes Yes Subscriber inheritance Yes No Cache most recent events Yes, sticky events No Event producers (e.g. for coding cached events) No Yes Event delivery in posting thread Yes (Default) Yes Event delivery in main thread Yes No Event delivery in background thread Yes No Aynchronous event delivery Yes No EventBus Otto Posting 1000 events, Android 2.3 emulator ~70% faster Posting 1000 events, S3 Android 4.0 ~110% faster Register 1000 subscribers, Android 2.3 emulator ~10% faster Register 1000 subscribers, S3 Android 4.0 ~70% faster Register subscribers cold start, Android 2.3 emulator ~350% faster Register subscribers cold start, S3 Android 4.0 About the same 28.06.2013 © MAKING WAVES 23 https://github.com/greenrobot/EventBus
  12. • https://github.com/jfeinstein10/SlidingMenu • SlidingMenu is an Open Source Android library

    that allows developers to easily create applications with sliding menus like those made popular in the Google+, YouTube, and Facebook apps. public class SlidingExample extends Activity { @Override public void onCreate(Bundle savedInstanceState) { SlidingMenu SlidingMenu menu = new SlidingMenu(this); menu.setMode(SlidingMenu.LEFT); menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); menu.setShadowWidthRes(R.dimen.shadow_width); menu.setShadowDrawable(R.drawable.shadow); menu.setBehindOffsetRes(R.dimen.slidingmenu_offset); menu.setFadeDegree(0.35f); menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT); menu.setMenu(R.layout.menu); } } 28.06.2013 © MAKING WAVES 24 SlidingMenu
  13. ListViewAnimations • https://github.com/nhaarman/ ListViewAnimations ListViewAnimations is an Open Source Android

    library that allows developers to easily create ListViews with animations. 28.06.2013 © MAKING WAVES 25
  14. android-maps-utils BubbleIconFactory bubbleFactory = new BubbleIconFactory(MapFragment.this.ge tActivity()); bubbleFactory.setStyle(Style.BLUE); Bitmap icon

    = bubbleFactory.makeIcon(name); marker = getMap() .addMarker(new MarkerOptions() .position(latLgnDistances.get(0.0)) .title(name) .icon(BitmapDescriptorFactory.fromB itmap(icon))); 28.06.2013 © MAKING WAVES 26