صفحه بندی

کتابخانه صفحه‌بندی (Paging Library) بارگذاری تدریجی و روان داده‌ها را در RecyclerView برنامه شما آسان‌تر می‌کند.

این جدول تمام مصنوعات موجود در گروه androidx.paging را فهرست می‌کند.

مصنوع انتشار پایدار کاندیدای انتشار انتشار بتا انتشار آلفا
صفحه بندی-* ۳.۳.۶ - ۳.۴.۰-بتا۰۱ -
صفحه بندی-نوشتن ۳.۳.۶ - ۳.۴.۰-بتا۰۱ -
این کتابخانه آخرین بار در تاریخ ۱۷ دسامبر ۲۰۲۵ به‌روزرسانی شده است.

اعلام وابستگی‌ها

برای افزودن یک وابستگی به Paging، باید مخزن Google Maven را به پروژه خود اضافه کنید. برای اطلاعات بیشتر، مخزن Maven گوگل را مطالعه کنید.

وابستگی‌های مربوط به مصنوعات مورد نیاز خود را در فایل build.gradle برای برنامه یا ماژول خود اضافه کنید:

شیار

dependencies {
  def paging_version = "3.3.6"

  implementation "androidx.paging:paging-runtime:$paging_version"

  // alternatively - without Android dependencies for tests
  testImplementation "androidx.paging:paging-common:$paging_version"

  // optional - RxJava2 support
  implementation "androidx.paging:paging-rxjava2:$paging_version"

  // optional - RxJava3 support
  implementation "androidx.paging:paging-rxjava3:$paging_version"

  // optional - Guava ListenableFuture support
  implementation "androidx.paging:paging-guava:$paging_version"

  // optional - Jetpack Compose integration
  implementation "androidx.paging:paging-compose:3.4.0-beta01"
}

کاتلین

dependencies {
  val paging_version = "3.3.6"

  implementation("androidx.paging:paging-runtime:$paging_version")

  // alternatively - without Android dependencies for tests
  testImplementation("androidx.paging:paging-common:$paging_version")

  // optional - RxJava2 support
  implementation("androidx.paging:paging-rxjava2:$paging_version")

  // optional - RxJava3 support
  implementation("androidx.paging:paging-rxjava3:$paging_version")

  // optional - Guava ListenableFuture support
  implementation("androidx.paging:paging-guava:$paging_version")

  // optional - Jetpack Compose integration
  implementation("androidx.paging:paging-compose:3.4.0-beta01")
}

برای اطلاعات بیشتر در مورد استفاده از افزونه‌های کاتلین، به مستندات ktx مراجعه کنید.

برای اطلاعات بیشتر در مورد وابستگی‌ها، به بخش «افزودن وابستگی‌های ساخت» مراجعه کنید.

بازخورد

بازخورد شما به بهبود Jetpack کمک می‌کند. اگر مشکلات جدیدی کشف کردید یا ایده‌هایی برای بهبود این کتابخانه دارید، به ما اطلاع دهید. لطفاً قبل از ایجاد یک کتابخانه جدید، نگاهی به مشکلات موجود در این کتابخانه بیندازید. می‌توانید با کلیک بر روی دکمه ستاره، رأی خود را به یک مشکل موجود اضافه کنید.

ایجاد یک مسئله جدید

برای اطلاعات بیشتر به مستندات ردیاب مشکل مراجعه کنید.

نسخه ۳.۴

نسخه ۳.۴.۰-بتا۰۱

۱۷ دسامبر ۲۰۲۵

androidx.paging:paging-*:3.4.0-beta01 منتشر شد. نسخه 3.4.0-beta01 شامل این کامیت‌ها است.

رفع اشکالات

  • رفع مشکل مسابقه بین بارگذاری RecyclerView و Refresh که منجر به IndexOutOfBoundsException در RecyclerView می‌شد. وقفه در به‌روزرسانی‌های رابط کاربری به دلیل بارگذاری‌های مداوم Refresh می‌تواند باعث ناهمگامی وضعیت Paging با RecyclerView شود. این مشکل با تنظیم مجدد Paging به حالت قبل از Refresh در صورت قطع Refresh (یعنی توسط بارگذاری متوالی Refresh ) برطرف می‌شود. ( I771b0 ، b/409809768 )

نسخه ۳.۴.۰-آلفا۰۴

۱۰ سپتامبر ۲۰۲۵

androidx.paging:paging-*:3.4.0-alpha04 منتشر شد. نسخه 3.4.0-alpha04 شامل این کامیت‌ها است.

تغییرات API

  • یک API جدید PagingState closestItemAroundPosition اضافه شده است تا آیتم بارگذاری شده‌ای را که به موقعیت هدف نزدیک‌تر است و با گزاره ورودی مطابقت دارد، بازیابی کند. این می‌تواند برای تولید کلیدهای به‌روزرسانی مبتنی بر آیتم استفاده شود که در آن‌ها آیتم ایده‌آل برای لنگر انداختن در اطراف است اما دقیقاً در موقعیت هدف قرار ندارد. ( I96e5c ، b/440187139 )

نسخه ۳.۴.۰-آلفا۰۳

۲۷ آگوست ۲۰۲۵

androidx.paging:paging-*:3.4.0-alpha03 منتشر شد. نسخه 3.4.0-alpha03 شامل این کامیت‌ها است.

ویژگی‌های جدید

  • Paging-common دسکتاپ را به عنوان یک هدف جدید Kotlin Multiplatform (KMP) اضافه کرده است. در مجموع، اکنون از JVM (اندروید و دسکتاپ)، Native (لینوکس، iOS، watchOS، tvOS، macOS، MinGW) و وب (JavaScript، WasmJS) پشتیبانی می‌کند. ( Id2483 ، b/436884811 )
  • بخش Paging-testing، اهداف جدید Kotlin Multiplatform (KMP) را اضافه کرده است. در مجموع، اکنون از JVM (اندروید و دسکتاپ)، Native (لینوکس، iOS، watchOS، tvOS، macOS، MinGW) و وب (جاوااسکریپت، WasmJS) پشتیبانی می‌کند. ( I0c543 ، b/435014650 )
  • Paging-compose اهداف جدید Kotlin Multiplatform (KMP) را اضافه کرده است. در مجموع، اکنون از JVM (اندروید و دسکتاپ)، Native (لینوکس، iOS، watchOS، tvOS، macOS، MinGW) و وب (جاوااسکریپت، WasmJS) پشتیبانی می‌کند. ( I70d44 , b/436884801 )

تغییرات API

نسخه ۳.۴.۰-آلفا۰۲

۳۰ ژوئیه ۲۰۲۵

androidx.paging:paging-*:3.4.0-alpha02 منتشر شد. نسخه 3.4.0-alpha02 شامل این کامیت‌ها است.

تغییرات API

  • PagingData.from اکنون امکان تنظیم placeholdersBefore و placeholdersAfter را فراهم می‌کند. توجه داشته باشید که پیمایش بین این placeholderها باعث بارگذاری نمی‌شود. ( I06983 )

نسخه ۳.۴.۰-آلفا۰۱

۲ ژوئیه ۲۰۲۵

androidx.paging:paging-*:3.4.0-alpha01 منتشر شد. نسخه 3.4.0-alpha01 شامل این کامیت‌ها است.

ویژگی‌های جدید

رفع اشکالات

  • تست‌های واحد اندروید که Paging نسخه ۳.۳ یا بالاتر را دریافت می‌کنند، دیگر از PagingLogger ( Ia9400 ، b/331684448 ) اجرا نخواهند شد.
  • اشکالی که باعث می‌شد RecyclerView هنگام اسکرول کاربر هنگام به‌روزرسانی RecyclerView ( Id1f16 ، b/381024738 ) IndexOutOfBoundsException صادر کند، برطرف شد.
  • اشکالی که باعث می‌شد صفحه‌بندی هنگام رفرش کردن هنگام اسکرول کردن، نتواند بارگذاری‌های بیشتری را انجام دهد، برطرف شد. ( I60ca5 ، b/352586078 )
  • مشکل کرش کردن هنگام اسکرول کردن و رفرش کردن آیتم‌های صفحه‌بندی برطرف شد. ( I8c65a ، b/347649763 )

نسخه ۳.۳

نسخه ۳.۳.۶

۱۲ فوریه ۲۰۲۵

androidx.paging:paging-*:3.3.6 منتشر شد. نسخه ۳.۳.۶ شامل این کامیت‌ها است.

رفع اشکالات

  • سیگنال‌های به‌روزرسانی و تلاش مجدد که در طول به‌روزرسانی اولیه ارسال می‌شوند، اکنون ذخیره شده و پس از آماده شدن ارائه‌دهنده Paging، به‌طور خودکار دوباره ارسال می‌شوند.

