Retrofit+RxJava 2.x Easily Implements the Network Layer of app

Foreword: I am also a novice, writing this article is intended to throw a brick to attract jade, I hope some gods can come to see where I have shortcomings, help me answer questions and solve difficulties! If you have just contacted a small partner, you can also make progress together... First of all, before reading this blog, you need to maste ...

Posted by NightCoder on Mon, 01 Jul 2019 16:15:28 -0700

Dagger's Learning Notes

Dependency Injection public class ClassA { ClassB b; public ClassA() { b = new ClassB(); } } Creating an object within a class with the new keyword creates a dependency. ClassA relies on ClassB, because the construction method of ClassB has been modified and parameters are needed, so not only the code of ClassB should ...

Posted by alanzhao on Sun, 30 Jun 2019 15:37:06 -0700

Use Retrofit and Okhttp to implement network caching. No net-read cache, net-reads re-request according to expiration time

Using Retrofit and Okhttp to implement network caching, updated in 2016.02.02 This article uses Retrofit 2.0.0-beta 2 and Okhttp 2.6.0 (the api writing changed after Okhttp 3.0) Cache for configuring Okhttp Configure the cache-control in the request header or unify the request headers for all requests Cloud cooperates with setting respo ...

Posted by BinaryDragon on Fri, 28 Jun 2019 14:33:20 -0700

Integration of RxJava+Retrofit 2.0+MVP Patterns in Android

Working Principle of MVP The above is the working principle of MVP. The Presenter Operations View and Mode s, which everyone notices, are directly invoked through interfaces. MVP workflow Presenter is responsible for logical processing. Model provides data. View is responsible for display.   As a new mode, View does not us ...

Posted by han2754 on Sat, 22 Jun 2019 16:09:23 -0700

Retrofit source code parsing

retrofit source code parsing In recent projects, retrofit is used mostly in network framework. In a word, the use of retrofit is relatively skilled, from encapsulation to bindData of network request, it is more convenient; the annotation of retrofit and retrofit+rajava are the mainstream of android network framework. Look at a picture below: ...

Posted by greatme on Tue, 18 Jun 2019 16:51:53 -0700

Single, Completable and Maybe in RxJava

Maybe tomorrow.jpeg Usually, if we want to use RxJava, the first thing we think about is using Observable. If we want to consider the situation of Backpress, we will use Flowable in the RxJava 2. x era. In addition to Observable and Flowable, there are three types of Observables in RxJava 2.x: Single, Completable, and Maybe. type describe ...

Posted by krystof78 on Sat, 08 Jun 2019 12:32:22 -0700

RxLifecycle Anti-Memory Leakage Analysis

Generation of call chain For example, fragment inherits RxFragment from RxLifecycle and then initiates network requests in fragment // observable generated by Retrofit Retrofit.create(xxx).subscribeOn(Schedulers.io()) .unsubscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) ...

Posted by Nothadoth on Mon, 03 Jun 2019 19:11:50 -0700

Retrofit 2 - How to download files from the server

This article is reproduced from: http://www.jianshu.com/p/92bb85fc07e8. How to declare a Retrofit request If you haven't written any lines of Retrofit request code before reading this article, it's better to take a look at the previous blogs. For many Retrofit users, a request to define a download file is almost identical to other reque ...

Posted by dacio on Mon, 27 May 2019 13:23:46 -0700

Android Framework Building and Sharing

Preface: I haven't written an article for a long time. It's almost 8 months since I last wrote an article. I deeply feel how lazy I am. I returned to Guangzhou from Shenzhen in early August to work, join a new team and learn a new way. Record, summarize and share here. 1. Component development Component development is not a new term, but what i ...

Posted by moreshion on Sun, 26 May 2019 14:23:54 -0700

Do you really use Retrofit 2? Retrofit 2 is a complete tutorial

Do you really use Retrofit 2? Retrofit 2 is a complete tutorial retrofit2 is based on okhttp package. It naturally supports responsive programming, simple and clear API calls, especially the adapters supporting various json frameworks, coupled with rxjava thread scheduling, can make your code instantly elegant. Let's take a look at the t ...

Posted by dragonusthei on Fri, 24 May 2019 16:11:42 -0700