{"id":387331,"date":"2024-06-29T07:15:49","date_gmt":"2024-06-29T07:15:49","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=387331"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=387331","title":{"rendered":"<span>\u041a\u0430\u043a \u043d\u0430\u0442\u044f\u043d\u0443\u0442\u044c \u0441\u044b\u0440 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u0438\u043b\u0438 MVI Paging3 \u0432 Android<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/97b\/6c7\/ae5\/97b6c7ae5b759c35be5da9850763f6cc.png\" width=\"1920\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/97b\/6c7\/ae5\/97b6c7ae5b759c35be5da9850763f6cc.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0413\u0435\u043e\u0440\u0433\u0438\u0439 \u0411\u0435\u0440\u0434\u043d\u0438\u043a\u043e\u0432. \u042f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 65apps, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 Android. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0435 \u0441 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c, \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u0434\u0432\u0443\u0445 \u0437\u0430\u0439\u0446\u0435\u0432 \u0438 \u0436\u0443\u0440\u0430\u0432\u043b\u044f \u0441 \u043d\u0435\u0431\u0430 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0443, \u043f\u0435\u0440\u0435\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u0441\u0442\u0430\u043b\u0430 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u0443\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/developer.android.com\/topic\/libraries\/architecture\/paging\/v3-overview\"><u>Paging3<\/u><\/a> \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0435\u0439. \u041e\u043d\u0430 \u0432\u0441\u0451 \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0430\u043c\u0430: \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0440\u0443\u0447\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0437\u0430\u0432\u0435\u0442\u0430\u043c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a MVI, MVVM \u0438 MVP. \u0421\u043d\u0430\u0440\u0443\u0436\u0438 \u0437\u0430\u0434\u0443\u043c\u043a\u0430 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0439, \u043d\u043e \u043e\u043d\u0430\u00a0 \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043b\u043e\u0436\u043a\u043e\u0439 \u0434\u0451\u0433\u0442\u044f \u0432 \u0431\u043e\u0447\u043a\u0435 \u043c\u0451\u0434\u0430. \u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441 \u043e\u0431\u0449\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c (\u043a \u0442\u0430\u043a\u0438\u043c \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0432 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 <a href=\"https:\/\/github.com\/arkivanov\/MVIKotlin\"><u>MVIKotlin<\/u><\/a>), \u043d\u0435 \u0441\u043c\u043e\u0433\u0443\u0442 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 Paging3.<\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443.\u00a0 \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043b\u0430\u0446\u0434\u0430\u0440\u043c\u0430 \u0434\u043b\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0439 \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d \u043d\u0435\u0431\u0435\u0437\u044b\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 <a href=\"https:\/\/github.com\/android\/architecture-components-samples\/tree\/master\/PagingSample\"><u>\u0441\u044d\u043c\u043f\u043b \u043e\u0442 Google<\/u><\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0438 \u0432\u043d\u0435\u0434\u0440\u0438\u043c <strong><em>\u043f\u043e\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u044e\u0434\u0430 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441\u0432\u043e\u0435\u0439 \u043c\u0435\u0447\u0442\u044b<\/em><\/strong> (\u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0439 MVIKotlin). \u041d\u0430\u0448 \u0432\u0437\u043e\u0440 \u043f\u0430\u0434\u0451\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 Paging3,\u00a0 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u0432 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0435.<\/p>\n<h2>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>\u0412\u0441\u0451, \u0447\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 Entity, DAO, \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u044b\u043c. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u043a\u0443\u0441\u043d\u043e\u0439! ???<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/72d\/0ff\/a31\/72d0ffa318d7454e1cb89426c41a39a4.png\" width=\"1241\" height=\"600\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/72d\/0ff\/a31\/72d0ffa318d7454e1cb89426c41a39a4.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0421\u043b\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u043c \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 CheeseSource:<\/p>\n<pre><code class=\"kotlin\">interface CheeseSource {     suspend fun get(index: Int): List&lt;CheeseListItem?> }<\/code><\/pre>\n<p>Nullable-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u2014 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440\u043e\u0432, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0442\u043e\u043c\u0443, \u0447\u0442\u043e AsyncPagingDataDiffer.getItem() \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c null.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438. \u0412\u0441\u0442\u0440\u0435\u0447\u0430\u0439\u0442\u0435 \u2014\u00a0 CheeseStore:<\/p>\n<pre><code class=\"kotlin\">interface CheeseStore : Store&lt;Intent, State, Nothing> {     sealed class Intent {         class LoadMore(val index: Int) : Intent()     }      data class State(         val items: List&lt;CheeseListItem?>     ) }<\/code><\/pre>\n<p>Intent \u043e\u0434\u0438\u043d, \u0438 \u0435\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0441\u0430\u043c\u043e \u0437\u0430 \u0441\u0435\u0431\u044f: \u043e\u043d \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438 \u0441\u043a\u0440\u043e\u043b\u043b\u0438\u043d\u0433\u0435 \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 (\u043e \u0441\u043a\u0440\u043e\u043b\u043b\u0438\u043d\u0433\u0435 \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435). Intent \u0438 State, \u043f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0445\u043e\u0434\u043e\u043c \u0438 \u0432\u044b\u0445\u043e\u0434\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430 CheeseSource.get(), \u0432\u043e\u043a\u0440\u0443\u0433 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0435\u0440\u0442\u0438\u0442\u0441\u044f \u0432\u0435\u0441\u044c \u0441\u043b\u043e\u0439.\u00a0<\/p>\n<p>\u0421\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u0445\u043e\u0434\u044b \u0438 \u0432\u044b\u0445\u043e\u0434\u044b \u0438 \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u0436\u0438\u0437\u043d\u0438 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 CheeseExecutor:<\/p>\n<pre><code class=\"kotlin\">class CheeseExecutor(     private val cheeseSource: CheeseSource ) : SuspendExecutor&lt;Intent, Unit, State, State, Nothing>() {     override suspend fun executeIntent(intent: Intent, getState: () -> State) {         when (intent) {             is LoadMore -> dispatch(getState().copy(items = cheeseSource.get(index)))         }     }      override suspend fun executeAction(action: Unit, getState: () -> State) {         dispatch(getState().copy(items = cheeseSource.get(0)))     } }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u043e\u043d \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0430 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u044f, \u043d\u043e \u0438 \u043e\u0442\u0434\u0430\u0451\u0442 \u043f\u0435\u0440\u0432\u0443\u044e \u043f\u043e\u0440\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b Store.<\/p>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0439 \u0432\u0430\u0436\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438: \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f CheeseSource!<\/p>\n<pre><code class=\"kotlin\">class CheeseDatabaseSource(     private val cheeseDao: CheeseDao ) : CheeseSource {     private val scope = CoroutineScope(Dispatchers.IO)     private val pager = \/* The same Pager.flow as in CheeseViewModel *\/      private val noopListUpdateCallback = object : ListUpdateCallback {         override fun onInserted(position: Int, count: Int) = Unit         override fun onChanged(position: Int, count: Int, payload: Any?) = Unit         override fun onMoved(fromPosition: Int, toPosition: Int) = Unit         override fun onRemoved(position: Int, count: Int) = Unit     }      private val dataDiffer = AsyncPagingDataDiffer(         diffCallback = CheeseAdapter.diffCallback,         updateCallback = noopListUpdateCallback,         mainDispatcher = Dispatchers.Default,         workerDispatcher = Dispatchers.Default     )      init {         scope.launch {             pager.collectLatest {                 dataDiffer.submitData(it)             }         }     }      override suspend fun get(index: Int): List&lt;CheeseListItem?> = with(dataDiffer) {         if (index in 0 until itemCount) {             getItem(index)             loadStateFlow.first {                 it.refresh !is LoadState.Loading             }         } else {             loadStateFlow.first {                 it.refresh.endOfPaginationReached || snapshot().isNotEmpty()             }         }         snapshot()     } }<\/code><\/pre>\n<p>CheeseDatabaseSource \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 Pager.flow \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 PagingData \u0438\u0437 \u043d\u0435\u0433\u043e \u0432 dataDiffer, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u043d\u0430\u043c\u0438 \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043f\u0438\u0441\u043a\u0430\u043c\u0438, \u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445!<\/p>\n<p>noopListUpdateCallback \u043d\u0443\u0436\u0435\u043d \u043b\u0438\u0448\u044c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f dataDiffer.<\/p>\n<p>\u0421\u0430\u043a\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 get() \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438, \u043e\u0434\u043d\u0430 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u0443\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u2014 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435. \u0415\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 dataDiffer \u043d\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u043c\u044b \u0436\u0434\u0451\u043c \u0438\u0445 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u043e\u043d\u0438 \u0435\u0441\u0442\u044c \u2014 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0438 \u0436\u0434\u0451\u043c, \u043f\u043e\u043a\u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430.<\/p>\n<p>ItemSnapshotList&lt;T> \u0438\u0437 Paging3 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 List&lt;T?>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0432\u043e\u043b\u044c\u043d\u044b \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u0432\u0435\u0440\u043d\u0443\u0442\u044c snapshot().<\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u043e\u0431\u0435\u0440\u0451\u043c \u0432\u0441\u0451 \u0432 CheeseStoreFactory:<\/p>\n<pre><code>class CheeseStoreFactory(     private val storeFactory: StoreFactory,     private val dao: CheeseDao ) {     fun create(): CheeseStore {         val storeDelegate = storeFactory.create(             name = CheeseStore::class.simpleName,             initialState = State(items = emptyList()),             executorFactory = { CheeseExecutor(CheeseDatabaseSource(dao)) },             bootstrapper = SimpleBootstrapper(Unit),             reducer = { it }         )         return object : CheeseStore, Store&lt;Intent, State, Nothing> by storeDelegate {}     } }<\/code><\/pre>\n<h2>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c CheeseView:<\/p>\n<pre><code class=\"kotlin\">interface CheeseView : MviView&lt;State, Intent><\/code><\/pre>\n<p>UI-\u0447\u0430\u0441\u0442\u044c \u0441\u044d\u043c\u043f\u043b\u0430 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c. \u041d\u0430\u0441, \u043f\u043e \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c, \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 CheeseAdapter, \u043a\u043e\u0442\u043e\u0440\u044b\u0439\u00a0 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f\u00a0 \u043e\u0442 PagingDataAdapter. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 CheeseViewHolder, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0441\u0430\u043c\u0438, \u0441\u0434\u0435\u043b\u0430\u0432 RecyclerView.Adapter \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u043c CheeseAdapter \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f AsyncListDiffer:<\/p>\n<pre><code class=\"kotlin\">class CheeseAdapter : RecyclerView.Adapter&lt;CheeseViewHolder>() {     var items = emptyList&lt;CheeseListItem>()         set(value) {             field = value             listDiffer.submitList(value)         }      private val listDiffer = AsyncListDiffer(this, diffCallback)      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = CheeseViewHolder(parent)      override fun onBindViewHolder(holder: CheeseViewHolder, position: Int) {         holder.bindTo(items[position])     }      override fun getItemCount() = items.size      companion object {         \/* The same as in PagingSample *\/     } }<\/code><\/pre>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/sockeqwe\/AdapterDelegates\"><u>AdapterDelegates<\/u><\/a>, \u043d\u043e \u0432\u043e \u0438\u043c\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430\u043c \u0441\u0430\u043c\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u044f\u0442\u044c \u0441\u043b\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c OnScrollListener, \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u044f\u044e\u0449\u0438\u0439 \u043e \u043a\u0430\u0436\u0434\u043e\u043c \u043d\u043e\u0432\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code>class CheeseScrollListener(     private val layoutManager: LinearLayoutManager,     private val loadMoreCallback: (Int) -> Unit ) : RecyclerView.OnScrollListener() {     private var previousFirstVisibleItem = 0     private var previousLastVisibleItem = 0      override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {         if (dy &lt; 0) {             previousFirstVisibleItem = layoutManager.findFirstVisibleItemPosition().also {                 if (previousFirstVisibleItem != it) {                     loadMoreCallback(it)                 }             }         } else {             previousLastVisibleItem = layoutManager.findLastVisibleItemPosition().also {                 if (previousLastVisibleItem != it) {                     loadMoreCallback(it)                 }             }         }     } }<\/code><\/pre>\n<p>\u0414\u0435\u043b\u043e \u0437\u0430 \u043c\u0430\u043b\u044b\u043c \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0451 \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 CheeseView:<\/p>\n<pre><code class=\"kotlin\">class CheeseViewImpl(     view: View ) : BaseMviView&lt;State, Intent>(), CheeseView {     private val recyclerView: RecyclerView = view.findViewById(R.id.cheeses)     private val adapter = CheeseAdapter()      init {         val layoutManager = LinearLayoutManager(view.context)         val scrollListener = CheeseScrollListener(layoutManager) {             dispatch(LoadMore(it))         }         recyclerView.layoutManager = layoutManager         recyclerView.adapter = adapter         recyclerView.addOnScrollListener(scrollListener)     }      override fun render(model: State) {         adapter.items = model.items     } }<\/code><\/pre>\n<p>\u0427\u0435\u0440\u0435\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430. \u0418\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/65apps\/mvi-paging3-sample\"><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/a>. \u041e\u043d \u0441\u043c\u043e\u0433 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 MVI, \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0432 \u043d\u043e\u0432\u0435\u0439\u0448\u0438\u0445 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u0438 Paging3 \u0441 \u0432\u0435\u043b\u0438\u043a\u0438\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0438\u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 \u0432\u0430\u0441 \u043d\u0430 \u043f\u0443\u0442\u0438 \u043a \u043c\u043e\u043b\u043d\u0438\u0435\u043d\u043e\u0441\u043d\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u0430\u043c\u0438!<\/p>\n<h2>\u0427\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435<\/h2>\n<p>Paging3 \u043e\u0431\u0448\u0438\u0440\u043d\u0430, \u0438 \u043d\u0435 \u0432\u0441\u0435 \u0435\u0451 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 MVI \u043c\u043e\u0433\u043b\u0438 \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u0415\u0441\u043b\u0438 \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u2014 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0439\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u0438\u043b\u0438 \u043f\u0438\u0448\u0438\u0442\u0435 \u043c\u043d\u0435 \u0432 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c @berdorge.\u00a0<\/p>\n<p>\u0415\u0449\u0435 \u043e\u0434\u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435, \u043f\u043e\u043c\u0438\u043c\u043e \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u2014 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435. \u041d\u0443 \u0438, \u0435\u0441\u043b\u0438 \u0442\u0435\u043c\u0430 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043d\u0430\u0434 \u0442\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0432\u0441\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n<p>\u041f\u0421. \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0441\u0430\u043c\u044b\u0439 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u043a\u0430\u043a\u043e\u0439 \u0441\u044b\u0440 \u043c\u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043f\u0440\u0430\u0437\u0434\u043d\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u043b\u044c \u044f\u0440\u043a\u0443\u044e \u043f\u043e\u0431\u0435\u0434\u0443? \ud83d\ude42<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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:\/\/habr.com\/ru\/articles\/585654\/\"> https:\/\/habr.com\/ru\/articles\/585654\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0413\u0435\u043e\u0440\u0433\u0438\u0439 \u0411\u0435\u0440\u0434\u043d\u0438\u043a\u043e\u0432. \u042f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 65apps, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 Android. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0435 \u0441 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c, \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u0434\u0432\u0443\u0445 \u0437\u0430\u0439\u0446\u0435\u0432 \u0438 \u0436\u0443\u0440\u0430\u0432\u043b\u044f \u0441 \u043d\u0435\u0431\u0430 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0443, \u043f\u0435\u0440\u0435\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u0441\u0442\u0430\u043b\u0430 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u0443\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/developer.android.com\/topic\/libraries\/architecture\/paging\/v3-overview\"><u>Paging3<\/u><\/a> \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0435\u0439. \u041e\u043d\u0430 \u0432\u0441\u0451 \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0430\u043c\u0430: \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0440\u0443\u0447\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0437\u0430\u0432\u0435\u0442\u0430\u043c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a MVI, MVVM \u0438 MVP. \u0421\u043d\u0430\u0440\u0443\u0436\u0438 \u0437\u0430\u0434\u0443\u043c\u043a\u0430 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0439, \u043d\u043e \u043e\u043d\u0430\u00a0 \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043b\u043e\u0436\u043a\u043e\u0439 \u0434\u0451\u0433\u0442\u044f \u0432 \u0431\u043e\u0447\u043a\u0435 \u043c\u0451\u0434\u0430. \u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441 \u043e\u0431\u0449\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c (\u043a \u0442\u0430\u043a\u0438\u043c \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0432 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 <a href=\"https:\/\/github.com\/arkivanov\/MVIKotlin\"><u>MVIKotlin<\/u><\/a>), \u043d\u0435 \u0441\u043c\u043e\u0433\u0443\u0442 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 Paging3.<\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443.\u00a0 \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043b\u0430\u0446\u0434\u0430\u0440\u043c\u0430 \u0434\u043b\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0439 \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d \u043d\u0435\u0431\u0435\u0437\u044b\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 <a href=\"https:\/\/github.com\/android\/architecture-components-samples\/tree\/master\/PagingSample\"><u>\u0441\u044d\u043c\u043f\u043b \u043e\u0442 Google<\/u><\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0438 \u0432\u043d\u0435\u0434\u0440\u0438\u043c <strong><em>\u043f\u043e\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u044e\u0434\u0430 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441\u0432\u043e\u0435\u0439 \u043c\u0435\u0447\u0442\u044b<\/em><\/strong> (\u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0439 MVIKotlin). \u041d\u0430\u0448 \u0432\u0437\u043e\u0440 \u043f\u0430\u0434\u0451\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 Paging3,\u00a0 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u0432 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0435.<\/p>\n<h2>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>\u0412\u0441\u0451, \u0447\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 Entity, DAO, \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u044b\u043c. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u043a\u0443\u0441\u043d\u043e\u0439! ???<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0421\u043b\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u043c \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 CheeseSource:<\/p>\n<pre><code class=\"kotlin\">interface CheeseSource {     suspend fun get(index: Int): List&lt;CheeseListItem?> }<\/code><\/pre>\n<p>Nullable-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u2014 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440\u043e\u0432, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0442\u043e\u043c\u0443, \u0447\u0442\u043e AsyncPagingDataDiffer.getItem() \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c null.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438. \u0412\u0441\u0442\u0440\u0435\u0447\u0430\u0439\u0442\u0435 \u2014\u00a0 CheeseStore:<\/p>\n<pre><code class=\"kotlin\">interface CheeseStore : Store&lt;Intent, State, Nothing> {     sealed class Intent {         class LoadMore(val index: Int) : Intent()     }      data class State(         val items: List&lt;CheeseListItem?>     ) }<\/code><\/pre>\n<p>Intent \u043e\u0434\u0438\u043d, \u0438 \u0435\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0441\u0430\u043c\u043e \u0437\u0430 \u0441\u0435\u0431\u044f: \u043e\u043d \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438 \u0441\u043a\u0440\u043e\u043b\u043b\u0438\u043d\u0433\u0435 \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 (\u043e \u0441\u043a\u0440\u043e\u043b\u043b\u0438\u043d\u0433\u0435 \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435). Intent \u0438 State, \u043f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0445\u043e\u0434\u043e\u043c \u0438 \u0432\u044b\u0445\u043e\u0434\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430 CheeseSource.get(), \u0432\u043e\u043a\u0440\u0443\u0433 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0435\u0440\u0442\u0438\u0442\u0441\u044f \u0432\u0435\u0441\u044c \u0441\u043b\u043e\u0439.\u00a0<\/p>\n<p>\u0421\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u0445\u043e\u0434\u044b \u0438 \u0432\u044b\u0445\u043e\u0434\u044b \u0438 \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u0436\u0438\u0437\u043d\u0438 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 CheeseExecutor:<\/p>\n<pre><code class=\"kotlin\">class CheeseExecutor(     private val cheeseSource: CheeseSource ) : SuspendExecutor&lt;Intent, Unit, State, State, Nothing>() {     override suspend fun executeIntent(intent: Intent, getState: () -> State) {         when (intent) {             is LoadMore -> dispatch(getState().copy(items = cheeseSource.get(index)))         }     }      override suspend fun executeAction(action: Unit, getState: () -> State) {         dispatch(getState().copy(items = cheeseSource.get(0)))     } }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u043e\u043d \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0430 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u044f, \u043d\u043e \u0438 \u043e\u0442\u0434\u0430\u0451\u0442 \u043f\u0435\u0440\u0432\u0443\u044e \u043f\u043e\u0440\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b Store.<\/p>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0439 \u0432\u0430\u0436\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438: \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f CheeseSource!<\/p>\n<pre><code class=\"kotlin\">class CheeseDatabaseSource(     private val cheeseDao: CheeseDao ) : CheeseSource {     private val scope = CoroutineScope(Dispatchers.IO)     private val pager = \/* The same Pager.flow as in CheeseViewModel *\/      private val noopListUpdateCallback = object : ListUpdateCallback {         override fun onInserted(position: Int, count: Int) = Unit         override fun onChanged(position: Int, count: Int, payload: Any?) = Unit         override fun onMoved(fromPosition: Int, toPosition: Int) = Unit         override fun onRemoved(position: Int, count: Int) = Unit     }      private val dataDiffer = AsyncPagingDataDiffer(         diffCallback = CheeseAdapter.diffCallback,         updateCallback = noopListUpdateCallback,         mainDispatcher = Dispatchers.Default,         workerDispatcher = Dispatchers.Default     )      init {         scope.launch {             pager.collectLatest {                 dataDiffer.submitData(it)             }         }     }      override suspend fun get(index: Int): List&lt;CheeseListItem?> = with(dataDiffer) {         if (index in 0 until itemCount) {             getItem(index)             loadStateFlow.first {                 it.refresh !is LoadState.Loading             }         } else {             loadStateFlow.first {                 it.refresh.endOfPaginationReached || snapshot().isNotEmpty()             }         }         snapshot()     } }<\/code><\/pre>\n<p>CheeseDatabaseSource \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 Pager.flow \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 PagingData \u0438\u0437 \u043d\u0435\u0433\u043e \u0432 dataDiffer, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u043d\u0430\u043c\u0438 \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043f\u0438\u0441\u043a\u0430\u043c\u0438, \u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445!<\/p>\n<p>noopListUpdateCallback \u043d\u0443\u0436\u0435\u043d \u043b\u0438\u0448\u044c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f dataDiffer.<\/p>\n<p>\u0421\u0430\u043a\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 get() \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438, \u043e\u0434\u043d\u0430 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u0443\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u2014 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435. \u0415\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 dataDiffer \u043d\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u043c\u044b \u0436\u0434\u0451\u043c \u0438\u0445 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u043e\u043d\u0438 \u0435\u0441\u0442\u044c \u2014 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0438 \u0436\u0434\u0451\u043c, \u043f\u043e\u043a\u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430.<\/p>\n<p>ItemSnapshotList&lt;T> \u0438\u0437 Paging3 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 List&lt;T?>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0432\u043e\u043b\u044c\u043d\u044b \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u0432\u0435\u0440\u043d\u0443\u0442\u044c snapshot().<\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u043e\u0431\u0435\u0440\u0451\u043c \u0432\u0441\u0451 \u0432 CheeseStoreFactory:<\/p>\n<pre><code>class CheeseStoreFactory(     private val storeFactory: StoreFactory,     private val dao: CheeseDao ) {     fun create(): CheeseStore {         val storeDelegate = storeFactory.create(             name = CheeseStore::class.simpleName,             initialState = State(items = emptyList()),             executorFactory = { CheeseExecutor(CheeseDatabaseSource(dao)) },             bootstrapper = SimpleBootstrapper(Unit),             reducer = { it }         )         return object : CheeseStore, Store&lt;Intent, State, Nothing> by storeDelegate {}     } }<\/code><\/pre>\n<h2>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c CheeseView:<\/p>\n<pre><code class=\"kotlin\">interface CheeseView : MviView&lt;State, Intent><\/code><\/pre>\n<p>UI-\u0447\u0430\u0441\u0442\u044c \u0441\u044d\u043c\u043f\u043b\u0430 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c. \u041d\u0430\u0441, \u043f\u043e \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c, \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 CheeseAdapter, \u043a\u043e\u0442\u043e\u0440\u044b\u0439\u00a0 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f\u00a0 \u043e\u0442 PagingDataAdapter. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 CheeseViewHolder, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0441\u0430\u043c\u0438, \u0441\u0434\u0435\u043b\u0430\u0432 RecyclerView.Adapter \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u043c CheeseAdapter \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f AsyncListDiffer:<\/p>\n<pre><code class=\"kotlin\">class CheeseAdapter : RecyclerView.Adapter&lt;CheeseViewHolder>() {     var items = emptyList&lt;CheeseListItem>()         set(value) {             field = value             listDiffer.submitList(value)         }      private val listDiffer = AsyncListDiffer(this, diffCallback)      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = CheeseViewHolder(parent)      override fun onBindViewHolder(holder: CheeseViewHolder, position: Int) {         holder.bindTo(items[position])     }      override fun getItemCount() = items.size      companion object {         \/* The same as in PagingSample *\/     } }<\/code><\/pre>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/sockeqwe\/AdapterDelegates\"><u>AdapterDelegates<\/u><\/a>, \u043d\u043e \u0432\u043e \u0438\u043c\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430\u043c \u0441\u0430\u043c\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u044f\u0442\u044c \u0441\u043b\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c OnScrollListener, \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u044f\u044e\u0449\u0438\u0439 \u043e \u043a\u0430\u0436\u0434\u043e\u043c \u043d\u043e\u0432\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code>class CheeseScrollListener(     private val layoutManager: LinearLayoutManager,     private val loadMoreCallback: (Int) -> Unit ) : RecyclerView.OnScrollListener() {     private var previousFirstVisibleItem = 0     private var previousLastVisibleItem = 0      override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {         if (dy &lt; 0) {             previousFirstVisibleItem = layoutManager.findFirstVisibleItemPosition().also {                 if (previousFirstVisibleItem != it) {                     loadMoreCallback(it)                 }             }         } else {             previousLastVisibleItem = layoutManager.findLastVisibleItemPosition().also {                 if (previousLastVisibleItem != it) {                     loadMoreCallback(it)                 }             }         }     } }<\/code><\/pre>\n<p>\u0414\u0435\u043b\u043e \u0437\u0430 \u043c\u0430\u043b\u044b\u043c \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0451 \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 CheeseView:<\/p>\n<pre><code class=\"kotlin\">class CheeseViewImpl(     view: View ) : BaseMviView&lt;State, Intent>(), CheeseView {     private val recyclerView: RecyclerView = view.findViewById(R.id.cheeses)     private val adapter = CheeseAdapter()      init {         val layoutManager = LinearLayoutManager(view.context)         val scrollListener = CheeseScrollListener(layoutManager) {             dispatch(LoadMore(it))         }         recyclerView.layoutManager = layoutManager         recyclerView.adapter = adapter         recyclerView.addOnScrollListener(scrollListener)     }      override fun render(model: State) {         adapter.items = model.items     } }<\/code><\/pre>\n<p>\u0427\u0435\u0440\u0435\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430. \u0418\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/65apps\/mvi-paging3-sample\"><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/a>. \u041e\u043d \u0441\u043c\u043e\u0433 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 MVI, \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0432 \u043d\u043e\u0432\u0435\u0439\u0448\u0438\u0445 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u0438 Paging3 \u0441 \u0432\u0435\u043b\u0438\u043a\u0438\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0438\u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 \u0432\u0430\u0441 \u043d\u0430 \u043f\u0443\u0442\u0438 \u043a \u043c\u043e\u043b\u043d\u0438\u0435\u043d\u043e\u0441\u043d\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u0430\u043c\u0438!<\/p>\n<h2>\u0427\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435<\/h2>\n<p>Paging3 \u043e\u0431\u0448\u0438\u0440\u043d\u0430, \u0438 \u043d\u0435 \u0432\u0441\u0435 \u0435\u0451 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 MVI \u043c\u043e\u0433\u043b\u0438 \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u0415\u0441\u043b\u0438 \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u2014 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0439\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u0438\u043b\u0438 \u043f\u0438\u0448\u0438\u0442\u0435 \u043c\u043d\u0435 \u0432 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c @berdorge.\u00a0<\/p>\n<p>\u0415\u0449\u0435 \u043e\u0434\u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435, \u043f\u043e\u043c\u0438\u043c\u043e \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u2014 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435. \u041d\u0443 \u0438, \u0435\u0441\u043b\u0438 \u0442\u0435\u043c\u0430 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043d\u0430\u0434 \u0442\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0432\u0441\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n<p>\u041f\u0421. \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0441\u0430\u043c\u044b\u0439 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u043a\u0430\u043a\u043e\u0439 \u0441\u044b\u0440 \u043c\u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043f\u0440\u0430\u0437\u0434\u043d\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u043b\u044c \u044f\u0440\u043a\u0443\u044e \u043f\u043e\u0431\u0435\u0434\u0443? \ud83d\ude42<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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:\/\/habr.com\/ru\/articles\/585654\/\"> https:\/\/habr.com\/ru\/articles\/585654\/<\/a><br \/><\/br><\/br><\/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-387331","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/387331","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=387331"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/387331\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=387331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=387331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=387331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}