InstaMaterial – RecyclerView animations done right (thanks to Android Dev Summit!)

We live in times where apps have to be not only useful but also smooth and delightful. Times slightly different than a couple years ago where all we had to do was just notifyDataSetChanged() on ListView adapter. Screen just blinked, new data appeared and that’s all.
Today, in a times of RenderThread, MaterialDesign animations and transitions app should show exactly what’s happening. User should see when data from his collection just changed or when something new appeared or/and was removed.

Continue reading “InstaMaterial – RecyclerView animations done right (thanks to Android Dev Summit!)”

FlatBuffers performance in Android – allocation tracking

After my last post about parsing JSON in Android with FlatBuffers parser (implemented in C++, connected via NDK to our project) great discussions started about the real performance of FlatBuffers and comparising them to another serialization solutions. You can find those debates on Reddit or in comments section on Jessie Willson’s blog. Continue reading “FlatBuffers performance in Android – allocation tracking”

JSON parsing with FlatBuffers in Android

FlatBuffers library is getting more and more popular recently. If you check last Android Performance Patterns series, Colt McAnlis mentions about it a couple times in different videos. Probably you remember Facebook’s announcement about migration to FlatBuffers. Also some time ago I published post about how to start using it in Android. Continue reading “JSON parsing with FlatBuffers in Android”

Dagger 2 – graph creation performance

#PerfMatters – recently very popular hashtag, especially in the Android world. The times when the apps just did something, no matter how, are already gone. Now everything should be pleasant, smooth and fast. For example Instagram spent almost half a year just to make its app faster, more beautiful, and more screen-size aware.

That’s why today I’d like to share with you short hint which can have a great impact on your app launch time (especially when it uses some external libraries). Continue reading “Dagger 2 – graph creation performance”

FlatBuffers in Android – introduction

JSON – probably everyone knows this lightweight data format used in almost all modern servers. It weights less, is more human-readable and in general is more dev-friendly than old-fashined, horrible xml. JSON is language-independend data format but parsing data and transforming it to e.g. Java objects costs us time and memory resources.
Several days ago Facebook announced big performance improvement in data handling in its Android app. It was connected with dropping JSON format and replacing it with FlatBuffers in almost entire app. Please check this article to get some basic knowledge about FlatBuffers and results of transition to it from JSON.

While the results are very promising, at the first glance the implementation isn’t too obvious. Also facebook didn’t say too much. That’s why in this post I’d like to show how we can start our work with FlatBuffers. Continue reading “FlatBuffers in Android – introduction”

InstaMaterial meets Design Support Library

A couple months ago I started InstaMaterial series. The goal was simple – to prove that it is pretty straightforward to implement all those fancy animations and UI effects showed in Material Design guidelines. Now it becomes even easier – Google gave us Android Design Support Library which provides all the most important UI elements introduced in Material Design. In this post I’d like to update InstaMaterial source code from custom views implementations to those provided by this library. Continue reading “InstaMaterial meets Design Support Library”

Dependency injection with Dagger 2 – Custom scopes

This post is a part of series of posts showing Dependency Injection with Dagger 2 framework in Android. Today I’m going to spend some time with custom scopes – functionality which can be a bit problematic for Dependency Injection beginners. Continue reading “Dependency injection with Dagger 2 – Custom scopes”

Dependency injection with Dagger 2 – the API

This post is a part of series of posts showing Dependency Injection in Android with Dagger 2. Today I’d like to delve into a fundamentals of Dagger 2 and go through a whole API of this Dependency Injection framework. Continue reading “Dependency injection with Dagger 2 – the API”

Dependency injection with Dagger 2 – Introduction to DI

Some time ago, at Google I/O 2015 Extended in Tech Space in Cracow I had a presentation about dependency injection with Dagger 2. In a time of preparation I realized that there is a lot of things to talk about and there is no chance to cover everything in dozen of slides. But it could be a good entry point to start the new series of posts – Dependency Injection in Android. Continue reading “Dependency injection with Dagger 2 – Introduction to DI”

Dagger 1 to 2 migration process

Dependency injection frameworks in Android – is there anyone who has never heard about it? At almost every Android dev conference someone talks about this software design pattern. I am a big fan of DI but there are also people who complain about it. The main reasons why they do this are:

  • dependency injection frameworks are slow – well, it was completely true a couple years ago in times of RoboGuice, when the whole dependency graph were created and validated in runtime. Now, when we have Dagger it’s not (completely) true. In Dagger 1 much of work (graph validation) is done in compilation time and objects creation process is done without reflection (it’s worth mentioning that recently presented Roboguice 3 also does much of his work in compile-time). Yes, it’s still a bit slower than hand-written code, but in average Android app it is almost imperceptible.
  • DI frameworks requires a lot of boilerplate – it is true and it isn’t. Yes, we have to create additional code for injections, classes which provides dependencies etc. but thanks to them we don’t have to deal with objects constructors every time when we need them. Yes, in small projects DI frameworks are overkill, but benefits of dependency injection increase when you start dealing with scale.
  • Other stuff like poor traceability, hard to read generated code etc.

Continue reading “Dagger 1 to 2 migration process”