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

Droidcon Paris 2015 feedback

Droidcon Paris 2015 feedback

renaudboulard

December 01, 2015
Tweet

More Decks by renaudboulard

Other Decks in Programming

Transcript

  1. • Gradle build • Android performance matters • Ingredient for

    a healthy code base • Barcamp • Trending Android
  2. • Configuration on Demand • Gradle Daemon • Newer versions

    of gradle • JVM 1.8 instead of 1.6 • Avoid expensive things during configuration phase • Don’t use dynamic dependencies (x.y.+)
  3. Package cost : 1.297s Resource change cost: 0.939s Jave change

    cost 4.462s • dex : 3.766s • Javac : 0.876s
  4. small project dev { multiDexEnabled true minSdkVersion 21 } 4.633

    secs prod {} 6.599 secs Bigger prject dev { multiDexEnabled true minSdkVersion 21 } 4.416 secs prod { multiDexEnabled true minSdkVersion 15 } 20.703 secs
  5. Goals of a gradle plugin: • Create a gradle task

    that performs a custom task • Inject this task into the android task graph • Parametrize this task regarding the needs of the project • Package it and share it
  6. class MyCustomTask extends DefaultTask { @Input def String input; @Output

    def String output; @TaskAction def trigger() { // Do your stuff here } }
  7. public class MyPlugin implements Plugin<Project> { @Override void apply(Project project)

    { project.afterEvaluate ({ def myTask = project.tasks.create("mytask", MyCustomTask ); myTask.input = "doStuff" def jarTask = project.tasks.findByName("jar") jarTask.dependsOn(myTask); } }) }
  8. public class MyPlugin implements Plugin<Project> { @Override void apply(Project project)

    { project.extensions.create("myExtension", MyTaskExtension) project.afterEvaluate ({ // ... myTask.input = project.myExtension.input // ... } }) }
  9. • Static analysis tools – checkstyle – … • Google

    Play Store publishing • Groovy library for git • Dex count • Sqlite Analyzer Plugin • ...
  10. • Gradle performance: https://speakerdeck.com/madisp/squeezing- the-last-drop-of-performance-out-of-your-gradle-builds-droidcon- paris-2015 • Build your gradle

    plugin https://bit.ly/gradle-plugin-next-level • Improve android builds: https://speakerdeck.com/florianmski/level- up-your-android-build
  11. • Networking is the main battery consumer – Less radio

    time means less data – Batching to minimize radio transmission – Prefetching by predicting what the user will do
  12. • GC events eats your app framerate – Reduce images

    size – Use primitives instead of objects – Keep an eye on your memory with management tools (AllocationTracker, TraceView)
  13. • Create your own scrolling container – Movement tracking –

    Inertia scrolling – Scrollbars drawing – Edge detection to get feedback
  14. Performance Matter - Ran Nachmany, Google https://youtu.be/04igNM9IpwE?list=PLn7H9CUCuXAv_kAdS0rxL1_jdxXp FVb0r ViewGroups -

    François Blavoet, Deezer https://youtu.be/MSTG0JPOrYk?list=PLn7H9CUCuXAv_kAdS0rxL1_jdxX pFVb0r Advanced Scrolling - Cyril Mottier, Captain Train https://youtu.be/N3J4ZFiR_3Q?list=PLn7H9CUCuXAv_kAdS0rxL1_jdxX pFVb0r
  15. • Orchestrates the flow of data with use “cases” •

    Offers its services to presentation layer • Pure Java module • No Android UI dependencies • No dependency to external source (db,content provider, shared preferences…)
  16. ▸ public class Artist { String displayName; Date onTourUntil; String

    uri; String id; String url; String htmlUrl; String …; Object…; Object …; Object …; } public class ArtistViewModel { String name; boolean isOnTour; } VIEW MODEL PRESENTER VIEW
  17. public interface SearchPresenter { void searchUser(String searchItem); void clickUser(ArtistViewModel artist);

    } public interface SearchView { void showProgress(); void hideProgress(); void showUser(List<ArtistViewModel> artistes); } VIEW MODEL PRESENTER VIEW
  18. public class SearchFragment extends Fragment implements SearchView { private SearchPresenter

    searchPresenter; @Override public void showProgress() { //... } @Override public void hideProgress() { //... } @Override public void showUser(List<UserViewModel> users) { //... } }
  19. • Provides dependency: @Provides and @Module • Request dependency: @Inject

    • Link modules and injections: @Component • Implement the singleton pattern : @Singleton
  20. • Choose an architecture and stick with it • Test

    while your code • Retrofit • Dagger 2 • Rx-java • Espresso • Junit
  21. • Clean Architecture : https://www.youtube.com/watch?v=- oZswd1j5H0 • Slide https://speakerdeck.com/romainpiel/ingredients-for-a-healthy- codebase

    • Presentation Dagger 2 : https://www.youtube.com/watch?v=IkTST564lA4 • slide Dagger 2 https://speakerdeck.com/jeremiemartinez/dagger-2- back-to-basics
  22. It’s a tool to : ▸ Enhance modularity ▸ Focus

    on business logic ▸ Reduce noise in the source code Occurs at compile time with byte code modification
  23. • To minimize the code necessary to bind your logic

    and your view • Still in Beta • Support library API 7
  24. public class User { public final String firstName; public final

    String lastName; public User (String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } }
  25. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MainActivityBinding binding =

    MainActivityBinding.inflate(getLayoutInflater()); User user = new User("Test", "User"); binding.setUser(user); }
  26. Le Data Binding sur Android - Guillaume Bernard, Koridev https://youtu.be/fG_93vUfm5s?list=PLn7H9CUCuXAv_kAdS0rxL1_jdxXpFV

    b0r Data Binding -- Write Apps Faster (Android Dev Summit 2015) https://youtu.be/NBbeQMOcnZ0
  27. • Android Emulator • Gives control on hardware features :

    – Control the battery level – GPS Location – Network and call management $
  28. Java Android Compiler Kit Jack Intermediate Library Linker Goal is

    to improve incremental build More efficient to compile compared to javac + dex, but still experimental
  29. Pros • Compile time detection of NPE with nullable type

    • Lambda • Type inference • Class extensions
  30. Cons • Overhead of 924 KB for runtime • Still

    in beta • Will it be adopted by the community ?
  31. Beacon • Autonomous • Cheap (15-20€) • Advertise data in

    a one way communication Eddystone Open beacon format
  32. 3 possible messages with Eddystone • UID – Beacon broadcast

    its unique identifier • URL – Beacon broadcast – Physical web – Short range and contactless QRCode • TLM (Telemetry) – Maintenance (battery level, …)
  33. Evolution inside the android build system https://drive.google.com/file/d/0B1CCib0JzAOJRXZSY0c1ckZTU0E Kotlin for Android

    https://www.youtube.com/watch?v=50lASllvG3Q Eddystone https://www.youtube.com/watch?v=HR3X5h9xdno