مشارکت خارجی

  • از اوا بابت ارسال رفع اشکال ( #754 ) متشکریم.

نسخه ۳.۳.۵

۱۱ دسامبر ۲۰۲۴

androidx.paging:paging-*:3.3.5 منتشر شد. نسخه ۳.۳.۵ شامل این کامیت‌ها است.

رفع اشکالات

  • اشکالی که باعث می‌شد RecyclerView هنگام اسکرول کاربر هنگام به‌روزرسانی RecyclerView IndexOutOfBoundsException صادر کند، برطرف شد. ( Id1f16 ، b/381024738 )

نسخه ۳.۳.۴

۱۳ نوامبر ۲۰۲۴

androidx.paging:paging-*:3.3.4 منتشر شد. نسخه ۳.۳.۴ شامل این کامیت‌ها است.

رفع اشکالات

  • تست‌های واحد اندروید که Paging نسخه ۳.۳ یا بالاتر را اجرا می‌کنند، دیگر خطایی مانند Method isLoggable in android.util.Log not mocked ( Ia9400 ، b/331684448 ).

نسخه ۳.۳.۲

۷ آگوست ۲۰۲۴

androidx.paging:paging-*:3.3.2 منتشر شد. نسخه ۳.۳.۲ شامل این کامیت‌ها است.

ویژگی‌های جدید

  • paging-common و paging-testing اهداف جدید Kotlin-Multiplatform را اضافه کرده‌اند: watchos ، tvos و linuxArm64 ( 90c9768 )، ( 53e0eca )

نسخه ۳.۳.۱

۲۴ ژوئیه ۲۰۲۴

androidx.paging:paging-*:3.3.1 منتشر شد. نسخه ۳.۳.۱ شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی که باعث می‌شد AsyncPagingDataDiffer یا APIهای ساخته شده روی آن مانند PagingDataAdapter که با RecyclerView استفاده می‌شود، هنگام رفرش شدن منبع داده پشتیبان هنگام اسکرول کردن، قادر به بارگذاری بیشتر نباشند، برطرف شد. ( I60ca5 ، b/352586078 )
  • مشکلی که هنگام اسکرول کردن RecyclerView با استفاده از PagingDataAdapter یا AsyncPagingDataDiffer و حذف آیتم‌ها از منبع داده پشتیبان رخ می‌داد، برطرف شد. ( I8c65a ، b/347649763 )

نسخه ۳.۳.۰

۱۴ مه ۲۰۲۴

androidx.paging:paging-*:3.3.0 منتشر شد. نسخه ۳.۳.۰ شامل این کامیت‌ها است.

تغییرات مهم از زمان ۳.۲.۰

  • PagingDataPresenter اکنون یک کلاس عمومی است. ارائه‌دهنده‌های چندسکویی اکنون می‌توانند بر روی PagingDataPresenter ساخته شوند، به جای اینکه به APIهای داخلی Paging یا AsyncPagingDataDiffer از paging-runtime نیاز داشته باشند.
  • متدهای کمکی جدید LoadStates و CombinedLoadStates در hasError و isIdle اضافه شده‌اند تا بررسی کنند که LoadStates به ترتیب در حالت خطا یا NotLoading است. همچنین یک متد الحاقی کاتلین جدید awaitNotLoading() روی Flow<CombinedLoadStates> اضافه شده است که منتظر می‌ماند تا بارگذاری در حالت NotLoading یا خطا قرار گیرد.
  • PagingData.empty() اکنون به طور پیش‌فرض حالت‌های NotLoading ارسال می‌کند، مگر اینکه LoadStates سفارشی به سازنده‌اش ارسال شوند. این با رفتار فعلی که هنگام ارسال به PagingDataAdapter LoadStates ارسال نمی‌کرد یا حالت‌های Loading را هنگام جمع‌آوری به عنوان LazyPagingItems ارسال می‌کرد، متفاوت است. هنگامی که به عنوان LazyPagingItems جمع‌آوری می‌شود، اکنون بلافاصله پس از ترکیب اولیه، یک لیست خالی نیز نمایش می‌دهد.

سازگاری چند پلتفرمی کاتلین

Paging اکنون مصنوعاتی سازگار با Kotlin Multiplatform ارائه می‌دهد، که بخش عمده‌ای از آن به لطف کار بالادستی پروژه چند پلتفرمی-صفحه‌بندی CashApp است.

  • paging-common تمام APIهای Paging 3 را به common منتقل کرده است و اکنون علاوه بر اندروید با jvm و iOS نیز سازگار است.
  • paging-testing کد خود را به common منتقل کرده و اکنون علاوه بر اندروید با jvm و iOS نیز سازگار است.
  • paging-compose کد خود را به common منتقل کرده و یک مصنوع اندروید ارائه می‌دهد که با پشتیبانی چند پلتفرمی androidx.compose مطابقت دارد.
  • paging-runtime ، paging-guava ، paging-rxjava2 و paging-rxjava3 فقط برای اندروید باقی خواهند ماند.

نسخه ۳.۳.۰-rc01

۱ مه ۲۰۲۴

androidx.paging:paging-*:3.3.0-rc01 بدون هیچ تغییری در Paging 3.3.0-beta01 منتشر شده است. نسخه 3.3.0-rc01 شامل این کامیت‌ها است.

نسخه ۳.۳.۰-بتا۰۱

۳ آوریل ۲۰۲۴

androidx.paging:paging-*:3.3.0-beta01 بدون هیچ تغییر قابل توجهی منتشر شده است. نسخه 3.3.0-beta01 شامل این کامیت‌ها است.

نسخه ۳.۳.۰-آلفا۰۵

۲۰ مارس ۲۰۲۴

androidx.paging:paging-*:3.3.0-alpha05 منتشر شد. نسخه 3.3.0-alpha05 شامل این کامیت‌ها است.

تغییرات API

  • صفحه‌بندی اکنون از حاشیه‌نویسی AndroidX Annotation @MainThread برای کد مشترک استفاده می‌کند. ( I78f0d , b/327682438 )

نسخه ۳.۳.۰-آلفا۰۴

۶ مارس ۲۰۲۴

androidx.paging:paging-*:3.3.0-alpha04 منتشر شد. نسخه 3.3.0-alpha04 شامل این کامیت‌ها است.

رفع اشکالات

  • خطاهای جزئی مستندات مربوط به اضافه شدن سازگاری چند پلتفرمی کاتلین برطرف شد. ( aosp/2950785 )

نسخه ۳.۳.۰-آلفا۰۳

۷ فوریه ۲۰۲۴

androidx.paging:paging-*:3.3.0-alpha03 منتشر شد. نسخه 3.3.0-alpha03 شامل این کامیت‌ها است.

ویژگی‌های جدید

  • PagingDataPresenter اکنون یک کلاس عمومی است. ارائه‌دهنده‌های چندسکویی اکنون می‌توانند بر روی PagingDataPresenter ساخته شوند، به جای اینکه به APIهای داخلی Paging یا AsyncPagingDataDiffer مربوط به paging-runtime نیاز داشته باشند. ( Id1f74 ، b/315214786 )
  • متدهای کمکی جدید LoadStates و CombinedLoadStates برای بررسی اینکه LoadStates در حالت خطا یا NotLoading است، اضافه شد. همچنین یک API جدید اضافه شد که تا زمانی که بارگذاری در حالت NotLoading یا خطا قرار نگیرد، روی LoadStateFlow منتظر می‌ماند. ( Id6c67 )

تغییر رفتار

  • PagingData.empty() اکنون به طور پیش‌فرض حالت‌های NotLoading ارسال می‌کند، مگر اینکه LoadStates سفارشی به سازنده‌اش ارسال شوند. این با رفتار موجود که در آن LoadStates هنگام ارسال به PagingDataAdapter ارسال نمی‌کرد یا حالت‌های Loading را هنگام جمع‌آوری به عنوان LazyPagingItems ارسال می‌کرد، متفاوت است. هنگامی که به عنوان LazyPagingItems جمع‌آوری می‌شود، اکنون بلافاصله پس از ترکیب اولیه، یک لیست خالی نیز نمایش می‌دهد. ( I4d11d , b/301833847 )

نسخه ۳.۳.۰-آلفا۰۲

۲۰ سپتامبر ۲۰۲۳

androidx.paging:paging-*:3.3.0-alpha02 منتشر شد. نسخه 3.3.0-alpha02 شامل این کامیت‌ها است.

سازگاری چند پلتفرمی کاتلین

Paging اکنون مصنوعاتی سازگار با Kotlin Multiplatform ارائه می‌دهد که بخش عمده آن به لطف کار بالادستی پروژه چند پلتفرمی-صفحه‌بندی CashApp است. این امر به ما امکان می‌دهد از واگرایی بین دو مخزن جلوگیری کرده و آنها را سازگار نگه داریم.

  • paging-common تمام APIهای Paging 3 را به common منتقل کرده است و اکنون علاوه بر اندروید با jvm و iOS نیز سازگار است.
  • paging-testing کد خود را به common منتقل کرده و اکنون علاوه بر اندروید با jvm و iOS نیز سازگار است.
  • paging-compose کد خود را به common منتقل کرده و یک مصنوع اندروید ارائه می‌دهد که با پشتیبانی چند پلتفرمی androidx.compose مطابقت دارد.
  • paging-runtime ، paging-guava ، paging-rxjava2 و paging-rxjava3 فقط برای اندروید باقی خواهند ماند.

تغییرات API

  • رابط عمومی Logger که فقط برای استفاده داخلی در نظر گرفته شده بود، منسوخ شده است ( I16e95 ، b/288623117 )

مشارکت خارجی

نسخه ۳.۳.۰-آلفا۰۱

۲۰ سپتامبر ۲۰۲۳

  • این اولین نسخه چند پلتفرمی از کتابخانه‌های androidx.paging است. این نسخه فقط دارای مصنوعات *-jvm و *-android است. برای انواع macOS، iOS و لینوکس، 3.3.0-alpha02 استفاده کنید.

نسخه ۳.۲

نسخه ۳.۲.۱

۶ سپتامبر ۲۰۲۳

androidx.paging:paging-*:3.2.1 منتشر شد. نسخه ۳.۲.۱ شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی که باعث می‌شد API مربوط به asSnapshot() مربوط به مصنوع Paging Testing هنگام ارسال یک Flow ساخته شده با استفاده از PagingData.from(List) هنگ کند، برطرف شد، زیرا asSnapshot() هیچ اطلاعاتی در مورد زمان اتمام بارگذاری نداشت (برخلاف سربار PagingData.from(List, LoadStates) ). این راه حل فقط برای جریان‌های قابل تکمیل (مثلاً flowOf(PagingData.from(...)) ) کار می‌کند. برای جریان‌های غیرقابل تکمیل (مثلاً MutableStateFlow ، از سربار PagingData.from که LoadStates را ارائه می‌دهد استفاده کنید). ( I502c3 )
  • اکنون Paging Compose به صورت داخلی از AndroidUiDispatcher.Main استفاده می‌کند تا اطمینان حاصل شود که داده‌های جدید در همان فریم پس از اتمام بارگذاری در دسترس هستند. ( Ia55af )

نسخه ۳.۲.۰

۲۶ ژوئیه ۲۰۲۳

androidx.paging:paging-*:3.2.0 منتشر شد. نسخه ۳.۲.۰ شامل این کامیت‌ها است.

تغییرات مهم از زمان ۳.۱.۰

  • Paging Compose به پایداری API رسیده و دوباره با بقیه Paging ادغام شده است، جایی که نسخه آن اکنون با تمام مصنوعات Paging دیگر مطابقت دارد. تغییرات از نسخه ۳.۱.۰ عبارتند از:
    • پشتیبانی از پیش‌نمایش لیستی از داده‌های جعلی با ایجاد یک PagingData.from(fakeData) و قرار دادن آن PagingData در یک MutableStateFlow (به عنوان مثال MutableStateFlow(PagingData.from(listOf(1, 2, 3))) ). این جریان را به عنوان گیرنده برای collectAsLazyPagingItems() برای پیش‌نمایش، به composables @Preview Preview ارسال کنید.
    • پشتیبانی از تمام طرح‌بندی‌های تنبل مانند LazyVerticalGrid و HorizontalPager و همچنین کامپوننت‌های تنبل سفارشی از کتابخانه‌های Wear و TV. این امر از طریق متدهای افزونه جدید سطح پایین‌تر LazyPagingItems itemKey و itemContentType حاصل شده است که به شما کمک می‌کند پارامترهای key و contentType را در APIهای استاندارد items که از قبل برای LazyColumn ، LazyVerticalGrid و همچنین معادل‌های آنها در APIهایی مانند HorizontalPager وجود دارند، پیاده‌سازی کنید.
    • items(lazyPagingItems) و itemsIndexed(lazyPagingItems) که فقط از LazyListScope پشتیبانی می‌کنند، منسوخ شده‌اند.
  • محصول جدید paging-testing که APIهایی را ارائه می‌دهد که حول محور تست واحد هر لایه از برنامه شما و ادغام آن با صفحه‌بندی به صورت جداگانه طراحی شده‌اند. به عنوان مثال، شامل موارد زیر است:
    • کلاس TestPager که به شما امکان می‌دهد رفتار پیاده‌سازی سفارشی PagingSource خود را مستقل از Pager و رابط کاربری واقعی اعتبارسنجی کنید.
    • APIهای asPagingSourceFactory برای تبدیل یک Flow<List<Value>> یا یک List<Value> استاتیک به یک PagingSourceFactory که می‌تواند در تست‌ها به یک Pager ارسال شود.
    • افزونه‌ی کاتلین asSnapshot روی Flow<PagingData<Value>> که Flow<PagingData<Value>> را به یک List<Value> مستقیم تبدیل می‌کند. asSnapshot lambda به شما امکان می‌دهد رابط کاربری برنامه خود را از طریق APIهایی مانند scrollTo یا appendScrollWhile تقلید کنید تا بتوانید صحت snapshot داده‌ها را در هر نقطه از مجموعه داده‌های صفحه‌بندی شده خود تأیید کنید.
  • لاگ‌های پیش‌فرض برای نمایش اطلاعات اشکال‌زدایی صفحه‌بندی در دو سطح اضافه شده‌اند: VERBOSE و DEBUG . لاگ‌ها را می‌توان از طریق دستور adb shell setprop log.tag.Paging [DEBUG|VERBOSE] فعال کرد. این موضوع هم برای صفحه‌بندی با نماها و هم برای صفحه‌بندی با Compose صدق می‌کند.
  • سازنده‌هایی برای PagingDataAdapter و AsyncPagingDataDiffer اضافه شده است که به جای CoroutineDispatcher CoroutineContext می‌پذیرند.
  • یک رابط تابعی جدید PagingSourceFactory اضافه شده است که سطح API صریح‌تری نسبت به لامبداهای قبلی () -> PagingSource ارائه می‌دهد. این کارخانه می‌تواند برای نمونه‌سازی یک Pager استفاده شود.

نسخه ۳.۲.۰-rc01

۲۱ ژوئن ۲۰۲۳

androidx.paging:paging-*:3.2.0-rc01 منتشر شد. نسخه 3.2.0-rc01 شامل این کامیت‌ها است.

مشارکت خارجی

  • از ویندان به خاطر کمکش در دور کردن صفحه‌بندی از جزئیات اندروید/JVM متشکرم. ( #553 ، #554 ، #555 ، #559 )

نسخه ۳.۲.۰-بتا۰۱

۷ ژوئن ۲۰۲۳

androidx.paging:paging-*:3.2.0-beta01 منتشر شد. نسخه 3.2.0-beta01 شامل این کامیت‌ها است.

صفحه بندی

  • Paging Compose رسماً به پایداری API رسیده است. به همین ترتیب، نسخه از 1.0.0-alpha20 به‌روزرسانی شده است تا اکنون با نسخه سایر مصنوعات Paging مطابقت داشته باشد.

تغییرات API

نسخه ۳.۲.۰-alpha06

۲۴ مه ۲۰۲۳

androidx.paging:paging-*:3.2.0-alpha06 منتشر شد. نسخه 3.2.0-alpha06 شامل این کامیت‌ها است.

ویژگی‌های جدید

  • یک رابط تابعی جدید PagingSourceFactory اضافه شده است که سطح API صریح‌تری نسبت به لامبداهای موجود () -> PagingSource ارائه می‌دهد. این کارخانه می‌تواند برای نمونه‌سازی یک Pager استفاده شود. ( I33165 ، b/280655188 )
  • API جدید paging-testing List<Value>.asPagingSourceFactory() برای دریافت PagingSourceFactory که فقط از یک لیست تغییرناپذیر از داده‌ها بارگیری می‌شود، اضافه شد. افزونه موجود در Flow<List<Value>> همچنان باید برای آزمایش با چندین نسل از داده‌های استاتیک استفاده شود. ( Id34d1 ، b/280655188 )

تغییرات API

  • اکنون تمام APIهای عمومی در تست صفحه‌بندی با @VisibleForTesting حاشیه‌نویسی می‌شوند تا اطمینان حاصل شود که این APIها فقط در تست‌ها استفاده می‌شوند. ( I7db6e )
  • API asSnapshot دیگر نیازی به ارسال CoroutineScope ندارد. اکنون به طور پیش‌فرض از context به ارث رسیده از scope والد خود استفاده می‌کند. ( Id0a78 , b/282240990 )
  • پارامترهای سازنده TestPager دوباره مرتب شدند تا به طور شهودی با ترتیب پارامترهای سازنده Pager واقعی مطابقت داشته باشند ( I6185a )
  • استفاده‌ی تست صفحه‌بندیِ منتقل‌شده از نوع lambda () -> PagingSource<Key, Value> برای تایپ PagingSourceFactory<Key, Value> . ( I4a950 ، b/280655188 )

تغییرات رفتاری

  • دیگر نیازی به اجرای تست‌های asSnapshot Paging توسط توزیع‌کننده اصلی نیست. تنظیم آن دیگر هیچ تغییری در رفتار تست ایجاد نمی‌کند. ( Ie56ea )

نسخه ۳.۲.۰-آلفا۰۵

۳ مه ۲۰۲۳

androidx.paging:paging-*:3.2.0-alpha05 منتشر شد. نسخه 3.2.0-alpha05 شامل این کامیت‌ها است.

تغییرات API

  • API تست صفحه‌بندی asSnapshot اکنون پارامتر loadOperations خود را به صورت پیش‌فرض روی یک لامبدا خالی تنظیم می‌کند. این امر امکان فراخوانی asSnapshot را بدون ارسال هیچ عملیات بارگذاری برای بازیابی داده‌ها از بارگذاری اولیه رفرش فراهم می‌کند. ( Ied354 ، b/277233770 )

بهبودهای مستندات

  • مستندات مربوط به asPagingSourceFactory() به‌روزرسانی شد تا روشن شود که این یک متد الحاقی روی یک Flow است که یک factory قابل استفاده مجدد برای تولید نمونه‌های PagingSource برمی‌گرداند. ( I5ff4f ، I705b5 )
  • مستندات مربوط به سازنده LoadResult.Page به‌روزرسانی شد تا نیاز به بازنویسی itemsBefore و itemsAfter برای پشتیبانی از پرش روشن شود. ( Ied354 )

مشارکت‌های خارجی

نسخه ۳.۲.۰-آلفا۰۴

۸ فوریه ۲۰۲۳

androidx.paging:paging-*:3.2.0-alpha04 منتشر شد. نسخه 3.2.0-alpha04 شامل این کامیت‌ها است.

تست صفحه بندی

  • اکنون، آرتیفکت paging-testing شامل یک متد asPagingSourceFactory برای ایجاد یک pagingSourceFactory از Flow<List<Value>> است که قرار است به یک Pager ارائه شود. هر List<Value>> که از Flow منتشر می‌شود، نشان‌دهنده‌ی یک نسل از داده‌های Paged است. این امر، تست‌های صفحه‌بندی را، برای مثال، روی تبدیل‌های PagingData با جعل یک منبع داده برای Pager جهت جمع‌آوری از آن، تسهیل می‌کند. ( I6f230 ، b/235528239 )
  • ابزار paging-testing با APIهای جدید مناسب برای تأیید صحت داده‌های موجود در Flow<PagingData<T>> گسترش یافته است. برای مثال، می‌توان از این ابزار برای تأیید خروجی Flow<PagingData<T>> از لایه ViewModel خود استفاده کرد.

    این کار از طریق افزونه asSnapshot کاتلین روی Flow<PagingData<Value>> انجام می‌شود که Flow<PagingData<Value>> را به یک List<Value> مستقیم تبدیل می‌کند. لامبدای asSnapshot به شما امکان می‌دهد رابط کاربری برنامه خود را از طریق APIهایی مانند scrollTo یا appendScrollWhile به روشی تکرارپذیر و سازگار تقلید کنید تا بتوانید صحت snapshot داده‌ها را در هر نقطه از مجموعه داده‌های صفحه‌بندی شده خود تأیید کنید.

    // Create your ViewModel instance
    val viewModel = 
    // Get the Flow of PagingData from the ViewModel
    val data< Flow<PagingData<String>> = viewModel.data
    val snapshot: List<String> = data.asSnapshot {
      // Each operation inside the lambda waits for the data to settle before continuing
      scrollTo(index = 50)
    
      // While you can’t view the items within the asSnapshot call,
      // you can continuously scroll in a direction while some condition is true
      // i.e., in this case until you hit a placeholder item
      appendScrollWhile {  item: String -> item != Header 1 }
    }
    // With the asSnapshot complete, you can now verify that the snapshot
    // has the expected values
    

    asSnapshot یک متد suspend است که انتظار می‌رود درون runTest اجرا شود. برای اطلاعات بیشتر به بخش «آزمایش کوروتین‌های کاتلین روی اندروید» مراجعه کنید. ( I55fd2 ، I5bd26 ، I7ce34 ، I51f4d ، I2249f ، Id6223 ، Ic4bab ، Ib29b9 ، Ic1238 ، I96def ، b/235528239 )

تغییرات API

  • فراخوانی‌های رابط کاربری برای getItem و peek در AsyncPagingDataDiffer و PagingDataAdapter اکنون به درستی به عنوان فقط قابل فراخوانی در نخ اصلی علامت‌گذاری شده‌اند. ( I699b6 )
  • کاراکترهای عمومی (wildcards) از انواع داده عمومی مورد استفاده توسط TestPager حذف شدند و استفاده از نتایج این متدها در کد نوشته شده به زبان برنامه‌نویسی جاوا آسان‌تر شد. ( I56c42 )

نسخه ۳.۲.۰-آلفا۰۳

۲۴ اکتبر ۲۰۲۲

androidx.paging:paging-*:3.2.0-alpha03 منتشر شد. نسخه 3.2.0-alpha03 شامل این کامیت‌ها است.

تست صفحه بندی

این نسخه شامل یک مصنوع جدید به نام paging-testing است. این مصنوع، APIهایی را ارائه می‌دهد که حول محور تست واحد هر لایه از برنامه شما و ادغام آن با Paging به صورت جداگانه طراحی شده‌اند.

برای مثال، این اولین نسخه شامل یک کلاس TestPager است که به شما امکان می‌دهد رفتار پیاده‌سازی سفارشی PagingSource خود را مستقل از Pager و رابط کاربری واقعی که معمولاً برای شبیه‌سازی یکپارچه‌سازی صفحه‌بندی سرتاسری نیاز دارید، اعتبارسنجی کنید.

TestPager باید یک جعلی در نظر گرفت - یک تست دابل که پیاده‌سازی واقعی Pager را منعکس می‌کند و در عین حال یک سطح API ساده‌شده برای تست PagingSource ارائه می‌دهد. این APIها، APIهای suspend هستند و باید درون runTest اجرا شوند، همانطور که در راهنمای «تست کوروتین‌های کاتلین روی اندروید» آمده است.

نمونه‌ای از این APIهای مورد استفاده را می‌توان در تست‌های room-paging یافت که برای استفاده TestPager بازسازی شده‌اند.

تغییرات API

  • تکرار راحت روی LoadResult.Page.data از طریق LoadResult.Page.iterator() فعال می‌کند. این به طور غیرمستقیم امکان استفاده از متد flatten کتابخانه استاندارد کاتلین را هنگام دریافت List<LoadResult.Page> فراهم می‌کند، مانند خاصیت pages از PagingState که به متد PagingSource.getRefreshKey ارسال می‌شود. ( Ie0718 )

نسخه ۳.۲.۰-آلفا۰۲

۱۰ آگوست ۲۰۲۲

androidx.paging:paging-*:3.2.0-alpha02 منتشر شد. نسخه 3.2.0-alpha02 شامل این کامیت‌ها است.

ویژگی‌های جدید

  • صفحه‌بندی اکنون از طریق کلاس‌های AsyncPagingDataDiffer یا PagingDataAdapter لاگ‌هایی را ارائه می‌دهد تا اطلاعات اشکال‌زدایی جمع‌آوری‌شده از PagingData را نمایش دهد.
  • گزارش‌ها را می‌توان از طریق دستور adb shell adb shell setprop log.tag.Paging [DEBUG|VERBOSE]. ( b/235527159 )

رفع اشکالات

  • خطای از دست رفتن سازنده PagingDataDiffer هنگام استفاده از paging-common:3.2.0-alpha01 با paging-runtime:3.1.1 یا قدیمی‌تر ( b/235256201 ) برطرف شد.

نسخه ۳.۲.۰-آلفا۰۱

۱ ژوئن ۲۰۲۲

androidx.paging:paging-*:3.2.0-alpha01 منتشر شد. نسخه 3.2.0-alpha01 شامل این کامیت‌ها است.

تغییرات API

  • سازنده‌هایی برای PagingDataAdapter و AsyncPagingDataDiffer اضافه شده است که به جای CoroutineDispatcher CoroutineContext می‌پذیرند. ( Idc878 )
  • به طور پیش‌فرض، PagingData.from() و PagingData.empty() دیگر بر CombinedLoadStates در سمت Presenter تأثیری نخواهند گذاشت. یک overload جدید که امکان ارسال sourceLoadStates و remoteLoadStates را به این سازنده‌ها فراهم می‌کند، اضافه شده است تا رفتار موجود در تنظیم LoadStates به صورت کاملاً ترمینالی (یعنی NotLoading(endOfPaginationReached = false) ) را حفظ کند، با این گزینه که در صورت نیاز، حالت‌های ریموت را نیز شامل شود. اگر LoadStates ارسال نشود، CombinedLoadStates قبلی هنگام دریافت PagingData استاتیک در سمت Presenter حفظ خواهد شد. ( Ic3ce5 , b/205344028 )

رفع اشکالات

  • نتیجه‌ی PagingSource.getRefreshKey() اکنون در مواردی که مقدار null برمی‌گرداند، اما initialKey غیر null تنظیم شده است، به درستی بر initialKey اولویت‌بندی می‌شود. ( Ic9542 ، b/230391606 )

مشارکت خارجی

  • به‌روزرسانی‌شده در :compose:ui:ui-test api (updateApi) به دلیل مهاجرت test-coroutines-lib ( I3366d )

نسخه ۳.۱

نسخه ۳.۱.۱

۹ مارس ۲۰۲۲

androidx.paging:paging-*:3.1.1 منتشر شد. نسخه 3.1.1 شامل این کامیت‌ها است.

رفع اشکالات

  • رویدادهای LoadState.NotLoading میانی بین نسل‌هایی که به اشتباه توسط .cachedIn() درج شده بودند، حذف شدند. این تغییر با حذف رویدادهای LoadState.NotLoading تکراری که بین تلاش‌های مجدد برای بارگذاری‌های ناموفق، هنگام به‌روزرسانی یا در طول نامعتبرسازی ایجاد می‌شدند، واکنش به تغییرات LoadState را بسیار آسان‌تر می‌کند.

نسخه ۳.۱.۰

۱۷ نوامبر ۲۰۲۱

androidx.paging:paging-*:3.1.0 منتشر شد. نسخه ۳.۱.۰ شامل این کامیت‌ها است.

تغییرات مهم از زمان ۳.۰.۰

  • APIهای Flow<PagingData>.observable و Flow<PagingData>.flowable دیگر آزمایشی نیستند.
  • تغییرات رفتاری در LoadState :
    • endOfPaginationReached اکنون برای LoadType.REFRESH هم برای PagingSource و هم RemoteMediator همیشه false است.
    • LoadStates از Paging اکنون قبل از انتشار در پایین‌دست، منتظر مقادیر معتبر از PagingSource و RemoteMediator می‌ماند. نسل‌های جدید PagingData اکنون همیشه به درستی با Loading for refresh state شروع می‌شوند، به جای اینکه در برخی موارد به اشتباه به NotLoading تنظیم مجدد شوند.
    • .loadStateFlow و .addLoadStateListener در APIهای ارائه‌دهنده، دیگر به طور زائد CombinedLoadStates اولیه را که همیشه حالت‌های واسطه روی null تنظیم شده است، ارسال نمی‌کنند.
  • لغو در نسل‌های گذشته اکنون به سرعت در هنگام نامعتبرسازی/نسل‌های جدید اتفاق می‌افتد. دیگر نیازی به استفاده از .collectLatest در Flow<PagingData> نیست، اگرچه هنوز هم توصیه می‌شود این کار را انجام دهید.
  • PagingSource.LoadResult.Invalid به عنوان یک نوع بازگشتی جدید از PagingSource.load اضافه شده است، که باعث می‌شود Paging هرگونه درخواست بارگذاری در حال انتظار یا آینده به این PagingSource را رد کرده و آن را نامعتبر کند. این نوع بازگشتی برای مدیریت داده‌های نامعتبر یا قدیمی که می‌توانند از پایگاه داده یا شبکه بازگردانده شوند، طراحی شده است.
  • APIهای ارائه‌دهنده‌ی .onPagesPresented و .addOnPagesUpdatedListener اضافه شده‌اند که همزمان با ارائه صفحات در رابط کاربری، فعال می‌شوند. به‌روزرسانی‌های صفحه می‌توانند در سناریوهای زیر اتفاق بیفتند:
    • بارگذاری اولیه‌ی نسل جدیدی از PagingData، صرف نظر از اینکه آیا نسل جدید شامل تغییراتی در موارد ارائه شده است یا خیر، تکمیل می‌شود. یعنی، نسل جدیدی که بارگذاری اولیه را بدون هیچ به‌روزرسانی انجام می‌دهد، زیرا لیست دقیقاً یکسان است، همچنان این فراخوانی را آغاز می‌کند.
    • یک صفحه درج شده است، حتی اگر صفحه درج شده حاوی هیچ مورد جدیدی نباشد.
    • یک صفحه حذف می‌شود، حتی اگر صفحه حذف شده خالی باشد.

نسخه ۳.۱.۰-rc01

۳ نوامبر ۲۰۲۱

androidx.paging:paging-*:3.1.0-rc01 منتشر شد. نسخه 3.1.0-rc01 شامل این کامیت‌ها است.

رفع اشکالات

  • مشکل شرایط رقابتی + نشت حافظه در .cachedIn() در مواردی که چندین رویداد بارگذاری توسط Paging downstream ارسال می‌شد در حالی که هیچ ناظری وجود نداشت یا بین زمانی که یک ناظر در حال تغییر به یک PagingData جدید بود، برطرف شد. ( Ib682e )

نسخه ۳.۱.۰-بتا۰۱

۱۳ اکتبر ۲۰۲۱

androidx.paging:paging-*:3.1.0-beta01 منتشر شد. نسخه 3.1.0-beta01 شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی که باعث می‌شد دسترسی‌های سریع به آیتم‌های زیاد، باعث حذف آن‌ها برای بررسی در prefetchDistance شود و باعث توقف بارگذاری صفحه شود، برطرف شد. این مشکل به ویژه زمانی پیش می‌آید که آیتم‌های زیادی به طور همزمان و به ترتیبی چیده شده باشند که اولویت بارگذاری را بر اساس جهت اسکرول کاربر تعیین کند. این دسترسی‌های به آیتم‌ها اکنون بافر شده و به صورت همزمان اولویت‌بندی می‌شوند تا از حذف آن‌ها جلوگیری شود. ( aosp/1833273 )

نسخه ۳.۱.۰-آلفا۰۴

۲۹ سپتامبر ۲۰۲۱

androidx.paging:paging-*:3.1.0-alpha04 منتشر شد. نسخه 3.1.0-alpha04 شامل این کامیت‌ها است.

تغییرات API

  • APIهای Flow<PagingData>.observable و Flow<PagingData>.flowable دیگر آزمایشی نیستند. ( Ie0bdd )

رفع اشکالات

  • برای LoadStates، endOfPaginationReached اکنون برای LoadType.REFRESH همیشه false است. پیش از این، endOfPaginationReached برای RemoteMediator REFRESH می‌توانست true باشد، اما برای PagingSource اینطور نبود. این رفتار اکنون طوری تنظیم شده است که همیشه false برگرداند زیرا هرگز منطقی نیست که REFRESH ترمینال باشد و اکنون به عنوان بخشی از قرارداد API در LoadStates مستند شده است. هنگام تصمیم‌گیری در مورد خاتمه صفحه‌بندی، همیشه باید این کار را با توجه به دستورالعمل‌های APPEND یا PREPEND انجام دهید. ( I047b6 )
  • LoadStates از Paging اکنون قبل از انتشار downstream بین نسل‌ها، منتظر مقادیر معتبر از PagingSource و RemoteMediator می‌ماند. این امر مانع از آن می‌شود که نسل‌های جدید PagingData در CombinedLoadStates.source.refresh، اگر از قبل در حال بارگذاری بوده است، NotLoading ارسال کنند. نسل‌های جدید PagingData اکنون همیشه به درستی با Loading for refresh شروع می‌شوند، به جای اینکه در برخی موارد ابتدا به اشتباه به NotLoading تنظیم مجدد شوند.

    لغو در نسل‌های گذشته اکنون به راحتی در هنگام نامعتبرسازی/نسل‌های جدید اتفاق می‌افتد. دیگر نیازی به استفاده از .collectLatest در Flow<PagingData> نیست، اگرچه هنوز هم اکیداً توصیه می‌شود که این کار را انجام دهید. ( I0b2b5 ، b/177351336 ، b/195028524 )

  • .loadStateFlow و .addLoadStateListener در APIهای ارائه‌دهنده، دیگر به طور زائد CombinedLoadStates اولیه را که همیشه حالت‌های واسطه روی null و حالت‌های منبع روی NotLoading(endOfPaginationReached = false) تنظیم شده است، ارسال نمی‌کنند. این به این معنی است که:

    1. اگر از RemoteMediator استفاده کنید، وضعیت‌های میانجی همیشه پر می‌شوند.
    2. ثبت یک شنونده‌ی loadState جدید یا یک جمع‌کننده‌ی جدید روی .loadStateFlow ‎ دیگر در صورتی که CombinedLoadStates واقعی را از PagingData دریافت نکرده باشد، مقدار فعلی را فوراً منتشر نمی‌کند. این اتفاق می‌تواند زمانی رخ دهد که یک جمع‌کننده یا جمع‌کننده قبل از ارسال PagingData شروع به کار کند. ( I1a748 )

نسخه ۳.۱.۰-alpha03

۲۱ ژوئیه ۲۰۲۱

androidx.paging:paging-*:3.1.0-alpha03 منتشر شد. نسخه 3.1.0-alpha03 شامل این کامیت‌ها است.

تغییرات API

  • نوع بازگشتی سوم LoadResult با نام LoadResult.Invalid به PagingSource اضافه می‌شود. وقتی PagingSource.load مقدار LoadResult.Invalid را برمی‌گرداند، paging داده‌های بارگذاری شده را دور می‌ریزد و PagingSource را نامعتبر می‌کند. این نوع بازگشتی برای مدیریت داده‌های نامعتبر یا قدیمی که می‌توانند از پایگاه داده یا شبکه بازگردانده شوند، طراحی شده است.

    برای مثال، اگر پایگاه داده‌ی اصلی در آن نوشته شود اما PagingSource به موقع نامعتبر نشود، اگر پیاده‌سازی آن به تغییرناپذیری مجموعه داده‌ی پشتیبان که از آن بارگذاری می‌شود بستگی داشته باشد (مثلاً پیاده‌سازی‌های پایگاه داده‌ی سبک LIMIT OFFSET)، ممکن است نتایج متناقضی را برگرداند. در این سناریو، توصیه می‌شود پس از بارگذاری، نامعتبر بودن بررسی شود و LoadResult.Invalid برگردانده شود، که باعث می‌شود Paging هرگونه درخواست بارگذاری در حال انتظار یا آینده به این PagingSource را رد کند و آن را نامعتبر کند.

    این نوع بازگشتی همچنین توسط Paging2 API که از LivePagedList یا RxPagedList بهره می‌برد، پشتیبانی می‌شود. هنگام استفاده از PagingSource با APIهای PagedList مربوط به Paging2، PagedList بلافاصله جدا می‌شود و تلاش‌های بیشتر برای بارگذاری داده‌ها در این PagedList را متوقف می‌کند و باعث نامعتبرسازی در PagingSource می‌شود.

    LoadResult یک کلاس مهر و موم شده است، به این معنی که این یک تغییر ناسازگار با منبع است، به طوری که موارد استفاده‌ای که مستقیماً از نتایج PagingSource.load استفاده می‌کنند، باید LoadResult.Invalid را در زمان کامپایل مدیریت کنند. به عنوان مثال، کاربران Kotlin که از exhaustive-when برای بررسی نوع بازگشتی استفاده می‌کنند، باید یک بررسی برای نوع Invalid اضافه کنند. ( Id6bd3 ، b/191806126 ، b/192013267 )

رفع اشکالات

  • فراخوانی‌های نامعتبرسازی که از طریق PagingSource.registerInvalidatedCallback یا DataSource.addInvalidatedCallback اضافه شده‌اند، اکنون اگر در یک PagingSource / DataSource که از قبل نامعتبر بوده ثبت شده باشند، به طور خودکار فعال می‌شوند. این کار، مشکل رقابتی که باعث می‌شد Paging سیگنال‌های نامعتبرسازی را رها کند و در هنگام ارائه منبعی که در طول بارگذاری اولیه نامعتبر بوده، گیر کند را برطرف می‌کند. علاوه بر این، فراخوانی‌های نامعتبرسازی اکنون پس از فعال شدن به درستی حذف می‌شوند، زیرا تضمین می‌شود که حداکثر یک بار فراخوانی شوند. ( I27e69 )
  • ارسال مقدار اولیه‌ی placeholder (InitialPagedList) از یک جریان PagedList که به تازگی نمونه‌سازی شده است، مثلاً LivePagedListBuilder یا RxPagedListBuilder، دیگر داده‌های بارگذاری شده‌ی قبلی را پاک نمی‌کند.

نسخه ۳.۱.۰-آلفا۰۲

۱ ژوئیه ۲۰۲۱

androidx.paging:paging-*:3.1.0-alpha02 منتشر شد. نسخه 3.1.0-alpha02 شامل این کامیت‌ها است.

ویژگی‌های جدید

  • رابط‌های برنامه‌نویسی شنونده و ارائه‌دهنده جریان onPagesPresented اضافه شدند که بلافاصله پس از به‌روزرسانی صفحات ارائه شده در رابط کاربری فعال می‌شوند.

    از آنجایی که این به‌روزرسانی‌ها با رابط کاربری همزمان هستند، می‌توانید متدهای آداپتور مانند .snapshot و .getItemCount را برای بررسی وضعیت پس از اعمال به‌روزرسانی فراخوانی کنید. توجه داشته باشید که .snapshot() به صورت صریح فراخوانی شده است زیرا انجام آن در هر به‌روزرسانی می‌تواند پرهزینه باشد.

    به‌روزرسانی‌های صفحه می‌توانند در سناریوهای زیر اتفاق بیفتند:

    • بارگذاری اولیه‌ی نسل جدیدی از PagingData، صرف نظر از اینکه آیا نسل جدید شامل تغییراتی در موارد ارائه شده است یا خیر، تکمیل می‌شود. یعنی، نسل جدیدی که بارگذاری اولیه را بدون هیچ به‌روزرسانی انجام می‌دهد، زیرا لیست دقیقاً یکسان است، همچنان این فراخوانی را آغاز می‌کند.
    • یک صفحه درج شده است، حتی اگر صفحه درج شده حاوی هیچ مورد جدیدی نباشد
    • یک صفحه حذف می‌شود، حتی اگر صفحه حذف شده خالی باشد ( I272c9 , b/189999634 )

رفع اشکالات

  • دسترسی به PagedList.dataSource از مقدار اولیه تولید شده توسط LivePagedList یا RxPagedList دیگر به اشتباه خطای IllegalStateException ( I96707 ) را صادر نمی‌کند.

نسخه ۳.۱.۰-آلفا۰۱

۲ ژوئن ۲۰۲۱

androidx.paging:paging-*:3.1.0-alpha01 منتشر شد. نسخه 3.1.0-alpha01 شامل این کامیت‌ها است.

تغییرات API

  • کلاس‌های ارائه شده توسط paging-rxjava3 اکنون تحت بسته androidx.paging.rxjava3 قرار می‌گیرند تا با paging-rxjava2 ( Ifa7f6 ) تداخل نداشته باشند.

رفع اشکالات

  • مشکلی که باعث می‌شد Paging گاهی اوقات رویدادهای no-op different را به RecyclerView ارسال کند، برطرف شد. این امر می‌توانست باعث شود برخی از listenerها زودتر فعال شوند. ( Ic507f ، b/182510751 )

مشارکت خارجی

  • APIهای سازگار با PagedList منسوخ‌شده به مصنوع rxjava3 اضافه شدند ( Id1ce2 ، b/182497591 )

صفحه‌بندی و نوشتن نسخه ۱.۰.۰

نسخه ۱.۰.۰-آلفا۲۰

۲۴ مه ۲۰۲۳

androidx.paging:paging-compose:1.0.0-alpha20 منتشر شد. نسخه 1.0.0-alpha20 شامل این کامیت‌ها است.

ویژگی‌های جدید

  • Paging Compose اکنون از پیش‌نمایش لیستی از داده‌های جعلی با ایجاد یک PagingData.from(fakeData) و قرار دادن آن PagingData در یک MutableStateFlow (مثلاً، MutableStateFlow(PagingData.from(listOf(1, 2, 3))) ) پشتیبانی می‌کند. با استفاده از آن داده‌ها به عنوان ورودی در @Preview ، فراخوانی‌های collectAsLazyPagingItems() باعث می‌شود LazyPagingItems قابل پیش‌نمایش باشند. ( I8a78d , b/194544557 )

رفع اشکالات

  • داده‌های ذخیره‌شده از pager.flow.cachedIn که در LazyPagingItems جمع‌آوری شده‌اند، اکنون بلافاصله پس از بازیابی وضعیت، بدون نیاز به جمع‌آوری ناهمزمان، در دسترس خواهند بود. این بدان معناست که داده‌های ذخیره‌شده بلافاصله پس از بازیابی وضعیت، پس از ترکیب اولیه، آماده ارائه خواهند بود. ( I97a60 ، b/177245496 )

نسخه ۱.۰.۰-آلفا۱۹

۳ مه ۲۰۲۳

androidx.paging:paging-compose:1.0.0-alpha19 منتشر شد. نسخه 1.0.0-alpha19 شامل این کامیت‌ها است.

پشتیبانی از همه طرح‌بندی‌های تنبل

Previously, Paging Compose provided custom items and itemsIndexed extensions on LazyListScope , which meant that you could not use Paging Compose with other lazy layouts like LazyVerticalGrid , HorizontalPager , or other custom lazy components provided by the Wear and TV libraries. Addressing this inflexibility is the primary update for this release.

To support more lazy layouts, we needed to build out APIs at a different layer - rather than providing a custom items API for each lazy layout, Paging Compose now provides slightly lower level extension methods on LazyPagingItems in itemKey and itemContentType . These APIs focus on helping you implement the key and contentType parameters to the standard items APIs that already exist for LazyColumn , LazyVerticalGrid as well as their equivalents in APIs like HorizontalPager . ( Ifa13b , Ib04f0 , b/259385813 )

This means that supporting a LazyVerticalGrid would look like:

// This part is unchanged
val lazyPagingItems = pager.collectAsLazyPagingItems()

LazyVerticalGrid(columns = GridCells.Fixed(2)) {
  // Here we use the standard items API
  items(
    count = lazyPagingItems.itemCount,
    // Here we use the new itemKey extension on LazyPagingItems to
    // handle placeholders automatically, ensuring you only need to provide
    // keys for real items
    key = lazyPagingItems.itemKey { it.uniqueId },
    // Similarly, itemContentType lets you set a custom content type for each item
    contentType = lazyPagingItems.itemContentType { "contentType" }
  ) { index ->
    // As the standard items call provides only the index, we get the item
    // directly from our lazyPagingItems
    val item = lazyPagingItems[index]
    PagingItem(item = item)
  }
}

For more examples of using these new APIs, please see our samples .

While these changes do make the LazyColumn and LazyRow examples a few lines longer, we felt that consistency across all lazy layouts was an important factor for those using Paging Compose going forward. For that reason, the existing extensions to LazyListScope have now been deprecated. ( I0c459 , I92c8f , b/276989796 )

تغییرات API

  • To ease the migration to the new APIs, the items and itemsIndexed extension functions on LazyListScope now support a contentType parameter, mirroring the support in the new APIs. ( Ib1918 , b/255283378 )

به‌روزرسانی‌های وابستگی

  • Paging Compose has updated its dependency from Compose 1.0.5 to Compose 1.2.1. ( Ib1918 , b/255283378 )

Version 1.0.0-alpha18

۸ فوریه ۲۰۲۳

androidx.paging:paging-compose:1.0.0-alpha18 is released with no changes. Version 1.0.0-alpha18 contains these commits.

Version 1.0.0-alpha17

۲۴ اکتبر ۲۰۲۲

androidx.paging:paging-compose:1.0.0-alpha17 is released. Version 1.0.0-alpha17 contains these commits.

ویژگی‌های جدید

Version 1.0.0-alpha16

۱۰ آگوست ۲۰۲۲

androidx.paging:paging-compose:1.0.0-alpha16 is released. Version 1.0.0-alpha16 contains these commits.

ویژگی‌های جدید

  • Paging now provides logs via the LazyPagingItems class to expose debugging information collected from PagingData.
  • The logs can be enabled via the adb shell command adb shell setprop log.tag.Paging [DEBUG|VERBOSE] . ([b/235527159}(https://issuetracker.google.com/issues/235527159))

رفع اشکالات

  • Fixed the missing PagingDataDiffer constructor error when using paging-compose:1.0.0-alpha15 with paging-common:3.1.1 or older.( b/235256201 , b/239868768 )

Version 1.0.0-alpha15

۱ ژوئن ۲۰۲۲

androidx.paging:paging-compose:1.0.0-alpha15 is released. Version 1.0.0-alpha15 contains these commits.

تغییرات API

  • Added constructors for PagingDataAdapter and AsyncPagingDataDiffer which accept CoroutineContext instead of CoroutineDispatcher . ( Idc878 )

رفع اشکالات

  • LazyPagingItems now sets the initial loadState to have a LoadState.Loading refresh. ( I55043 , b/224855902 )

Version 1.0.0-alpha14

۱۳ اکتبر ۲۰۲۱

androidx.paging:paging-compose:1.0.0-alpha14 is released. Version 1.0.0-alpha14 contains these commits.

Version 1.0.0-alpha13

۲۹ سپتامبر ۲۰۲۱

androidx.paging:paging-compose:1.0.0-alpha13 is released. Version 1.0.0-alpha13 contains these commits.

تغییرات API

  • LazyPagingItems.snapshot() function was replaced with LazyPagingItems.itemSnapshotList property ( Ie2da8 )
  • Deprecated LazyPagingItems.getAsState() was removed ( Ie65e4 )

Version 1.0.0-alpha12

۲۱ ژوئیه ۲۰۲۱

androidx.paging:paging-compose:1.0.0-alpha12 is released. Version 1.0.0-alpha12 contains these commits.

تغییرات API

  • items(lazyPagingItems) and itemsIndexed(lazyPagingItems) used to connect Paging with LazyColumn/Row now accept the option key param which allows you to specify a stable key representing the item. You can read more about keys here. ( I7986d )
  • Function lazyPagingItems.getAsState(index) is now deprecated. Use lazyPagingItems[index] instead. ( I086cb , b/187339372 )

Version 1.0.0-alpha11

۳۰ ژوئن ۲۰۲۱

androidx.paging:paging-compose:1.0.0-alpha11 is released. Version 1.0.0-alpha11 contains these commits.

Version 1.0.0-alpha10

۲ ژوئن ۲۰۲۱

androidx.paging:paging-compose:1.0.0-alpha10 is released. Version 1.0.0-alpha10 contains these commits.

نسخه ۱.۰.۰-آلفا۰۹

May 18, 2021

androidx.paging:paging-compose:1.0.0-alpha09 is released. Version 1.0.0-alpha09 contains these commits.

رفع اشکالات

  • LazyPagingItems' itemCount and item getter are now observable which allows it to be used with LazyVerticalGrid as well ( Ie2446 , b/171872064 , b/168285687 )

Compose Compatibility

  • androidx.paging:paging-compose:1.0.0-alpha09 is only compatible with Compose version 1.0.0-beta07 and above.

نسخه ۱.۰.۰-آلفا۰۸

۲۴ فوریه ۲۰۲۱

androidx.paging:paging-compose:1.0.0-alpha08 is released. Version 1.0.0-alpha08 contains these commits.

Updated to integrate with Compose 1.0.0-beta01.

نسخه ۱.۰.۰-آلفا۰۷

۱۰ فوریه ۲۰۲۱

androidx.paging:paging-compose:1.0.0-alpha07 is released. Version 1.0.0-alpha07 contains these commits.

Updated to integrate with Compose alpha12.

نسخه ۱.۰.۰-alpha06

۲۸ ژانویه ۲۰۲۱

androidx.paging:paging-compose:1.0.0-alpha06 is released. Version 1.0.0-alpha06 contains these commits.

رفع اشکالات

Updated to depend on Compose 1.0.0-alpha11.

نسخه ۱.۰.۰-آلفا۰۵

۱۳ ژانویه ۲۰۲۱

androidx.paging:paging-compose:1.0.0-alpha05 is released. Version 1.0.0-alpha05 contains these commits.

Updated to depend on Compose 1.0.0-alpha10.

نسخه ۱.۰.۰-آلفا۰۴

۱۶ دسامبر ۲۰۲۰

androidx.paging:paging-compose:1.0.0-alpha04 is released. Version 1.0.0-alpha04 contains these commits.

رفع اشکالات

  • Updated the convenience properties, CombinedLoadStates.refresh , CombinedLoadStates.prepend , CombinedLoadStates.append to only transition from Loading to NotLoading after both mediator and source load states are NotLoading to ensure the remote update has been applied. ( I65619 )

نسخه ۱.۰.۰-آلفا۰۳

۲ دسامبر ۲۰۲۰

androidx.paging:paging-compose:1.0.0-alpha03 is released. Version 1.0.0-alpha03 contains these commits.

  • Updated to match Compose 1.0.0-alpha08.

نسخه ۱.۰.۰-آلفا۰۲

۱۱ نوامبر ۲۰۲۰

androidx.paging:paging-compose:1.0.0-alpha02 is released. Version 1.0.0-alpha02 contains these commits.

تغییرات API

  • Added .peek() , .snapshot() , .retry() and .refresh() methods to LazyPagingItem s which expose the same functionality available in AsyncPagingDataDiffer / PagingDataAdapter ( Iddfe8 , b/172041660 )

نسخه ۱.۰.۰-آلفا۰۱

۲۸ اکتبر ۲۰۲۰

androidx.paging:paging-compose:1.0.0-alpha01 is released. Version 1.0.0-alpha01 contains these commits.

ویژگی‌های جدید

The paging-compose artifact provides integration between The Paging Library and Jetpack Compose . A simple usage example:

  @Composable
  @OptIn(ExperimentalLazyDsl::class)
  fun ItemsDemo(flow: Flow<PagingData<String>>) {
      val lazyPagingItems = flow.collectAsLazyPagingItems()
      LazyColumn {
          items(lazyPagingItems) {
              Text("Item is $it")
          }
      }
  }

نسخه ۳.۰.۱

نسخه ۳.۰.۱

۲۱ ژوئیه ۲۰۲۱

androidx.paging:paging-*:3.0.1 is released. Version 3.0.1 contains these commits.

رفع اشکالات

  • Accessing PagedList.dataSource from the initial value produced by LivePagedList or RxPagedList will no longer incorrectly throw an IllegalStateException ( I96707 )

نسخه ۳.۰.۰

نسخه ۳.۰.۰

۵ مه ۲۰۲۱

androidx.paging:paging-*:3.0.0 is released. Version 3.0.0 contains these commits.

Major features of 3.0.0

The majority of the existing API from Paging 2.xx has been deprecated in favor of the new Paging 3 APIs to bring the following improvements:

  • First-class support for Kotlin coroutines and Flow
  • Support for cancellation
  • Built-in load state and error signals
  • Retry + refresh functionality
  • All three DataSource subclasses have been combined into a unified PagingSource class
  • Custom page transformations including a built-in one for adding separators
  • Loading state headers and footers

Version 3.0.0-rc01

۲۱ آوریل ۲۰۲۱

androidx.paging:paging-*:3.0.0-rc01 is released. Version 3.0.0-rc01 contains these commits.

رفع اشکالات

  • Fixed an issue where Paging would sometimes send no-op differ events to RecyclerView, which could cause certain listeners to trigger early. ( Ic507f , b/182510751 )

Version 3.0.0-beta03

۲۴ مارس ۲۰۲۱

androidx.paging:paging-*:3.0.0-beta03 is released. Version 3.0.0-beta03 contains these commits.

رفع اشکالات

  • We've revamped how placeholders are handled when list is reloaded to prevent unexpected jumps in RecyclerView. See NullPaddedDiffing.md for details. ( If1490 , b/170027529 , b/177338149 )
  • The various PagedList builders (old compatibility path) no longer incorrectly synchronously call DataSource.Factory.create() on Main thread when .build() is called. ( b/182798948 )

Version 3.0.0-beta02

۱۰ مارس ۲۰۲۱

androidx.paging:paging-*:3.0.0-beta02 is released. Version 3.0.0-beta02 contains these commits.

تغییرات API

  • Rx3 extensions now correctly propagate @ExperimentalCoroutinesApi Opt-In requirement. Previously they were marked on the @get method, which is ignored by the Kotlin Compiler due to: https://youtrack.jetbrains.com/issue/KT-45227 ( I5733c )

رفع اشکالات

  • Enforce restrictions on public usage of experimental APIs ( I6aa29 , b/174531520 )
  • Fixed a bug causing PagingState to always be null when remote refresh is called.
  • Fixed a bug where empty pages returned by PagingSource could prevent Paging from fetching again to fulfill prefetchDistance causing Paging to get “stuck”.

Version 3.0.0-beta01

۱۰ فوریه ۲۰۲۱

androidx.paging:paging-*:3.0.0-beta01 is released. Version 3.0.0-beta01 contains these commits.

تغییرات API

  • Rx2 and Rx3 wrappers now expose the experimental annotation it depends on. If you are using the Rx compat wrappers in paging-rxjava2 or paging-rxjava3, you will now need to annotate usages with @OptIn(ExperimentalCoroutinesApi::class) ( Ib1f9d )

رفع اشکالات

  • Fixed IndexOutOfBoundsException: Inconsistency detected sometimes thrown when using v2 DataSource APIs through compatibility paths
  • isInvalid call during initialization of DataSource when used via compatibility paths are now correctly launched on fetchDispatcher instead of on the main thread. This fixes an IllegalStateException due to Db access on the main thread when using Room's PagingSource implementation.

Version 3.0.0-alpha13

۲۷ ژانویه ۲۰۲۱

androidx.paging:paging-*:3.0.0-alpha13 is released. Version 3.0.0-alpha13 contains these commits.

تغییرات API

  • PagingSource.getRefreshKey is no longer optional to implement, it is now an abstract function without a default implementation. Migrating users can either continue returning the default implementation, which simply returns null , but getRefreshKey() should have a real implementation returning a key based on user's current scroll position that allows Paging to continue loading centered around the viewport via PagingState.anchorPosition if possible. ( I4339a )
  • InvalidatingPagingSourceFactory is now a final class ( Ia3b0a )
  • Allow configuration of terminal separator (header / footer) behavior with an additional optional SeparatorType parameter. The two options are:
    • FULLY_COMPLETE - existing behavior; wait for both PagingSource and RemoteMediator to mark endOfPaginationReached before adding terminal separators. If RemoteMediator is not used, remote loadState is ignored. This is primarily useful if you only want to show section separators when the section is fully loaded, including fetching from remote source eg, network.
    • SOURCE_COMPLETE - only wait for PagingSource to mark endOfPaginationReached even if RemoteMediator is used. This allows headers and footers to be presented synchronously with the initial load, which prevents users from needing to scroll to see terminal separators. ( Ibe993 , b/174700218 )

رفع اشکالات

  • Fixed a rare memory leak which happens when a PagingSource is invalidated before PageFetcher can even begin to start loading from it. ( I9606b , b/174625633 )

Version 3.0.0-alpha12

۱۳ ژانویه ۲۰۲۱

androidx.paging:paging-*:3.0.0-alpha12 is released. Version 3.0.0-alpha12 contains these commits.

تغییرات API

  • InvalidatingPagingSourceFactory is no longer an abstract class as it never had any abstract methods. ( I4a8c4 )
  • Added an overload of .cachedIn() that accepts ViewModel instead of Lifecycle or CoroutineScope for Java users. ( I97d81 , b/175332619 )
  • Allow Java callers to use PagingData transform operations in an async way, by accepting an Executor into transform operator arguments. All of the -Sync transform operators have the -Sync suffix removed now, and Kotlin Coroutine users will need to disambiguate by calling the extension function which accepts a suspending block instead. All PagingData transformation operators have been moved to extensions under the static PagingDataTransforms class. Java users will need to call them via static helpers eg, PagingDataTransforms.map(pagingData, transform) For Kotlin users, the syntax is the same but you'll need to import the function. ( If6885 , b/172895919 )

رفع اشکالات

  • Fixed a bug where RemoteMediator.load() would not be called during adapter.refresh() if the end of pagination had already been reached.

Version 3.0.0-alpha11

۱۶ دسامبر ۲۰۲۰

androidx.paging:paging-*:3.0.0-alpha11 is released. Version 3.0.0-alpha11 contains these commits.

ویژگی‌های جدید

  • Saved state support added for the following basic use cases (full support, especially in the layered source case is still a work in progress):
    • flow is cached and application is not killed (eg flow is cached in a view model and activity is recreated in process)
    • paging source is counted, placeholders are enabled and the layout is not staggered.

تغییرات API

  • PagingSource.getRefreshKey() is now stable API ( I22f6f , b/173530980 )
  • PagingSource.invalidate is no longer an open function. If you need to get notified when invalidation happens, consider calling the registerInvalidatedCallback method instead of overriding invalidate. ( I628d9 , b/173029013 , b/137971356 )
  • Pager now has a single experimental constructor alongside its regular constructors, rather than leaking experimental APIs into non-experimental public API via the opt-in annotation. ( I9dc61 , b/174531520 )
  • Updated the convenience properties, CombinedLoadStates.refresh , CombinedLoadStates.prepend , CombinedLoadStates.append to only transition from Loading to NotLoading after both mediator and source load states are NotLoading to ensure the remote update has been applied. ( I65619 )
  • LoadParams.pageSize has been removed (it was already deprecated). The recommendation is to use LoadParams.loadSize in your PagingSource.

    LoadParams.loadSize is always equal to the PagingConfig.pageSize except for the initial load call where it is equal to the PagingConfig.initialLoadSize .

    If you are testing your Paging2 DataSource without using a Pager or PagedList, pageSize may not match the PagingConfig.pageSize if you are also setting initialLoadSize . If it is important for your tests, try using a Pager/PagedList instead which will internally set the correct PageSize for your DataSource load methods. ( I98ac7 , b/149157296 )

رفع اشکالات

  • Fixed a crash due to IllegalStateException when using separators with PagingConfig.maxSize set. ( I0ed33 , b/174787528 )
  • Fixed a bug where load state for PREPEND / APPEND would not update to NotLoading(endOfPaginationReached = true) immediately after initial load if RemoteMediator was set ( I8cf5a )
  • Fixed a bug where presenter-side APIs such as .snapshot(), .peek(), etc., would return the previous (out-of-date) list within ListUpdateCallback updates.
  • Fixed a bug where Separators operators would not add headers or footers when used with RemoteMediator
  • Fixed a bug where LoadState updates to NotLoading for RemoteMediator would get stuck in the Loading state
  • Fixed a bug where the Paging2.0 compatibility API, .asPagingSourceFactory() , could cause the backing DataSource to be initialized on the incorrect CoroutineDispatcher. This resolves a crash and possible ANR cases, especially when using Room's current implementation of PagingSource, which uses this compatibility path.

Version 3.0.0-alpha10

۲ دسامبر ۲۰۲۰

androidx.paging:paging-*:3.0.0-alpha10 is released. Version 3.0.0-alpha10 contains these commits.

تغییرات API

  • The deprecated dataRefreshFlow and dataRefreshListener APIs have been removed as they are redundant with loadStateFlow / Listener updates. For those migrating, the loadStateFlow equivalent is:

    loadStateFlow.distinctUntilChangedBy { it.refresh }
        .filter { it.refresh is NotLoading }
    

    ( Ib5570 , b/173530908 )

رفع اشکالات

  • endOfPaginationReached for RemoteMediator REFRESH now correctly propagate to LoadState updates and prevents remote APPEND and PREPEND from triggering. ( I94a3f , b/155290248 )
  • Presenting an empty list either due to empty initial page or heavy filtering will no longer prevent Paging from kicking off PREPEND or APPEND loads. ( I3e702 , b/168169730 )
  • Fixed an issue where getRefreshKey does not get called on subsequent generations of PagingSource when invalidations occur rapidly. ( I45460 , b/170027530 )

مشارکت خارجی

  • A new abstract class InvalidatingPagingSourceFactory has been added with an .invalidate() API that forwards invalidate to all of the PagingSources it emits. Thanks to @claraf3 ! ( Ie71fc , b/160716447 )

مشکلات شناخته شده

  • Headers and footers from the .insertSeparators() transform may not appear immediately when using RemoteMediator b/172254056
  • Using RemoteMediator can cause remote LoadState to get stuck if invalidation and PagingSource.load(LoadParams.Refresh(...)) completes before RemoteMediator.load() returns b/173717820

Version 3.0.0-alpha09

۱۱ نوامبر ۲۰۲۰

androidx.paging:paging-*:3.0.0-alpha09 is released. Version 3.0.0-alpha09 contains these commits.

تغییرات API

  • Fully deprecate dataRefreshFlow / Listener methods with a replaceWith clause. ( I6e2dd )

رفع اشکالات

  • Fix for IllegalArgumentException being throw when using separators with RemoteMediator and an invalidate is triggered while a remote load that would return endOfPagination is still running ( I3a260 )

Version 3.0.0-alpha08

۲۸ اکتبر ۲۰۲۰

androidx.paging:paging-*:3.0.0-alpha08 is released. Version 3.0.0-alpha08 contains these commits.

تغییرات API

  • The Kotlin / Java variants of DataSource.InvalidatedCallback have been combined by enabling SAM-conversions in Kotlin via functional interface (available in Kotlin 1.4). This also fixes a bug where the kotlin variant of invalidate callbacks were not called after transformed by .map or .mapByPage . ( I1f244 , b/165313046 )

رفع اشکالات

  • Paging's interaction with ViewPager has been improved considerably. Specifically, Paging will no longer cancel a RemoteMediator#load call due to a page invalidation. It will also no longer make an append/prepend load request, if REFRESH is required , until REFRESH request completes successfully. ( I6390b , b/162252536 )
  • API lint check for MissingGetterMatchingBuilder is enabled for androidx ( I4bbea , b/138602561 )
  • Fixed a bug where .withLoadState* ConcatAdapter helpers would crash due to notifying RecyclerView from background thread ( I18bb5 , b/170988309 )
  • Fixed a bug where loading a very small non-empty page would sometimes prevent prefetch from triggering loads correctly. Iffda3 b/169259468

Version 3.0.0-alpha07

۱ اکتبر ۲۰۲۰

androidx.paging:paging-*:3.0.0-alpha07 is released. Version 3.0.0-alpha07 contains these commits.

تغییرات API

  • Async PagingData Guava-based operators now accept an Executor as a param, to control execution context. ( Id4372 )

رفع اشکالات

  • Fixed IndexOutOfBounds exception thrown in RemoteMediator due to a race condition. ( I00b7f , b/165821814 )
  • Fixed a race condition in DataSource -> PagingSource conversion that could cause the resulting PagingSource to ignore invalidation signals from DataSource.
  • Fixed an issue in page fetchin logic that would sometimes cause it to fail to pick up new generations of PagingSource until PagingDataAdapter.refresh() was invoked
  • Fixed an issue that would cause scroll-position to sometimes be lost when using a DataSource converted into a PagingSource (such as the one produced by Room), in conjunction with RemoteMediator

مشارکت خارجی

  • Thanks to @simonschiller for adding RxJava2, RxJava3, and Guava-based async transformation operators for PagingData!

Version 3.0.0-alpha06

۲ سپتامبر ۲۰۲۰

androidx.paging:paging-*:3.0.0-alpha06 is released. Version 3.0.0-alpha06 contains these commits.

تغییرات API

  • UnsupportedOperationException with clearer messaging around lack of support for stable ids is now thrown whenever PagingDataAdapter.setHasStableIds is called. ( Ib3890 , b/158801427 )

رفع اشکالات

  • insertSeparators no longer filters out empty pages allowing prefetch distance to be respected by the presenter even in cases where many empty pages are inserted. ( I9cff6 , b/162538908 )

Version 3.0.0-alpha05

۱۹ آگوست ۲۰۲۰

androidx.paging:paging-*:3.0.0-alpha05 is released. Version 3.0.0-alpha05 contains these commits.

رفع اشکالات

  • Paging now correctly prefetches pages even when the presented data is heavily filtered
  • Returning LoadResult.Error to a retried load no longer causes Item accesses to incorrectly re-trigger retry

مشارکت خارجی

  • Thanks to Clara F for helping clean up some tests! ( 549612 )

Version 3.0.0-alpha04

August 5, 2020

androidx.paging:paging-*:3.0.0-alpha04 is released. Version 3.0.0-alpha04 contains these commits.

تغییرات API

  • Added peek() API to AsyncPagingDataDiffer and PagingDataAdapter to allow presented data access without trigger page loads. ( I38898 , b/159104197 )
  • Added a snapshot() API to PagingDataAdapter and AsyncPagingDataDiffer to allow retrieving the presented items without triggering page fetch. ( I566b6 , b/159104197 )
  • Added a PagingData.from(List<T>) constructor to allow presenting static lists, which can be combined with the overall PagingData flow to show static lists in certain states, eg, before initial REFRESH finishes or simply for testing transformations. ( Id134d )
  • Deprecate dataRefresh Flow / Listener APIs as they were intended to expose the presented items state on REFRESH, but with improvements to loadState Flow / Listener callback timing, and itemCount property, it is redundant ( Ia19f3 )
  • Added RxJava3 compatibility wrappers for PagingSource and RemoteMediator ( I49ef3 , b/161480176 )

رفع اشکالات

  • PositionalDataSource converted into PagingSource via toPagingSourceFactory helper, including PagingSource generated by Room now correctly mark themselves to support jumping. ( I3e84c , b/162161201 )
  • Fixed a bug where using the synchronous variant of submitData would sometimes lead to a race causing a ClosedSendChannelException ( I4d702 , b/160192222 )

مشارکت خارجی

  • Thanks to Zac Sweers for adding RxJava3 compatibility wrappers on behalf of Slack! ( I49ef3 , b/161480176 )

Version 3.0.0-alpha03

۲۲ ژوئیه ۲۰۲۰

androidx.paging:paging-*:3.0.0-alpha03 is released. Version 3.0.0-alpha03 contains these commits.

تغییرات API

  • The constructor for PagingState is now public, which should make testing implementations of getRefreshKey() easier ( I8bf15 )
  • Hid DataSource kotlin map function variants from Java, to resolve ambiguity between original and kotlin variants. ( If7b23 , b/161150011 )
  • Redundant APIs intended as conveniences for Kotlin users have been marked @JvmSynthetic ( I56ae5 )
  • Added overloads for LoadResult.Page's constructor which defaults itemsBefore and itemsAfter to COUNT_UNDEFINED ( I47849 )
  • Made existing PagingData operators accept suspending methods and introduced new mapSync, flatMapSync, and filterSync non-suspending operators for Java users. The existing transformation methods have been moved to extension functions so Kotlin users will now need to import them. ( I34239 , b/159983232 )

رفع اشکالات

  • Room (and PositionalDataSource) PagingSources will now display a leading separator as part of the first page, so the user doesn't need to scroll to reveal it. ( I6f747 , b/160257628 )
  • Item accesses on placeholders now correctly trigger PagingSource loads until a page is returned that fulfills the requested index after being transformed by PagingData.filter() ( I95625 , b/158763195 )
  • Fix for a bug where sometimes scrolling after PagingSource returns an error could prevent PagingDataAdapter.retry() from retrying. ( I1084f , b/160194384 )
  • Fixes an issue where item accesses after dropping a page might not load pages although the item access was within prefetchDistance ( Ie95ae , b/160038730 )
  • Setting PagingConfig.maxSize no longer enables placeholders after a drop event ( I2be29 , b/159667766 )

Version 3.0.0-alpha02

June 24, 2020

androidx.paging:paging-*:3.0.0-alpha02 is released. Version 3.0.0-alpha02 contains these commits.

تغییرات API

  • Added overloads for PagingConfig 's constructor with common default values ( I39c50 , b/158576040 )
  • Added overloads for constructors of PagingDataAdapter and AsyncPagingDataDiffer with common default values ( Ie91f5 )
  • The adapter APIs, dataRefreshFlow and dataRefreshListener now pass a Boolean to signal whether a PagingData is empty ( I6e37e , b/159054196 )
  • Added RxJava and Guava APIs for RemoteMediator - RxRemoteMediator and ListenableFutureRemoteMediator
  • Added helpers to PagingState for common item access such as isEmpty() and firstItemOrNull() ( I3b5b6 , b/158892717 )

رفع اشکالات

  • Pager now checks for PagingSource reuse in factory, to prevent accidental reuse of invalid PagingSources, which gave an unclear error ( I99809 , b/158486430 )
  • Failures from RemoteMediator REFRESH no longer prevent PagingSource from loading ( I38b1b , b/158892717 )
  • The non-suspending version of submitData no longer causes a crash due to concurrent collection on multiple PagingData when called after the suspending version of submitData . ( I26358 , b/158048877 )
  • Fixed "cannot collect twice from pager" exception that could occur after config change ( I58bcc , b/158784811 )

Version 3.0.0-alpha01

۱۰ ژوئن ۲۰۲۰

androidx.paging:paging-*:3.0.0-alpha01 is released. Version 3.0.0-alpha01 contains these commits.

The Paging Library has updated to 3.0, to enable several major new features.

New Features of 3.0

مشکلات شناخته شده

  • Paging 3 javadocs are not yet available. In the interim, please use the guides linked above or the Kotlin docs. ( b/158614050 )

نسخه ۲.۱.۲

نسخه ۲.۱.۲

۱۸ مارس ۲۰۲۰

androidx.paging:paging:2.1.2 is released. Version 2.1.2 contains these commits against 2.1.0 .

رفع اشکالات

  • Fix for IndexOutOfBoundsException in rare cases when converting a position during invalidation.

Release issue

  • Paging version 2.1.1 was released incorrectly from a misconfigured branch, exposing partially-implemented APIs and functionality upcoming in a future release.

  • Paging 2.1.2 contains the load-centering fix originally released in 2.1.1, but this time correctly cherry-picked atop the 2.1.0 release. It is strongly recommended to upgrade to this release, if you are currently on 2.1.1.

نسخه ۲.۱.۱

نسخه ۲.۱.۱

۱۸ دسامبر ۲۰۱۹

androidx.paging:paging-*:2.1.1 is released. Version 2.1.1 contains these commits .

رفع اشکالات

  • Contiguous initial loads from PositionalDataSources are now centered around last access when placeholders disabled

نسخه ۲.۱.۰

نسخه ۲.۱.۰

۲۵ ژانویه ۲۰۱۹

Paging 2.1.0 is released with no changes from 2.1.0-rc01 .

Version 2.1.0-rc01

۶ دسامبر ۲۰۱۸

Paging 2.1.0-rc01 is released with no changes from 2.1.0-beta01 .

Version 2.1.0-beta01

۱ نوامبر ۲۰۱۸

Paging 2.1.0-beta01 is released with no changes from 2.1.0-alpha01 .

Version 2.1.0-alpha01

۱۲ اکتبر ۲۰۱۸

Paging 2.1.0-alpha01 has two major additions - page dropping, and KTX extension libraries for every artifact - as well as several other API changes and bugfixes.

تغییرات API

  • Added PagedList.Config.Builder.setMaxSize() for limiting the number of loaded items in memory.
  • Added androidx.paging.Config() as a Kotlin alternative for PagedList.Config.Builder
  • Added androidx.paging.PagedList() as a Kotlin alternative for PagedList.Builder
  • Added DataSourceFactory.toLiveData() as a Kotlin alternative for LivePagedListBuilder
  • Added DataSourceFactory.toObservable() and toFlowable() as Kotlin alternatives for RxPagedListBuilder
  • Added AsyncPagedListDiffer.addPagedListListener() for listening to when PagedList is swapped. b/111698609
  • Added PagedListAdapter.onCurrentListChanged() variant that passes old and new list, deprecated previous variant.
  • Added PagedListAdapter/AsyncPagedListDiffer.submitList() variants which take an additional callback that triggers if/when the pagedlist is displayed, after diffing. This allows you to synchronize a PagedList swap with other UI updates. b/73781068
  • PagedList.getLoadedCount() added to let you know how many items are in memory. Note that the return value is always equal to .size() if placeholders are disabled.

رفع اشکالات

  • Fixed a race condition when diffing if lists are reused b/111591017
  • PagedList.loadAround() now throws IndexOutOfBoundsException when index is invalid. Previously it could crash with an unclear other exception.
  • Fixed a case where an extremely small initial load size together with unchanged data would result in no further loading b/113122599

نسخه ۲.۰.۰

نسخه ۲.۰.۰

۱ اکتبر ۲۰۱۸

Paging 2.0.0 is released with a single bugfix.

رفع اشکالات

  • Fixed a crash that could occur with very fast scrolling using PositionalDataSource and placeholders b/114635383 .

Version 2.0.0-beta01

۲ ژوئیه ۲۰۱۸

رفع اشکالات

  • Fixed content disappearing in some prepend cases (placeholders disabled, PositionalDataSource) b/80149146
  • (Already released in 1.0.1 ) Fixed crashes where PagedListAdapter and AsyncPagedListDiffer would fail to signal move events. b/110711937

Pre-AndroidX Dependencies

For the pre-AndroidX versions of Paging that follow, include these dependencies:

dependencies {
    def paging_version = "1.0.0"

    implementation "android.arch.paging:runtime:$paging_version"

    // alternatively - without Android dependencies for testing
    testImplementation "android.arch.paging:common:$paging_version"

    // optional - RxJava support
    implementation "android.arch.paging:rxjava2:$paging_version"
}

نسخه ۱.۰.۱

نسخه ۱.۰.۱

۲۶ ژوئن ۲۰۱۸

Paging 1.0.1 is released with a single bugfix in runtime . We highly recommend using 1.0.1 for stability. Paging RxJava2 1.0.1 is also released, and is identical to 1.0.0-rc1 .

رفع اشکالات

  • Fixed crashes where PagedListAdapter and AsyncPagedListDiffer would fail to signal move events. b/110711937

RxJava2 Version 1.0.0

RxJava2 Version 1.0.0-rc1

۱۶ مه ۲۰۱۸

Paging RxJava2 1.0.0-rc1 is moving to release candidate with no changes from the initial alpha.

نسخه ۱.۰.۰

Version 1.0.0-rc1

April 19, 2018 Paging Release Candidate

We do not have any more known issues or new features scheduled for the Paging 1.0.0 release. Please upgrade your projects to use 1.0.0-rc1 and help us battle test it so that we can ship a rock solid 1.0.0 .

There are no changes in this release, it is the same as 1.0.0-beta1 .

Version 1.0.0-beta1

۵ آوریل ۲۰۱۸

Paging will be in beta for a short time before progressing to release candidate. We are not planning further API changes for Paging 1.0 , and the bar for any API changes is very high.

Alpha RxJava2 support for Paging is released as a separate optional module ( android.arch.paging:rxjava2:1.0.0-alpha1 ) and will temporarily be versioned separately until it stabilizes.

This new library provides an RxJava2 alternative to LivePagedListBuilder , capable of constructing Observable s and Flowable s, taking Scheduler s instead of Executor s:

کاتلین

val pagedItems = RxPagedListBuilder(myDataSource, /* page size */ 50)
        .setFetchScheduler(myNetworkScheduler)
        .buildObservable()

جاوا

Observable<PagedList<Item>> pagedItems =
        RxPagedListBuilder(myDataSource, /* page size */ 50)
                .setFetchScheduler(myNetworkScheduler)
                .buildObservable();

ویژگی‌های جدید

  • RxPagedListBuilder is added via the new android.arch.paging:rxjava2 artifact.

تغییرات API

  • API changes to clarify the role of executors in builders:

    • Renamed setBackgroundThreadExecutor() to setFetchExecutor() (in PagedList.Builder and LivePagedListBuilder )

    • Renamed setMainThreadExecutor() to setNotifyExecutor() (in PagedList.Builder ).

  • Fixed PagedList.mCallbacks member to be private.

رفع اشکالات

  • LivePagedListBuilder triggers initial PagedList load on the specified executor, instead of the Arch Components IO thread pool.

  • Fixed invalidate behavior in internal DataSource wrappers (used to implement DataSource.map , as well as placeholder-disabled PositionalDataSource loading) b/77237534

Version 1.0.0-alpha7

۲۱ مارس ۲۰۱۸

Paging 1.0.0-alpha7 is released alongside Lifecycles 1.1.1 . As Paging alpha7 depends on the move of the Function class mentioned above, you will need to update your lifecycle:runtime dependency to android.arch.lifecycle:runtime:1.1.1 .

Paging alpha7 is planned to be the final release before Paging hits beta.

تغییرات API

  • DataSource.LoadParams objects now have a public constructor and DataSource.LoadCallback objects are now abstract. This enables wrapping a DataSource or directly testing a DataSource with a mock callback. b/72600421
  • Mappers for DataSource and DataSource.Factory
    • map(Function<IN,OUT>) allows you to transform, wrap, or decorate results loaded by a DataSource .
    • mapByPage(<List<IN>,List<OUT>>) enables the same for batch processing (eg if items loaded from SQL need to additionally query a separate database, that can be done as a batch.)
  • PagedList#getDataSource() is added as a convenience method b/72611341
  • All deprecated classes have been removed from the API, including the remains of recyclerview.extensions package, and the LivePagedListProvider .
  • DataSource.Factory is changed from an interface to an abstract class to enable map functionality.

رفع اشکالات

  • Changed Builders to be final. b/70848565
  • Room DataSource implementation is now fixed to handle multi-table queries - this fix is contained within Room 1.1.0-beta1, see above.
  • Fixed a bug where BoundaryCallback.onItemAtEndLoaded would not be invoked for PositionalDataSource if placeholders are enabled and the total size is an exact multiple of the page size.

Version 1.0.0-alpha5

۲۲ ژانویه ۲۰۱۸

رفع اشکالات

  • Fix page loading when placeholders are disabled b/70573345
  • Additional logging for tracking down IllegalArgumentException bug b/70360195 (and speculative Room-side fix)
  • Javadoc sample code fixes b/70411933 , b/71467637