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

Open Source Android Libraries

Open Source Android Libraries

Presentación utilizada en XII Jornadas SLCENT de Actualización Informática y Electrónica. 28 de Octubre de 2015, Almería.

http://hacklabalmeria.net/actividades/2015/10/28/xii-jornadas-slcent.html

Esta charla trata de ofrecer una visión general sobre licencias Open Source y librerías Open Source para Android.

More Decks by José Juan Sánchez Hernández

Other Decks in Programming

Transcript

  1. About me José Juan Sánchez Hernández Android Developer (In my

    spare time :) Member and collaborator of: - Android Almería Developer Group - HackLab Almería @josejuansanchez 2
  2. Who are you? 3 • How many Android developers are

    there in the room? • How many of you have used open source libraries in your projects?
  3. This talk is based on the next talks/slides: 1. Can

    you work without open source libraries?
 Gabriele Mariotti. Droidcon Italy 2015. slides video 2. Android Library Love.
 Andrew Watson. DevFestMN 2015. slides video 3. Don't reinvent the wheel, use libraries.
 Pavel Junak. Droidcon Berlin 2015. slides video 6. A few small useful libraries. Victor Cassone. link
 
 
 4 Advertisement Thanks!
  4. Agenda 1. How to evaluate a library? 2. Android Libraries

    you should know about 3. Demo time 4. References 5
  5. Agenda 1. How to evaluate a library? 2. Android Libraries

    you should know about 3. Demo time 4. References 6
  6. • Never choose the first library. • Read the README.

    • Pay attention to some important points: • License • Maintenance • Support • Documentation • Quality code 7 Before using open source libraries Reference [1]
  7. • Check if the license under which the library is

    released. • Check if the license is compatible with your project. • Pay attention to legal issues. 8 License Reference [1] Can I use it?
  8. • Open Source does not mean you are free to

    do anything you want with the library. • You have to respect the license. 9 What is Open Source? Reference [1] Open Source != Free
  9. What do you know about the types of license? 10

    Reference [1] Wait a moment, please!
  10. 14

  11. • Never choose the first library. • Read the README.

    • Pay attention to some important points: • License • Maintenance • Support • Documentation • Quality code 15 Before using open source libraries Reference [1]
  12. • a company? • a community? • a single developer?

    16 Maintenance Reference [1] Who is the author of this library?
  13. • Checks the last commits in the repository. • Check

    how often the project is updated (or was updated). • If you use a library which is no longer maintained, you could have problems in the future. 17 Maintenance Reference [1] Is this library still alive?
  14. • Never choose the first library. • Read the README.

    • Pay attention to some important points: • License • Maintenance • Support • Documentation • Quality code 19 Before using open source libraries Reference [1]
  15. • Evaluate what kind of support you can find using

    it. • Popular libraries have a tag (and a lot of posts) on stackoverflow. • Popular libraries have a G+ community or a very good issues section where to find a lot of comments and posts. 20 Support Reference [1] Can someone help me?
  16. • Check how many issues are open. • Check how

    many issues were closed. • If you find 300 issues open and 1 issue closed is not a good evidence. 21 Issues Reference [1] Is someone fixing the issues?
  17. • Never choose the first library. • Read the README.

    • Pay attention to some important points: • License • Maintenance • Support • Documentation • Quality code 23 Before using open source libraries Reference [1]
  18. Check if the library provides: • Doc / Wiki section.

    • A good README file. • Examples. • A demo in Google Play. 24 Documentation Reference [1] You can’t use the library without documentation!
  19. • Never choose the first library. • Read the README.

    • Pay attention to some important points: • License • Maintenance • Support • Documentation • Quality code 27 Before using open source libraries Reference [1]
  20. • The existence of Unit Tests is a good indicator

    of a serious project. • Check how it is written. • Check if the authors use comments, javadoc, 
 Clean Code, SOLID principles. 28 Quality code Reference [1] Is it good?
  21. 29

  22. Agenda 1. How to evaluate a library? 2. Android Libraries

    you should know about 3. Demo time 4. References 32
  23. 33 Butter Knife Author Jake Wharton License Apache 2.0 View

    "injection" library for Android https://github.com/JakeWharton/butterknife
  24. • Uses annotation for code generation (no reflection). • Reduces

    boilerplate for view assignment. • Removes anonymous inner classes for listeners associated with views. • Simplifies resource lookups. 34 What does ButterKnife do? Reference [6]
  25. 44 Reference [6] Other listeners callbacks • @OnLongClick • @OnItemClick

    • @OnItemLongClick • @OnCheckedChanged • @OnFocusChange • @OnPageChange • @OnTextChange • @OnTouch
  26. 45 EventBus Author Greenrobot License Apache 2.0 Android optimized event

    bus that simplifies communication between Activities, Fragments, Threads, Services, etc. https://github.com/greenrobot/EventBus
  27. • Developed by greenRobot. • Inspired by Guava’s EventBus. •

    Android optimized way to simplify communication in application. • Claims to have best performance. • There are other options (Otto, TinyBus, … etc). 46 About EventBus Reference [6]
  28. 47 EventBus in 4 steps 1. Define an event. 2.

    Register subscribers. 3. Post event. 4. Receive event. Reference [6]
  29. 48 1. Define an event Reference [6] • Event: the

    object that will be delivered. • POJO: Plain Old Java Object
  30. 51 4. Receive events Reference [6] • Must have onEvent

    method or else crash. • Params must be something posted.
  31. 52 Picasso Author Square License Apache 2.0 A powerful image

    downloading and caching library for Android. https://github.com/square/picasso
  32. • Developed by Square. • Never again: AsyncTask with HttpConnection

    downloading image. • Picasso allows image loading in your application, often in one line of code! 53 About Picasso Reference [3]
  33. 55 Place Holders Reference [3] Picasso.with(context) .load(url) .placeholder(R.drawable.placeholder) .error(R.drawable.placeholder_error) .into(imageView);

    • Supports both download and error placeholders as optional features. • A request will be retried 3 times before the error placeholder is shown.
  34. 56 Image Transformations Reference [3] Picasso.with(context) .load(url) .resize(50, 50) .centerCrop()

    .into(imageView) • Transform images to better fit into layouts and to reduce memory size.
  35. 57 Retrofit Author Square License Apache 2.0 A type-safe REST

    client for Android which intelligently maps an API into a client interface using annotations. http://square.github.io/retrofit/
  36. 58 LeakCanary Author Square License Apache 2.0 A memory leak

    detection library for Android and Java. https://github.com/square/leakcanary
  37. 59 Other useful libraries… • RxAndroid • RxJava • Retrolambda

    • GSON • Timber • ion • okHttp • Dagger • SQLBrite • Sugar ORM • Realm • …
  38. Agenda 1. How to evaluate a library? 2. Android Libraries

    you should know about 3. Demo time 4. References 60
  39. Agenda 1. How to evaluate a library? 2. Android Libraries

    you should know about 3. Demo time 4. References 61
  40. References / Talks 1. Can you work without open source

    libraries?
 Gabriele Mariotti. Droidcon Italy 2015. slides video 2. Android Library Love.
 Andrew Watson. DevFestMN 2015. slides video 3. Don't reinvent the wheel, use libraries.
 Pavel Junak. Droidcon Berlin 2015. slides video 
 
 62
  41. References / Links 4. Choosing an open source license doesn’t

    need to be scary. GitHub, Inc. link 5. The Free-Libre / Open Source Software (FLOSS) License Slide. David A. Wheeler. 2007. link 6. A few small useful libraries. Victor Cassone. link 
 
 63