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.

Transcript

  1. Open Source Android Libraries XII Jornadas SLCENT de Actualización Informática

    y Electrónica
  2. 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
  3. 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?
  4. 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!
  5. Agenda 1. How to evaluate a library? 2. Android Libraries

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

    you should know about 3. Demo time 4. References 6
  7. • 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]
  8. • 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?
  9. • 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
  10. What do you know about the types of license? 10

    Reference [1] Wait a moment, please!
  11. 11 http://choosealicense.com Demystified with <3 by GitHub, Inc.

  12. 12 The Free-Libre / Open Source Software (FLOSS) License Slide

    Reference [5]
  13. 13 http://protocoder.org

  14. 14

  15. • 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]
  16. • a company? • a community? • a single developer?

    16 Maintenance Reference [1] Who is the author of this library?
  17. • 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?
  18. 18 Example: https://github.com/square/picasso

  19. • 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]
  20. • 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?
  21. • 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?
  22. 22 Example: https://github.com/square/picasso

  23. • 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]
  24. 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!
  25. 25 Example: https://github.com/ReactiveX/RxJava

  26. 26 Example: https://github.com/ReactiveX/RxJava

  27. • 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]
  28. • 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?
  29. 29

  30. 30 Integration jCenter or Maven Central?

  31. 31 Example:

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

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

    "injection" library for Android https://github.com/JakeWharton/butterknife
  34. • 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]
  35. Binding Views To Activities 35

  36. 36 Before Reference [6]

  37. 37 After Reference [6]

  38. 38 The issue Reference [6]

  39. 39 The ButterKnife way Reference [6]

  40. Binding Listeners 40

  41. 41 Before Reference [6]

  42. 42 After Reference [6]

  43. 43 Using clicked view Reference [6]

  44. 44 Reference [6] Other listeners callbacks • @OnLongClick • @OnItemClick

    • @OnItemLongClick • @OnCheckedChanged • @OnFocusChange • @OnPageChange • @OnTextChange • @OnTouch
  45. 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
  46. • 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]
  47. 47 EventBus in 4 steps 1. Define an event. 2.

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

    object that will be delivered. • POJO: Plain Old Java Object
  49. 49 2. Register subscribers Reference [6] Any object can receive

    events.
  50. 50 3. Post events Reference [6]

  51. 51 4. Receive events Reference [6] • Must have onEvent

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

    downloading and caching library for Android. https://github.com/square/picasso
  53. • 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]
  54. 54 With Picasso Reference [3] Picasso .with(context) .load(url) .into(imageView);

  55. 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.
  56. 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.
  57. 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/
  58. 58 LeakCanary Author Square License Apache 2.0 A memory leak

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

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

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

    you should know about 3. Demo time 4. References 61
  62. 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
  63. 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
  64. Open Source Android Libraries XII Jornadas SLCENT de Actualización Informática

    y Electrónica