{"id":284122,"date":"2017-03-29T18:45:02","date_gmt":"2017-03-29T14:45:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=284122"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=284122","title":{"rendered":"Retrofit, Realm, Dagger in Android"},"content":{"rendered":"<p>Retrofit, Realm, Dagger \u0422\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043f\u043e Android \u0437\u0430 \u0434\u0432\u0430 \u0447\u0430\u0441\u0430<\/p>\n<p>  Retrofit 2, Realm 3, Dagger 2<\/p>\n<p>  \u041e\u0431\u044b\u0447\u043d\u043e \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c feed. \u041f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u041a\u044d\u0448. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u0434\u0430.<\/p>\n<p>  \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e Swipe \u0431\u043e\u043d\u0443\u0441.<\/p>\n<p>  \u041a\u044d\u0448 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 OkHttp \u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. \u041f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0441 Sqlite \u0438\u043b\u0438 ORM.<\/p>\n<p>  \u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043d\u0430 ORM Realm. Realm \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 native \u0438 \u043f\u0440\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a\u0430\u043a \u043f\u043b\u0430\u0433\u0438\u043d \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442 apk<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Realm<\/b><\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/realm.io\/news\/android-installation-change\/\">realm.io\/news\/android-installation-change<\/a><\/p>\n<p>  Using the plugin we can now ship Realm as an AAR, as opposed to a JAR. We can also avoid including the annotation processor in the library and make it a standalone package. This means the your final APKs will not have to include the annotation processor, shaving a few kilobytes off your app  <\/div>\n<\/div>\n<p>  Retrofit \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043e\u0442 Square. \u0423\u043c\u0435\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 Observer, \u043d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u043d\u0435 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e. \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0437\u0430\u0434\u0430\u0447. \u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 Observer \u0441 Retrofit \u0432\u0438\u0434\u0438\u0442\u0441\u044f \u0435\u0441\u043b\u0438 \u043d\u0430\u0434\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0432 Presenter.<\/p>\n<p>  \u0414\u0440\u0443\u0433\u0430\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043e\u0442 Square \u044d\u0442\u043e Dagger. Dagger 2 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043a\u043e\u0434\u0430 \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e Dagger. \u0415\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0442\u0435\u0439, \u043d\u043e \u044f \u043d\u0435\u0431\u0443\u0434\u0443 \u0434\u043e\u043b\u0433\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e. \u042f \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e \u043f\u043e\u043a\u0430\u0436\u0443 \u0447\u0442\u043e \u0438 \u0433\u0434\u0435 \u043d\u0430\u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c. \u042d\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0435\u043c\u0443 \u043a\u0430\u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u043d\u044c\u0435\u043a\u0446\u0438\u044e. \u041e\u0431\u044c\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u0430\u043b\u044c\u0446\u0430\u0445.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432 Activity \u043e\u0431\u0435\u043a\u0442\u044b Retrofit \u0438 Realm \u043d\u0443\u0436\u043d\u044b \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u043a\u043e\u0434\u0430.<\/p>\n<pre><code class=\"java\">@Inject Retrofit retrofit; @Inject Realm mRealm; @Override protected void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState); \t... \t((App) getApplication()).getApplicationComponent().inject(this); <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0430\u044f \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u044f. <\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 ApplicationComponent. Dagger \u0433\u0435\u043d\u0435\u0440\u0438\u0442 \u0438\u043c\u0435\u043d\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 DaggerApplicationComponent \u0438\u0437 ApplicationComponent, Realm \u0438\u0437 provideRealm,\u2026 <\/p>\n<pre><code class=\"java\">public class App extends Application {     @Override     public void onCreate() {         super.onCreate();         WEB_SERVICE_BASE_URL = &quot;http:\/\/&quot; + AppUtils.getNetworkHost(this);         mApplicationComponent = DaggerApplicationComponent.builder()                 .appModule(new AppModule(this))                 .netModule(new NetModule(WEB_SERVICE_BASE_URL))                 .realmModule(new RealmModule(this))                 .build();     }     public ApplicationComponent getApplicationComponent() {         return mApplicationComponent;     } } <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043d\u0430\u0448\u0438 \u043c\u043e\u0434\u0443\u043b\u0438. \u0422\u043e\u0447\u043d\u0435\u0435 Dagger \u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u043b \u0437\u0430 \u043d\u0430\u0441. \u041a\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f?<br \/>  Dager \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0410\u043d\u043e\u0442\u0430\u0446\u0438\u044e<\/p>\n<pre><code class=\"java\">@Module public class RealmModule {     @Provides     @Singleton     Realm provideRealm(RealmConfiguration realmConfiguration) { \t\t... <\/code><\/pre>\n<p>  <a href=\"https:\/\/habrahabr.ru\/users\/singleton\/\" class=\"user_link\">Singleton<\/a> provideRealm \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f <a href=\"https:\/\/habrahabr.ru\/users\/inject\/\" class=\"user_link\">Inject<\/a> Realm mRealm<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 NetModule. \u0422\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0434\u0430\u0436\u0435 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0432 \u0441\u0430\u043c\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435:<\/p>\n<p>  <a href=\"https:\/\/habrahabr.ru\/users\/provides\/\" class=\"user_link\">Provides<\/a><br \/>  <a href=\"https:\/\/habrahabr.ru\/users\/singleton\/\" class=\"user_link\">Singleton<\/a><br \/>  Retrofit provideRetrofit(Gson gson, OkHttpClient okHttpClient) {<br \/>  provideOkhttpClient \u0438 provideGson \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e Gson, OkHttpClient <\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0412 ApplicationComponent \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <a href=\"https:\/\/habrahabr.ru\/users\/component\/\" class=\"user_link\">Component<\/a> \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u044e \u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u0438<\/p>\n<pre><code class=\"java\">@Singleton @Component(modules = {AppModule.class, NetModule.class, RealmModule.class}) public interface ApplicationComponent {     void inject(MainActivity activity); \t} <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 Activity \u0442\u043e \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c inject. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f DetailActivity \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"java\">public interface ApplicationComponent {     void inject(MainActivity activity);     void inject(DetailActivity activity); \t} <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 Fragments \u0438 Service \u0442\u0430\u043a \u0436\u0435.<\/p>\n<p>  \u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a Realm. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 extends RealmObject. \u0418\u0445 \u043d\u0435\u043b\u044c\u0437\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 Retrofit. \u0418\u043d\u0430\u0447\u0435 \u0432\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0432\u0438\u0441\u043d\u0435\u0442.<\/p>\n<p>  \u0412 Activity:<\/p>\n<pre><code class=\"java\">mBooksViewAdapter = new BooksViewAdapter(         mRealm.where(RealmBook.class).findAllSorted(&quot;id&quot;, Sort.ASCENDING), this); <\/code><\/pre>\n<p>  \u0412 Adapter:<\/p>\n<pre><code class=\"java\">public BooksViewAdapter(RealmResults&lt;RealmBook&gt; books, OnStartDragListener dragStartListener) {     this.mBooks = books; <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u0441 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f\u043c\u0438 Sqlite. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"java\">public void addBook(View view) {     if (!mRealm.isInTransaction())         mRealm.beginTransaction();     RealmBook book = mRealm.createObject(RealmBook.class);     book.setId(&quot;1&quot; + Random();     book.setTitle(&quot;Terminator&quot;);     book.setLink(&quot;http;\/\/rerer\/rerer\/trytry&quot;);     book.setPrice(12332d);     mRealm.commitTransaction();     mBooksViewAdapter.notifyDataSetChanged(); } @Override public void onDeleted(int position, String id) {     RealmBook realmBooks = mRealm.where(RealmBook.class).equalTo(&quot;id&quot;, id).findFirst();     if (realmBooks != null) {         if (!mRealm.isInTransaction())             mRealm.beginTransaction();         realmBooks.deleteFromRealm();         mRealm.commitTransaction();     } } <\/code><\/pre>\n<p>  Realm \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 RealmChangeListener.<\/p>\n<pre><code class=\"java\">mBooks.addChangeListener(this); <\/code><\/pre>\n<p>  \u0411\u0443\u0434\u0435\u0442 \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 onChange \u0435\u0441\u043b\u0438 \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Adapter.<\/p>\n<pre><code class=\"java\">@Override public void onChange(Object element) {     notifyDataSetChanged(); } <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u044b\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0432\u0435\u0449\u0438 \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a Dagger \u0438 Realm. Retrofit \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. <\/p>\n<p>  <a href=\"https:\/\/github.com\/app-z\/DaggerRetrofitRealm\">\u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 github<\/a><\/p>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f\u0445 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e <a href=\"https:\/\/github.com\/android10\/Android-CleanArchitecture\">Clean Architecture<\/a>. \u041f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f!<br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/325172\/\"> https:\/\/habrahabr.ru\/post\/325172\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Retrofit, Realm, Dagger \u0422\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043f\u043e Android \u0437\u0430 \u0434\u0432\u0430 \u0447\u0430\u0441\u0430<\/p>\n<p>  Retrofit 2, Realm 3, Dagger 2<\/p>\n<p>  \u041e\u0431\u044b\u0447\u043d\u043e \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c feed. \u041f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u041a\u044d\u0448. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u0434\u0430.<\/p>\n<p>  \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e Swipe \u0431\u043e\u043d\u0443\u0441.<\/p>\n<p>  \u041a\u044d\u0448 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 OkHttp \u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. \u041f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0441 Sqlite \u0438\u043b\u0438 ORM.<\/p>\n<p>  \u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043d\u0430 ORM Realm. Realm \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 native \u0438 \u043f\u0440\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a\u0430\u043a \u043f\u043b\u0430\u0433\u0438\u043d \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442 apk  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-284122","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/284122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=284122"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/284122\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=284122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=284122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=284122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}