getUserDetails(@Path("user") User user); @GET("/users/{user}/repos") List<Repo> listRepos(@Path("user") User user); } public class User { String getLogin(); String getLocation(); } public class Repo { String getName(); String getDescription(); String getLanguage(); boolean isFork(); User getOwner(); }
getUserDetails(@Path("user") User user); @GET("/users/{user}/repos") List<Repo> listRepos(@Path("user") User user); } public class User { String getLogin(); String getLocation(); } public class Repo { String getName(); String getDescription(); String getLanguage(); boolean isFork(); User getOwner(); }
void getUserDetails(@Path("user") User user, Callback<User> …); @GET("/users/{user}/repos") void listRepos(@Path("user") User user, Callback<List<Repo>> …); } public class User { String getLogin(); String getLocation(); } public class Repo { String getName(); String getDescription(); String getLanguage(); boolean isFork(); User getOwner(); }
getUserDetails(@Path("user") User user); @GET("/users/{user}/repos") List<Repo> listRepos(@Path("user") User user); } public class User { String getLogin(); String getLocation(); } public class Repo { String getName(); String getDescription(); String getLanguage(); boolean isFork(); User getOwner(); }
getUserDetails(@Path("user") User user); @GET("/users/{user}/repos") Observable<List<Repo>> listRepos(@Path("user") User user); } public class User { String getLogin(); String getLocation(); } public class Repo { String getName(); String getDescription(); String getLanguage(); boolean isFork(); User getOwner(); }
.observeOn(Schedulers.computation()) .map(it -> { /* time consuming operation */ } ) .observeOn(AndroidSchedulers.mainThread()) .subscribe( /* show users on UI */ ); subscribeOn(): “Create the Observable on this thread”
data in background, • cache processed data, • subscribe on changes and reload automatically… • …unless user left the UI which needs this data, in that case just mark the data as dirty and reload as needed, • have a basic backpressure handling.
from the computer disease that anybody who works with computers now knows about. It's a very serious disease and it interferes completely with the work. The trouble with computers is you *play* with them. They are so wonderful. You have these switches - if it's an even number you do this, if it's an odd number you do that - and pretty soon you can do more and more elaborate things if you are clever enough, on one machine. After a while the whole system broke down. Frankel wasn't paying any attention; he wasn't supervising anybody. The system was going very, very slowly - while he was sitting in a room figuring out how to make one tabulator automatically print arc- tangent X, and then it would start and it would print columns and then bitsi, bitsi, bitsi, and calculate the arc-tangent automatically by integrating as it went along and make a whole table in one operation. Absolutely useless. We *had* tables of arc-tangents. But if you've ever worked with computers, you understand the disease - the *delight* in being able to see how much you can do. But he got the disease for the first time, the poor fellow who invented the thing.” ― Richard P. Feynman, Surely You're Joking, Mr. Feynman!