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

Construye un app con Groovy en Android que consume un API JSON generado en con Wordpress

Construye un app con Groovy en Android que consume un API JSON generado en con Wordpress

Charla ofrecida en el grupo de usuarios de Groovy MadridGUG. En estas transparencias se explica como configurar una api JSON con Wordpress y como consumirlo mediante una librería Android escrita en Groovy. Así mismo se muestran las ventajas de programar en Android con Groovy.

Sergio del Amo

June 14, 2016
Tweet

More Decks by Sergio del Amo

Other Decks in Technology

Transcript

  1. CONSTRUYE UN APP CON GROOVY
    EN ANDROID Y CONSUME UN API
    JSON DE WORDPRESS

    View full-size slide

  2. GROOVYCALAMARI.COM
    A “weekly” curated email
    newsletter full of
    interesting, relevant links
    about the Groovy
    Ecosystem

    View full-size slide

  3. https://play.google.com/store/apps/details?id=com.botconf.ggx

    View full-size slide

  4. https://play.google.com/store/apps/details?id=com.botconf.greach

    View full-size slide

  5. ASISTENTES
    ▸ USUARIO WORDPRESS?
    ▸ PROGRAMADOR WORDPRESS?
    ▸ PROGRAMADOR ANDROID?
    ▸ PROGRAMADOR GROOVY?

    View full-size slide

  6. PEQUEÑA ( < 20 EMPLEADOS )
    MEDIANA-GRANDE ( > 20 EMPLEADOS )

    View full-size slide

  7. ¿ES POSIBLE CONTRATAR
    PROGRAMADORES GROOVY
    PARA UNA STARTUP?

    View full-size slide

  8. PERFIL SHOPTIMIX?

    View full-size slide

  9. IS GROOVY TOO
    NICHE?

    View full-size slide

  10. ¿NECESITA GROOVY
    ESTAR EN EL TOP 10?

    View full-size slide

  11. GROOVY PODRÍA SER
    EL SWIFT DE ANDROID

    View full-size slide

  12. ¿PORQUE WORDPRESS?

    View full-size slide

  13. EL 25% DE TODAS LAS
    WEB SE EJECUTAN EN
    WORDPRESS
    SOURCE W3TECHS

    View full-size slide

  14. ALOJAMIENTO BARATO

    View full-size slide

  15. FÁCIL DE USAR

    View full-size slide

  16. PRODUCTO
    FLEXIBLE

    View full-size slide

  17. MUCHOS PLUGINS!

    View full-size slide

  18. ¿CÓMO CREAR EL APP DE
    (UNA CONFERENCIA) CON UN
    BACKEND DE WORPRESS?

    View full-size slide

  19. CUSTOM POST TYPES
    ▸ CONGRESS
    ▸ SPEAKER
    ▸ TALK

    View full-size slide

  20. HTTP://EXAMPLE.COM/WP-JSON/POSTS?TYPE=TALK

    View full-size slide

  21. https://github.com/groovy/groovy-android-gradle-plugin

    View full-size slide

  22. http://mariogarcia.github.io/grooid-templates/
    https://github.com/rvanderwerf/grooid-templates

    View full-size slide

  23. SQLite
    ENTITIES
    grooid_wpapi
    Activities
    Fragments
    Adapters
    USE CASES
    INTERFACE
    ADAPTERS
    BotConf grooid_wpapi

    View full-size slide

  24. REFRESCO
    ▸ TAREA EN SEGUNDO
    PLANO PARA DESCARGAR
    EL JSON
    ▸ ACTUALIZAR BASE DE
    DATOS LOCAL
    ▸ NOTIFICAR UI DE CAMBIOS
    EN LA BASE DE DATOS Y
    ACTUALIZAR LA INTERFAZ

    View full-size slide

  25. https://github.com/Arasthel/SwissKnife

    View full-size slide

  26. GROOID_WPAPI
    ▸ https://github.com/sdelamo/grooid-wpapi

    View full-size slide

  27. ADAPTER PATTERN
    ▸ CONVERTS THE INTERFACE OF A CLASS INTO ANOTHER
    INTERFACE THE CLIENTS EXPECT. ADAPTERS LETS
    CLASSES WORK TOGETHER THAT COULDN’T OTHERWISE
    BECAUSE OF INCOMPATIBLE INTERFACES
    SOURCE HEAD FIRST PATTERNS

    View full-size slide

  28. GROOID_WPAPI
    void loadConferenceData { List conferences,
    List speakers,
    List talks ->
    }
    JSON PAYLOAD
    void fetchAllPosts(String url, String type, Closure customFields) {
    List posts ->
    }
    SpeakerWPAPIPostAdapter SpeakeTalkWPAPIPostAdapter
    class RemoteRepositoryUseCase implements IRemoteRepository

    View full-size slide

  29. STRING INTERPOLATION

    View full-size slide

  30. GROOVY WITH OPERATOR

    View full-size slide

  31. AgendaSessionTimeHeader
    TalkCard
    AgendaSessionTimeHeader
    AgendaSessionTimeHeader
    TalkCard
    TalkCard
    TalkCard

    View full-size slide

  32. CHRONOLOGICAL
    ORDER
    REVERSE
    CHRONOLOGICAL
    ORDER
    12 Dec 2014
    11 Dec 2014
    13 Dec 2013
    12 Dec 2013
    14 Dec 2015
    15 Dec 2015

    View full-size slide

  33. SPOCK ON ANDROID
    ▸ https://github.com/pieces029/android-spock

    View full-size slide

  34. SHARED PREFERENCES

    View full-size slide

  35. MAIN ACTIVITY
    TALK ACTIVITY

    View full-size slide

  36. ASTS
    HTTPS://GITHUB.COM/MARIOGARCIA/MGUG-ANDROID

    View full-size slide

  37. MULTI-DEX IS A NIGHTMARE
    ▸ Android 64k method limit
    METHOD COUNT COMPARISION
    0
    7500
    15000
    22500
    30000
    OKHTTP IO.FABRIC GSON RETROFIT GROOVY ANDROID
    SOURCE: HTTPS://GITHUB.COM/GROOVY/GROOVY-ANDROID-GRADLE-PLUGIN/ISSUES/65

    View full-size slide

  38. ANDROID STUDIO
    SUPPORT

    View full-size slide

  39. CALL TO ACTION

    View full-size slide

  40. YO:
    ▸ GROOID_WPAPI (https://github.com/sdelamo/grooid-wpapi)
    ▸ BOTCONF (https://github.com/sdelamo/botconf)

    View full-size slide

  41. PROGRAMA ANDROID
    APPS CON GROOVY
    TU:

    View full-size slide

  42. GROOVYCALAMARI.COM
    A “weekly” curated email
    newsletter full of
    interesting, relevant links
    about the Groovy
    Ecosystem

    View full-size slide