فعالیت

به APIهای قابل ترکیب ساخته شده بر روی Activity دسترسی داشته باشید.
آخرین به‌روزرسانی انتشار پایدار کاندیدای انتشار انتشار بتا انتشار آلفا
۲۳ سپتامبر ۲۰۲۶ ۱.۱۳.۰ - - ۱.۱۴.۰-آلفا۰۳

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

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

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

شیار

dependencies {
    def activity_version = "1.13.0"

    // Java language implementation
    implementation "androidx.activity:activity:$activity_version"
    // Kotlin
    implementation "androidx.activity:activity-ktx:$activity_version"
}

کاتلین

dependencies {
    val activity_version = "1.13.0"

    // Java language implementation
    implementation("androidx.activity:activity:$activity_version")
    // Kotlin
    implementation("androidx.activity:activity-ktx:$activity_version")
}

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

بازخورد

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

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

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

نسخه ۱.۱۴

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

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

androidx.activity:activity:1.14.0-alpha03 ، androidx.activity:activity-compose:1.14.0-alpha03 و androidx.activity:activity-ktx:1.14.0-alpha03 منتشر شدند. نسخه 1.14.0-alpha03 شامل این کامیت‌ها است.

تغییرات API

  • به جای EdgeToEdge#enable() WindowCompat#enableEdgeToEdge(Window) استفاده کنید ( Ibff3e )
  • فیلدهای متنی Material 2 که value, onValueChange منسوخ شده‌اند. لطفاً به سربارگذاری‌ای که از TextFieldState برای بالا بردن وضعیت خود استفاده می‌کند، مهاجرت کنید. ( I6b841 ، b/556234973 )

رفع اشکالات

  • وابستگی androidx.lifecycle:lifecycle-runtime به نسخه ۲.۱۰.۰ به‌روزرسانی شد. این نسخه برای بررسی‌های lint زمان اجرای چرخه عمر همراه با AGP نسخه ۹.۵.۰-alpha۰۴ یا بالاتر مورد نیاز است. ( I99bfd ، b/556807521 )
  • defaultViewModelArgs جدید ComponentActivity اکنون از پیکربندی بوت مستقیم نیز پشتیبانی می‌کنند. ( I10a08 )

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

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

androidx.activity:activity:1.14.0-alpha02 ، androidx.activity:activity-compose:1.14.0-alpha02 و androidx.activity:activity-ktx:1.14.0-alpha02 منتشر شدند. نسخه 1.14.0-alpha02 شامل این کامیت‌ها است.

رفع اشکالات

  • compileSdk برای کتابخانه‌های Compose به نسخه ۳۷.۱ به‌روزرسانی شد. این کار مستلزم به‌روزرسانی مداوم compileSdk برای همه برنامه‌ها و کتابخانه‌هایی است که از Compose استفاده می‌کنند. ( I05b0f )

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

۲۶ اوت ۲۰۲۶

androidx.activity:activity:1.14.0-alpha01 ، androidx.activity:activity-compose:1.14.0-alpha01 و androidx.activity:activity-ktx:1.14.0-alpha01 منتشر شدند. نسخه 1.14.0-alpha01 شامل این کامیت‌ها است.

تغییرات API

  • Intent extras دیگر به طور خودکار برای فعالیت‌های صادر شده به defaultViewModelCreationExtras اضافه نمی‌شوند. توسعه‌دهندگان فعالیت‌های صادر شده می‌توانند defaultViewModelArgs برای ارائه صریح intent extras معتبر، لغو کنند. ( Id0cb6 , b/213646066 )
  • اکنون Activity توابع کارخانه‌ای NavigationEventDispatcherOwner و OnBackPressedDispatcherOwner را برای ایجاد آسان نمونه‌هایی از اجزای مربوطه ارائه می‌دهد. ( I1d259 ، Iadd5c )
  • OnBackPressedDispatcher اکنون یک افزونه asNavigationEventDispatcher ارائه می‌دهد تا به راحتی آن را به NavigationEventDispatcher تبدیل کند. ( Id11cf )

نسخه ۱.۱۳

نسخه ۱.۱۳.۰

۱۱ مارس ۲۰۲۶

androidx.activity:activity:1.13.0 ، androidx.activity:activity-compose:1.13.0 و androidx.activity:activity-ktx:1.13.0 منتشر شدند. نسخه 1.13.0 شامل این کامیت‌ها است.

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

  • ComponentActivity اکنون رابط OnPictureInPictureUiStateChangedProvider را پیاده‌سازی می‌کند، به این معنی که اکنون می‌تواند با مصنوع جدید core:core-pip ادغام شود که به هر کامپوننتی اجازه می‌دهد رویدادهای تغییر وضعیت رابط کاربری تصویر در تصویر را دریافت کند.
  • EdgeToEdge اکنون در تغییرات پیکربندی دوباره فراخوانی می‌شود تا اطمینان حاصل شود که رنگ نوار وضعیت سیستم به درستی به‌روزرسانی می‌شود.

نسخه ۱.۱۳.۰-rc01

۲۵ فوریه ۲۰۲۶

androidx.activity:activity:1.13.0-rc01 ، androidx.activity:activity-compose:1.13.0-rc01 و androidx.activity:activity-ktx:1.13.0-rc01 منتشر شدند. نسخه 1.13.0-rc01 شامل این کامیت‌ها است.

رفع اشکالات

  • از فعالیت ۱.۱۲.۴ : اکنون ActivityResultContracts به عکس و ویدیو، هنگام استفاده در دستگاه‌هایی با آخرین اصلاحات امنیتی URI ( I61201 ، b/433708587 ) به درستی اجرا می‌شوند.

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

۱۴ ژانویه ۲۰۲۶

androidx.activity:activity:1.13.0-alpha01 ، androidx.activity:activity-compose:1.13.0-alpha01 و androidx.activity:activity-ktx:1.13.0-alpha01 منتشر شدند. نسخه 1.13.0-alpha01 شامل این کامیت‌ها است.

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

  • اکنون EdgeToEdge در هنگام تغییرات پیکربندی دوباره فراخوانی می‌شود تا از به‌روزرسانی صحیح رنگ نوار وضعیت سیستم اطمینان حاصل شود. ( Id1381 ، b/364713509 )

تغییرات API

  • ComponentActivity اکنون رابط OnPictureInPictureUiStateChangedProvider را پیاده‌سازی می‌کند، به این معنی که اکنون می‌تواند با مصنوع جدید core:core-pip ادغام شود که به هر کامپوننتی اجازه می‌دهد رویدادهای تغییر وضعیت رابط کاربری تصویر در تصویر را دریافت کند. ( I4df5c ، b/441310308 )

رفع اشکالات

  • از فعالیت ۱.۱۲.۲: مشکلی که باعث می‌شد تنظیم دستی isEnabled روی OnBackPressedCallback که از چرخه حیات آگاه است، وضعیت Lifecycle نادیده بگیرد و به طور بالقوه باعث خرابی شود، برطرف شد. ( I7d898 ، b/461999811 )

نسخه ۱.۱۲

نسخه ۱.۱۲.۴

۱۱ فوریه ۲۰۲۶

androidx.activity:activity:1.12.4 ، androidx.activity:activity-compose:1.12.4 و androidx.activity:activity-ktx:1.12.4 منتشر شدند. نسخه ۱.۱۲.۴ شامل این کامیت‌ها است.

رفع اشکالات

  • ActivityResultContracts عکس و ویدیو (Photo and Video ActivityResultContracts) اکنون هنگام استفاده در دستگاه‌هایی با آخرین اصلاحات امنیتی URI به درستی اجرا می‌شوند. ( I61201 ، b/433708587 )

نسخه ۱.۱۲.۳

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

androidx.activity:activity:1.12.3 ، androidx.activity:activity-compose:1.12.3 و androidx.activity:activity-ktx:1.12.3 منتشر شدند. نسخه ۱.۱۲.۳ شامل این کامیت‌ها است.

نسخه ۱.۱۲.۲

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

androidx.activity:activity:1.12.2 ، androidx.activity:activity-compose:1.12.2 و androidx.activity:activity-ktx:1.12.2 منتشر شدند. نسخه ۱.۱۲.۲ شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی که باعث می‌شد تنظیم دستی isEnabled روی OnBackPressedCallback که از چرخه حیات آگاه است، وضعیت چرخه حیات را نادیده بگیرد و به طور بالقوه باعث خرابی شود، برطرف شد. ( I7d898 ، b/461999811 )

نسخه ۱.۱۲.۱

۳ دسامبر ۲۰۲۵

androidx.activity:activity:1.12.1 ، androidx.activity:activity-compose:1.12.1 و androidx.activity:activity-ktx:1.12.1 منتشر شدند. نسخه ۱.۱۲.۱ شامل این کامیت‌ها است.

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

نسخه ۱.۱۲.۰

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

androidx.activity:activity:1.12.0 ، androidx.activity:activity-compose:1.12.0 و androidx.activity:activity-ktx:1.12.0 منتشر شدند. نسخه 1.12.0 شامل این کامیت‌ها است.

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

  • کتابخانه Androidx Activity اکنون به کتابخانه جدید NavigationEvent وابسته است. این شامل پشتیبانی از NavigationEventDispatcher در ComponentActivity و ComponentDialog می‌شود. APIهای OnBackPressed نیز بر روی APIهای NavigationEvent بازنویسی شده‌اند تا از سازگاری معکوس آنها با کتابخانه قبلی اطمینان حاصل شود.

نسخه ۱.۱۲.۰-rc01

۵ نوامبر ۲۰۲۵

androidx.activity:activity:1.12.0-rc01 ، androidx.activity:activity-compose:1.12.0-rc01 و androidx.activity:activity-ktx:1.12.0-rc01 منتشر شدند. نسخه 1.12.0-rc01 شامل این کامیت‌ها است.

رفع اشکالات

  • رفع خطاهای زمان اجرا برای BackHandler و PredictiveBackHandler در برنامه‌هایی که از کلاس‌های Activity سفارشی استفاده می‌کنند. این composableها اکنون با خیال راحت به LocalOnBackPressedDispatcherOwner برمی‌گردند و در عین حال ترتیب ارسال را در برنامه‌هایی که NavigationEventDispatcherOwner پشتیبانی می‌کنند، حفظ می‌کنند. ( I43873 )

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

۲۲ اکتبر ۲۰۲۵

androidx.activity:activity:1.12.0-beta01 ، androidx.activity:activity-compose:1.12.0-beta01 و androidx.activity:activity-ktx:1.12.0-beta01 منتشر شدند. نسخه 1.12.0-beta01 شامل این کامیت‌ها است.

تغییرات API

  • معرفی API آزمایشی ActivityFlags برای مدیریت تغییرات رفتاری زمان اجرا و مهاجرت‌ها. اولین flag امکان مرتب‌سازی پایدار برای OnBackPressedCallback را فراهم می‌کند و پیمایش برگشت را در طول تغییرات چرخه عمر قابل پیش‌بینی‌تر می‌کند. توسعه‌دهندگان می‌توانند با تنظیم ActivityFlags.isOnBackPressedLifecycleOrderMaintained = false از این قابلیت انصراف دهند. ( I06bdf , Id08bb , I439aa , b/422730945 , b/450533622 )

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

  • به‌روزرسانی وابستگی‌های چرخه حیات به نسخه ۲.۹.۴ ( Ic9fb2 )

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

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

androidx.activity:activity:1.12.0-alpha09 ، androidx.activity:activity-compose:1.12.0-alpha09 و androidx.activity:activity-ktx:1.12.0-alpha09 منتشر شدند. نسخه 1.12.0-alpha09 شامل این کامیت‌ها است.

تغییرات وابستگی

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

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

androidx.activity:activity:1.12.0-alpha08 ، androidx.activity:activity-compose:1.12.0-alpha08 و androidx.activity:activity-ktx:1.12.0-alpha08 منتشر شدند. نسخه 1.12.0-alpha08 شامل این کامیت‌ها است.

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

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

۲۷ آگوست ۲۰۲۵

androidx.activity:activity:1.12.0-alpha07 ، androidx.activity:activity-compose:1.12.0-alpha07 و androidx.activity:activity-ktx:1.12.0-alpha07 منتشر شدند. نسخه 1.12.0-alpha07 شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی با EdgeToEdge در API 35 که در آن نماهای نامرئی باعث ایجاد درج‌های اندازه‌گیری غیرمنتظره می‌شدند، برطرف شد. ( If49ff )

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

نسخه ۱.۱۲.۰-alpha06

۱۳ آگوست ۲۰۲۵

androidx.activity:activity:1.12.0-alpha06 ، androidx.activity:activity-compose:1.12.0-alpha06 و androidx.activity:activity-ktx:1.12.0-alpha06 منتشر شدند. نسخه 1.12.0-alpha06 شامل این کامیت‌ها است.

به‌روزرسانی MinSDK

به‌روزرسانی‌های مستندات

  • KDocs مربوط به PredictiveBackHandler به‌روزرسانی شد تا یک مشکل زمان‌بندی شناخته‌شده را که ممکن است در همان فریمی که غیرفعال است، یک ژست را پردازش کند، فراخوانی کند. ( I5be5c ، b/431534103 )
  • KDocs برای BackHandler و PredictiveBackHandler به‌روزرسانی شد تا علاوه بر توصیه ترکیب بی‌قید و شرط با پرچم enabled ، رفتار «آخرین بردهای ترکیب‌شده» را نیز به صراحت بیان کند. ( I7ab94 )

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

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

۳۰ ژوئیه ۲۰۲۵

androidx.activity:activity:1.12.0-alpha05 ، androidx.activity:activity-compose:1.12.0-alpha05 و androidx.activity:activity-ktx:1.12.0-alpha05 منتشر شدند. نسخه 1.12.0-alpha05 شامل این کامیت‌ها است.

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

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

۲ ژوئیه ۲۰۲۵

androidx.activity:activity:1.12.0-alpha04 ، androidx.activity:activity-compose:1.12.0-alpha04 و androidx.activity:activity-ktx:1.12.0-alpha04 منتشر شدند. نسخه 1.12.0-alpha04 شامل این کامیت‌ها است.

تغییرات وابستگی

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

۱۸ ژوئن ۲۰۲۵

androidx.activity:activity:1.12.0-alpha03 ، androidx.activity:activity-compose:1.12.0-alpha03 و androidx.activity:activity-ktx:1.12.0-alpha03 منتشر شدند. نسخه 1.12.0-alpha03 شامل این کامیت‌ها است.

رفع اشکالات

  • OnBackPressedDispatcher و NavigationEventDispatcher اکنون هر دو به صورت تنبل در ComponentActivity مقداردهی اولیه می‌شوند. ( I710e6 )

  • مشکلات مربوط به OnBackPressedDistpatcher که باعث موارد زیر می‌شد، برطرف شد:

    • فقط آخرین ارسال‌کننده‌ی OnBackPressedCallback به مطلع شدن از وضعیت فعالش اضافه شد ( b/418715930 )
    • OnBackPressedDispatcher هنگام استفاده از تابع addCallback که یک چرخه عمر می‌گیرد، فراخوانی اشتباه را حذف می‌کند. ( b/422714753 )
    • OnBackPressedDispatcher.remove() تمام نمونه‌های OnBackPressedCallback ثبت‌شده را حذف نمی‌کند. ( b/423024414 )

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

۴ ژوئن ۲۰۲۵

androidx.activity:activity:1.12.0-alpha02 ، androidx.activity:activity-compose:1.12.0-alpha02 و androidx.activity:activity-ktx:1.12.0-alpha02 منتشر شدند. نسخه 1.12.0-alpha02 شامل این کامیت‌ها است.

رفع اشکالات

  • از NavigationEvent 1.0.0-alpha02 : خطای ConcurrentModificationException که هنگام فراخوانی NavigationEventCallback.remove() به دلیل تغییر همزمان لیست داخلی closeableها رخ می‌داد، برطرف شد. ( I63066 )

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

۲۰ مه ۲۰۲۵

androidx.activity:activity:1.12.0-alpha01 ، androidx.activity:activity-compose:1.12.0-alpha01 و androidx.activity:activity-ktx:1.12.0-alpha01 منتشر شدند. نسخه 1.12.0-alpha01 شامل این کامیت‌ها است.

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

  • ComponentActivity و ComponentDialog از طریق API مربوط NavigationEventDispatcherOwner با NavigationEvent 1.0.0-alpha01 ادغام شده‌اند. اکنون می‌توانید از طریق فیلد navigationEventDispatcher یک NavigationEventDispatcher از ComponentActivity خود بازیابی کنید. از آنجایی که OnBackPressedDispatcher بر روی کتابخانه جدید بازنویسی شده است، تمام کاربردهای قبلی باید به درستی کار کنند. از این به بعد باید NavigationEventDispatcher و NavigationEventCallback استفاده کنید. ( Ib8eed ، I6cc44 ، Ib7724 ، I9a0f7 ، b/412597031 ، b/ 415028038 ، b/412596729 ، b/412597140 ، b/412596012 )

نسخه ۱.۱۱

نسخه ۱.۱۱.۰

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

androidx.activity:activity:1.11.0 ، androidx.activity:activity-compose:1.11.0 و androidx.activity:activity-ktx:1.11.0 منتشر شدند. نسخه 1.11.0 شامل این کامیت‌ها است.

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

  • API MediaCapabilities به PickVisualMediaRequest اضافه شد تا برنامه‌ها بتوانند قابلیت‌های رسانه‌ای آن، مانند انواع HDR پشتیبانی‌شده، را مشخص کنند.
  • اکتیویتی اکنون با API 36 کامپایل شده است.

نسخه ۱.۱۱.۰-rc01

۲۳ آوریل ۲۰۲۵

androidx.activity:activity:1.11.0-rc01 ، androidx.activity:activity-compose:1.11.0-rc01 و androidx.activity:activity-ktx:1.11.0-rc01 منتشر شدند. نسخه 1.11.0-rc01 شامل این کامیت‌ها است.

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

۹ آوریل ۲۰۲۵

androidx.activity:activity:1.11.0-beta01 ، androidx.activity:activity-compose:1.11.0-beta01 و androidx.activity:activity-ktx:1.11.0-beta01 منتشر شدند. نسخه 1.11.0-beta01 شامل این کامیت‌ها است.

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

۲۶ مارس ۲۰۲۵

androidx.activity:activity:1.11.0-alpha02 ، androidx.activity:activity-compose:1.11.0-alpha02 و androidx.activity:activity-ktx:1.11.0-alpha02 منتشر شدند. نسخه 1.11.0-alpha02 شامل این کامیت‌ها است.

تغییرات API

  • EDGE_NONE و frameTimeMillis جدید از اندروید ۱۶ بتا۰۳ در BackEventCompat ارائه شده توسط توابع handleOnBackStarted و handleOnBackProgressed از OnBackPressedCallback ادغام شدند.

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

  • اکتیویتی اکنون با API 36 کامپایل شده است. ( I510e8 ، b/301910674 )

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

۱۲ مارس ۲۰۲۵

androidx.activity:activity:1.11.0-alpha01 ، androidx.activity:activity-compose:1.11.0-alpha01 و androidx.activity:activity-ktx:1.11.0-alpha01 منتشر شدند. نسخه 1.11.0-alpha01 شامل این کامیت‌ها است.

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

  • API MediaCapabilities به PickVisualMediaRequest اضافه شد تا برنامه‌ها بتوانند قابلیت‌های رسانه‌ای خود، مانند انواع HDR پشتیبانی‌شده را مشخص کنند. ( Ic3ee7 )

نسخه ۱.۱۰

نسخه ۱.۱۰.۱

۲۶ فوریه ۲۰۲۵

androidx.activity:activity:1.10.1 ، androidx.activity:activity-compose:1.10.1 و androidx.activity:activity-ktx:1.10.1 منتشر شدند. نسخه ۱.۱۰.۱ شامل این کامیت‌ها است.

رفع اشکالات

  • ViewTree OnBackPressedDispatcherOwners و FullyDrawnReporterOwners اکنون می‌توانند از طریق والدهای مجزای یک نما، مانند ViewOverlay حل شوند. برای اطلاعات بیشتر در مورد والدهای مجزای نما، به یادداشت‌های انتشار core یا مستندات موجود در ViewTree.setViewTreeDisjointParent مراجعه کنید. ( Ie7750 )

نسخه ۱.۱۰.۰

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

androidx.activity:activity:1.10.0 ، androidx.activity:activity-compose:1.10.0 و androidx.activity:activity-ktx:1.10.0 منتشر شدند. نسخه ۱.۱۰.۰ شامل این کامیت‌ها است.

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

  • PhotoPicker اکنون امکان انتخاب تصاویر به ترتیب و انتخاب اینکه کدام برگه (چه آلبوم‌ها و چه تصاویر) در ابتدا قابل مشاهده باشد را فراهم می‌کند.
  • قراردادهای PickVisualMedia و PickMultipleVisualMedia Activity Result که Photo Picker را فعال می‌کنند، در صورت عدم دسترسی به Photo Picker سیستمی، دیگر مستقیماً به سرویس‌های Google Play ارجاع نمی‌دهند، بلکه از اکشن عمومی ACTION_SYSTEM_FALLBACK_PICK_IMAGES و موارد اضافی مرتبط برای ارائه یک تجربه Photo Picker سازگار به OEMها و برنامه‌های سیستمی به عنوان یک جایگزین استفاده می‌کنند.
  • ترکیب جدید LocalActivity محلی که Activity برای محدوده فعلی فراهم می‌کند و نیاز توسعه‌دهندگان را برای دریافت Activity از LocalContext برطرف می‌کند.

نسخه ۱.۱۰.۰-rc01

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

androidx.activity:activity:1.10.0-rc01 ، androidx.activity:activity-compose:1.10.0-rc01 و androidx.activity:activity-ktx:1.10.0-rc01 منتشر شدند. نسخه 1.10.0-rc01 شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی که باعث می‌شد تغییر وضعیت فعال‌شده در حالی که PredictiveBackHandler در حال حاضر فعال است، باعث اتصال کوتاه (short circuit) فوری در فراخوانی مجدد شود، برطرف شد. اکنون فراخوانی مجدد فعلی صرف نظر از تغییرات وضعیت فعال‌شده، پایان می‌یابد. ( Ib8719 )

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

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

androidx.activity:activity:1.10.0-beta01 ، androidx.activity:activity-compose:1.10.0-beta01 و androidx.activity:activity-ktx:1.10.0-beta01 بدون هیچ تغییری از آخرین نسخه آلفا منتشر شده‌اند. نسخه 1.10.0-beta01 شامل این کامیت‌ها است.

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

۳۰ اکتبر ۲۰۲۴

androidx.activity:activity:1.10.0-alpha03 ، androidx.activity:activity-compose:1.10.0-alpha03 و androidx.activity:activity-ktx:1.10.0-alpha03 منتشر شدند. نسخه 1.10.0-alpha03 شامل این کامیت‌ها است.

تغییرات API

  • یک ترکیب جدید LocalActivity به نام local اضافه شده است که Activity برای محدوده فعلی فراهم می‌کند و نیاز توسعه‌دهندگان را برای دریافت Activity از LocalContext از بین می‌برد. همچنین با یک قانون lint جدید ارائه می‌شود که بررسی می‌کند چه زمانی LocalContext به اشتباه به یک Activity تبدیل می‌شود. ( I7746a , b/283009666 )

رفع اشکالات

  • از فعالیت 1.9.3 : PredictiveBackHandler دیگر پس از غیرفعال شدن هندلر، فراخوانی برگشتی خود را اجرا نمی‌کند. این مشکل را که NavHost از Navigation Compose خطای IndexOutOfBoundsException را صادر می‌کرد، برطرف می‌کند. ( I3f75e , b/365027664 , b/340202286 )

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

  • اکتیویتی کامپوز اکنون به Compose Runtime 1.7.0 ( I7746a ، b/283009666 ) بستگی دارد.

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

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

androidx.activity:activity:1.10.0-alpha02 ، androidx.activity:activity-compose:1.10.0-alpha02 و androidx.activity:activity-ktx:1.10.0-alpha02 منتشر شدند. نسخه 1.10.0-alpha02 شامل این کامیت‌ها است.

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

  • قراردادهای PickVisualMedia و PickMultipleVisualMedia Activity Result که Photo Picker را فعال می‌کنند، در صورت عدم دسترسی به Photo Picker سیستمی، دیگر مستقیماً به سرویس‌های Google Play ارجاع نمی‌دهند، بلکه از اکشن عمومی ACTION_SYSTEM_FALLBACK_PICK_IMAGES و موارد اضافی مرتبط برای ارائه یک تجربه Photo Picker سازگار به OEMها و برنامه‌های سیستمی به عنوان یک جایگزین استفاده می‌کنند. این موضوع نباید هیچ تاثیری بر تجربه کاربر برای دستگاه‌هایی که نسخه جدیدی از سرویس‌های Google Play را دارند، داشته باشد. ( I3513d )

رفع اشکالات

  • حذف دستورالعمل دسترسی به APIهای پلتفرم جدید، زیرا این امر به طور خودکار از طریق مدل‌سازی API هنگام استفاده از R8 با AGP 7.3 یا بالاتر (مثلاً R8 نسخه 3.3) و برای همه نسخه‌ها هنگام استفاده از AGP 8.1 یا بالاتر (مثلاً D8 نسخه 8.1) اتفاق می‌افتد. به مشتریانی که از AGP استفاده نمی‌کنند، توصیه می‌شود به D8 نسخه 8.1 یا بالاتر به‌روزرسانی کنند. برای جزئیات بیشتر به این مقاله مراجعه کنید. ( I9496c ، b/345472586 )
  • از Activity 1.9.2 : مشکلی که باعث می‌شد API مربوط به Activity Compose PredictiveBackHandler به مدیریت حرکت سیستمی برگشت به عقب در فریمی که غیرفعال شده بود، ادامه دهد، برطرف شد. این مشکل می‌توانست منجر به این شود که کتابخانه‌هایی مانند Navigation Compose حتی با وجود یک پشته خالی برگشت به عقب را مدیریت کنند و در نتیجه خطای IndexOutOfBoundsException ( Ie3301 , b/340202286 ) رخ دهد.
  • از فعالیت 1.9.1 : مشکلی با PredictiveBackHandler که پس از انجام عملیات بازگشت به سیستم، تلاش برای انجام onBackPressed از OnBackPressedDispatcher با شکست مواجه می‌شد، برطرف شد. ( I5f1f8 )

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

۲۶ ژوئن ۲۰۲۴

androidx.activity:activity:1.10.0-alpha01 ، androidx.activity:activity-compose:1.10.0-alpha01 و androidx.activity:activity-ktx:1.10.0-alpha01 منتشر شدند. این نسخه در یک شاخه داخلی توسعه داده شده است.

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

  • پشتیبانی از ویژگی‌های جدید PhotoPicker که در اندروید V معرفی شدند، از جمله امکان انتخاب تصاویر به ترتیب و انتخاب اینکه کدام تب (آلبوم‌ها یا تصاویر) در ابتدا قابل مشاهده باشد، اضافه شده است.

نسخه ۱.۹

نسخه ۱.۹.۳

۱۶ اکتبر ۲۰۲۴

androidx.activity:activity:1.9.3 ، androidx.activity:activity-compose:1.9.3 و androidx.activity:activity-ktx:1.9.3 منتشر شدند. نسخه 1.9.3 شامل این کامیت‌ها است.

رفع اشکالات

  • PredictiveBackHandler دیگر پس از غیرفعال شدن هندلر، تابع فراخوانی خود را اجرا نمی‌کند. این کار مشکلی را که در آن NavHost از Navigation Compose خطای IndexOutOfBoundsException صادر می‌کرد، برطرف می‌کند. ( I3f75e , b/340202286 )

نسخه ۱.۹.۲

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

androidx.activity:activity:1.9.2 ، androidx.activity:activity-compose:1.9.2 و androidx.activity:activity-ktx:1.9.2 منتشر شدند. نسخه 1.9.2 شامل این lthcocommits است.

رفع اشکالات

  • مشکلی که باعث می‌شد API مربوط به Activity Compose PredictiveBackHandler به مدیریت حرکت سیستمی بازگشت به عقب در فریمی که غیرفعال شده بود، ادامه دهد، برطرف شد. این مشکل می‌توانست منجر به این شود که کتابخانه‌هایی مانند Navigation Compose حتی با وجود یک پشته خالی، بازگشت به عقب را مدیریت کنند و در نتیجه خطای IndexOutOfBoundsException ( Ie3301 , b/340202286 ) رخ دهد.

نسخه ۱.۹.۱

۲۴ ژوئیه ۲۰۲۴

androidx.activity:activity:1.9.1 ، androidx.activity:activity-compose:1.9.1 و androidx.activity:activity-ktx:1.9.1 منتشر شدند. نسخه ۱.۹.۱ شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی با PredictiveBackHandler که باعث می‌شد پس از انجام عملیات بازگشت به سیستم، تلاش برای انجام onBackPressed از OnBackPressedDispatcher با شکست مواجه شود، برطرف شد. ( I5f1f8 )

نسخه ۱.۹.۰

۱۷ آوریل ۲۰۲۴

androidx.activity:activity:1.9.0 ، androidx.activity:activity-compose:1.9.0 و androidx.activity:activity-ktx:1.9.0 منتشر شدند. نسخه 1.9.0 شامل این کامیت‌ها است.

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

  • ComponentActivity اکنون OnUserLeaveHintProvider پیاده‌سازی می‌کند تا به کامپوننت‌ها اجازه دهد برای رویدادهای onUserLeaveHint فراخوانی مجدد انجام دهند.
  • APIهای OnBackPressedCallback ، BackHandler و PredictiveBackHandler اکنون هنگام فراخوانی onBackPressedDispatcher.onBackPressed() هنگام مدیریت بازگشت، هشدار می‌دهند زیرا این کار همیشه انیمیشن بازگشت پیش‌بینی‌شده را مختل می‌کند. برای جزئیات بیشتر به راهنمای بهترین شیوه‌ها مراجعه کنید.
  • بقیه APIهای Activity در کاتلین بازنویسی شده‌اند و تمام افزونه‌هایی که قبلاً در activity-ktx موجود بودند به activity منتقل شده‌اند. activity-ktx اکنون کاملاً خالی است.
    • به عنوان بخشی از تبدیل ActivityResultLauncher به Kotlin، متد getContract اکنون یک ویژگی انتزاعی Kotlin است. این یک تغییر سازگار با باینری است، اما اگر پیاده‌سازی ActivityResultLauncher شما به زبان Kotlin نوشته شده باشد، کد منبع آن دچار مشکل می‌شود.

نسخه ۱.۹.۰-rc01

۳ آوریل ۲۰۲۴

androidx.activity:activity:1.9.0-rc01 ، androidx.activity:activity-compose:1.9.0-rc01 و androidx.activity:activity-ktx:1.9.0-rc01 منتشر شدند. نسخه 1.9.0-rc01 شامل این کامیت‌ها است.

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

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

۲۰ مارس ۲۰۲۴

androidx.activity:activity:1.9.0-beta01 ، androidx.activity:activity-compose:1.9.0-beta01 و androidx.activity:activity-ktx:1.9.0-beta01 منتشر شدند. نسخه 1.9.0-beta01 شامل این کامیت‌ها است.

رفع اشکالات

  • رگرسیون عملکرد هنگام شروع فعالیت که در Activity 1.9.0-alpha02 معرفی شده بود و ناشی از فراخوانی OnBackPressedDispatcher به عنوان بخشی از ایجاد Activity بود، برطرف شد. ( Ie75e3 )

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

۷ فوریه ۲۰۲۴

androidx.activity:activity:1.9.0-alpha03 ، androidx.activity:activity-compose:1.9.0-alpha03 و androidx.activity:activity-ktx:1.9.0-alpha03 منتشر شدند. نسخه 1.9.0-alpha03 شامل این کامیت‌ها است.

هشدار پرز

رفع اشکالات

  • اگر یک رویداد برگشت از سیستمی که در حین اجرای یک حرکت برگشت پیش‌بینی‌کننده از قبل شروع شده است، ارسال شود، حرکت برگشت پیش‌بینی‌کننده در حال اجرا لغو می‌شود و رویداد برگشت جدید برای شروع یک حرکت برگشت پیش‌بینی‌کننده جدید به کار گرفته می‌شود. ( I3482e )
  • مشکل از کار افتادن برنامه هنگام دسترسی به onBackPressedDispatcher از یک ComponentActivity برای اولین بار از یک thread پس‌زمینه برطرف شد. اکنون دسترسی به onBackPressedDispatcher در هر thread ای ایمن است. ( I79955 )

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

۲۴ ژانویه ۲۰۲۴

androidx.activity:activity:1.9.0-alpha02 ، androidx.activity:activity-compose:1.9.0-alpha02 و androidx.activity:activity-ktx:1.9.0-alpha02 منتشر شدند. نسخه 1.9.0-alpha02 شامل این کامیت‌ها است.

تبدیل‌های کاتلین

  • ActivityResultRegistry در کاتلین بازنویسی شده است. این امر تضمین می‌کند که nullability ژنریک‌های موجود در قرارداد ارسالی به register ، به درستی به ActivityResultLauncher برگردانده شده به شما منتقل شود. ( I121f0 )
  • ActivityResult در کاتلین بازنویسی شده است. افزونه‌های کاتلین ActivityResult که از تجزیه به فیلدهای resultCode و data پشتیبانی می‌کنند، از activity-ktx به activity منتقل شده‌اند. ( I0565a )
  • افزونه‌های کاتلینِ by viewModels() برای ComponentActivity و trackPipAnimationHintView از activity-ktx به activity منتقل شده‌اند. آرتیفکت activity-ktx اکنون کاملاً خالی است. ( I0a444 )

رفع اشکالات

  • API enableEdgeToEdge اکنون دور هر بریدگی نمایشگر را رسم می‌کند. ( a3644b , b/311173461 )
  • از فعالیت 1.8.2 : مشکل ارسال صحیح کلید ACTION_SYSTEM_FALLBACK_PICK_IMAGES به قرارداد فعالیت Photo Picker، یعنی EXTRA_SYSTEM_FALLBACK_PICK_IMAGES_MAX ، به جای استفاده از کلید extra با کلید "com.google.android.gms.provider.extra.PICK_IMAGES_MAX" برطرف شد. اگر شما یک تولیدکننده تجهیزات اصلی (OEM) هستید که یک Photo Picker پشتیبان سیستمی را برای پشتیبانی از هر دو مورد اضافی پیاده‌سازی می‌کند، اکیداً توصیه می‌شود تا بیشترین سازگاری تضمین شود. ( I96a00 )

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

۲۹ نوامبر ۲۰۲۳

androidx.activity:activity:1.9.0-alpha01 ، androidx.activity:activity-compose:1.9.0-alpha01 و androidx.activity:activity-ktx:1.9.0-alpha01 منتشر شدند. نسخه 1.9.0-alpha01 شامل این کامیت‌ها است.

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

  • ComponentActivity اکنون OnUserLeaveHintProvider پیاده‌سازی می‌کند تا به کامپوننت‌ها اجازه دهد برای رویدادهای onUserLeaveHint فراخوانی مجدد انجام دهند. ( I54892 )

تغییرات API

  • ComponentActivity در کاتلین بازنویسی شده است. ( I14f31 )
  • ActivityResultCaller در کاتلین بازنویسی شده است. ( Ib02e4 )
  • ActivityResultLauncher در کاتلین بازنویسی شده است. به عنوان بخشی از این تبدیل، متد getContract اکنون یک ویژگی انتزاعی کاتلین است. این یک تغییر سازگار با باینری است، اما اگر پیاده‌سازی ActivityResultLauncher شما در کاتلین نوشته شده باشد، کد منبع آن دچار مشکل می‌شود. ( Id4615 )
  • PickVisualMediaRequest اکنون همان حداقل سطح API 19 را دارد که در قرارداد PickVisualMedia Activity Result وجود دارد. ( Id6e21 )

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

نسخه ۱.۸

نسخه ۱.۸.۲

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

androidx.activity:activity:1.8.2 ، androidx.activity:activity-compose:1.8.2 و androidx.activity:activity-ktx:1.8.2 منتشر شدند. نسخه ۱.۸.۲ شامل این کامیت‌ها است.

رفع اشکالات

  • مشکل ارسال صحیح کلید ACTION_SYSTEM_FALLBACK_PICK_IMAGES به قرارداد فعالیت Photo Picker، به نام EXTRA_SYSTEM_FALLBACK_PICK_IMAGES_MAX ، به جای استفاده از کلید extra با کلید "com.google.android.gms.provider.extra.PICK_IMAGES_MAX" ، برطرف شد. اگر شما یک تولیدکننده تجهیزات اصلی (OEM) هستید که یک Photo Picker پشتیبان سیستمی را برای پشتیبانی از هر دو مورد اضافی پیاده‌سازی می‌کند، اکیداً توصیه می‌شود تا بیشترین سازگاری تضمین شود. ( I96a00 )

نسخه ۱.۸.۱

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

androidx.activity:activity:1.8.1 ، androidx.activity:activity-compose:1.8.1 و androidx.activity:activity-ktx:1.8.1 منتشر شدند. نسخه ۱.۸.۱ شامل این کامیت‌ها است.

رفع اشکالات

  • اکنون OnBackPressedDispatcher حتی پس از اضافه شدن یک OnBackPressedCallback جدید در حین مدیریت ژست برگشت، به ارسال به OnBackPressedCallback صحیح ادامه می‌دهد. ( Id0ff6 )

نسخه ۱.۸.۰

۴ اکتبر ۲۰۲۳

androidx.activity:activity:1.8.0 ، androidx.activity:activity-compose:1.8.0 و androidx.activity:activity-ktx:1.8.0 منتشر شدند. نسخه ۱.۸.۰ شامل این کامیت‌ها است.

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

  • بازگشت پیش‌بینی‌کننده - OnBackPressedCallback اکنون علاوه بر فراخوانی قبلی handleOnBackPressed() برای زمانی که حرکت بازگشت انجام می‌شود، فراخوانی‌های پیش‌بینی‌کننده بازگشت جدیدی را برای مدیریت شروع حرکت بازگشت، پیشرفت در طول حرکت و لغو حرکت بازگشت ارائه می‌دهد. این همچنین با PredictiveBackHandler Composable برای مدیریت رویدادهای پیش‌بینی‌کننده حرکت بازگشت در Activity Compose همراه است. این یک جریان از اشیاء BackEventCompat را فراهم می‌کند که باید در lamba معلقی که ارائه می‌دهید جمع‌آوری شوند:
  PredictiveBackHandler { progress: Flow<BackEventCompat> ->
    // code for gesture back started
    try {
      progress.collect { backEvent ->
      // code for progress
    }
    // code for completion
    } catch (e: CancellationException) {
      // code for cancellation
    }
  }

ComponentActivity.onBackPressed() اکنون به نفع APIها برای مدیریت بازگشت، منسوخ شده است. توسعه‌دهندگان اکنون باید از OnBackPressedDispatcher استفاده کنند، نه اینکه این متد را بازنویسی کنند.

  • EdgeToEdge - برای تنظیم آسان نمایش لبه به لبه به شیوه‌ای سازگار با نسخه‌های قبلی، ComponentActivity.enableEdgeToEdge() اضافه شده است.

نسخه ۱.۸.۰-rc01

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

androidx.activity:activity:1.8.0-rc01 ، androidx.activity:activity-compose:1.8.0-rc01 و androidx.activity:activity-ktx:1.8.0-rc01 منتشر شدند. نسخه 1.8.0-rc01 شامل این کامیت‌ها است.

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

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

androidx.activity:activity:1.8.0-beta01 ، androidx.activity:activity-compose:1.8.0-beta01 و androidx.activity:activity-ktx:1.8.0-beta01 منتشر شدند. نسخه 1.8.0-beta01 شامل این کامیت‌ها است.

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

  • مستندات BackEventCompat بهبود یافت. ( aosp/2722254 )

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

۲۳ آگوست ۲۰۲۳

androidx.activity:activity:1.8.0-alpha07 ، androidx.activity:activity-compose:1.8.0-alpha07 و androidx.activity:activity-ktx:1.8.0-alpha07 منتشر شدند. نسخه 1.8.0-alpha07 شامل این کامیت‌ها است.

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

  • Activity Compose یک PredictiveBackHandler Composable جدید برای مدیریت رویدادهای پیش‌بینی‌کننده‌ی بازگشت به عقب اضافه کرده است. این یک Flow از اشیاء BackEventCompat را ارائه می‌دهد که باید در lamba معلقی که شما ارائه می‌دهید، جمع‌آوری شوند:

    PredictiveBackHandler { progress: Flow<BackEventCompat> ->
      // code for gesture back started
      try {
        progress.collect { backEvent ->
        // code for progress
      }
      // code for completion
      } catch (e: CancellationException) {
        // code for cancellation
      }
    }
    

    همچنین با یک هشدار زمان کامپایل از طریق قاعده lint همراه است تا از فراخوانی‌های Flow collect() اطمینان حاصل شود. ( Id2773 ، b/294884345 )

  • متد onBackPressedDispatcher در ComponentActivity اکنون به صورت تنبل مقداردهی اولیه می‌شود، بنابراین فقط در صورت نیاز ایجاد می‌شود. ( I0bf8e )

رفع اشکالات

  • ComponentActivity در اندروید ۱۳، وقتی فراخوانی onBackPressed() را دریافت می‌کند و اکتیویتی از قبل DESTROYED شده است، دیگر NPE را نشان نمی‌دهد. ( Idb055 , b/291869278 )
  • کاربردهای API آزمایشی isAtLeastU() حذف شد ( Ie9117 ، b/289269026 )

نسخه ۱.۸.۰-alpha06

۲۱ ژوئن ۲۰۲۳

androidx.activity:activity:1.8.0-alpha06 ، androidx.activity:activity-compose:1.8.0-alpha06 و androidx.activity:activity-ktx:1.8.0-alpha06 منتشر شدند. نسخه 1.8.0-alpha06 شامل این کامیت‌ها است.

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

  • OnBackPressedDispatcher اکنون به درستی هرگونه فراخوانی برگشتی که در طول یک حرکت پیش‌بینانه‌ی بازگشت حذف می‌شوند را لغو می‌کند. ( I3f90f )

تغییرات API

  • هنگام ارسال SystemBarStyle.auto به enableEdgeToEdge API، اکنون می‌توانید پارامتر لامبدا detectDarkMode را برای ارائه منطق سفارشی برای تشخیص حالت شب، بازنویسی کنید. ( aosp/2546393 , b/278263793 )

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

۷ ژوئن ۲۰۲۳

androidx.activity:activity:1.8.0-alpha05 ، androidx.activity:activity-compose:1.8.0-alpha05 و androidx.activity:activity-ktx:1.8.0-alpha05 منتشر شدند. این نسخه در یک شاخه داخلی توسعه داده شده است.

تغییرات API

  • اکتیویتی اکنون یک کلاس BackEventCompat ارائه می‌دهد که به عنوان یک نسخه سازگار با نسخه‌های قبلی BackEvent عمل می‌کند و از کلاس BackEvent چارچوب جدا شده است.
  • تغییر مهم: متدهای handleOnBackStarted و handleOnBackProgressed از OnBackPressedCallback اکنون به جای کلاس android.window.BackEvent در چارچوب، یک نمونه androidx.activity.BackEventCompat دریافت می‌کنند. APIهای معادل @VisibleForTesting در OnBackPressedDispatcher نیز به‌روزرسانی شده‌اند.
  • سازنده‌ی OnBackPressedDispatcher اکنون یک نمونه‌ی اختیاری Consumer<Boolean> می‌گیرد که به مالکان dispatcher اجازه می‌دهد هر زمان که تعداد callbackهای فعال از صفر به غیر صفر یا برعکس تغییر کرد، یک callback دریافت کنند.

رفع اشکالات

  • از فعالیت 1.7.2 : رفع مشکل از کار افتادن ReportDrawn هنگام خروج از صفحه قبل از فراخوانی report . ( Ic46f1 ، b/260506820 )

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

۱۰ مه ۲۰۲۳

androidx.activity:activity:1.8.0-alpha04 ، androidx.activity:activity-compose:1.8.0-alpha04 و androidx.activity:activity-ktx:1.8.0-alpha04 منتشر شدند. این از یک شاخه داخلی منتشر شده است.

رفع اشکالات

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

۱۲ آوریل ۲۰۲۳

androidx.activity:activity:1.8.0-alpha03 ، androidx.activity:activity-compose:1.8.0-alpha03 و androidx.activity:activity-ktx:1.8.0-alpha03 منتشر شدند. این از یک شاخه داخلی منتشر شده است.

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

  • برای تنظیم آسان نمایش لبه به لبه به شیوه‌ای سازگار با نسخه‌های قبلی، ComponentActivity.setUpEdgeToEdge() اضافه شد.

تغییرات API

  • ComponentActivity.onBackPressed() اکنون به نفع APIها برای مدیریت بازگشت، منسوخ شده است. توسعه‌دهندگان اکنون باید از OnBackPressedDispatcher استفاده کنند، نه اینکه این متد را بازنویسی کنند. ( Ibce2f ، b/271596918 )
  • ComponentDialog و ComponentActivity اکنون حاوی API عمومی initViewTreeOwners() هستند که برای مقداردهی اولیه همه مالکان درخت نماها قبل از تنظیم نمای محتوا استفاده می‌شود. ( Ibdce0 ، b/261314581 )

رفع اشکالات

  • مشکلی که در آن Fragmentها به اشتباه MenuHostها را نامعتبر می‌کردند و باعث می‌شدند سایر منوها در Activity رفتار غیرمنتظره‌ای داشته باشند، برطرف شد. ( I9404e ، b/244336571 )

سایر تغییرات

  • ActivityResultRegister اکنون به جای جاوا از Kotlin Random استفاده می‌کند. ( I4d98f , b/272096025 )

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

۸ مارس ۲۰۲۳

androidx.activity:activity:1.8.0-alpha02 ، androidx.activity:activity-compose:1.8.0-alpha02 و androidx.activity:activity-ktx:1.8.0-alpha02 منتشر شدند. این نسخه‌ها از یک شاخه داخلی توسعه داده شده‌اند.

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

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

۸ فوریه ۲۰۲۳

androidx.activity:activity:1.8.0-alpha01 ، androidx.activity:activity-compose:1.8.0-alpha01 و androidx.activity:activity-ktx:1.8.0-alpha01 منتشر شدند. این از یک شاخه داخلی ساخته شده است.

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

  • کلاس OnBackPressedCallback اکنون علاوه بر فراخوانی قبلی handleOnBackPressed() برای زمان اجرای حرکت برگشت، شامل فراخوانی‌های پیش‌بینانه‌ی پیشرفت برگشت جدید برای مدیریت شروع حرکت برگشت، پیشرفت در طول حرکت و لغو حرکت برگشت است.

نسخه ۱.۷

نسخه ۱.۷.۲

۲۴ مه ۲۰۲۳

androidx.activity:activity:1.7.2 ، androidx.activity:activity-compose:1.7.2 و androidx.activity:activity-ktx:1.7.2 منتشر شدند. نسخه ۱.۷.۲ شامل این کامیت‌ها است.

رفع اشکالات

  • رفع مشکل از کار افتادن ReportDrawn هنگام خروج از صفحه قبل از فراخوانی report . ( Ic46f1 ، b/260506820 )

نسخه ۱.۷.۱

۱۹ آوریل ۲۰۲۳

androidx.activity:activity:1.7.1 ، androidx.activity:activity-compose:1.7.1 و androidx.activity:activity-ktx:1.7.1 منتشر شدند. نسخه ۱.۷.۱ شامل این کامیت‌ها است.

رفع اشکالات

  • هنگام استفاده از ComponentActivity با ActivityScenario دیگر ReportFullyDrawExecuter نشت نمی‌کند. ( Id2ff2 ، b/277434271 )

نسخه ۱.۷.۰

۲۲ مارس ۲۰۲۳

androidx.activity:activity:1.7.0 ، androidx.activity:activity-compose:1.7.0 و androidx.activity:activity-ktx:1.7.0 منتشر شدند. نسخه ۱.۷.۰ شامل این کامیت‌ها است.

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

  • قراردادهای فعالیت Photo Picker در PickVisualMedia و PickMultipleVisualMedia به‌روزرسانی شده‌اند تا شامل یک fallback اضافی برای زمانی باشند که MediaStore.ACTION_PICK_IMAGES در دسترس نیست که به OEMها و برنامه‌های سیستمی، مانند سرویس‌های Google Play، اجازه می‌دهد تا با پیاده‌سازی اقدام fallback، یک تجربه سازگار با Photo Picker را در طیف وسیع‌تری از دستگاه‌های Android و سطوح API ارائه دهند. Photo Picker در صورت موجود بودن، قبل از بازگشت به استفاده از Intent.ACTION_OPEN_DOCUMENT ، از این fallback استفاده خواهد کرد، که همچنان از همه دستگاه‌های API 19 و بالاتر پشتیبانی می‌کند.
  • ComponentDialog اکنون SavedStateRegistryOwner پیاده‌سازی می‌کند و به SavedStateRegistry مخصوص به خود دسترسی دارد و SavedStateRegistryOwner برای ViewTree خود تنظیم می‌کند. اکنون می‌توان از Jetpack Compose در یک ComponentDialog استفاده کرد زیرا هم LifecycleOwner و هم SavedStateRegistryOwner متصل به پنجره را از طریق الزامات APIهای ViewTree برآورده می‌کند.
  • IntentSenderRequest.Builder.setFlags() اکنون به شما امکان می‌دهد به جای فقط یک پرچم، چندین پرچم را از Intent تنظیم کنید.

تبدیل کاتلین

تعدادی از کلاس‌های Activity به Kotlin تبدیل شده‌اند. همه کلاس‌های تبدیل‌شده همچنان سازگاری دودویی خود را با نسخه‌های قبلی حفظ می‌کنند. کلاس‌های زیر دارای تغییرات ناسازگار با منبع برای کلاس‌های نوشته‌شده در Kotlin هستند: ActivityResultRegistryOwner ، OnBackPressedDispatcherOwner .

جدول زیر تبدیل‌های منبع برای نسخه جدید Activity را ارائه می‌دهد:

فعالیت ۱.۵ فعالیت ۱.۶
override fun getActivityResultRegistry() = activityResultRegistry override val activityResultRegistry = activityResultRegistry
override fun getOnBackPressedDispatcher() = onBackPressedDispatcher override val onBackPressedDispatcher = onBackPressedDispatcher

این کلاس‌ها نیز به کاتلین تبدیل شده‌اند، اما همچنان با کد منبع سازگار هستند: ContextAware ، ContextAwareHelper ، OnContextAvailableListener ، IntentSenderRequest و OnBackPressedDispatcher

رابط‌های برنامه‌نویسی کاربردی FullyDrawnReporter

ComponentActivity اکنون یک نمونه FullyDrawnReporter ارائه می‌دهد که به چندین کامپوننت اجازه می‌دهد تا زمانی که برای تعامل آماده هستند، گزارش دهند. ComponentActivity قبل از فراخوانی reportFullyDrawn() از طرف شما، منتظر تکمیل تمام کامپوننت‌ها خواهد ماند. این APIها الزامات زمان‌بندی را برای شما انجام می‌دهند و نیازی به فراخوانی به عنوان بخشی از فراخوانی onDraw ندارند.

این APIها برای فعال کردن موارد زیر تشویق می‌شوند:

  • ارسال سیگنال به Android Runtime هنگام اتمام راه‌اندازی، برای اطمینان از اینکه تمام کدهایی که در طول یک توالی راه‌اندازی چند فریمی اجرا می‌شوند، گنجانده شده و برای کامپایل در پس‌زمینه اولویت‌بندی می‌شوند.
  • سیگنال‌دهی Macrobenchmark و Play Vitals زمانی که برنامه شما باید برای معیارهای راه‌اندازی کاملاً ترسیم شده در نظر گرفته شود، تا بتوانید عملکرد را پیگیری کنید.

سه API برای نوشتن فعالیت اضافه شده است تا استفاده از FullyDrawnReporter از composable های جداگانه راحت تر شود:

  • ReportDrawn نشان می‌دهد که ترکیب‌بندی شما بلافاصله برای تعامل آماده است.
  • ReportDrawnWhen یک گزاره (مثلاً list.count > 0 ) می‌گیرد تا نشان دهد چه زمانی composable شما برای تعامل آماده است.
  • ReportDrawnAfter یک متد تعلیقی می‌گیرد که وقتی تکمیل می‌شود، نشان می‌دهد که شما آماده تعامل هستید.

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

نسخه ۱.۷.۰-rc01

۸ مارس ۲۰۲۳

androidx.activity:activity:1.7.0-rc01 ، androidx.activity:activity-compose:1.7.0-rc01 و androidx.activity:activity-ktx:1.7.0-rc01 منتشر شدند. نسخه 1.7.0-rc01 شامل این کامیت‌ها است.

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

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

۲۲ فوریه ۲۰۲۳

androidx.activity:activity:1.7.0-beta02 ، androidx.activity:activity-compose:1.7.0-beta02 و androidx.activity:activity-ktx:1.7.0-beta02 منتشر شدند. نسخه 1.7.0-beta02 شامل این کامیت‌ها است.

تغییرات API

  • اکشن و اکسترکتی که توسط قراردادهای PickVisualMedia و PickMultipleVisualMedia به عنوان یک جایگزین برای زمانی که MediaStore.ACTION_PICK_IMAGES در دسترس نیست استفاده می‌شود، اکنون ثابت‌های عمومی هستند که پایداری API را برای OEMها و برنامه‌های سیستمی که می‌خواهند یک تجربه Photo Picker سازگار ارائه دهند، فراهم می‌کنند. پیاده‌سازی این جایگزین هنوز فقط به برنامه‌های سیستمی محدود است. ( Icd320 )

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

۸ فوریه ۲۰۲۳

androidx.activity:activity:1.7.0-beta01 ، androidx.activity:activity-compose:1.7.0-beta01 و androidx.activity:activity-ktx:1.7.0-beta01 منتشر شدند. نسخه 1.7.0-beta01 شامل این کامیت‌ها است.

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

  • IntentSenderRequest.Builder.setFlags() اکنون به شما امکان می‌دهد به جای فقط یک پرچم، چندین پرچم را از Intent تنظیم کنید. ( Iac04c )

رفع اشکالات

  • جایگزین PickVisualMedia برای زمانی که فریم‌ورک Photo Picker در دسترس نیست، اکنون به درستی مدیریت را به برنامه‌های نصب شده در تصویر سیستم دستگاه محدود می‌کند. ( If8ae6 )

تبدیل‌های کاتلین

  • ActivityResultRegistryOwner اکنون با کاتلین نوشته شده است. این یک تغییر ناسازگار با سورس برای کلاس‌هایی است که با کاتلین نوشته شده‌اند - اکنون باید به جای پیاده‌سازی تابع getActivityResultRegistry() قبلی، ویژگی activityResultRegistry را بازنویسی کنید. ( I0b00e )
  • OnBackPressedDispatcherOwner اکنون با کاتلین نوشته شده است. این یک تغییر ناسازگار با سورس کد برای کلاس‌هایی است که با کاتلین نوشته شده‌اند - اکنون باید به جای پیاده‌سازی تابع getOnBackPressedDispatcher قبلی، ویژگی onBackPressedDispatcher را بازنویسی کنید. ( Ia277d )
  • ContextAware ، ContextAwareHelper ، OnContextAvailableListener ، IntentSenderRequest و OnBackPressedDispatcher اکنون به زبان کاتلین نوشته شده‌اند. ( I1a73e ، Iada92 ، aosp/2410754 ، I18ac7 ، b/257291701 )

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

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

androidx.activity:activity:1.7.0-alpha04 ، androidx.activity:activity-compose:1.7.0-alpha04 و androidx.activity:activity-ktx:1.7.0-alpha04 منتشر شدند. نسخه 1.7.0-alpha04 شامل این کامیت‌ها است.

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

  • قراردادهای PickVisualMedia و PickMultipleVisualMedia Activity Result اکنون در مواردی که Photo Picker ارائه شده توسط سیستم اندروید (مثلاً MediaStore.ACTION_PICK_IMAGES ) در دسترس نباشد، از Photo Picker ارائه شده توسط سرویس‌های گوگل پلی استفاده می‌کنند. API مربوط به isPhotoPickerAvailable() که فقط سیستم اندروید ارائه شده توسط Photo Picker را تشخیص می‌دهد، منسوخ شده است. توصیه می‌شود از API جدید isPhotoPickerAvailable(Context) استفاده شود که در صورت موجود بودن هر یک از Photo Pickerها، آن را برمی‌گرداند. ( I55be6 )

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

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

androidx.activity:activity:1.7.0-alpha03 ، androidx.activity:activity-compose:1.7.0-alpha03 و androidx.activity:activity-ktx:1.7.0-alpha03 منتشر شدند. نسخه 1.7.0-alpha03 شامل این کامیت‌ها است.

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

  • ComponentDialog اکنون SavedStateRegistryOwner پیاده‌سازی می‌کند و به SavedStateRegistry خود دسترسی دارد و SavedStateRegistryOwner برای ViewTree خود تنظیم می‌کند. اکنون می‌توان از Jetpack Compose در یک ComponentDialog استفاده کرد زیرا هم LifecycleOwner و هم SavedStateRegistryOwner متصل به پنجره را از طریق الزامات APIهای ViewTree برآورده می‌کند. ( Idca17 ، I73468 b/261162296 )

تغییرات API

  • یک تابع ترکیبی ReportDrawn اضافه شد که بلافاصله فعالیت را به عنوان آماده برای فراخوانی reportFullyDrawn علامت‌گذاری می‌کند. ( Ic5b14 ، b/259687964 )

تبدیل‌های کاتلین

  • کلاس‌های ActvitiyResultCallback و OnBackPressedCallback هر دو با حفظ سازگاری سورس و باینری به کاتلین تبدیل شده‌اند. ( Ifc5e5 ، Ide1b0 ، b/257291701 )

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

۲۴ اکتبر ۲۰۲۲

androidx.activity:activity:1.7.0-alpha02 ، androidx.activity:activity-compose:1.7.0-alpha02 و androidx.activity:activity-ktx:1.7.0-alpha02 منتشر شدند. نسخه 1.7.0-alpha02 شامل این کامیت‌ها است.

رفع اشکالات

  • از فعالیت 1.6.1 : مشکلی که باعث می‌شد قرارداد PickMultipleVisualMedia Activity Result هنگام استفاده از مقدار پیش‌فرض برای maxItems در دستگاه‌های اندروید R اجرا نشود، برطرف شد. ( Ie2776 ، b/249182130 )

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

۵ اکتبر ۲۰۲۲

androidx.activity:activity:1.7.0-alpha01 ، androidx.activity:activity-compose:1.7.0-alpha01 و androidx.activity:activity-ktx:1.7.0-alpha01 منتشر شدند. نسخه 1.7.0-alpha01 شامل این کامیت‌ها است.

رابط‌های برنامه‌نویسی کاربردی FullyDrawnReporter

ComponentActivity اکنون یک نمونه FullyDrawnReporter ارائه می‌دهد که به چندین کامپوننت اجازه می‌دهد تا زمانی که برای تعامل آماده هستند، گزارش دهند. ComponentActivity قبل از فراخوانی reportFullyDrawn() از طرف شما، منتظر تکمیل تمام کامپوننت‌ها خواهد ماند. این APIها الزامات زمان‌بندی را برای شما انجام می‌دهند و نیازی به فراخوانی به عنوان بخشی از فراخوانی onDraw ندارند.

این APIها برای فعال کردن موارد زیر تشویق می‌شوند:

  • ارسال سیگنال به Android Runtime هنگام اتمام راه‌اندازی، برای اطمینان از اینکه تمام کدهایی که در طول یک توالی راه‌اندازی چند فریمی اجرا می‌شوند، گنجانده شده و برای کامپایل در پس‌زمینه اولویت‌بندی می‌شوند.
  • سیگنال‌دهی Macrobenchmark و Play Vitals زمانی که برنامه شما باید برای معیارهای راه‌اندازی کاملاً ترسیم شده در نظر گرفته شود، تا بتوانید عملکرد را پیگیری کنید.

دو API برای Activity Compose اضافه شده است تا استفاده از FullyDrawnReporter از composable های جداگانه راحت تر شود:

  • ReportDrawnWhen یک گزاره (مثلاً list.count > 0 ) می‌گیرد تا نشان دهد چه زمانی composable شما برای تعامل آماده است.
  • ReportDrawnAfter یک متد تعلیقی می‌گیرد که وقتی تکمیل می‌شود، نشان می‌دهد که شما آماده تعامل هستید.

نسخه ۱.۶.۱

نسخه ۱.۶.۱

۲۴ اکتبر ۲۰۲۲

androidx.activity:activity:1.6.1 ، androidx.activity:activity-compose:1.6.1 و androidx.activity:activity-ktx:1.6.1 منتشر شدند. نسخه ۱.۶.۱ شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی که باعث می‌شد قرارداد PickMultipleVisualMedia Activity Result در دستگاه‌های اندروید R هنگام استفاده از مقدار پیش‌فرض برای maxItems اجرا نشود، برطرف شد. ( Ie2776 ، b/249182130 )

نسخه ۱.۶.۰

نسخه ۱.۶.۰

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

androidx.activity:activity:1.6.0 ، androidx.activity:activity-compose:1.6.0 و androidx.activity:activity-ktx:1.6.0 منتشر شدند. نسخه 1.6.0 شامل این کامیت‌ها است.

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

  • ActivityResultContracts.PickVisualMedia و ActivityResultContracts.PickMultipleVisualMedia برای ارائه یک قرارداد سازگار با نسخه‌های قبلی اضافه شده‌اند که وقتی Photo Picker در دسترس است MediaStore.ACTION_PICK_IMAGES و وقتی در دسترس نیست Intent.ACTION_OPEN_DOCUMENT استفاده می‌کند.
  • OnBackInvokedCallback در اندروید ۱۳ در OnBackPressedDispatchers ارائه شده توسط ComponentActivity و ComponentDialog ادغام شد. این تضمین می‌کند که تمام APIهای ساخته شده روی OnBackPressedDispatcher هنگام فعال کردن یک حرکت پیش‌بینی‌کننده‌ی بازگشت، کار می‌کنند.

نسخه ۱.۶.۰-rc02

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

androidx.activity:activity:1.6.0-rc02 ، androidx.activity:activity-compose:1.6.0-rc02 و androidx.activity:activity-ktx:1.6.0-rc02 منتشر شدند. نسخه 1.6.0-rc02 شامل این کامیت‌ها است.

رفع اشکالات

  • OnBackPressedDispatcher اکنون OnBackInvokedCallback به جای PRIORITY_OVERLAY با PRIORITY_DEFAULT ثبت می‌کند. ( I3901f )
  • کلاس‌هایی که ComponentActivity ارث‌بری می‌کنند، اکنون همیشه هر دو تابع فراخوانی onMultiWindowModeChanged() خود را ارسال خواهند کرد. ( Ic4d85 )
  • وقتی فراخوانی launch هرگونه Exception ایجاد کند و فراخوانی برگشتی بدون LifecycleOwner ثبت شده باشد، ActivityResultRegistry دیگر نتیجه‌ای را به ActivityResultCallback برنمی‌گرداند. ( Ia7ff7 , b/238350794 )
  • ComponentActivity اکنون فراخوانی‌های منو را به درستی و بدون نیاز به فراخوانی تابع super در activity شما ارسال می‌کند. ( Ie33c5 ، b/238057118 )

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

نسخه ۱.۶.۰-rc01

۲۴ آگوست ۲۰۲۲

androidx.activity:activity:1.6.0-rc01 ، androidx.activity:activity-compose:1.6.0-rc01 و androidx.activity:activity-ktx:1.6.0-rc01 منتشر شدند. نسخه 1.6.0-rc01 شامل این کامیت‌ها است.

رفع اشکالات

  • مقداردهی اولیه OnBackPressedDispatcher دیگر هنگام استفاده از نسخه‌های SDK قبل از ۳۳ باعث ClassVerificationError نمی‌شود. ( Ic32e1 )
  • کلاس‌هایی که تابع فراخوانی onPictureInPictureModeChanged() در ComponentActivity را لغو می‌کنند، اکنون همیشه فراخوانی‌هایشان ارسال خواهد شد. ( Ib7fdb )

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

۱۰ آگوست ۲۰۲۲

androidx.activity:activity:1.6.0-beta01 ، androidx.activity:activity-compose:1.6.0-beta01 و androidx.activity:activity-ktx:1.6.0-beta01 منتشر شدند. نسخه 1.6.0-beta01 شامل این کامیت‌ها است.

تغییرات API

  • متدهای startActivityForResult و startIntentSenderForResult در ComponentActivity با @NonNull منسوخ شده‌اند، زیرا ارسال null همیشه منجر به خرابی شده است. ( Id2a25 ، b/231476082 )

رفع اشکالات

  • از فعالیت 1.5.1 : ActivityResultRegistry دیگر نتیجه‌ای را به ActivityResultCallback برنمی‌گرداند، زمانی که فراخوانی launch هرگونه Exception را ایجاد کند و فراخوانی برگشتی بدون LifecycleOwner ثبت شده باشد. ( Ia7ff7 , b/238350794 )
  • از فعالیت 1.5.1 : ComponentActivity اکنون به درستی فراخوانی‌های منو را به onPrepareOptionMenu() ، onCreateOptionsMenu() و onOptionsItemSelected() بدون نیاز به فراخوانی تابع super ارسال می‌کند. ( Ie33c5 ، b/238057118 )

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

  • از Activity 1.5.1 : کتابخانه Activity اکنون به Lifecycle نسخه 2.5.1 ( If6697 ) وابسته است.

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

۱۵ ژوئن ۲۰۲۲

androidx.activity:activity:1.6.0-alpha05 ، androidx.activity:activity-compose:1.6.0-alpha05 و androidx.activity:activity-ktx:1.6.0-alpha05 منتشر شدند. نسخه 1.6.0-alpha05 در یک شاخه پیش از انتشار خصوصی توسعه داده شده و هیچ کامیت عمومی ندارد.

تغییرات API

  • minCompileSdk اکنون ۳۳ است تا با Tiramisu Beta 3 SDK هماهنگ شود.

رفع اشکالات

  • مشکل کرش کردن در دستگاه‌های قدیمی‌تر هنگام بررسی افزونه SDK برای PickVisualMedia ActivityResultContract برطرف شد، به طوری که اکنون باید با ACTION_OPEN_DOCUMENT در دستگاه‌های دارای اندروید ۱۰ و پایین‌تر کار کند.

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

۱۸ مه ۲۰۲۲

androidx.activity:activity:1.6.0-alpha04 و androidx.activity:activity-ktx:1.6.0-alpha04 منتشر شدند.

رفع اشکالات

  • خطایی در PickVisualMediaRequest که در آن تلاش برای ایجاد یک درخواست، چه از طریق Builder و چه از طریق تابع سطح بالای کاتلین، منجر به سرریز پشته می‌شد، برطرف شد.
  • OnBackInvokedCallback در نسخه توسعه‌یافته بتا ۲ اندروید ۱۳ در OnBackPressedDispatcher ارائه شده توسط ComponentDialog ادغام شده است. این امر تضمین می‌کند که تمام APIهای ساخته شده بر روی OnBackPressedDispatcher هنگام فعال کردن حرکت پیش‌بینی‌کننده بازگشت، کار می‌کنند.

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

۲۷ آوریل ۲۰۲۲

androidx.activity:activity:1.6.0-alpha03 ، androidx.activity:activity-compose:1.6.0-alpha03 و androidx.activity:activity-ktx:1.6.0-alpha03 منتشر شدند.

  • توجه: این نسخه فقط با SDK نسخه ۱ توسعه‌دهندگان اندروید ۱۳ کامپایل می‌شود.

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

  • ActivityResultContracts.PickVisualMedia و ActivityResultContracts.PickMultipleVisualMedia برای ارائه یک قرارداد سازگار با نسخه‌های قبلی اضافه شده‌اند که وقتی Photo Picker در دسترس است MediaStore.ACTION_PICK_IMAGES و وقتی در دسترس نیست Intent.ACTION_OPEN_DOCUMENT استفاده می‌کند.
  • OnBackInvokedCallback در نسخه توسعه بتا ۱ اندروید ۱۳ در OnBackPressedDispatcher ارائه شده توسط ComponentActivity ادغام شده است. این امر تضمین می‌کند که تمام APIهای ساخته شده بر روی OnBackPressedDispatcher هنگام فعال کردن یک حرکت پیش‌بینی‌کننده بازگشت، کار کنند.

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

۲۳ مارس ۲۰۲۲

androidx.activity:activity:1.6.0-alpha01 ، androidx.activity:activity-compose:1.6.0-alpha01 و androidx.activity:activity-ktx:1.6.0-alpha01 منتشر شدند.

  • توجه: این نسخه فقط با SDK پیش‌نمایش توسعه‌دهندگان اندروید ۱۳ نسخه ۲ کامپایل می‌شود.

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

  • تغییرات یکپارچه در پیش‌نمایش توسعه‌دهندگان اندروید ۱۳ نسخه ۲ در ComponentActivity .

نسخه ۱.۵.۱

نسخه ۱.۵.۱

۲۷ ژوئیه ۲۰۲۲

androidx.activity:activity:1.5.1 ، androidx.activity:activity-compose:1.5.1 و androidx.activity:activity-ktx:1.5.1 منتشر شدند. نسخه ۱.۵.۱ شامل این کامیت‌ها است.

رفع اشکالات

  • وقتی فراخوانی launch() هرگونه Exception ایجاد کند و فراخوانی بدون LifecycleOwner ثبت شده باشد، ActivityResultRegistry دیگر نتیجه‌ای را به ActivityResultCallback برنمی‌گرداند. ( Ia7ff7 , b/238350794 )

  • ComponentActivity اکنون به درستی فراخوانی‌های منو را به onPrepareOptionMenu() ، onCreateOptionsMenu() و onOptionsItemSelected() بدون نیاز به فراخوانی تابع super ارسال می‌کند. ( Ie33c5 ، b/238057118 )

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

نسخه ۱.۵.۰

نسخه ۱.۵.۰

۲۹ ژوئن ۲۰۲۲

androidx.activity:activity:1.5.0 ، androidx.activity:activity-compose:1.5.0 و androidx.activity:activity-ktx:1.5.0 منتشر شدند. نسخه ۱.۵.۰ شامل این کامیت‌ها است.

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

  • ComponentDialog - ComponentDialog یک زیرکلاس از Dialog است که شامل یک OnBackPressedDispatcher است که هنگام فشردن دکمه بازگشت سیستم و نمایش دیالوگ فراخوانی می‌شود. نکته مهم این است که این زیرکلاس همچنین ViewTreeOnBackPressedDispatcherOwner را تنظیم می‌کند و به viewها اجازه می‌دهد تا یک روش عمومی برای بازیابی dispatcher صحیح، چه در ComponentActivity و چه در ComponentDialog وجود داشته باشد، داشته باشند.
  • رابط‌های فراخوانی - ComponentActivity اکنون مجموعه‌ای از رابط‌های فراخوانی ماژولار را پیاده‌سازی می‌کند که می‌توانند به جای فراخوانی‌های Activity مورد استفاده قرار گیرند. این رابط‌ها شامل موارد زیر هستند: OnNewIntentProvider ، OnConfigurationChangedProvider ، OnTrimMemoryProvider ، OnPictureInPictureModeChangedProvider ، OnMultiWindowModeChangedProvider
  • یکپارچه‌سازی CreationExtras - ComponentActivity اکنون توانایی ارائه یک ViewModelProvider.Factory بدون وضعیت را از طریق CreationExtras در Lifecycle 2.5.0 دارد.

تغییرات دیگر

  • سازنده‌ی بدون پارامتر برای ActivityResultContracts.CreateDocument منسوخ شده و با یک سازنده‌ی جدید جایگزین شده است که یک نوع mime مشخص (مثلاً "image/png") را همانطور که توسط Intent.ACTION_CREATE_DOCUMENT الزامی است، می‌گیرد.

نسخه ۱.۵.۰-rc01

۱۱ مه ۲۰۲۲

androidx.activity:activity:1.5.0-rc01 ، androidx.activity:activity-compose:1.5.0-rc01 و androidx.activity:activity-ktx:1.5.0-rc01 بدون هیچ تغییری نسبت به نسخه ۱.۵.۰-beta01 منتشر شده‌اند. نسخه ۱.۵.۰-rc01 شامل این کامیت‌ها است.

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

۲۰ آوریل ۲۰۲۲

androidx.activity:activity:1.5.0-beta01 ، androidx.activity:activity-compose:1.5.0-beta01 و androidx.activity:activity-ktx:1.5.0-beta01 منتشر شدند. نسخه 1.5.0-beta01 شامل این کامیت‌ها است.

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

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

۶ آوریل ۲۰۲۲

androidx.activity:activity:1.5.0-alpha05 ، androidx.activity:activity-compose:1.5.0-alpha05 و androidx.activity:activity-ktx:1.5.0-alpha05 منتشر شدند. نسخه 1.5.0-alpha05 شامل این کامیت‌ها است.

رفع اشکالات

  • تابع onPanelClosed() در ComponentActivity ، اکنون تابع super onPanelClosed() را نیز فراخوانی می‌کند و مشکلی را که باعث می‌شد متد onContextMenuClosed فراخوانی نشود، برطرف می‌کند. ( Ib6f77 )

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

۲۳ مارس ۲۰۲۲

androidx.activity:activity:1.5.0-alpha04 ، androidx.activity:activity-compose:1.5.0-alpha04 و androidx.activity:activity-ktx:1.5.0-alpha04 منتشر شدند. نسخه 1.5.0-alpha04 شامل این کامیت‌ها است.

رفع اشکالات

  • SavedStateViewFactory اکنون از CreationExtras پشتیبانی می‌کند، حتی زمانی که با SavedStateRegistryOwner مقداردهی اولیه شده باشد. اگر مقادیر اضافی ارائه شوند، آرگومان‌های مقداردهی اولیه نادیده گرفته می‌شوند. ( I6c43b ، b/224844583 )

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

۲۳ فوریه ۲۰۲۲

androidx.activity:activity:1.5.0-alpha03 ، androidx.activity:activity-compose:1.5.0-alpha03 و androidx.activity:activity-ktx:1.5.0-alpha03 منتشر شدند. نسخه 1.5.0-alpha03 شامل این کامیت‌ها است.

تغییرات API

  • اکنون می‌توانید CreationExtras by viewModels() به اکتیویتی ارسال کنید ( I6a3e6 , b/217600303 )

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

۹ فوریه ۲۰۲۲

androidx.activity:activity:1.5.0-alpha02 ، androidx.activity:activity-compose:1.5.0-alpha02 و androidx.activity:activity-ktx:1.5.0-alpha02 منتشر شدند. نسخه 1.5.0-alpha02 شامل این کامیت‌ها است.

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

  • ComponentActivity اکنون رابط OnPictureInPictureModeChangedProvider را پیاده‌سازی می‌کند تا به هر کامپوننتی اجازه دهد رویدادهای تغییر حالت تصویر در تصویر را دریافت کند. ( I9f567 )
  • ComponentActivity اکنون رابط OnMultiWindowModeChangedProvider را پیاده‌سازی می‌کند تا به هر کامپوننتی اجازه دهد رویدادهای تغییر حالت چند پنجره‌ای را دریافت کند. ( I62d91 )

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

۲۶ ژانویه ۲۰۲۲

androidx.activity:activity:1.5.0-alpha01 ، androidx.activity:activity-compose:1.5.0-alpha01 و androidx.activity:activity-ktx:1.5.0-alpha01 منتشر شدند. نسخه 1.5.0-alpha01 شامل این کامیت‌ها است.

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

  • ComponentActivity اکنون با ViewModel CreationExtras که به عنوان بخشی از Lifecycle 2.5.0-alpha01 معرفی شده است، ادغام می‌شود. ( Ie7e00 ، b/207012584 )
  • ComponentDialog اضافه شد، یک زیرکلاس از Dialog که شامل OnBackPressedDispatcher است که هنگام فشردن دکمه بازگشت سیستم هنگام نمایش دیالوگ فراخوانی می‌شود. نکته مهم این است که این زیرکلاس ViewTreeOnBackPressedDispatcherOwner را نیز تنظیم می‌کند و به viewها اجازه می‌دهد تا یک روش عمومی برای بازیابی dispatcher صحیح، چه در ComponentActivity و چه در ComponentDialog وجود داشته باشد، داشته باشند. ( I8a1bc )
  • ComponentActivity اکنون رابط کاربری جدید OnNewIntentProvider را پیاده‌سازی می‌کند تا به هر کامپوننتی اجازه دهد این رویدادها را دریافت کند. ( If1f8b )
  • ComponentActivity اکنون رابط کاربری جدید OnConfigurationChangedProvider را پیاده‌سازی می‌کند تا به هر کامپوننتی اجازه دهد این رویدادها را دریافت کند. ( If623b )
  • ComponentActivity اکنون رابط کاربری جدید OnTrimMemoryProvider را پیاده‌سازی می‌کند تا به هر کامپوننتی اجازه دریافت این رویدادها را بدهد. ( Ia9295 )

تغییرات API

  • سازنده‌ی بدون پارامتر برای ActivityResultContracts.CreateDocument منسوخ شده و با یک سازنده‌ی جدید جایگزین شده است که یک نوع mime مشخص (مثلاً "image/png" ) را همانطور که توسط Intent.ACTION_CREATE_DOCUMENT لازم است، می‌گیرد. ( I2bec6 )
  • اکنون می‌توان OnBackPressedDispatcherOwner مرتبط با یک View را از طریق ViewTreeOnBackPressedDispatcherOwner بازیابی کرد، به جای اینکه به تبدیل Context ( I74685 ) متکی باشیم.

رفع اشکالات

  • مشکل از کار افتادن برنامه هنگام دسترسی به ViewModel برای اولین بار از طریق callback تابع registerForActivityResult() یا callbackهای مربوط به LifecycleObserver که به عنوان بخشی از init یک ComponentActivity اضافه شده بود، برطرف شد. ( Ife83f )

نسخه ۱.۴.۰

نسخه ۱.۴.۰

۲۷ اکتبر ۲۰۲۱

androidx.activity:activity:1.4.0 ، androidx.activity:activity-compose:1.4.0 و androidx.activity:activity-ktx:1.4.0 منتشر شدند. نسخه ۱.۴.۰ شامل این کامیت‌ها است.

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

  • کامپوننت اندروید ایکس ComponentActivity (AndroidX ComponentActivity) اکنون رابط MenuHost را پیاده‌سازی می‌کند. این به هر کامپوننتی اجازه می‌دهد تا با اضافه کردن یک نمونه MenuProvider به اکتیویتی، آیتم‌های منو را به ActionBar اضافه کند. هر MenuProvider می‌تواند به صورت اختیاری با یک Lifecycle اضافه شود که به طور خودکار قابلیت مشاهده آن آیتم‌های منو را بر اساس وضعیت Lifecycle کنترل می‌کند و حذف MenuProvider را هنگام از بین رفتن Lifecycle مدیریت می‌کند.
  • کلاس ActivityResultContract در کاتلین بازنویسی شده است تا اطمینان حاصل شود که توسعه‌دهندگانی که قراردادهای سفارشی را در کاتلین می‌نویسند، می‌توانند nullability صحیح را برای کلاس‌های ورودی و خروجی خود تعریف کنند.
  • کلاس ActivityResultContracts و قراردادهای آن در کاتلین بازنویسی شده‌اند تا از nullability مناسب اطمینان حاصل شود.

نسخه ۱.۴.۰-rc01

۱۳ اکتبر ۲۰۲۱

androidx.activity:activity:1.4.0-rc01 ، androidx.activity:activity-compose:1.4.0-rc01 و androidx.activity:activity-ktx:1.4.0-rc01 منتشر شدند. نسخه 1.4.0-rc01 شامل این کامیت‌ها است.

رفع اشکالات

  • وقتی فراخوانی launch هرگونه Exception ایجاد کند، ActivityResultRegistry دیگر نتیجه‌ای را به ActivityResultCallback برنمی‌گرداند. ( If4f91 , b/200845664 )

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

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

androidx.activity:activity:1.4.0-beta01 ، androidx.activity:activity-compose:1.4.0-beta01 و androidx.activity:activity-ktx:1.4.0-beta01 منتشر شدند. نسخه 1.4.0-beta01 شامل این کامیت‌ها است.

تغییرات API

  • نوع ActivityResultContracts.OpenMultipleDocuments و ActivityResultContracts.GetMultipleContents که باعث می‌شد هنگام استفاده از کد زبان برنامه‌نویسی جاوا، از نوع خروجی List<? extends Uri> استفاده شود، اصلاح شد. ( If71de )
  • ثابت‌های عمومی درون کلاس‌های ActivityResultContracts.StartActivityForResult ، ActivityResultContracts.StartIntentSenderForResult و ActivityResultContracts.RequestMultiplePermissions اکنون هنگام استفاده از کاتلین از طریق اشیاء Companion که اکنون عمومی شده‌اند، قابل دسترسی هستند. ( aosp/1832555 )

به‌روزرسانی‌های مستندات

  • پیام منسوخ شدن APIها که اکنون توسط APIهای Activity Result ، یعنی startActivityForResult ، startIntentSenderForResult ، onActivityResult ، requestPermissions و onRequestPermissionsResult مدیریت می‌شوند، همگی با جزئیات بیشتری گسترش یافته‌اند. ( cce80f )

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

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

androidx.activity:activity:1.4.0-alpha02 ، androidx.activity:activity-compose:1.4.0-alpha02 و androidx.activity:activity-ktx:1.4.0-alpha02 منتشر شدند. نسخه 1.4.0-alpha02 شامل این کامیت‌ها است.

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

  • آرتیفکت activity-compose اکنون حاوی یک خطای lint LaunchDuringComposition است که مانع از فراخوانی متد launch از ActivityResultLauncher به عنوان بخشی از ترکیب می‌شود، زیرا ترکیب باید عاری از عوارض جانبی باشد. از APIها برای مدیریت عوارض جانبی استفاده کنید. ( 7c2bbe ، b/191347220 )

تغییرات API

  • کلاس ActivityResultContract در کاتلین بازنویسی شده است تا اطمینان حاصل شود که توسعه‌دهندگانی که قراردادهای سفارشی را در کاتلین می‌نویسند، می‌توانند nullability صحیح را برای کلاس‌های ورودی و خروجی خود تعریف کنند. ( I8a8f5 )
  • کلاس ActivityResultContracts و قراردادهای آن در کاتلین بازنویسی شده‌اند تا از nullability مناسب اطمینان حاصل شود. ( I69802 )

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

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

androidx.activity:activity:1.4.0-alpha01 ، androidx.activity:activity-compose:1.4.0-alpha01 و androidx.activity:activity-ktx:1.4.0-alpha01 منتشر شدند. نسخه 1.4.0-alpha01 شامل این کامیت‌ها است.

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

  • کامپوننت اندروید اکس (AndroidX ComponentActivity اکنون رابط MenuHost را پیاده‌سازی می‌کند. این به هر کامپوننتی اجازه می‌دهد تا با اضافه کردن یک نمونه MenuProvider به اکتیویتی، آیتم‌های منو را به ActionBar اضافه کند. هر MenuProvider می‌تواند به صورت اختیاری با یک Lifecycle اضافه شود که به طور خودکار قابلیت مشاهده آن آیتم‌های منو را بر اساس وضعیت Lifecycle کنترل می‌کند و حذف MenuProvider را هنگام از بین رفتن Lifecycle مدیریت می‌کند. ( I3b608 ):
/**
  * Using the addMenuProvider() API directly in your Activity
  **/
class ExampleActivity : ComponentActivity(R.layout.activity_example) {

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    // Add menu items without overriding methods in the Activity
   addMenuProvider(object : MenuProvider {
      override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
        // Add menu items here
        menuInflater.inflate(R.menu.example_menu, menu)
      }

      override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
        // Handle the menu selection
        return true
      }
    })
  }
}

/**
  * Using the addMenuProvider() API in a Fragment
  **/
class ExampleFragment : Fragment(R.layout.fragment_example) {

  override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    // The usage of an interface lets you inject your own implementation
    val menuHost: MenuHost = requireActivity()
  
    // Add menu items without using the Fragment Menu APIs
    // Note how we can tie the MenuProvider to the viewLifecycleOwner
    // and an optional Lifecycle.State (here, RESUMED) to indicate when
    // the menu should be visible
    menuHost.addMenuProvider(object : MenuProvider {
      override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
        // Add menu items here
        menuInflater.inflate(R.menu.example_menu, menu)
      }

      override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
        // Handle the menu selection
        return true
      }
    }, viewLifecycleOwner, Lifecycle.State.RESUMED)
  }

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

  • ActivityResultRegistry اکنون هنگام تلاش برای فراخوانی launch() روی ActivityResultLauncher که ثبت نشده یا ثبت نشده است، یک IllegalStateException صادر می‌کند. ( Ida75d , b/192567522 )

مشارکت خارجی

  • ممنون dmitrilc بابت رفع یک غلط املایی در مستندات ActivityResult . ( #221 )

نسخه ۱.۳.۱

نسخه ۱.۳.۱

۴ آگوست ۲۰۲۱

androidx.activity:activity:1.3.1 ، androidx.activity:activity-compose:1.3.1 و androidx.activity:activity-ktx:1.3.1 منتشر شدند. نسخه ۱.۳.۱ شامل این کامیت‌ها است.

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

  • فعالیت اکنون به کاتلین 1.5.21 بستگی دارد.
  • اکتیویتی Compose اکنون به Compose 1.0.1 وابسته است.

نسخه ۱.۳.۰

نسخه ۱.۳.۰

۲۸ ژوئیه ۲۰۲۱

androidx.activity:activity:1.3.0 ، androidx.activity:activity-compose:1.3.0 و androidx.activity:activity-ktx:1.3.0 منتشر شدند. نسخه ۱.۳.۰ شامل این کامیت‌ها است.

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

  • مصنوع Activity Compose - مصنوع activity-compose متد افزونه setContent را برای میزبانی رابط کاربری Jetpack Compose شما در یک activity و پوشش‌های مخصوص Compose برای تعامل با APIهای ComponentActivity جهت مدیریت دکمه بازگشت سیستم و APIهای Activity Result فراهم می‌کند. برای جزئیات بیشتر به مستندات مراجعه کنید.
  • قرارداد CaptureVideo - قرارداد CaptureVideo ActivityResultContract جایگزین قرارداد منسوخ شده TakeVideo شده و یک مقدار بولی (boolean) برمی‌گرداند که نشان‌دهنده موفقیت است و در بسیاری از برنامه‌های دوربین کار می‌کند.
  • ردیابی نمای تصویر در تصویر - کاربران activity-ktx اکنون می‌توانند از متد الحاقی trackPipAnimationHintView در Activity استفاده کنند تا به طور خودکار PictureInPictureParams را با موقعیت جدید نما هنگام تغییر موقعیت آن نسبت به پنجره، بازسازی کنند.

نسخه ۱.۳.۰-rc02

۱۴ ژوئیه ۲۰۲۱

androidx.activity:activity:1.3.0-rc02 ، androidx.activity:activity-compose:1.3.0-rc02 و androidx.activity:activity-ktx:1.3.0-rc02 منتشر شدند. نسخه 1.3.0-rc02 شامل این کامیت‌ها است.

رفع اشکالات

  • فراخوانی‌های ActivityResultRegistry اکنون به درستی ذخیره و بازیابی می‌شوند، بنابراین فراخوانی‌های مجدد در savedState تکرار نمی‌شوند. ( I97816 ، b/191893160 )

نسخه ۱.۳.۰-rc01

۱ ژوئیه ۲۰۲۱

androidx.activity:activity:1.3.0-rc01 ، androidx.activity:activity-compose:1.3.0-rc01 و androidx.activity:activity-ktx:1.3.0-rc01 بدون هیچ تغییری نسبت به 1.3.0-beta02 منتشر شده‌اند. نسخه ۱.۳.۰-rc01 شامل این کامیت‌ها است.

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

۱۶ ژوئن ۲۰۲۱

androidx.activity:activity:1.3.0-beta02 ، androidx.activity:activity-compose:1.3.0-beta02 و androidx.activity:activity-ktx:1.3.0-beta02 منتشر شدند. نسخه 1.3.0-beta02 شامل این کامیت‌ها است.

تابع activity-compose به‌روزرسانی شد تا به Compose 1.0.0-beta09 وابسته باشد. androidx.compose.ui:ui-test-junit4 اکنون در زمان کامپایل به activity-compose وابسته است.

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

۲ ژوئن ۲۰۲۱

androidx.activity:activity:1.3.0-beta01 ، androidx.activity:activity-compose:1.3.0-beta01 و androidx.activity:activity-ktx:1.3.0-beta01 منتشر شدند. نسخه 1.3.0-beta01 شامل این کامیت‌ها است.

تغییرات API

  • متد @Composable registerForActivityResult() ‎ که قبلاً منسوخ شده بود، حذف شده است. لطفاً از rememberLauncherForActivityResult() ‎ استفاده کنید. ( Ic39d3 )

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

۱۸ مه ۲۰۲۱

androidx.activity:activity:1.3.0-alpha08 ، androidx.activity:activity-compose:1.3.0-alpha08 و androidx.activity:activity-ktx:1.3.0-alpha08 منتشر شدند. نسخه 1.3.0-alpha08 شامل این کامیت‌ها است.

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

  • قرارداد جدید CaptureVideo ActivityResultContract یک مقدار بولی به ActivityResultCallback شما برمی‌گرداند که نشان می‌دهد آیا ویدیوی شما با موفقیت در URI داده شده ذخیره شده است یا خیر. این قرارداد جایگزین قرارداد منسوخ شده TakeVideo می‌شود، زیرا برنامه‌های دوربین به ندرت از بازگرداندن یک تصویر کوچک پشتیبانی می‌کنند و نتیجه را بی‌فایده می‌کند. ( Ie21f2 ، b/185938070 )
  • API Activity#setPipAnimationHintView جدیدی اضافه شده است تا هر زمان که نما حرکت می‌کند، راهنمای منبع PipParams به‌روزرسانی شود. ( I9063d )

تغییرات API

  • تابع rememberLauncherForActivityResult اکنون یک لانچر برمی‌گرداند که تابع unregister() را منسوخ می‌کند - ثبت و لغو ثبت لانچر به طور خودکار توسط rememberLauncherForActivityResult انجام می‌شود. ( I2443e )

سازگاری با آهنگسازی

  • androidx.activity:activity-compose:1.3.0-alpha08 فقط با Compose نسخه 1.0.0-beta07 و بالاتر سازگار است.

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

۲۱ آوریل ۲۰۲۱

androidx.activity:activity:1.3.0-alpha07 ، androidx.activity:activity-compose:1.3.0-alpha07 و androidx.activity:activity-ktx:1.3.0-alpha07 منتشر شدند. نسخه 1.3.0-alpha07 شامل این کامیت‌ها است.

رفع اشکالات

  • rememberLauncherForActivityResult اکنون یک ارجاع پایدار به همان نمونه ActivityResultLauncher برمی‌گرداند، حتی اگر قرارداد به دلیل ترکیب‌های مجدد تغییر کند. ( Id2d6d )
  • استفاده از نسخه‌های ناپایدار Fragments بالاتر از 1.3.0 دیگر خطای مثبت کاذب lint که به شما می‌گوید 1.3.0 استفاده کنید را نشان نمی‌دهد. ( aosp/1670206 , b/184847092 )

نسخه ۱.۳.۰-alpha06

۷ آوریل ۲۰۲۱

androidx.activity:activity:1.3.0-alpha06 ، androidx.activity:activity-compose:1.3.0-alpha06 و androidx.activity:activity-ktx:1.3.0-alpha06 منتشر شدند. نسخه 1.3.0-alpha06 شامل این کامیت‌ها است.

تغییرات API

  • API registerForActivityResult() به rememberLauncherForActivityResult() تغییر نام داده است تا بهتر نشان دهد که ActivityResultLauncher برگردانده شده یک شیء مدیریت شده است که از طرف شما به خاطر سپرده می‌شود. اکنون تلاش برای فراخوانی تابع unregister در ActivityResultLauncher برگردانده شده، منجر به خطا خواهد شد. ( I2bb6d )
  • LocalOnBackPressedDispatcherOwner.current و LocalActivityResultRegistryOwner.current اکنون یک مقدار nullable برمی‌گردانند تا بهتر مشخص شود که آیا در ترکیب فعلی موجود است یا خیر. APIهایی که به این APIها نیاز دارند، مانند BackHandler و rememberLauncherForActivityResult() ، اکنون در صورت عدم یافتن مالک اصلی، خطای توصیفی‌تری ارسال می‌کنند. NavHost اکنون حتی زمانی که OnBackPressedDispatcherOwner یافت نشود، کار می‌کند، مانند موردی که هنگام پیش‌نمایش NavHost وجود دارد. ( I7d8b4 )

رفع اشکالات

  • اکنون BackHandler در صورتی که Activity STOPPED و سپس دوباره STARTED و سایر فراخوانی‌های برگشتی با LifecycleOwner اضافه شده باشند، به درستی کلیدهای برگشتی را رهگیری می‌کند. ( I71de6 , b/182284739 )
  • استفاده از افزونه‌ی متد launch() با یک ActivityResultContract سفارشی که ورودی Unit دارد، دیگر باعث ایجاد NullPointerException ( I76282 , b/183837954 ) نخواهد شد.

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

۲۴ مارس ۲۰۲۱

androidx.activity:activity:1.3.0-alpha05 ، androidx.activity:activity-compose:1.3.0-alpha05 و androidx.activity:activity-ktx:1.3.0-alpha05 منتشر شدند. نسخه 1.3.0-alpha05 شامل این کامیت‌ها است.

رفع اشکالات

  • از فعالیت ۱.۲.۲ : مشکلی در بررسی خط InvalidFragmentVersionForActivityResult که منجر به مثبت کاذب هنگام استفاده از Fragment 1.3.1 یا بالاتر می‌شد، برطرف شد. ( I54da1 ، b/182388985 )
  • از Activity 1.2.2 : ComponentActivity اکنون هنگام اجرای یک Intent از ActivityResultContract که قبلاً به عنوان یک Intent اضافی در Intent دیگری نگهداری می‌شد، از ClassNotFoundException جلوگیری می‌کند. ( Ieff05 , b/182906230 )

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

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

۱۰ مارس ۲۰۲۱

androidx.activity:activity:1.3.0-alpha04 ، androidx.activity:activity-compose:1.3.0-alpha04 و androidx.activity:activity-ktx:1.3.0-alpha04 منتشر شدند. نسخه 1.3.0-alpha04 شامل این کامیت‌ها است.

رفع اشکالات

  • From Activity 1.2.1 : RequestMultiplePermissions now always returns results for all requested permissions instead of only permissions that weren't previously granted. ( I50bc3 , b/180884668 )
  • From Activity 1.2.1 : ActivityResultRegistry now ensures that in progress launch() requests will return their results even if you unregister() , then register() again with the same key. ( I9ef34 , b/181267562 )
  • Activity Compose no longer adds test dependencies to the runtime classpath. ( Ifd8b3 )
  • Fixed an issue with BackHandler where the previously set onBack lambda was still being used after recomposition. ( 8eb5eb )

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

۲۴ فوریه ۲۰۲۱

androidx.activity:activity:1.3.0-alpha03 , androidx.activity:activity-compose:1.3.0-alpha03 , and androidx.activity:activity-ktx:1.3.0-alpha03 are released. Version 1.3.0-alpha03 contains these commits.

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

  • There is a now a Composable registerForActivityResult function for getting results from activities within composables. ( Ia7851 , b/172690553 )

تغییرات API

  • LocalOnBackPressedDispatcherOwner now has a provides functions that can be used with CompositionLocalProvider , replacing the asProvidableCompositionLocal() API. ( I45d24 )

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

۱۰ فوریه ۲۰۲۱

androidx.activity:activity:1.3.0-alpha02 , androidx.activity:activity-compose:1.3.0-alpha02 , and androidx.activity:activity-ktx:1.3.0-alpha02 are released. Version 1.3.0-alpha02 contains these commits.

رفع اشکالات

  • Fixed an issue in Activity Compose 1.3.0-alpha01 that causes a NoSuchMethodError: No static method setContent exception when using Compose 1.0.0-alpha12 . All Compose users should depend on 1.3.0-alpha02 and above. ( b/179911234 )

تغییرات API

  • The BackHandler API can be used to allow a Composable to intercept the system back button. ( I58ed5 , b/172154006 )

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

۱۰ فوریه ۲۰۲۱

androidx.activity:activity:1.3.0-alpha01 , androidx.activity:activity-compose:1.3.0-alpha01 , and androidx.activity:activity-ktx:1.3.0-alpha01 are released. Version 1.3.0-alpha01 contains these commits.

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

  • The new activity-compose artifact provides Jetpack Compose specific helpers for androidx.activity specific APIs.
    • ComponentActivity.setContent has moved from androidx.compose.ui.platform.setContent to androidx.activity.compose.setContent . ( Icf416 )

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

  • Using Activity Compose 1.3.0-alpha01 and libraries that depend on it, such as androidx.compose.ui:ui-test-junit4:1.0.0-alpha12 , will result in a NoSuchMethodError: No static method setContent exception. ( b/179911234 )

نسخه ۱.۲.۴

نسخه ۱.۲.۴

۲۱ ژوئیه ۲۰۲۱

androidx.activity:activity:1.2.4 and androidx.activity:activity-ktx:1.2.4 are released. Version 1.2.4 contains these commits.

رفع اشکالات

نسخه ۱.۲.۳

نسخه ۱.۲.۳

۵ مه ۲۰۲۱

androidx.activity:activity:1.2.3 and androidx.activity:activity-ktx:1.2.3 are released. Version 1.2.3 contains these commits.

رفع اشکالات

  • Using the launch() method extension with a custom ActivityResultContract that has a Unit input will no longer cause a NullPointerException ( I76282 , b/183837954 )
  • Fixed a false positive lint error telling you to use Fragment 1.3.0 when using an snapshot, alpha, beta, or RC build of a newer version of Fragments. ( f4a57e , b/184847092 )

نسخه ۱.۲.۲

نسخه ۱.۲.۲

۲۴ مارس ۲۰۲۱

androidx.activity:activity:1.2.2 and androidx.activity:activity-ktx:1.2.2 are released. Version 1.2.2 contains these commits.

رفع اشکالات

  • Fixed an issue in the InvalidFragmentVersionForActivityResult lint check that led to a false positive when using Fragment 1.3.1 or higher. ( I54da1 , b/182388985 )
  • ComponentActivity now avoids a ClassNotFoundException when launching an Intent from an ActivityResultContract that was previously held as an extra in another Intent . ( Ieff05 , b/182906230 )

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

نسخه ۱.۲.۱

نسخه ۱.۲.۱

March 10, 2021

androidx.activity:activity:1.2.1 and androidx.activity:activity-ktx:1.2.1 are released. Version 1.2.1 contains these commits.

رفع اشکالات

  • RequestMultiplePermissions now always returns results for all requested permissions instead of only permissions that weren't previously granted. ( I50bc3 , b/180884668 )
  • ActivityResultRegistry now ensures that in progress launch() requests will return their results even if you unregister() , then register() again with the same key. ( I9ef34 , b/181267562 )

نسخه ۱.۲.۰

نسخه ۱.۲.۰

۱۰ فوریه ۲۰۲۱

androidx.activity:activity:1.2.0 and androidx.activity:activity-ktx:1.2.0 are released. Version 1.2.0 contains these commits.

Major changes since 1.1.0

  • Activity Result APIs : ComponentActivity now provides an ActivityResultRegistry that lets you handle startActivityForResult() + onActivityResult() as well as requestPermissions() + onRequestPermissionsResult() flows without overriding methods in your Activity or Fragment, brings increased type safety via ActivityResultContract , and provides hooks for testing these flows. See the updated Getting a Result from an Activity .
  • ContextAware : ComponentActivity now implements ContextAware , allowing you to add one or more OnContextAvailableListener instances which will receive a callback before the base Activity.onCreate() .

    • A suspending Kotlin extension withContextAvailable() allows you to run a non-suspending block when the Context becomes available and return a result.
    • This API is used by FragmentActivity in Fragment 1.3.0 to restore the state of the FragmentManager . Any listeners added to subclasses of FragmentActivity will run after that listener.
    • This API is used by AppCompatActivity in AppCompat 1.3.0-alpha02 or higher. Any listeners added to subclasses of AppCompatActivity will run after that listener.
  • ViewTree Support : ComponentActivity now supports the ViewTreeLifecycleOwner.get(View) , ViewTreeViewModelStoreOwner.get(View) , and ViewTreeSavedStateRegistryOwner APIs added in Lifecycle 2.3.0 and SavedState 1.1.0 such that it will return the Activity as the LifecycleOwner , ViewModelStoreOwner , and SavedStateRegistryOwner for any Views directly added to the ComponentActivity .

  • reportFullyDrawn() backport - The Activity method of reportFullyDrawn() has been backported in ComponentActivity to work on all API levels, fixing a crash on API 19 and adding tracing for this method for all API levels.

نسخه ۱.۲.۰-rc01

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

androidx.activity:activity:1.2.0-rc01 and androidx.activity:activity-ktx:1.2.0-rc01 are released. Version 1.2.0-rc01 contains these commits.

رفع اشکالات

  • The ActivityResultRegistry now always restores the exact state that was saved. ( Idd56b )
  • Add tracing to ComponentActivity.reportFullyDrawn ( Ic7632 )

مشارکت خارجی

  • ComponentActivity now overrides reportFullyDrawn() , allowing it to be called on all API levels and fixing a crash when calling this method without the appropriate system permission on API 19 devices. Thanks Simon Schiller! ( b/163239764 , #103 )

Version 1.2.0-beta02

۲ دسامبر ۲۰۲۰

androidx.activity:activity:1.2.0-beta02 and androidx.activity:activity-ktx:1.2.0-beta02 are released. Version 1.2.0-beta02 contains these commits.

رفع اشکالات

  • Fixed an issue where the Activity Result API would not wait for the Lifecycle to be STARTED before delivering results when registered with a Lifecycle . ( I109ea )

مشارکت خارجی

  • Updated the documentation for launch() to explicitly call out that it can throw an ActivityNotFoundException . Thanks Michał Zieliński! ( aosp/1493580 )

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

۱ اکتبر ۲۰۲۰

androidx.activity:activity:1.2.0-beta01 and androidx.activity:activity-ktx:1.2.0-beta01 are released. Version 1.2.0-beta01 contains these commits.

رفع اشکالات

  • The ActivityResultRegistry now randomly generates integers until it finds one that is unallocated to use as a request code register() , thus preventing the possible integer overflow caused by incrementing request codes. ( b/168779518 )

  • Lifecycle observers are properly removed when calling unregister() on an ActivityResultLauncher . ( b/165608393 )

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

  • The ActivityResultRegistry now throws an IllegalStateException when attempting to call register() with a LifecycleOwner whose Lifecycle has already reached STARTED . ( b/165435866 )

Documentation Updated

  • ContextAware documentation links to LifecycleOwner to highlight Lifecycle callbacks as the appropriate place for creation and destruction events. ( aosp/1414152 )

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

۱۹ آگوست ۲۰۲۰

androidx.activity:activity:1.2.0-alpha08 and androidx.activity:activity-ktx:1.2.0-alpha08 are released. Version 1.2.0-alpha08 contains these commits.

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

  • ComponentActivity now implements ContextAware , allowing you to add one or more OnContextAvailableListener instances which will receive a callback before the base Activity.onCreate() . ( b/161390636 )
    • A suspending Kotlin extension withContextAvailable() allows you to run a non-suspending block when the Context becomes available and return a result. ( I8290c )
    • This API is used by FragmentActivity in Fragment 1.3.0-alpha08 to restore the state of the FragmentManager . Any listeners added to subclasses of FragmentActivity will run after that listener. ( I513da )
    • This API is used by AppCompatActivity in AppCompat 1.3.0-alpha02 . Any listeners added to subclasses of AppCompatActivity will run after that listener. ( I513da )

رفع اشکالات

  • Fixed an issue with the ActivityResultFragmentVersionDetector Lint check that caused it to break when using Lint 27.1.0 or higher. ( b/162155191 )

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

۲۲ ژوئیه ۲۰۲۰

androidx.activity:activity:1.2.0-alpha07 and androidx.activity:activity-ktx:1.2.0-alpha07 are released. Version 1.2.0-alpha07 contains these commits.

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

  • Added a new InvalidFragmentVersionForActivityResult lint check that verifies that you are using Fragment 1.3.0-alpha07 when using the Activity Result API , avoiding runtime crashes due to “invalid request code” issues and non-functioning permission requests caused by using older versions of Fragments. ( b/152554847 )

مشارکت خارجی

  • Fixed an ArrayIndexOutOfBoundsException when parsing the results for the RequestPermission Activity Result contract. ( I8f9e3 , b/161057605 )

نسخه ۱.۲.۰-alpha06

June 10, 2020

androidx.activity:activity:1.2.0-alpha06 and androidx.activity:activity-ktx:1.2.0-alpha06 are released. Version 1.2.0-alpha06 contains these commits.

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

  • You can now destructure the ActivityResult class in kotlin to directly access the requestCode and intent . ( b/157212935 )
  • ActivityResultLauncher now allows you to get the ActivityResultContract that was used to register the launcher. ( b/156875743 )

تغییرات API

  • Breaking change : The invoke() method on ActivityResultRegistry has been renamed to onLaunch() . ( b/157496491 )
  • The OpenMultipleDocuments contract now returns an empty list instead of null to the registered callback if no result is returned. ( b/157348014 )

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

۲۰ مه ۲۰۲۰

androidx.activity:activity:1.2.0-alpha05 and androidx.activity:activity-ktx:1.2.0-alpha05 are released. Version 1.2.0-alpha05 contains these commits.

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

تغییرات API

  • The TakePicture contract now returns a boolean indicating success rather than a thumbnail Bitmap as this was very rarely supported by camera apps when writing the image to the provided Uri . ( b/154302879 )
  • The invoke() extensions on ActivityResultLauncher have been removed in favor of explicitly using launch() to better indicate that these are asynchronous operations. Kotlin extensions for launch have been added to the androidx.activity.result package for ActivityResultLauncher<Void> and ActivityResultLauncher<Unit> that remove the need to pass in null or Unit , respectively, mirroring that behavior from the previously invoke() extensions. ( aosp/1304674 , aosp/1304675 )
  • The IntentSenderRequest.Builder methods for setFlagsMask() and setFlagsValues() has been combined into a single setFlags() method. ( aosp/1302111 )

رفع اشکالات

  • When registering an ActivityResultCallback with a LifecycleOwner , fixed an issue where the callback would be triggered before the state reaches STARTED . ( aosp/1309744 )

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

  • The ActivityResultRegistry now generates request codes starting at 0xFFFF rather than at 0 , preventing overlap when using startActivityForResult() or requestPermissions() in an activity. ( aosp/1302324 )

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

۲۹ آوریل ۲۰۲۰

androidx.activity:activity:1.2.0-alpha04 and androidx.activity:activity-ktx:1.2.0-alpha04 are released. Version 1.2.0-alpha04 contains these commits.

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

  • Added a contract that can call startIntentSenderForResult to the ActivityResult APIs. ( b/153007517 )

تغییرات API

  • The prepareCall() method has been renamed to registerForActivityResult() , both on ComponentActivity here and in Fragment 1.3.0-alpha04 . ( aosp/1278717 )
  • The GetContents , OpenDocuments , and RequestPermissions contracts have been renamed to GetMultipleContents , OpenMultipleDocuments , and RequestMultiplePermissions , respectively. ( aosp/1280161 )
  • ComponentActivity now implements the ActivityResultRegisteryOwner interface. ( aosp/1290888 )
  • - The startActivityForResult() / onActivityResult() and onRequestPermissionsResult() APIs on ComponentActivity have been deprecated. Please use the Activity Result APIs . ( b/154751887 )

رفع اشکالات

  • When using the GetMultipleContents and OpenMultipleDocuments contracts and selecting a single item, it is now correctly returned to your callback. ( b/152941153 )

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

April 1, 2020

androidx.activity:activity:1.2.0-alpha03 and androidx.activity:activity-ktx:1.2.0-alpha03 are released. Version 1.2.0-alpha03 contains these commits.

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

  • Added the TakeVideo , PickContact , GetContent , GetContents , OpenDocument , OpenDocuments , OpenDocumentTree , and CreateDocument contracts to the set of pre-built contracts provided by ActivityResultContracts . ( aosp/1262482 , aosp/1266916 , aosp/1268960 )
  • The Activity Result APIs now support launching an activity for result with an optional ActivityOptionsCompat . ( b/151860054 )

تغییرات API

  • The TakePicture contract now takes a Uri input for where the image should be stored. The previous contract that does not take any input has been renamed to TakePicturePreview . ( aosp/1262482 )
  • The registerActivityResultCallback() method on ActivityResultRegistry has been renamed to register() . ( aosp/1267621 )
  • The dispose() method on ActivityResultLauncher has been renamed to unregister() and the unregisterResultCallback() on ActivityResultRegistry has been removed. ( aosp/1267621 )
  • The createIntent() method of ActivityResultContact now takes a Context in addition to the input to make it possible to create explicit Intents. ( aosp/1238800 )
  • An ActivityResultContract can now override getSynchronousResult() to deliver a result without calling startActivityForResult . This is used by the RequestPermission and RequestPermissions contracts to correctly deliver a 'granted' status if the requested permissions are already granted. ( b/151110799 )
  • The previously available Dial contract has been removed as that Intent is not meant to be used with startActivityForResult() . ( aosp/1266916 )
  • Many of the Activity Result APIs not meant to be extended are now final . This includes getActivityResultRegistry() , the prepareCall() methods, all methods of ActivityResultRegistry except invoke() , and a number of the default contracts that do not support optional extras. ( b/152439361 )

رفع اشکالات

  • Fixed a NullPointerException in ActivityResultRegistry when attempting to deliver results to a callback that has not yet been re-registered after a configuration change; ActivityResultRegistry now holds onto these pending results and delivers them when the callback is re-registered. ( b/152137004 )

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

۱۸ مارس ۲۰۲۰

androidx.activity:activity:1.2.0-alpha02 and androidx.activity:activity-ktx:1.2.0-alpha02 are released. Version 1.2.0-alpha02 contains these commits.

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

  • ActivityResultRegistry : ComponentActivity now provides an ActivityResultRegistry that lets you handle the startActivityForResult() + onActivityResult() as well as requestPermissions() + onRequestPermissionsResult() flows without overriding methods in your Activity or Fragment, brings increased type safety via ActivityResultContract , and provides hooks for testing these flows. See the updated Getting a Result from an Activity . ( b/125158199 )

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

۴ مارس ۲۰۲۰

androidx.activity:activity:1.2.0-alpha01 and androidx.activity:activity-ktx:1.2.0-alpha01 are released. Version 1.2.0-alpha01 contains these commits.

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

  • Added support for the ViewTreeLifecycleOwner.get(View) API added in Lifecycle 2.3.0-alpha01 such that it will return the Activity as the LifecycleOwner for any Views directly added to the Activity. ( aosp/1182955 )

رفع اشکالات

  • Fixed a regression introduced in Activity 1.1.0 when running on older versions of the platform where onBackPressed() would cause an IllegalStateException due to a bug in the android.app.FragmentManager . ( b/146290338 )

نسخه ۱.۱.۰

نسخه ۱.۱.۰

January 22, 2020

androidx.activity:activity:1.1.0 is released. Version 1.1.0 contains these commits .

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

  • Lifecycle ViewModel SavedState Integration : SavedStateViewModelFactory is now the default factory used when using by viewModels() , the ViewModelProvider constructor, or ViewModelProviders.of() with a ComponentActivity or its subclasses.

نسخه ۱.۱.۰-rc03

December 4, 2019

androidx.activity:activity:1.1.0-rc03 and androidx.activity:activity-ktx:1.1.0-rc03 are released. Version 1.1.0-rc03 contains these commits .

Dependency changes

  • Activity now depends on Lifecycle 2.2.0-rc03 and Lifecycle ViewModel SavedState 1.0.0-rc03 .

نسخه ۱.۱.۰-rc02

November 7, 2019

androidx.activity:activity:1.1.0-rc02 and androidx.activity:activity-ktx:1.1.0-rc02 are released. Version 1.1.0-rc02 contains these commits .

Dependency changes

  • Activity now depends on lifecycle 2.2.0-rc02 .

نسخه ۱.۱.۰-rc01

۲۳ اکتبر ۲۰۱۹

androidx.activity:activity:1.1.0-rc01 and androidx.activity:activity-ktx:1.1.0-rc01 are released with no changes from 1.1.0-beta01 . Version 1.1.0-rc01 contains these commits .

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

October 9, 2019

androidx.activity:activity:1.1.0-beta01 and androidx.activity:activity-ktx:1.1.0-beta01 are released. Version 1.1.0-beta01 contains these commits .

Dependency changes

  • Activity now depends on SavedState 1.0.0 stable.

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

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

androidx.activity:activity:1.1.0-alpha03 and androidx.activity:activity-ktx:1.1.0-alpha03 are released. The commits included in this version can be found here .

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

  • Activity now depends on Core 1.1.0 stable.

رفع اشکالات

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

August 7, 2019

androidx.activity:activity:1.1.0-alpha02 and androidx.activity:activity-ktx:1.1.0-alpha02 are released. The commits included in this version can be found here .

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

  • SavedStateViewModelFactory is now the default factory used when using by viewModels() , the ViewModelProvider constructor, or ViewModelProviders.of() with a ComponentActivity ( b/135716331 )

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

July 2, 2019

androidx.activity:activity:1.1.0-alpha01 and androidx.activity:activity-ktx:1.1.0-alpha01 are released. The commits included in this version can be found here .

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

  • activity now depends on Lifecycle 2.2.0-alpha02 . ( aosp/1007817 )
  • activity-ktx added a dependency on lifecycle-runtime-ktx ; you no longer need to explicitly add it to your dependencies when using activity-ktx or libraries that depend on activity-ktx (such as fragment-ktx ). ( aosp/987162 )

نسخه ۱.۰.۰

نسخه ۱.۰.۰

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

androidx.activity:activity:1.0.0 and androidx.activity:activity-ktx:1.0.0 are released. The commits included in this version can be found here .

Major Features of 1.0.0

  • ComponentActivity : ComponentActivity serves as the new base class for FragmentActivity in Fragment 1.1.0 and, by extension, AppCompatActivity in AppCompat 1.1.0 .
  • activity-ktx : The activity-ktx module includes a by viewModels Kotlin property extension for accessing ViewModels. This module is automatically included when you include fragment-ktx from Fragment 1.1.0 .
  • OnBackPressedDispatcher : As a composable alternative to overriding onBackPressed() , you can now register a OnBackPressedCallback from any LifecycleOwner (such as a fragment) to intercept system back button events. A lambda with receiver version addCallback has been added to activity-ktx . See Provide custom back navigation documentation for more details.
  • onRetainCustomNonConfigurationInstance deprecation : the onRetainCustomNonConfigurationInstance() and the related getLastCustomNonConfigurationInstance() APIs have been deprecated. It is strongly recommended to use ViewModels to store non-configuration state as they offer a composable solution suitable for any ViewModelStoreOwner that makes the ownership of the retained objects clear and provides an onCleared() callback for cleaning up resources when the activity is finally destroyed.

نسخه ۱.۰.۰-rc01

July 2, 2019

androidx.activity:activity:1.0.0-rc01 and androidx.activity:activity-ktx:1.0.0-rc01 are released with no changes from 1.0.0-beta01 . The commits included in this version can be found here .

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

۵ ژوئن ۲۰۱۹

androidx.activity::activity:1.0.0-beta01 and androidx.activity:activity-ktx:1.0.0-beta01 are released with no changes from 1.0.0-alpha08 . The commits included in this version can be found here .

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

۷ مه ۲۰۱۹

androidx.activity:activity:1.0.0-alpha08 and androidx.activity:activity-ktx:1.0.0-alpha08 are released. The commits included in this version can be found here .

تغییرات API

  • Breaking change: The previously deprecated addOnBackPressedCallback and removeOnBackPressedCallback methods on ComponentActivity have been removed. aosp/953857
  • The setEnabled() and isEnabled() methods of OnBackPressedCallback are now final. b/131416833
  • The remove() method of OnBackPressedCallback is now final. aosp/952720
  • OnBackPressedDispatcher now has public constructors, allowing you to construct your own instances for testing, etc. aosp/953431
  • onBackPressed() for ComponentActivity is now explicitly marked as @MainThread aosp/952721

رفع اشکالات

  • Fixed a ConcurrentModificationException when calling remove() from within the handleOnBackPressed() method of a OnBackPressedCalback that was added with a LifecycleOwner . b/131765095

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

April 25th, 2019

androidx.activity:activity:1.0.0-alpha07 and androidx.activity:activity-ktx:1.0.0-alpha07 are released. The commits included in this version can be found here .

تغییرات API

This release makes significant changes to the handling of the onBackPressed() . See the updated custom back documentation for more details.

  • The methods for OnBackPressedCallback and OnBackPressedDispatcher have been marked as @MainThread . ( aosp/943813 )
  • The handleOnBackPressed() method no longer returns a boolean . Instead, OnBackPressedCallback is now an abstract class that can be enabled or disabled - only when the new isEnabled() method returns true will handleOnBackPressed() be called, in which you must handle the back button. ( aosp/944518 )
  • The addCallback methods of OnBackPressedDispatcher no longer return a Cancellable instance. OnBackPressedCallback now contain a remove() method that fulfill this functionality, allowing you to call remove() during handleOnBackPressed() . ( aosp/944519 ) ( aosp/946316 )
  • activity-ktx now contains a receiver scoped callback for addCallback that accepts a lamdba that implements handleOnBackPressed() and has access to isEnabled and remove() ( aosp/944520 )

نسخه ۱.۰.۰-alpha06

April 3rd, 2019

androidx.activity:activity:1.0.0-alpha06 and androidx.activity:activity-ktx:1.0.0-alpha06 are released. The commits included in this version can be found here .

تغییرات API

  • ComponentActivity now contain a second constructor that takes a @LayoutRes int , which replaces the previous behavior of annotating your AppCompatActivity class with @ContentView . This approach works in both app and library modules. ( b/128352521 )
  • The OnBackPressedCallback related APIs on ComponentActivity have been deprecated in favor of the new OnBackPressedDispatcher , retrievable via getOnBackPressedDispatcher() . ( aosp/922523 )
  • Methods to add a new OnBackPressedCallback to the OnBackPressedDispatcher now return a Cancellable object, allowing removal of the callback without requiring an explicit reference to the OnBackPressedDispatcher . ( aosp/922523 )
  • Adding a OnBackPressedCallback with an associated LifecycleOwner now results in adding and removing the OnBackPressedCallback as the Lifecycle is started and stopped, respectively. ( aosp/922523 )

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

March 13th, 2019

androidx.activity:activity:1.0.0-alpha05 and androidx.activity:activity-ktx:1.0.0-alpha05 are released. The full list of commits included in this release can be found here .

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

  • @ContentView annotation lookups are now cached ( b/123709449 )

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

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

androidx.activity:activity 1.0.0-alpha04 and androidx.activity:activity-ktx 1.0.0-alpha04 are released.

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

  • Added support for the @ContentView class annotation that allows you to indicate which layout XML file should be inflated as an alternative to using setContentView() . ( aosp/837619 )

تغییرات API

  • Added a note that getViewModelStore() should not be overridden and will be made final in a future release. Please file a feature request if you are currently overriding this method. ( aosp/837619 )

رفع اشکالات

  • The activity module now depends on version 2.1.0-alpha02 of ViewModel to match the activity-ktx module's dependency.

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

December 17, 2018

androidx.activity 1.0.0-alpha03 is released.

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

  • ComponentActivity now implements BundleSavedStateRegistryOwner and depends on the newly released SavedState library [ aosp/815133 ]
  • ComponentActivity now works around an Android framework bug that would cause InputMethodManager to leak the last focused view [ b/37122102 ]

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

۳ دسامبر ۲۰۱۸

تغییرات API

  • Added a note that getLifecycle() should not be overridden and will be made final in a future release. Please file a feature request if you are currently overriding this method. ( aosp/815834 )

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

November 5, 2018

androidx.activity 1.0.0-alpha01 introduces ComponentActivity , a new base class of the existing FragmentActivity and AppCompatActivity .

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

  • You can now register an OnBackPressedCallback via addOnBackPressedCallback to receive onBackPressed() callbacks without needing to override the method in your activity.
  • Added a new by viewModels() Kotlin property delegate for retrieving ViewModel s from a ComponentActivity .
  • Pending input events (such as clicks) are now canceled in onStop() .

تغییرات API

  • The implementation of LifecycleOwner and ViewModelStoreOwner have been moved from FragmentActivity to ComponentActivity .
  • onRetainCustomNonConfigurationInstance has been deprecated. Use a ViewModel for storing objects that need to survive configuration changes.
،

فعالیت

به APIهای قابل ترکیب ساخته شده بر روی Activity دسترسی داشته باشید.
آخرین به‌روزرسانی انتشار پایدار کاندیدای انتشار انتشار بتا انتشار آلفا
۲۳ سپتامبر ۲۰۲۶ ۱.۱۳.۰ - - ۱.۱۴.۰-آلفا۰۳

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

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

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

شیار

dependencies {
    def activity_version = "1.13.0"

    // Java language implementation
    implementation "androidx.activity:activity:$activity_version"
    // Kotlin
    implementation "androidx.activity:activity-ktx:$activity_version"
}

کاتلین

dependencies {
    val activity_version = "1.13.0"

    // Java language implementation
    implementation("androidx.activity:activity:$activity_version")
    // Kotlin
    implementation("androidx.activity:activity-ktx:$activity_version")
}

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

بازخورد

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

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

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

نسخه ۱.۱۴

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

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

androidx.activity:activity:1.14.0-alpha03 ، androidx.activity:activity-compose:1.14.0-alpha03 و androidx.activity:activity-ktx:1.14.0-alpha03 منتشر شدند. نسخه 1.14.0-alpha03 شامل این کامیت‌ها است.

تغییرات API

  • به جای EdgeToEdge#enable() WindowCompat#enableEdgeToEdge(Window) استفاده کنید ( Ibff3e )
  • فیلدهای متنی Material 2 که value, onValueChange منسوخ شده‌اند. لطفاً به سربارگذاری‌ای که از TextFieldState برای بالا بردن وضعیت خود استفاده می‌کند، مهاجرت کنید. ( I6b841 ، b/556234973 )

رفع اشکالات

  • وابستگی androidx.lifecycle:lifecycle-runtime به نسخه ۲.۱۰.۰ به‌روزرسانی شد. این نسخه برای بررسی‌های lint زمان اجرای چرخه عمر همراه با AGP نسخه ۹.۵.۰-alpha۰۴ یا بالاتر مورد نیاز است. ( I99bfd ، b/556807521 )
  • defaultViewModelArgs جدید ComponentActivity اکنون از پیکربندی بوت مستقیم نیز پشتیبانی می‌کنند. ( I10a08 )

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

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

androidx.activity:activity:1.14.0-alpha02 ، androidx.activity:activity-compose:1.14.0-alpha02 و androidx.activity:activity-ktx:1.14.0-alpha02 منتشر شدند. نسخه 1.14.0-alpha02 شامل این کامیت‌ها است.

رفع اشکالات

  • compileSdk برای کتابخانه‌های Compose به نسخه ۳۷.۱ به‌روزرسانی شد. این کار مستلزم به‌روزرسانی مداوم compileSdk برای همه برنامه‌ها و کتابخانه‌هایی است که از Compose استفاده می‌کنند. ( I05b0f )

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

۲۶ اوت ۲۰۲۶

androidx.activity:activity:1.14.0-alpha01 ، androidx.activity:activity-compose:1.14.0-alpha01 و androidx.activity:activity-ktx:1.14.0-alpha01 منتشر شدند. نسخه 1.14.0-alpha01 شامل این کامیت‌ها است.

تغییرات API

  • Intent extras دیگر به طور خودکار برای فعالیت‌های صادر شده به defaultViewModelCreationExtras اضافه نمی‌شوند. توسعه‌دهندگان فعالیت‌های صادر شده می‌توانند defaultViewModelArgs برای ارائه صریح intent extras معتبر، لغو کنند. ( Id0cb6 , b/213646066 )
  • اکنون Activity توابع کارخانه‌ای NavigationEventDispatcherOwner و OnBackPressedDispatcherOwner را برای ایجاد آسان نمونه‌هایی از اجزای مربوطه ارائه می‌دهد. ( I1d259 ، Iadd5c )
  • OnBackPressedDispatcher اکنون یک افزونه asNavigationEventDispatcher ارائه می‌دهد تا به راحتی آن را به NavigationEventDispatcher تبدیل کند. ( Id11cf )

نسخه ۱.۱۳

نسخه ۱.۱۳.۰

۱۱ مارس ۲۰۲۶

androidx.activity:activity:1.13.0 ، androidx.activity:activity-compose:1.13.0 و androidx.activity:activity-ktx:1.13.0 منتشر شدند. نسخه 1.13.0 شامل این کامیت‌ها است.

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

  • ComponentActivity اکنون رابط OnPictureInPictureUiStateChangedProvider را پیاده‌سازی می‌کند، به این معنی که اکنون می‌تواند با مصنوع جدید core:core-pip ادغام شود که به هر کامپوننتی اجازه می‌دهد رویدادهای تغییر وضعیت رابط کاربری تصویر در تصویر را دریافت کند.
  • EdgeToEdge اکنون در تغییرات پیکربندی دوباره فراخوانی می‌شود تا اطمینان حاصل شود که رنگ نوار وضعیت سیستم به درستی به‌روزرسانی می‌شود.

نسخه ۱.۱۳.۰-rc01

۲۵ فوریه ۲۰۲۶

androidx.activity:activity:1.13.0-rc01 ، androidx.activity:activity-compose:1.13.0-rc01 و androidx.activity:activity-ktx:1.13.0-rc01 منتشر شدند. نسخه 1.13.0-rc01 شامل این کامیت‌ها است.

رفع اشکالات

  • از فعالیت ۱.۱۲.۴ : اکنون ActivityResultContracts به عکس و ویدیو، هنگام استفاده در دستگاه‌هایی با آخرین اصلاحات امنیتی URI ( I61201 ، b/433708587 ) به درستی اجرا می‌شوند.

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

۱۴ ژانویه ۲۰۲۶

androidx.activity:activity:1.13.0-alpha01 ، androidx.activity:activity-compose:1.13.0-alpha01 و androidx.activity:activity-ktx:1.13.0-alpha01 منتشر شدند. نسخه 1.13.0-alpha01 شامل این کامیت‌ها است.

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

  • اکنون EdgeToEdge در هنگام تغییرات پیکربندی دوباره فراخوانی می‌شود تا از به‌روزرسانی صحیح رنگ نوار وضعیت سیستم اطمینان حاصل شود. ( Id1381 ، b/364713509 )

تغییرات API

  • ComponentActivity اکنون رابط OnPictureInPictureUiStateChangedProvider را پیاده‌سازی می‌کند، به این معنی که اکنون می‌تواند با مصنوع جدید core:core-pip ادغام شود که به هر کامپوننتی اجازه می‌دهد رویدادهای تغییر وضعیت رابط کاربری تصویر در تصویر را دریافت کند. ( I4df5c ، b/441310308 )

رفع اشکالات

  • از فعالیت ۱.۱۲.۲: مشکلی که باعث می‌شد تنظیم دستی isEnabled روی OnBackPressedCallback که از چرخه حیات آگاه است، وضعیت Lifecycle نادیده بگیرد و به طور بالقوه باعث خرابی شود، برطرف شد. ( I7d898 ، b/461999811 )

نسخه ۱.۱۲

نسخه ۱.۱۲.۴

۱۱ فوریه ۲۰۲۶

androidx.activity:activity:1.12.4 ، androidx.activity:activity-compose:1.12.4 و androidx.activity:activity-ktx:1.12.4 منتشر شدند. نسخه ۱.۱۲.۴ شامل این کامیت‌ها است.

رفع اشکالات

  • ActivityResultContracts عکس و ویدیو (Photo and Video ActivityResultContracts) اکنون هنگام استفاده در دستگاه‌هایی با آخرین اصلاحات امنیتی URI به درستی اجرا می‌شوند. ( I61201 ، b/433708587 )

نسخه ۱.۱۲.۳

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

androidx.activity:activity:1.12.3 ، androidx.activity:activity-compose:1.12.3 و androidx.activity:activity-ktx:1.12.3 منتشر شدند. نسخه ۱.۱۲.۳ شامل این کامیت‌ها است.

نسخه ۱.۱۲.۲

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

androidx.activity:activity:1.12.2 ، androidx.activity:activity-compose:1.12.2 و androidx.activity:activity-ktx:1.12.2 منتشر شدند. نسخه ۱.۱۲.۲ شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی که باعث می‌شد تنظیم دستی isEnabled روی OnBackPressedCallback که از چرخه حیات آگاه است، وضعیت چرخه حیات را نادیده بگیرد و به طور بالقوه باعث خرابی شود، برطرف شد. ( I7d898 ، b/461999811 )

نسخه ۱.۱۲.۱

۳ دسامبر ۲۰۲۵

androidx.activity:activity:1.12.1 ، androidx.activity:activity-compose:1.12.1 و androidx.activity:activity-ktx:1.12.1 منتشر شدند. نسخه ۱.۱۲.۱ شامل این کامیت‌ها است.

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

نسخه ۱.۱۲.۰

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

androidx.activity:activity:1.12.0 ، androidx.activity:activity-compose:1.12.0 و androidx.activity:activity-ktx:1.12.0 منتشر شدند. نسخه 1.12.0 شامل این کامیت‌ها است.

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

  • کتابخانه Androidx Activity اکنون به کتابخانه جدید NavigationEvent وابسته است. این شامل پشتیبانی از NavigationEventDispatcher در ComponentActivity و ComponentDialog می‌شود. APIهای OnBackPressed نیز بر روی APIهای NavigationEvent بازنویسی شده‌اند تا از سازگاری معکوس آنها با کتابخانه قبلی اطمینان حاصل شود.

نسخه ۱.۱۲.۰-rc01

۵ نوامبر ۲۰۲۵

androidx.activity:activity:1.12.0-rc01 ، androidx.activity:activity-compose:1.12.0-rc01 و androidx.activity:activity-ktx:1.12.0-rc01 منتشر شدند. نسخه 1.12.0-rc01 شامل این کامیت‌ها است.

رفع اشکالات

  • رفع خطاهای زمان اجرا برای BackHandler و PredictiveBackHandler در برنامه‌هایی که از کلاس‌های Activity سفارشی استفاده می‌کنند. این composableها اکنون با خیال راحت به LocalOnBackPressedDispatcherOwner برمی‌گردند و در عین حال ترتیب ارسال را در برنامه‌هایی که NavigationEventDispatcherOwner پشتیبانی می‌کنند، حفظ می‌کنند. ( I43873 )

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

۲۲ اکتبر ۲۰۲۵

androidx.activity:activity:1.12.0-beta01 ، androidx.activity:activity-compose:1.12.0-beta01 و androidx.activity:activity-ktx:1.12.0-beta01 منتشر شدند. نسخه 1.12.0-beta01 شامل این کامیت‌ها است.

تغییرات API

  • معرفی API آزمایشی ActivityFlags برای مدیریت تغییرات رفتاری زمان اجرا و مهاجرت‌ها. اولین flag امکان مرتب‌سازی پایدار برای OnBackPressedCallback را فراهم می‌کند و پیمایش برگشت را در طول تغییرات چرخه عمر قابل پیش‌بینی‌تر می‌کند. توسعه‌دهندگان می‌توانند با تنظیم ActivityFlags.isOnBackPressedLifecycleOrderMaintained = false از این قابلیت انصراف دهند. ( I06bdf , Id08bb , I439aa , b/422730945 , b/450533622 )

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

  • به‌روزرسانی وابستگی‌های چرخه حیات به نسخه ۲.۹.۴ ( Ic9fb2 )

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

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

androidx.activity:activity:1.12.0-alpha09 ، androidx.activity:activity-compose:1.12.0-alpha09 و androidx.activity:activity-ktx:1.12.0-alpha09 منتشر شدند. نسخه 1.12.0-alpha09 شامل این کامیت‌ها است.

تغییرات وابستگی

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

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

androidx.activity:activity:1.12.0-alpha08 ، androidx.activity:activity-compose:1.12.0-alpha08 و androidx.activity:activity-ktx:1.12.0-alpha08 منتشر شدند. نسخه 1.12.0-alpha08 شامل این کامیت‌ها است.

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

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

۲۷ آگوست ۲۰۲۵

androidx.activity:activity:1.12.0-alpha07 ، androidx.activity:activity-compose:1.12.0-alpha07 و androidx.activity:activity-ktx:1.12.0-alpha07 منتشر شدند. نسخه 1.12.0-alpha07 شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی با EdgeToEdge در API 35 که در آن نماهای نامرئی باعث ایجاد درج‌های اندازه‌گیری غیرمنتظره می‌شدند، برطرف شد. ( If49ff )

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

نسخه ۱.۱۲.۰-alpha06

۱۳ آگوست ۲۰۲۵

androidx.activity:activity:1.12.0-alpha06 ، androidx.activity:activity-compose:1.12.0-alpha06 و androidx.activity:activity-ktx:1.12.0-alpha06 منتشر شدند. نسخه 1.12.0-alpha06 شامل این کامیت‌ها است.

به‌روزرسانی MinSDK

به‌روزرسانی‌های مستندات

  • KDocs مربوط به PredictiveBackHandler به‌روزرسانی شد تا یک مشکل زمان‌بندی شناخته‌شده را که ممکن است در همان فریمی که غیرفعال است، یک ژست را پردازش کند، فراخوانی کند. ( I5be5c ، b/431534103 )
  • KDocs برای BackHandler و PredictiveBackHandler به‌روزرسانی شد تا علاوه بر توصیه ترکیب بی‌قید و شرط با پرچم enabled ، رفتار «آخرین بردهای ترکیب‌شده» را نیز به صراحت بیان کند. ( I7ab94 )

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

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

۳۰ ژوئیه ۲۰۲۵

androidx.activity:activity:1.12.0-alpha05 ، androidx.activity:activity-compose:1.12.0-alpha05 و androidx.activity:activity-ktx:1.12.0-alpha05 منتشر شدند. نسخه 1.12.0-alpha05 شامل این کامیت‌ها است.

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

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

۲ ژوئیه ۲۰۲۵

androidx.activity:activity:1.12.0-alpha04 ، androidx.activity:activity-compose:1.12.0-alpha04 و androidx.activity:activity-ktx:1.12.0-alpha04 منتشر شدند. نسخه 1.12.0-alpha04 شامل این کامیت‌ها است.

تغییرات وابستگی

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

۱۸ ژوئن ۲۰۲۵

androidx.activity:activity:1.12.0-alpha03 ، androidx.activity:activity-compose:1.12.0-alpha03 و androidx.activity:activity-ktx:1.12.0-alpha03 منتشر شدند. نسخه 1.12.0-alpha03 شامل این کامیت‌ها است.

رفع اشکالات

  • OnBackPressedDispatcher و NavigationEventDispatcher اکنون هر دو به صورت تنبل در ComponentActivity مقداردهی اولیه می‌شوند. ( I710e6 )

  • مشکلات مربوط به OnBackPressedDistpatcher که باعث موارد زیر می‌شد، برطرف شد:

    • فقط آخرین ارسال‌کننده‌ی OnBackPressedCallback به مطلع شدن از وضعیت فعالش اضافه شد ( b/418715930 )
    • OnBackPressedDispatcher هنگام استفاده از تابع addCallback که یک چرخه عمر می‌گیرد، فراخوانی اشتباه را حذف می‌کند. ( b/422714753 )
    • OnBackPressedDispatcher.remove() تمام نمونه‌های OnBackPressedCallback ثبت‌شده را حذف نمی‌کند. ( b/423024414 )

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

۴ ژوئن ۲۰۲۵

androidx.activity:activity:1.12.0-alpha02 ، androidx.activity:activity-compose:1.12.0-alpha02 و androidx.activity:activity-ktx:1.12.0-alpha02 منتشر شدند. نسخه 1.12.0-alpha02 شامل این کامیت‌ها است.

رفع اشکالات

  • از NavigationEvent 1.0.0-alpha02 : خطای ConcurrentModificationException که هنگام فراخوانی NavigationEventCallback.remove() به دلیل تغییر همزمان لیست داخلی closeableها رخ می‌داد، برطرف شد. ( I63066 )

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

۲۰ مه ۲۰۲۵

androidx.activity:activity:1.12.0-alpha01 ، androidx.activity:activity-compose:1.12.0-alpha01 و androidx.activity:activity-ktx:1.12.0-alpha01 منتشر شدند. نسخه 1.12.0-alpha01 شامل این کامیت‌ها است.

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

  • ComponentActivity و ComponentDialog از طریق API مربوط NavigationEventDispatcherOwner با NavigationEvent 1.0.0-alpha01 ادغام شده‌اند. اکنون می‌توانید از طریق فیلد navigationEventDispatcher یک NavigationEventDispatcher از ComponentActivity خود بازیابی کنید. از آنجایی که OnBackPressedDispatcher بر روی کتابخانه جدید بازنویسی شده است، تمام کاربردهای قبلی باید به درستی کار کنند. از این به بعد باید NavigationEventDispatcher و NavigationEventCallback استفاده کنید. ( Ib8eed ، I6cc44 ، Ib7724 ، I9a0f7 ، b/412597031 ، b/ 415028038 ، b/412596729 ، b/412597140 ، b/412596012 )

نسخه ۱.۱۱

نسخه ۱.۱۱.۰

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

androidx.activity:activity:1.11.0 ، androidx.activity:activity-compose:1.11.0 و androidx.activity:activity-ktx:1.11.0 منتشر شدند. نسخه 1.11.0 شامل این کامیت‌ها است.

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

  • API MediaCapabilities به PickVisualMediaRequest اضافه شد تا برنامه‌ها بتوانند قابلیت‌های رسانه‌ای آن، مانند انواع HDR پشتیبانی‌شده، را مشخص کنند.
  • اکتیویتی اکنون با API 36 کامپایل شده است.

نسخه ۱.۱۱.۰-rc01

۲۳ آوریل ۲۰۲۵

androidx.activity:activity:1.11.0-rc01 ، androidx.activity:activity-compose:1.11.0-rc01 و androidx.activity:activity-ktx:1.11.0-rc01 منتشر شدند. نسخه 1.11.0-rc01 شامل این کامیت‌ها است.

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

۹ آوریل ۲۰۲۵

androidx.activity:activity:1.11.0-beta01 ، androidx.activity:activity-compose:1.11.0-beta01 و androidx.activity:activity-ktx:1.11.0-beta01 منتشر شدند. نسخه 1.11.0-beta01 شامل این کامیت‌ها است.

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

۲۶ مارس ۲۰۲۵

androidx.activity:activity:1.11.0-alpha02 ، androidx.activity:activity-compose:1.11.0-alpha02 و androidx.activity:activity-ktx:1.11.0-alpha02 منتشر شدند. نسخه 1.11.0-alpha02 شامل این کامیت‌ها است.

تغییرات API

  • EDGE_NONE و frameTimeMillis جدید از اندروید ۱۶ بتا۰۳ در BackEventCompat ارائه شده توسط توابع handleOnBackStarted و handleOnBackProgressed از OnBackPressedCallback ادغام شدند.

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

  • اکتیویتی اکنون با API 36 کامپایل شده است. ( I510e8 ، b/301910674 )

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

۱۲ مارس ۲۰۲۵

androidx.activity:activity:1.11.0-alpha01 ، androidx.activity:activity-compose:1.11.0-alpha01 و androidx.activity:activity-ktx:1.11.0-alpha01 منتشر شدند. نسخه 1.11.0-alpha01 شامل این کامیت‌ها است.

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

  • API MediaCapabilities به PickVisualMediaRequest اضافه شد تا برنامه‌ها بتوانند قابلیت‌های رسانه‌ای خود، مانند انواع HDR پشتیبانی‌شده را مشخص کنند. ( Ic3ee7 )

نسخه ۱.۱۰

نسخه ۱.۱۰.۱

۲۶ فوریه ۲۰۲۵

androidx.activity:activity:1.10.1 ، androidx.activity:activity-compose:1.10.1 و androidx.activity:activity-ktx:1.10.1 منتشر شدند. نسخه ۱.۱۰.۱ شامل این کامیت‌ها است.

رفع اشکالات

  • ViewTree OnBackPressedDispatcherOwners و FullyDrawnReporterOwners اکنون می‌توانند از طریق والدهای مجزای یک نما، مانند ViewOverlay حل شوند. برای اطلاعات بیشتر در مورد والدهای مجزای نما، به یادداشت‌های انتشار core یا مستندات موجود در ViewTree.setViewTreeDisjointParent مراجعه کنید. ( Ie7750 )

نسخه ۱.۱۰.۰

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

androidx.activity:activity:1.10.0 ، androidx.activity:activity-compose:1.10.0 و androidx.activity:activity-ktx:1.10.0 منتشر شدند. نسخه ۱.۱۰.۰ شامل این کامیت‌ها است.

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

  • PhotoPicker اکنون امکان انتخاب تصاویر به ترتیب و انتخاب اینکه کدام برگه (چه آلبوم‌ها و چه تصاویر) در ابتدا قابل مشاهده باشد را فراهم می‌کند.
  • قراردادهای PickVisualMedia و PickMultipleVisualMedia Activity Result که Photo Picker را فعال می‌کنند، در صورت عدم دسترسی به Photo Picker سیستمی، دیگر مستقیماً به سرویس‌های Google Play ارجاع نمی‌دهند، بلکه از اکشن عمومی ACTION_SYSTEM_FALLBACK_PICK_IMAGES و موارد اضافی مرتبط برای ارائه یک تجربه Photo Picker سازگار به OEMها و برنامه‌های سیستمی به عنوان یک جایگزین استفاده می‌کنند.
  • ترکیب جدید LocalActivity محلی که Activity برای محدوده فعلی فراهم می‌کند و نیاز توسعه‌دهندگان را برای دریافت Activity از LocalContext برطرف می‌کند.

نسخه ۱.۱۰.۰-rc01

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

androidx.activity:activity:1.10.0-rc01 ، androidx.activity:activity-compose:1.10.0-rc01 و androidx.activity:activity-ktx:1.10.0-rc01 منتشر شدند. نسخه 1.10.0-rc01 شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی که باعث می‌شد تغییر وضعیت فعال‌شده در حالی که PredictiveBackHandler در حال حاضر فعال است، باعث اتصال کوتاه (short circuit) فوری در فراخوانی مجدد شود، برطرف شد. اکنون فراخوانی مجدد فعلی صرف نظر از تغییرات وضعیت فعال‌شده، پایان می‌یابد. ( Ib8719 )

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

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

androidx.activity:activity:1.10.0-beta01 ، androidx.activity:activity-compose:1.10.0-beta01 و androidx.activity:activity-ktx:1.10.0-beta01 بدون هیچ تغییری از آخرین نسخه آلفا منتشر شده‌اند. نسخه 1.10.0-beta01 شامل این کامیت‌ها است.

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

۳۰ اکتبر ۲۰۲۴

androidx.activity:activity:1.10.0-alpha03 ، androidx.activity:activity-compose:1.10.0-alpha03 و androidx.activity:activity-ktx:1.10.0-alpha03 منتشر شدند. نسخه 1.10.0-alpha03 شامل این کامیت‌ها است.

تغییرات API

  • یک ترکیب جدید LocalActivity به نام local اضافه شده است که Activity برای محدوده فعلی فراهم می‌کند و نیاز توسعه‌دهندگان را برای دریافت Activity از LocalContext از بین می‌برد. همچنین با یک قانون lint جدید ارائه می‌شود که بررسی می‌کند چه زمانی LocalContext به اشتباه به یک Activity تبدیل می‌شود. ( I7746a , b/283009666 )

رفع اشکالات

  • از فعالیت 1.9.3 : PredictiveBackHandler دیگر پس از غیرفعال شدن هندلر، فراخوانی برگشتی خود را اجرا نمی‌کند. این مشکل را که NavHost از Navigation Compose خطای IndexOutOfBoundsException را صادر می‌کرد، برطرف می‌کند. ( I3f75e , b/365027664 , b/340202286 )

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

  • اکتیویتی کامپوز اکنون به Compose Runtime 1.7.0 ( I7746a ، b/283009666 ) بستگی دارد.

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

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

androidx.activity:activity:1.10.0-alpha02 ، androidx.activity:activity-compose:1.10.0-alpha02 و androidx.activity:activity-ktx:1.10.0-alpha02 منتشر شدند. نسخه 1.10.0-alpha02 شامل این کامیت‌ها است.

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

  • قراردادهای PickVisualMedia و PickMultipleVisualMedia Activity Result که Photo Picker را فعال می‌کنند، در صورت عدم دسترسی به Photo Picker سیستمی، دیگر مستقیماً به سرویس‌های Google Play ارجاع نمی‌دهند، بلکه از اکشن عمومی ACTION_SYSTEM_FALLBACK_PICK_IMAGES و موارد اضافی مرتبط برای ارائه یک تجربه Photo Picker سازگار به OEMها و برنامه‌های سیستمی به عنوان یک جایگزین استفاده می‌کنند. این موضوع نباید هیچ تاثیری بر تجربه کاربر برای دستگاه‌هایی که نسخه جدیدی از سرویس‌های Google Play را دارند، داشته باشد. ( I3513d )

رفع اشکالات

  • حذف دستورالعمل دسترسی به APIهای پلتفرم جدید، زیرا این امر به طور خودکار از طریق مدل‌سازی API هنگام استفاده از R8 با AGP 7.3 یا بالاتر (مثلاً R8 نسخه 3.3) و برای همه نسخه‌ها هنگام استفاده از AGP 8.1 یا بالاتر (مثلاً D8 نسخه 8.1) اتفاق می‌افتد. به مشتریانی که از AGP استفاده نمی‌کنند، توصیه می‌شود به D8 نسخه 8.1 یا بالاتر به‌روزرسانی کنند. برای جزئیات بیشتر به این مقاله مراجعه کنید. ( I9496c ، b/345472586 )
  • از Activity 1.9.2 : مشکلی که باعث می‌شد API مربوط به Activity Compose PredictiveBackHandler به مدیریت حرکت سیستمی برگشت به عقب در فریمی که غیرفعال شده بود، ادامه دهد، برطرف شد. این مشکل می‌توانست منجر به این شود که کتابخانه‌هایی مانند Navigation Compose حتی با وجود یک پشته خالی برگشت به عقب را مدیریت کنند و در نتیجه خطای IndexOutOfBoundsException ( Ie3301 , b/340202286 ) رخ دهد.
  • از فعالیت 1.9.1 : مشکلی با PredictiveBackHandler که پس از انجام عملیات بازگشت به سیستم، تلاش برای انجام onBackPressed از OnBackPressedDispatcher با شکست مواجه می‌شد، برطرف شد. ( I5f1f8 )

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

۲۶ ژوئن ۲۰۲۴

androidx.activity:activity:1.10.0-alpha01 ، androidx.activity:activity-compose:1.10.0-alpha01 و androidx.activity:activity-ktx:1.10.0-alpha01 منتشر شدند. این نسخه در یک شاخه داخلی توسعه داده شده است.

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

  • پشتیبانی از ویژگی‌های جدید PhotoPicker که در اندروید V معرفی شدند، از جمله امکان انتخاب تصاویر به ترتیب و انتخاب اینکه کدام تب (آلبوم‌ها یا تصاویر) در ابتدا قابل مشاهده باشد، اضافه شده است.

نسخه ۱.۹

نسخه ۱.۹.۳

۱۶ اکتبر ۲۰۲۴

androidx.activity:activity:1.9.3 ، androidx.activity:activity-compose:1.9.3 و androidx.activity:activity-ktx:1.9.3 منتشر شدند. نسخه 1.9.3 شامل این کامیت‌ها است.

رفع اشکالات

  • PredictiveBackHandler دیگر پس از غیرفعال شدن هندلر، تابع فراخوانی خود را اجرا نمی‌کند. این کار مشکلی را که در آن NavHost از Navigation Compose خطای IndexOutOfBoundsException صادر می‌کرد، برطرف می‌کند. ( I3f75e , b/340202286 )

نسخه ۱.۹.۲

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

androidx.activity:activity:1.9.2 ، androidx.activity:activity-compose:1.9.2 و androidx.activity:activity-ktx:1.9.2 منتشر شدند. نسخه 1.9.2 شامل این lthcocommits است.

رفع اشکالات

  • مشکلی که باعث می‌شد API مربوط به Activity Compose PredictiveBackHandler به مدیریت حرکت سیستمی بازگشت به عقب در فریمی که غیرفعال شده بود، ادامه دهد، برطرف شد. این مشکل می‌توانست منجر به این شود که کتابخانه‌هایی مانند Navigation Compose حتی با وجود یک پشته خالی، بازگشت به عقب را مدیریت کنند و در نتیجه خطای IndexOutOfBoundsException ( Ie3301 , b/340202286 ) رخ دهد.

نسخه ۱.۹.۱

۲۴ ژوئیه ۲۰۲۴

androidx.activity:activity:1.9.1 ، androidx.activity:activity-compose:1.9.1 و androidx.activity:activity-ktx:1.9.1 منتشر شدند. نسخه ۱.۹.۱ شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی با PredictiveBackHandler که باعث می‌شد پس از انجام عملیات بازگشت به سیستم، تلاش برای انجام onBackPressed از OnBackPressedDispatcher با شکست مواجه شود، برطرف شد. ( I5f1f8 )

نسخه ۱.۹.۰

۱۷ آوریل ۲۰۲۴

androidx.activity:activity:1.9.0 ، androidx.activity:activity-compose:1.9.0 و androidx.activity:activity-ktx:1.9.0 منتشر شدند. نسخه 1.9.0 شامل این کامیت‌ها است.

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

  • ComponentActivity اکنون OnUserLeaveHintProvider پیاده‌سازی می‌کند تا به کامپوننت‌ها اجازه دهد برای رویدادهای onUserLeaveHint فراخوانی مجدد انجام دهند.
  • APIهای OnBackPressedCallback ، BackHandler و PredictiveBackHandler اکنون هنگام فراخوانی onBackPressedDispatcher.onBackPressed() هنگام مدیریت بازگشت، هشدار می‌دهند زیرا این کار همیشه انیمیشن بازگشت پیش‌بینی‌شده را مختل می‌کند. برای جزئیات بیشتر به راهنمای بهترین شیوه‌ها مراجعه کنید.
  • بقیه APIهای Activity در کاتلین بازنویسی شده‌اند و تمام افزونه‌هایی که قبلاً در activity-ktx موجود بودند به activity منتقل شده‌اند. activity-ktx اکنون کاملاً خالی است.
    • به عنوان بخشی از تبدیل ActivityResultLauncher به Kotlin، متد getContract اکنون یک ویژگی انتزاعی Kotlin است. این یک تغییر سازگار با باینری است، اما اگر پیاده‌سازی ActivityResultLauncher شما به زبان Kotlin نوشته شده باشد، کد منبع آن دچار مشکل می‌شود.

نسخه ۱.۹.۰-rc01

۳ آوریل ۲۰۲۴

androidx.activity:activity:1.9.0-rc01 ، androidx.activity:activity-compose:1.9.0-rc01 و androidx.activity:activity-ktx:1.9.0-rc01 منتشر شدند. نسخه 1.9.0-rc01 شامل این کامیت‌ها است.

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

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

۲۰ مارس ۲۰۲۴

androidx.activity:activity:1.9.0-beta01 ، androidx.activity:activity-compose:1.9.0-beta01 و androidx.activity:activity-ktx:1.9.0-beta01 منتشر شدند. نسخه 1.9.0-beta01 شامل این کامیت‌ها است.

رفع اشکالات

  • رگرسیون عملکرد هنگام شروع فعالیت که در Activity 1.9.0-alpha02 معرفی شده بود و ناشی از فراخوانی OnBackPressedDispatcher به عنوان بخشی از ایجاد Activity بود، برطرف شد. ( Ie75e3 )

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

۷ فوریه ۲۰۲۴

androidx.activity:activity:1.9.0-alpha03 ، androidx.activity:activity-compose:1.9.0-alpha03 و androidx.activity:activity-ktx:1.9.0-alpha03 منتشر شدند. نسخه 1.9.0-alpha03 شامل این کامیت‌ها است.

هشدار پرز

رفع اشکالات

  • اگر یک رویداد برگشت از سیستمی که در حین اجرای یک حرکت برگشت پیش‌بینی‌کننده از قبل شروع شده است، ارسال شود، حرکت برگشت پیش‌بینی‌کننده در حال اجرا لغو می‌شود و رویداد برگشت جدید برای شروع یک حرکت برگشت پیش‌بینی‌کننده جدید به کار گرفته می‌شود. ( I3482e )
  • مشکل از کار افتادن برنامه هنگام دسترسی به onBackPressedDispatcher از یک ComponentActivity برای اولین بار از یک thread پس‌زمینه برطرف شد. اکنون دسترسی به onBackPressedDispatcher در هر thread ای ایمن است. ( I79955 )

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

۲۴ ژانویه ۲۰۲۴

androidx.activity:activity:1.9.0-alpha02 ، androidx.activity:activity-compose:1.9.0-alpha02 و androidx.activity:activity-ktx:1.9.0-alpha02 منتشر شدند. نسخه 1.9.0-alpha02 شامل این کامیت‌ها است.

تبدیل‌های کاتلین

  • ActivityResultRegistry در کاتلین بازنویسی شده است. این امر تضمین می‌کند که nullability ژنریک‌های موجود در قرارداد ارسالی به register ، به درستی به ActivityResultLauncher برگردانده شده به شما منتقل شود. ( I121f0 )
  • ActivityResult در کاتلین بازنویسی شده است. افزونه‌های کاتلین ActivityResult که از تجزیه به فیلدهای resultCode و data پشتیبانی می‌کنند، از activity-ktx به activity منتقل شده‌اند. ( I0565a )
  • افزونه‌های کاتلینِ by viewModels() برای ComponentActivity و trackPipAnimationHintView از activity-ktx به activity منتقل شده‌اند. آرتیفکت activity-ktx اکنون کاملاً خالی است. ( I0a444 )

رفع اشکالات

  • API enableEdgeToEdge اکنون دور هر بریدگی نمایشگر را رسم می‌کند. ( a3644b , b/311173461 )
  • از فعالیت 1.8.2 : مشکل ارسال صحیح کلید ACTION_SYSTEM_FALLBACK_PICK_IMAGES به قرارداد فعالیت Photo Picker، یعنی EXTRA_SYSTEM_FALLBACK_PICK_IMAGES_MAX ، به جای استفاده از کلید extra با کلید "com.google.android.gms.provider.extra.PICK_IMAGES_MAX" برطرف شد. اگر شما یک تولیدکننده تجهیزات اصلی (OEM) هستید که یک Photo Picker پشتیبان سیستمی را برای پشتیبانی از هر دو مورد اضافی پیاده‌سازی می‌کند، اکیداً توصیه می‌شود تا بیشترین سازگاری تضمین شود. ( I96a00 )

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

۲۹ نوامبر ۲۰۲۳

androidx.activity:activity:1.9.0-alpha01 ، androidx.activity:activity-compose:1.9.0-alpha01 و androidx.activity:activity-ktx:1.9.0-alpha01 منتشر شدند. نسخه 1.9.0-alpha01 شامل این کامیت‌ها است.

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

  • ComponentActivity اکنون OnUserLeaveHintProvider پیاده‌سازی می‌کند تا به کامپوننت‌ها اجازه دهد برای رویدادهای onUserLeaveHint فراخوانی مجدد انجام دهند. ( I54892 )

تغییرات API

  • ComponentActivity در کاتلین بازنویسی شده است. ( I14f31 )
  • ActivityResultCaller در کاتلین بازنویسی شده است. ( Ib02e4 )
  • ActivityResultLauncher در کاتلین بازنویسی شده است. به عنوان بخشی از این تبدیل، متد getContract اکنون یک ویژگی انتزاعی کاتلین است. این یک تغییر سازگار با باینری است، اما اگر پیاده‌سازی ActivityResultLauncher شما در کاتلین نوشته شده باشد، کد منبع آن دچار مشکل می‌شود. ( Id4615 )
  • PickVisualMediaRequest اکنون همان حداقل سطح API 19 را دارد که در قرارداد PickVisualMedia Activity Result وجود دارد. ( Id6e21 )

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

نسخه ۱.۸

نسخه ۱.۸.۲

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

androidx.activity:activity:1.8.2 ، androidx.activity:activity-compose:1.8.2 و androidx.activity:activity-ktx:1.8.2 منتشر شدند. نسخه ۱.۸.۲ شامل این کامیت‌ها است.

رفع اشکالات

  • مشکل ارسال صحیح کلید ACTION_SYSTEM_FALLBACK_PICK_IMAGES به قرارداد فعالیت Photo Picker، به نام EXTRA_SYSTEM_FALLBACK_PICK_IMAGES_MAX ، به جای استفاده از کلید extra با کلید "com.google.android.gms.provider.extra.PICK_IMAGES_MAX" ، برطرف شد. اگر شما یک تولیدکننده تجهیزات اصلی (OEM) هستید که یک Photo Picker پشتیبان سیستمی را برای پشتیبانی از هر دو مورد اضافی پیاده‌سازی می‌کند، اکیداً توصیه می‌شود تا بیشترین سازگاری تضمین شود. ( I96a00 )

نسخه ۱.۸.۱

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

androidx.activity:activity:1.8.1 ، androidx.activity:activity-compose:1.8.1 و androidx.activity:activity-ktx:1.8.1 منتشر شدند. نسخه ۱.۸.۱ شامل این کامیت‌ها است.

رفع اشکالات

  • اکنون OnBackPressedDispatcher حتی پس از اضافه شدن یک OnBackPressedCallback جدید در حین مدیریت ژست برگشت، به ارسال به OnBackPressedCallback صحیح ادامه می‌دهد. ( Id0ff6 )

نسخه ۱.۸.۰

۴ اکتبر ۲۰۲۳

androidx.activity:activity:1.8.0 ، androidx.activity:activity-compose:1.8.0 و androidx.activity:activity-ktx:1.8.0 منتشر شدند. نسخه ۱.۸.۰ شامل این کامیت‌ها است.

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

  • بازگشت پیش‌بینی‌کننده - OnBackPressedCallback اکنون علاوه بر فراخوانی قبلی handleOnBackPressed() برای زمانی که حرکت بازگشت انجام می‌شود، فراخوانی‌های پیش‌بینی‌کننده بازگشت جدیدی را برای مدیریت شروع حرکت بازگشت، پیشرفت در طول حرکت و لغو حرکت بازگشت ارائه می‌دهد. این همچنین با PredictiveBackHandler Composable برای مدیریت رویدادهای پیش‌بینی‌کننده حرکت بازگشت در Activity Compose همراه است. این یک جریان از اشیاء BackEventCompat را فراهم می‌کند که باید در lamba معلقی که ارائه می‌دهید جمع‌آوری شوند:
  PredictiveBackHandler { progress: Flow<BackEventCompat> ->
    // code for gesture back started
    try {
      progress.collect { backEvent ->
      // code for progress
    }
    // code for completion
    } catch (e: CancellationException) {
      // code for cancellation
    }
  }

ComponentActivity.onBackPressed() اکنون به نفع APIها برای مدیریت بازگشت، منسوخ شده است. توسعه‌دهندگان اکنون باید از OnBackPressedDispatcher استفاده کنند، نه اینکه این متد را بازنویسی کنند.

  • EdgeToEdge - برای تنظیم آسان نمایش لبه به لبه به شیوه‌ای سازگار با نسخه‌های قبلی، ComponentActivity.enableEdgeToEdge() اضافه شده است.

نسخه ۱.۸.۰-rc01

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

androidx.activity:activity:1.8.0-rc01 ، androidx.activity:activity-compose:1.8.0-rc01 و androidx.activity:activity-ktx:1.8.0-rc01 منتشر شدند. نسخه 1.8.0-rc01 شامل این کامیت‌ها است.

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

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

androidx.activity:activity:1.8.0-beta01 ، androidx.activity:activity-compose:1.8.0-beta01 و androidx.activity:activity-ktx:1.8.0-beta01 منتشر شدند. نسخه 1.8.0-beta01 شامل این کامیت‌ها است.

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

  • مستندات BackEventCompat بهبود یافت. ( aosp/2722254 )

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

۲۳ آگوست ۲۰۲۳

androidx.activity:activity:1.8.0-alpha07 ، androidx.activity:activity-compose:1.8.0-alpha07 و androidx.activity:activity-ktx:1.8.0-alpha07 منتشر شدند. نسخه 1.8.0-alpha07 شامل این کامیت‌ها است.

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

  • Activity Compose یک PredictiveBackHandler Composable جدید برای مدیریت رویدادهای پیش‌بینی‌کننده‌ی بازگشت به عقب اضافه کرده است. این یک Flow از اشیاء BackEventCompat را ارائه می‌دهد که باید در lamba معلقی که شما ارائه می‌دهید، جمع‌آوری شوند:

    PredictiveBackHandler { progress: Flow<BackEventCompat> ->
      // code for gesture back started
      try {
        progress.collect { backEvent ->
        // code for progress
      }
      // code for completion
      } catch (e: CancellationException) {
        // code for cancellation
      }
    }
    

    همچنین با یک هشدار زمان کامپایل از طریق قاعده lint همراه است تا از فراخوانی‌های Flow collect() اطمینان حاصل شود. ( Id2773 ، b/294884345 )

  • متد onBackPressedDispatcher در ComponentActivity اکنون به صورت تنبل مقداردهی اولیه می‌شود، بنابراین فقط در صورت نیاز ایجاد می‌شود. ( I0bf8e )

رفع اشکالات

  • ComponentActivity در اندروید ۱۳، وقتی فراخوانی onBackPressed() را دریافت می‌کند و اکتیویتی از قبل DESTROYED شده است، دیگر NPE را نشان نمی‌دهد. ( Idb055 , b/291869278 )
  • کاربردهای API آزمایشی isAtLeastU() حذف شد ( Ie9117 ، b/289269026 )

نسخه ۱.۸.۰-alpha06

۲۱ ژوئن ۲۰۲۳

androidx.activity:activity:1.8.0-alpha06 ، androidx.activity:activity-compose:1.8.0-alpha06 و androidx.activity:activity-ktx:1.8.0-alpha06 منتشر شدند. نسخه 1.8.0-alpha06 شامل این کامیت‌ها است.

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

  • OnBackPressedDispatcher اکنون به درستی هرگونه فراخوانی برگشتی که در طول یک حرکت پیش‌بینانه‌ی بازگشت حذف می‌شوند را لغو می‌کند. ( I3f90f )

تغییرات API

  • هنگام ارسال SystemBarStyle.auto به enableEdgeToEdge API، اکنون می‌توانید پارامتر لامبدا detectDarkMode را برای ارائه منطق سفارشی برای تشخیص حالت شب، بازنویسی کنید. ( aosp/2546393 , b/278263793 )

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

۷ ژوئن ۲۰۲۳

androidx.activity:activity:1.8.0-alpha05 ، androidx.activity:activity-compose:1.8.0-alpha05 و androidx.activity:activity-ktx:1.8.0-alpha05 منتشر شدند. این نسخه در یک شاخه داخلی توسعه داده شده است.

تغییرات API

  • اکتیویتی اکنون یک کلاس BackEventCompat ارائه می‌دهد که به عنوان یک نسخه سازگار با نسخه‌های قبلی BackEvent عمل می‌کند و از کلاس BackEvent چارچوب جدا شده است.
  • تغییر مهم: متدهای handleOnBackStarted و handleOnBackProgressed از OnBackPressedCallback اکنون به جای کلاس android.window.BackEvent در چارچوب، یک نمونه androidx.activity.BackEventCompat دریافت می‌کنند. APIهای معادل @VisibleForTesting در OnBackPressedDispatcher نیز به‌روزرسانی شده‌اند.
  • سازنده‌ی OnBackPressedDispatcher اکنون یک نمونه‌ی اختیاری Consumer<Boolean> می‌گیرد که به مالکان dispatcher اجازه می‌دهد هر زمان که تعداد callbackهای فعال از صفر به غیر صفر یا برعکس تغییر کرد، یک callback دریافت کنند.

رفع اشکالات

  • از فعالیت 1.7.2 : رفع مشکل از کار افتادن ReportDrawn هنگام خروج از صفحه قبل از فراخوانی report . ( Ic46f1 ، b/260506820 )

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

۱۰ مه ۲۰۲۳

androidx.activity:activity:1.8.0-alpha04 ، androidx.activity:activity-compose:1.8.0-alpha04 و androidx.activity:activity-ktx:1.8.0-alpha04 منتشر شدند. این از یک شاخه داخلی منتشر شده است.

رفع اشکالات

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

۱۲ آوریل ۲۰۲۳

androidx.activity:activity:1.8.0-alpha03 ، androidx.activity:activity-compose:1.8.0-alpha03 و androidx.activity:activity-ktx:1.8.0-alpha03 منتشر شدند. این از یک شاخه داخلی منتشر شده است.

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

  • برای تنظیم آسان نمایش لبه به لبه به شیوه‌ای سازگار با نسخه‌های قبلی، ComponentActivity.setUpEdgeToEdge() اضافه شد.

تغییرات API

  • ComponentActivity.onBackPressed() اکنون به نفع APIها برای مدیریت بازگشت، منسوخ شده است. توسعه‌دهندگان اکنون باید از OnBackPressedDispatcher استفاده کنند، نه اینکه این متد را بازنویسی کنند. ( Ibce2f ، b/271596918 )
  • ComponentDialog و ComponentActivity اکنون حاوی API عمومی initViewTreeOwners() هستند که برای مقداردهی اولیه همه مالکان درخت نماها قبل از تنظیم نمای محتوا استفاده می‌شود. ( Ibdce0 ، b/261314581 )

رفع اشکالات

  • مشکلی که در آن Fragmentها به اشتباه MenuHostها را نامعتبر می‌کردند و باعث می‌شدند سایر منوها در Activity رفتار غیرمنتظره‌ای داشته باشند، برطرف شد. ( I9404e ، b/244336571 )

سایر تغییرات

  • ActivityResultRegister اکنون به جای جاوا از Kotlin Random استفاده می‌کند. ( I4d98f , b/272096025 )

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

۸ مارس ۲۰۲۳

androidx.activity:activity:1.8.0-alpha02 ، androidx.activity:activity-compose:1.8.0-alpha02 و androidx.activity:activity-ktx:1.8.0-alpha02 منتشر شدند. این نسخه‌ها از یک شاخه داخلی توسعه داده شده‌اند.

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

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

۸ فوریه ۲۰۲۳

androidx.activity:activity:1.8.0-alpha01 ، androidx.activity:activity-compose:1.8.0-alpha01 و androidx.activity:activity-ktx:1.8.0-alpha01 منتشر شدند. این از یک شاخه داخلی ساخته شده است.

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

  • کلاس OnBackPressedCallback اکنون علاوه بر فراخوانی قبلی handleOnBackPressed() برای زمان اجرای حرکت برگشت، شامل فراخوانی‌های پیش‌بینانه‌ی پیشرفت برگشت جدید برای مدیریت شروع حرکت برگشت، پیشرفت در طول حرکت و لغو حرکت برگشت است.

نسخه ۱.۷

نسخه ۱.۷.۲

۲۴ مه ۲۰۲۳

androidx.activity:activity:1.7.2 , androidx.activity:activity-compose:1.7.2 , and androidx.activity:activity-ktx:1.7.2 are released. Version 1.7.2 contains these commits.

رفع اشکالات

  • Fix ReportDrawn crashing when navigating away from a screen before report is called. ( Ic46f1 , b/260506820 )

نسخه ۱.۷.۱

۱۹ آوریل ۲۰۲۳

androidx.activity:activity:1.7.1 , androidx.activity:activity-compose:1.7.1 , and androidx.activity:activity-ktx:1.7.1 are released. Version 1.7.1 contains these commits.

رفع اشکالات

  • The ReportFullyDrawExecuter no longer leaks when using ComponentActivity with ActivityScenario . ( Id2ff2 , b/277434271 )

نسخه ۱.۷.۰

۲۲ مارس ۲۰۲۳

androidx.activity:activity:1.7.0 , androidx.activity:activity-compose:1.7.0 , and androidx.activity:activity-ktx:1.7.0 are released. Version 1.7.0 contains these commits.

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

  • The Photo Picker activity contracts in PickVisualMedia and PickMultipleVisualMedia have been updated to contain an additional fallback for when MediaStore.ACTION_PICK_IMAGES is unavailable that allows OEMs and system apps, such as Google Play services, to provide a consistent Photo Picker experience on a wider range of Android devices and API levels by implementing the fallback action . The Photo Picker will use this fallback if it is available before falling back to using Intent.ACTION_OPEN_DOCUMENT , which remains to support all API 19 and higher devices.
  • ComponentDialog now implements SavedStateRegistryOwner and has access to its own SavedStateRegistry and sets the SavedStateRegistryOwner for its ViewTree . It is now possible to use Jetpack Compose within a ComponentDialog as it meets both the LifecycleOwner and SavedStateRegistryOwner attached to the Window via the ViewTree APIs requirements.
  • IntentSenderRequest.Builder.setFlags() now allows you to set multiple flags from Intent , rather than only a single flag.

Kotlin Conversion

A number of Activity classes have been converted to Kotlin. All converted classes still retain their binary compatibility with previous versions. The following classes have source incompatible changes for classes written in Kotlin: ActivityResultRegistryOwner , OnBackPressedDispatcherOwner .

The table below provides the source conversions for the new version of Activity:

Activity 1.5 Activity 1.6
override fun getActivityResultRegistry() = activityResultRegistry override val activityResultRegistry = activityResultRegistry
override fun getOnBackPressedDispatcher() = onBackPressedDispatcher override val onBackPressedDispatcher = onBackPressedDispatcher

These classes were also converted to Kotlin, but remain source compatible: ContextAware , ContextAwareHelper , OnContextAvailableListener , IntentSenderRequest , and OnBackPressedDispatcher

FullyDrawnReporter APIs

ComponentActivity now provides a FullyDrawnReporter instance that allows multiple components to report when they are ready for interaction. ComponentActivity will wait for all components to complete before calling reportFullyDrawn() on your behalf. These APIs take care of the timing requirements for you and do not need to be called as part of an onDraw call.

These APIs are encouraged to enable:

  • Signaling the Android Runtime when startup completes, to ensure all of the code run during a multi-frame startup sequence is included and prioritized for background compilation.
  • Signaling Macrobenchmark and Play Vitals when your application should be considered fully drawn for startup metrics, so you can track performance.

Three Activity Compose APIs have been added to make it more convenient to use the FullyDrawnReporter from individual composables:

  • ReportDrawn indicates that your composable is immediately ready for interaction.
  • ReportDrawnWhen takes a predicate (ie, list.count > 0 ) to indicate when your composable is ready for interaction.
  • ReportDrawnAfter takes a suspending method that, when it completes, indicates that you are ready for interaction.

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

نسخه ۱.۷.۰-rc01

۸ مارس ۲۰۲۳

androidx.activity:activity:1.7.0-rc01 , androidx.activity:activity-compose:1.7.0-rc01 , and androidx.activity:activity-ktx:1.7.0-rc01 are released. Version 1.7.0-rc01 contains these commits.

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

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

۲۲ فوریه ۲۰۲۳

androidx.activity:activity:1.7.0-beta02 , androidx.activity:activity-compose:1.7.0-beta02 , and androidx.activity:activity-ktx:1.7.0-beta02 are released. Version 1.7.0-beta02 contains these commits.

تغییرات API

  • The action and extra used by the PickVisualMedia and PickMultipleVisualMedia contracts as a fallback for when MediaStore.ACTION_PICK_IMAGES is unavailable are now public constants that provide API stability to OEMs and system apps that want to provide a consistent Photo Picker experience. The implementation of this fallback is still limited to only system apps. ( Icd320 )

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

۸ فوریه ۲۰۲۳

androidx.activity:activity:1.7.0-beta01 , androidx.activity:activity-compose:1.7.0-beta01 , and androidx.activity:activity-ktx:1.7.0-beta01 are released. Version 1.7.0-beta01 contains these commits.

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

  • IntentSenderRequest.Builder.setFlags() now allows you to set multiple flags from Intent , rather than only a single flag. ( Iac04c )

رفع اشکالات

  • The fallback for PickVisualMedia for when the framework Photo Picker is unavailable now correctly limits the handling to apps installed in the device's system image. ( If8ae6 )

تبدیل‌های کاتلین

  • ActivityResultRegistryOwner is now written in Kotlin. This is a source incompatible change for those classes written in Kotlin - you must now override the activityResultRegistry property rather than implementing the previous getActivityResultRegistry() function. ( I0b00e )
  • OnBackPressedDispatcherOwner is now written in Kotlin. This is a source incompatible change for those classes written in Kotlin - you must now override the onBackPressedDispatcher property rather than implementing the previous getOnBackPressedDispatcher function. ( Ia277d )
  • ContextAware , ContextAwareHelper , OnContextAvailableListener , IntentSenderRequest and OnBackPressedDispatcher are now written in Kotlin. ( I1a73e , Iada92 , aosp/2410754 , I18ac7 , b/257291701 )

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

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

androidx.activity:activity:1.7.0-alpha04 , androidx.activity:activity-compose:1.7.0-alpha04 , and androidx.activity:activity-ktx:1.7.0-alpha04 are released. Version 1.7.0-alpha04 contains these commits.

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

  • The PickVisualMedia and PickMultipleVisualMedia Activity Result contracts will now use a Google Play services provided Photo Picker where available in cases where the Android system provided Photo Picker (eg, MediaStore.ACTION_PICK_IMAGES ) is not available. The isPhotoPickerAvailable() API that only detects the Android system provided Photo Picker has been deprecated. It is recommended to use the new isPhotoPickerAvailable(Context) API, which will return if either Photo Picker is available. ( I55be6 )

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

January 11, 2023

androidx.activity:activity:1.7.0-alpha03 , androidx.activity:activity-compose:1.7.0-alpha03 , and androidx.activity:activity-ktx:1.7.0-alpha03 are released. Version 1.7.0-alpha03 contains these commits.

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

  • ComponentDialog now implements SavedStateRegistryOwner and has access to its own SavedStateRegistry and sets the SavedStateRegistryOwner for its ViewTree. It is now possible to use Jetpack Compose within a ComponentDialog as it meets both the LifecycleOwner and SavedStateRegistryOwner attached to the Window via the ViewTree APIs requirements. ( Idca17 , I73468 b/261162296 )

تغییرات API

  • Added a ReportDrawn composable that immediately marks the activity as ready to call reportFullyDrawn . ( Ic5b14 , b/259687964 )

تبدیل‌های کاتلین

  • The ActvitiyResultCallback and OnBackPressedCallback classes have both been converted to Kotlin while maintaining source and binary compatibility. ( Ifc5e5 , Ide1b0 , b/257291701 )

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

۲۴ اکتبر ۲۰۲۲

androidx.activity:activity:1.7.0-alpha02 , androidx.activity:activity-compose:1.7.0-alpha02 , and androidx.activity:activity-ktx:1.7.0-alpha02 are released. Version 1.7.0-alpha02 contains these commits.

رفع اشکالات

  • From Activity 1.6.1 : Fixed an issue with the PickMultipleVisualMedia Activity Result contract not launching on Android R devices when using the default value for maxItems . ( Ie2776 , b/249182130 )

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

۵ اکتبر ۲۰۲۲

androidx.activity:activity:1.7.0-alpha01 , androidx.activity:activity-compose:1.7.0-alpha01 , and androidx.activity:activity-ktx:1.7.0-alpha01 are released. Version 1.7.0-alpha01 contains these commits.

FullyDrawnReporter APIs

ComponentActivity now provides a FullyDrawnReporter instance that allows multiple components to report when they are ready for interaction. ComponentActivity will wait for all components to complete before calling reportFullyDrawn() on your behalf. These APIs take care of the timing requirements for you and do not need to be called as part of an onDraw call.

These APIs are encouraged to enable:

  • Signaling the Android Runtime when startup completes, to ensure all of the code run during a multi-frame startup sequence is included and prioritized for background compilation.
  • Signaling Macrobenchmark and Play Vitals when your application should be considered fully drawn for startup metrics, so you can track performance.

Two Activity Compose APIs have been added to make it more convenient to use the FullyDrawnReporter from individual composables:

  • ReportDrawnWhen takes a predicate (ie, list.count > 0 ) to indicate when your composable is ready for interaction.
  • ReportDrawnAfter takes a suspending method that, when it completes, indicates that you are ready for interaction.

نسخه ۱.۶.۱

نسخه ۱.۶.۱

۲۴ اکتبر ۲۰۲۲

androidx.activity:activity:1.6.1 , androidx.activity:activity-compose:1.6.1 , and androidx.activity:activity-ktx:1.6.1 are released. Version 1.6.1 contains these commits.

رفع اشکالات

  • Fixed an issue with the PickMultipleVisualMedia Activity Result contract not launching on Android R devices when using the default value for maxItems . ( Ie2776 , b/249182130 )

نسخه ۱.۶.۰

نسخه ۱.۶.۰

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

androidx.activity:activity:1.6.0 , androidx.activity:activity-compose:1.6.0 , and androidx.activity:activity-ktx:1.6.0 are released. Version 1.6.0 contains these commits.

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

  • Added ActivityResultContracts.PickVisualMedia and ActivityResultContracts.PickMultipleVisualMedia for providing a backward compatible contract that uses MediaStore.ACTION_PICK_IMAGES when the Photo Picker is available and Intent.ACTION_OPEN_DOCUMENT when it is not available.
  • Integrated the OnBackInvokedCallback in Android 13 into the OnBackPressedDispatchers provided by ComponentActivity and ComponentDialog . This ensures that all APIs built on OnBackPressedDispatcher work when enabling a predictive back gesture .

Version 1.6.0-rc02

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

androidx.activity:activity:1.6.0-rc02 , androidx.activity:activity-compose:1.6.0-rc02 , and androidx.activity:activity-ktx:1.6.0-rc02 are released. Version 1.6.0-rc02 contains these commits.

رفع اشکالات

  • OnBackPressedDispatcher now registers the OnBackInvokedCallback with the PRIORITY_DEFAULT instead of PRIORITY_OVERLAY . ( I3901f )
  • Classes that extend ComponentActivity will now always have both of their onMultiWindowModeChanged() callbacks dispatched. ( Ic4d85 )
  • The ActivityResultRegistry will no longer return a result to the ActivityResultCallback when the launch call throws any Exception and the callback was registered without a LifecycleOwner . ( Ia7ff7 , b/238350794 )
  • ComponentActivity will now properly dispatch menu calls without the need to call the super function in your activity. ( Ie33c5 , b/238057118 )

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

نسخه ۱.۶.۰-rc01

۲۴ آگوست ۲۰۲۲

androidx.activity:activity:1.6.0-rc01 , androidx.activity:activity-compose:1.6.0-rc01 , and androidx.activity:activity-ktx:1.6.0-rc01 are released. Version 1.6.0-rc01 contains these commits.

رفع اشکالات

  • Initializing an OnBackPressedDispatcher will no longer cause ClassVerificationError s when using SDK versions prior to 33. ( Ic32e1 )
  • Classes that override ComponentActivity 's onPictureInPictureModeChanged() callback will now always have their callbacks dispatched. ( Ib7fdb )

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

۱۰ آگوست ۲۰۲۲

androidx.activity:activity:1.6.0-beta01 , androidx.activity:activity-compose:1.6.0-beta01 , and androidx.activity:activity-ktx:1.6.0-beta01 are released. Version 1.6.0-beta01 contains these commits.

تغییرات API

  • Marked the deprecated startActivityForResult and startIntentSenderForResult methods on ComponentActivity with @NonNull because passing null has always resulted in a crash. ( Id2a25 , b/231476082 )

رفع اشکالات

  • From Activity 1.5.1 : The ActivityResultRegistry will no longer return a result to the ActivityResultCallback when the launch call throws any Exception and the callback was registered without a LifecycleOwner . ( Ia7ff7 , b/238350794 )
  • From Activity 1.5.1 : ComponentActivity will now properly dispatch menu calls to onPrepareOptionMenu() , onCreateOptionsMenu() and onOptionsItemSelected() overrides without the need to call the super function. ( Ie33c5 , b/238057118 )

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

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

June 15, 2022

androidx.activity:activity:1.6.0-alpha05 , androidx.activity:activity-compose:1.6.0-alpha05 , and androidx.activity:activity-ktx:1.6.0-alpha05 are released. Version 1.6.0-alpha05 was developed in a private pre-release branch and has no public commits.

تغییرات API

  • minCompileSdk is now 33 to align with Tiramisu Beta 3 SDK

رفع اشکالات

  • Fixed crash on older devices when doing SDK extension check for the PickVisualMedia ActivityResultContract so that it should now work with ACTION_OPEN_DOCUMENT on devices running Android 10 and lower.

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

۱۸ مه ۲۰۲۲

androidx.activity:activity:1.6.0-alpha04 and androidx.activity:activity-ktx:1.6.0-alpha04 are released.

رفع اشکالات

  • Fixed an error in PickVisualMediaRequest where attempting to create a request, either via the Builder or the top level Kotlin function, would result in a stack overflow.
  • Integrated the OnBackInvokedCallback in Android 13 Dev Beta 2 into the OnBackPressedDispatcher provided by ComponentDialog . This ensures that all APIs built on OnBackPressedDispatcher work when enabling a predictive back gesture .

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

April 27, 2022

androidx.activity:activity:1.6.0-alpha03 , androidx.activity:activity-compose:1.6.0-alpha03 , and androidx.activity:activity-ktx:1.6.0-alpha03 are released.

  • Note: This version will only compile against the Android 13 Developer Beta 1 SDK.

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

  • Added ActivityResultContracts.PickVisualMedia and ActivityResultContracts.PickMultipleVisualMedia for providing a backward compatible contract that uses MediaStore.ACTION_PICK_IMAGES when the Photo Picker is available and Intent.ACTION_OPEN_DOCUMENT when it is not available.
  • Integrated the OnBackInvokedCallback in Android 13 Dev Beta 1 into the OnBackPressedDispatcher provided by ComponentActivity . This ensures that all APIs built on OnBackPressedDispatcher work when enabling a predictive back gesture .

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

۲۳ مارس ۲۰۲۲

androidx.activity:activity:1.6.0-alpha01 , androidx.activity:activity-compose:1.6.0-alpha01 , and androidx.activity:activity-ktx:1.6.0-alpha01 are released.

  • Note: This version will only compile against the Android 13 Developer Preview 2 SDK.

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

  • Integrated changes in Android 13 Dev Preview 2 into ComponentActivity .

نسخه ۱.۵.۱

نسخه ۱.۵.۱

۲۷ ژوئیه ۲۰۲۲

androidx.activity:activity:1.5.1 , androidx.activity:activity-compose:1.5.1 , and androidx.activity:activity-ktx:1.5.1 are released. Version 1.5.1 contains these commits.

رفع اشکالات

  • The ActivityResultRegistry will no longer return a result to the ActivityResultCallback when the launch() call throws any Exception and the callback was registered without a LifecycleOwner . ( Ia7ff7 , b/238350794 )

  • ComponentActivity will now properly dispatch menu calls to onPrepareOptionMenu() , onCreateOptionsMenu() and onOptionsItemSelected() overrides without the need to call the super function. ( Ie33c5 , b/238057118 )

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

نسخه ۱.۵.۰

نسخه ۱.۵.۰

۲۹ ژوئن ۲۰۲۲

androidx.activity:activity:1.5.0 , androidx.activity:activity-compose:1.5.0 , and androidx.activity:activity-ktx:1.5.0 are released. Version 1.5.0 contains these commits.

Important changes since 1.4.0

  • ComponentDialog - ComponentDialog is a subclass of Dialog that includes an OnBackPressedDispatcher that will be called when the system back button is pressed and the dialog is visible. Importantly, this subclass also sets the ViewTreeOnBackPressedDispatcherOwner , allowing views a generic way to retrieve the correct dispatcher whether it exists in a ComponentActivity or a ComponentDialog .
  • Callback Interfaces - ComponentActivity now implements a set of modular callback interfaces that can be used instead of the Activity callbacks. These interfaces include the following: OnNewIntentProvider , OnConfigurationChangedProvider , OnTrimMemoryProvider , OnPictureInPictureModeChangedProvider , OnMultiWindowModeChangedProvider
  • CreationExtras Integration - ComponentActivity now has the ability to provide a stateless ViewModelProvider.Factory via Lifecycle 2.5.0 's CreationExtras .

تغییرات دیگر

  • The no parameter constructor for ActivityResultContracts.CreateDocument has been deprecated and replaced with a new constructor that takes a concrete mime type (eg, "image/png") as is required by Intent.ACTION_CREATE_DOCUMENT .

نسخه ۱.۵.۰-rc01

May 11, 2022

androidx.activity:activity:1.5.0-rc01 , androidx.activity:activity-compose:1.5.0-rc01 , and androidx.activity:activity-ktx:1.5.0-rc01 are released with no changes from 1.5.0-beta01. Version 1.5.0-rc01 contains these commits.

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

۲۰ آوریل ۲۰۲۲

androidx.activity:activity:1.5.0-beta01 , androidx.activity:activity-compose:1.5.0-beta01 , and androidx.activity:activity-ktx:1.5.0-beta01 are released. Version 1.5.0-beta01 contains these commits.

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

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

۶ آوریل ۲۰۲۲

androidx.activity:activity:1.5.0-alpha05 , androidx.activity:activity-compose:1.5.0-alpha05 , and androidx.activity:activity-ktx:1.5.0-alpha05 are released. Version 1.5.0-alpha05 contains these commits.

رفع اشکالات

  • ComponentActivity 's onPanelClosed() now calls the super onPanelClosed() as well, fixing an issue where the onContextMenuClosed method would not be called. ( Ib6f77 )

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

۲۳ مارس ۲۰۲۲

androidx.activity:activity:1.5.0-alpha04 , androidx.activity:activity-compose:1.5.0-alpha04 , and androidx.activity:activity-ktx:1.5.0-alpha04 are released. Version 1.5.0-alpha04 contains these commits.

رفع اشکالات

  • SavedStateViewFactory now supports using CreationExtras even when it was initialized with a SavedStateRegistryOwner . If extras are provided, the initialized arguments are ignored. ( I6c43b , b/224844583 )

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

۲۳ فوریه ۲۰۲۲

androidx.activity:activity:1.5.0-alpha03 , androidx.activity:activity-compose:1.5.0-alpha03 , and androidx.activity:activity-ktx:1.5.0-alpha03 are released. Version 1.5.0-alpha03 contains these commits.

تغییرات API

  • You can now pass CreationExtras to the activity by viewModels() function ( I6a3e6 , b/217600303 )

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

۹ فوریه ۲۰۲۲

androidx.activity:activity:1.5.0-alpha02 , androidx.activity:activity-compose:1.5.0-alpha02 , and androidx.activity:activity-ktx:1.5.0-alpha02 are released. Version 1.5.0-alpha02 contains these commits.

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

  • ComponentActivity now implements the OnPictureInPictureModeChangedProvider interface to allow any component to receive picture-in-picture mode change events. ( I9f567 )
  • ComponentActivity now implements the OnMultiWindowModeChangedProvider interface to allow any component to receive multi-window mode change events. ( I62d91 )

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

۲۶ ژانویه ۲۰۲۲

androidx.activity:activity:1.5.0-alpha01 , androidx.activity:activity-compose:1.5.0-alpha01 , and androidx.activity:activity-ktx:1.5.0-alpha01 are released. Version 1.5.0-alpha01 contains these commits.

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

  • ComponentActivity now integrates with ViewModel CreationExtras, introduced as part of Lifecycle 2.5.0-alpha01 . ( Ie7e00 , b/207012584 )
  • Added ComponentDialog , a subclass of Dialog that includes an OnBackPressedDispatcher that will be called when the system back button is pressed when the dialog is visible. Importantly, this subclass also sets the ViewTreeOnBackPressedDispatcherOwner , allowing views a generic way to retrieve the correct dispatcher whether it exists in a ComponentActivity or a ComponentDialog . ( I8a1bc )
  • ComponentActivity now implements the new OnNewIntentProvider interface to allow any component to receive these events. ( If1f8b )
  • ComponentActivity now implements the new OnConfigurationChangedProvider interface to allow any component to receive these events. ( If623b )
  • ComponentActivity now implements the new OnTrimMemoryProvider interface to allow any component to receive these events. ( Ia9295 )

تغییرات API

  • The no parameter constructor for ActivityResultContracts.CreateDocument has been deprecated and replaced with a new constructor that takes a concrete mime type (eg, "image/png" ) as is required by Intent.ACTION_CREATE_DOCUMENT . ( I2bec6 )
  • The OnBackPressedDispatcherOwner associated with a View can now be retrieved via the ViewTreeOnBackPressedDispatcherOwner , rather than relying on casting the Context . ( I74685 )

رفع اشکالات

  • Fixed a crash when accessing a ViewModel for the very first time from a registerForActivityResult() callback or the callbacks to a LifecycleObserver added as part of init of a ComponentActivity . ( Ife83f )

نسخه ۱.۴.۰

نسخه ۱.۴.۰

October 27, 2021

androidx.activity:activity:1.4.0 , androidx.activity:activity-compose:1.4.0 , and androidx.activity:activity-ktx:1.4.0 are released. Version 1.4.0 contains these commits.

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

  • AndroidX ComponentActivity now implements the MenuHost interface. This allows any component to add menu items to the ActionBar by adding a MenuProvider instance to the activity. Each MenuProvider can optionally be added with a Lifecycle that will automatically control the visibility of those menu items based on the Lifecycle state and handle the removal of the MenuProvider when the Lifecycle is destroyed.
  • The ActivityResultContract class has been rewritten in Kotlin to ensure that developers writing custom contracts in Kotlin can define the correct nullability for their input and output classes.
  • The ActivityResultContracts class and its contracts have been rewritten in Kotlin to ensure the proper nullability.

نسخه ۱.۴.۰-rc01

۱۳ اکتبر ۲۰۲۱

androidx.activity:activity:1.4.0-rc01 , androidx.activity:activity-compose:1.4.0-rc01 , and androidx.activity:activity-ktx:1.4.0-rc01 are released. Version 1.4.0-rc01 contains these commits.

رفع اشکالات

  • The ActivityResultRegistry will no longer return a result to the ActivityResultCallback when the launch call throws any Exception . ( If4f91 , b/200845664 )

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

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

androidx.activity:activity:1.4.0-beta01 , androidx.activity:activity-compose:1.4.0-beta01 , and androidx.activity:activity-ktx:1.4.0-beta01 are released. Version 1.4.0-beta01 contains these commits.

تغییرات API

  • Fixed the type for the ActivityResultContracts.OpenMultipleDocuments and ActivityResultContracts.GetMultipleContents that caused then to use an output type of List<? extends Uri> when using the code from the Java programming language. ( If71de )
  • Public constants within the ActivityResultContracts.StartActivityForResult , ActivityResultContracts.StartIntentSenderForResult , and ActivityResultContracts.RequestMultiplePermissions classes are now accessible when using Kotlin via their now public Companion objects. ( aosp/1832555 )

به‌روزرسانی‌های مستندات

  • The deprecation message for APIs now handled by the Activity Result APIs , namely startActivityForResult , startIntentSenderForResult , onActivityResult , requestPermissions , and onRequestPermissionsResult , have all been expanded with more details. ( cce80f )

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

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

androidx.activity:activity:1.4.0-alpha02 , androidx.activity:activity-compose:1.4.0-alpha02 , and androidx.activity:activity-ktx:1.4.0-alpha02 are released. Version 1.4.0-alpha02 contains these commits.

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

  • The activity-compose artifact now contains a LaunchDuringComposition lint error that prevents you from calling the launch method of ActivityResultLauncher as part of composition as composition should be side-effect free. Use the APIs for handling side-effects . ( 7c2bbe , b/191347220 )

تغییرات API

  • The ActivityResultContract class has been rewritten in Kotlin to ensure that developers writing custom contracts in Kotlin can define the correct nullability for their input and output classes. ( I8a8f5 )
  • The ActivityResultContracts class and its contracts have been rewritten in Kotlin to ensure the proper nullability. ( I69802 )

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

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

androidx.activity:activity:1.4.0-alpha01 , androidx.activity:activity-compose:1.4.0-alpha01 , and androidx.activity:activity-ktx:1.4.0-alpha01 are released. Version 1.4.0-alpha01 contains these commits.

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

  • AndroidX ComponentActivity now implements the MenuHost interface.. This allows any component to add menu items to the ActionBar by adding a MenuProvider instance to the activity. Each MenuProvider can optionally be added with a Lifecycle that will automatically control the visibility of those menu items based on the Lifecycle state and handle the removal of the MenuProvider when the Lifecycle is destroyed. ( I3b608 ):
/**
  * Using the addMenuProvider() API directly in your Activity
  **/
class ExampleActivity : ComponentActivity(R.layout.activity_example) {

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    // Add menu items without overriding methods in the Activity
   addMenuProvider(object : MenuProvider {
      override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
        // Add menu items here
        menuInflater.inflate(R.menu.example_menu, menu)
      }

      override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
        // Handle the menu selection
        return true
      }
    })
  }
}

/**
  * Using the addMenuProvider() API in a Fragment
  **/
class ExampleFragment : Fragment(R.layout.fragment_example) {

  override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    // The usage of an interface lets you inject your own implementation
    val menuHost: MenuHost = requireActivity()
  
    // Add menu items without using the Fragment Menu APIs
    // Note how we can tie the MenuProvider to the viewLifecycleOwner
    // and an optional Lifecycle.State (here, RESUMED) to indicate when
    // the menu should be visible
    menuHost.addMenuProvider(object : MenuProvider {
      override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
        // Add menu items here
        menuInflater.inflate(R.menu.example_menu, menu)
      }

      override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
        // Handle the menu selection
        return true
      }
    }, viewLifecycleOwner, Lifecycle.State.RESUMED)
  }

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

  • The ActivityResultRegistry will now throw an IllegalStateException when attempting to call launch() on an ActivityResultLauncher that has not be registered or that has been unregistered. ( Ida75d , b/192567522 )

مشارکت خارجی

  • Thanks dmitrilc for fixing a typo in the ActivityResult documentation. ( #221 )

نسخه ۱.۳.۱

نسخه ۱.۳.۱

۴ آگوست ۲۰۲۱

androidx.activity:activity:1.3.1 , androidx.activity:activity-compose:1.3.1 , and androidx.activity:activity-ktx:1.3.1 are released. Version 1.3.1 contains these commits.

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

  • Activity now depends on Kotlin 1.5.21 .
  • Activity Compose now depends on Compose 1.0.1 .

نسخه ۱.۳.۰

نسخه ۱.۳.۰

July 28, 2021

androidx.activity:activity:1.3.0 , androidx.activity:activity-compose:1.3.0 , and androidx.activity:activity-ktx:1.3.0 are released. Version 1.3.0 contains these commits.

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

  • Activity Compose artifact - The activity-compose artifact provides the setContent extension method for hosting your Jetpack Compose UI in an activity and Compose specific wrappers for interacting with the ComponentActivity APIs for handling the system back button and the Activity Result APIs. See the documentation for more details.
  • CaptureVideo contract - The CaptureVideo ActivityResultContract replaces the now deprecated TakeVideo contract and returns a boolean denoting success that works across many camera apps.
  • Picture-In-Picture Hint View Tracking - Users of activity-ktx can now use the trackPipAnimationHintView extension method on Activity to automatically rebuild the PictureInPictureParams with the new position of the view as it changes position relative to the window.

Version 1.3.0-rc02

۱۴ ژوئیه ۲۰۲۱

androidx.activity:activity:1.3.0-rc02 , androidx.activity:activity-compose:1.3.0-rc02 , and androidx.activity:activity-ktx:1.3.0-rc02 are released. Version 1.3.0-rc02 contains these commits.

رفع اشکالات

  • The ActivityResultRegistry callbacks are now properly saved and restored so callbacks are not duplicated in the savedState. ( I97816 , b/191893160 )

نسخه ۱.۳.۰-rc01

۱ ژوئیه ۲۰۲۱

androidx.activity:activity:1.3.0-rc01 , androidx.activity:activity-compose:1.3.0-rc01 , and androidx.activity:activity-ktx:1.3.0-rc01 are released with no changes from 1.3.0-beta02 . Version 1.3.0-rc01 contains these commits.

Version 1.3.0-beta02

۱۶ ژوئن ۲۰۲۱

androidx.activity:activity:1.3.0-beta02 , androidx.activity:activity-compose:1.3.0-beta02 , and androidx.activity:activity-ktx:1.3.0-beta02 are released. Version 1.3.0-beta02 contains these commits.

Updated activity-compose to depend on Compose 1.0.0-beta09 . androidx.compose.ui:ui-test-junit4 now has a compile time dependency on activity-compose .

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

۲ ژوئن ۲۰۲۱

androidx.activity:activity:1.3.0-beta01 , androidx.activity:activity-compose:1.3.0-beta01 , and androidx.activity:activity-ktx:1.3.0-beta01 are released. Version 1.3.0-beta01 contains these commits.

تغییرات API

  • The previously deprecated @Composable registerForActivityResult() method has been removed. Please use rememberLauncherForActivityResult() . ( Ic39d3 )

Version 1.3.0-alpha08

۱۸ مه ۲۰۲۱

androidx.activity:activity:1.3.0-alpha08 , androidx.activity:activity-compose:1.3.0-alpha08 , and androidx.activity:activity-ktx:1.3.0-alpha08 are released. Version 1.3.0-alpha08 contains these commits.

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

  • The new CaptureVideo ActivityResultContract returns a boolean to your ActivityResultCallback indicating if your video was successfully saved to the given URI. This replaces the now deprecated TakeVideo contract as camera apps very rarely supported returning a thumbnail bitmap, making the result unhelpful. ( Ie21f2 , b/185938070 )
  • Added new API Activity#setPipAnimationHintView to update the PipParams' source rect hint whenever the view moves. ( I9063d )

تغییرات API

  • The rememberLauncherForActivityResult function now returns a launcher that deprecates the unregister() function - registration and unregistering the launcher is handled automatically by rememberLauncherForActivityResult . ( I2443e )

Compose Compatibility

  • androidx.activity:activity-compose:1.3.0-alpha08 is only compatible with Compose version 1.0.0-beta07 and above.

Version 1.3.0-alpha07

۲۱ آوریل ۲۰۲۱

androidx.activity:activity:1.3.0-alpha07 , androidx.activity:activity-compose:1.3.0-alpha07 , and androidx.activity:activity-ktx:1.3.0-alpha07 are released. Version 1.3.0-alpha07 contains these commits.

رفع اشکالات

  • rememberLauncherForActivityResult now returns a stable reference to the same ActivityResultLauncher instance even if the contract changes due to recompositions. ( Id2d6d )
  • Using unstable versions of Fragments above 1.3.0 will no longer throw a false positive lint error telling you to use 1.3.0 . ( aosp/1670206 , b/184847092 )

Version 1.3.0-alpha06

۷ آوریل ۲۰۲۱

androidx.activity:activity:1.3.0-alpha06 , androidx.activity:activity-compose:1.3.0-alpha06 , and androidx.activity:activity-ktx:1.3.0-alpha06 are released. Version 1.3.0-alpha06 contains these commits.

تغییرات API

  • The registerForActivityResult() API has been renamed to rememberLauncherForActivityResult() to better indicate that the returned ActivityResultLauncher is a managed object that is remembered on your behalf. Attempting to call unregister the returned ActivityResultLauncher will now throw an error. ( I2bb6d )
  • LocalOnBackPressedDispatcherOwner.current and LocalActivityResultRegistryOwner.current now return a nullable value to better determine whether it is available in the current composition. APIs that requires those APIs, such as BackHandler and rememberLauncherForActivityResult() , respectively, will now throw a more descriptive error if the underlying owner is not found. NavHost now works even when an OnBackPressedDispatcherOwner is not found, such is the case when previewing the NavHost . ( I7d8b4 )

رفع اشکالات

  • The BackHandler will now properly intercept back presses in the event that the Activity is STOPPED , then STARTED again, and other callbacks were added with a LifecycleOwner. ( I71de6 , b/182284739 )
  • Using the launch() method extension with a custom ActivityResultContract that has a Unit input will no longer cause a NullPointerException ( I76282 , b/183837954 )

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

۲۴ مارس ۲۰۲۱

androidx.activity:activity:1.3.0-alpha05 , androidx.activity:activity-compose:1.3.0-alpha05 , and androidx.activity:activity-ktx:1.3.0-alpha05 are released. Version 1.3.0-alpha05 contains these commits.

رفع اشکالات

  • From Activity 1.2.2 : Fixed an issue in the InvalidFragmentVersionForActivityResult lint check that led to a false positive when using Fragment 1.3.1 or higher. ( I54da1 , b/182388985 )
  • From Activity 1.2.2 : ComponentActivity now avoids a ClassNotFoundException when launching an Intent from an ActivityResultContract that was previously held as an extra in another Intent . ( Ieff05 , b/182906230 )

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

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

March 10, 2021

androidx.activity:activity:1.3.0-alpha04 , androidx.activity:activity-compose:1.3.0-alpha04 , and androidx.activity:activity-ktx:1.3.0-alpha04 are released. Version 1.3.0-alpha04 contains these commits.

رفع اشکالات

  • From Activity 1.2.1 : RequestMultiplePermissions now always returns results for all requested permissions instead of only permissions that weren't previously granted. ( I50bc3 , b/180884668 )
  • From Activity 1.2.1 : ActivityResultRegistry now ensures that in progress launch() requests will return their results even if you unregister() , then register() again with the same key. ( I9ef34 , b/181267562 )
  • Activity Compose no longer adds test dependencies to the runtime classpath. ( Ifd8b3 )
  • Fixed an issue with BackHandler where the previously set onBack lambda was still being used after recomposition. ( 8eb5eb )

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

۲۴ فوریه ۲۰۲۱

androidx.activity:activity:1.3.0-alpha03 , androidx.activity:activity-compose:1.3.0-alpha03 , and androidx.activity:activity-ktx:1.3.0-alpha03 are released. Version 1.3.0-alpha03 contains these commits.

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

  • There is a now a Composable registerForActivityResult function for getting results from activities within composables. ( Ia7851 , b/172690553 )

تغییرات API

  • LocalOnBackPressedDispatcherOwner now has a provides functions that can be used with CompositionLocalProvider , replacing the asProvidableCompositionLocal() API. ( I45d24 )

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

۱۰ فوریه ۲۰۲۱

androidx.activity:activity:1.3.0-alpha02 , androidx.activity:activity-compose:1.3.0-alpha02 , and androidx.activity:activity-ktx:1.3.0-alpha02 are released. Version 1.3.0-alpha02 contains these commits.

رفع اشکالات

  • Fixed an issue in Activity Compose 1.3.0-alpha01 that causes a NoSuchMethodError: No static method setContent exception when using Compose 1.0.0-alpha12 . All Compose users should depend on 1.3.0-alpha02 and above. ( b/179911234 )

تغییرات API

  • The BackHandler API can be used to allow a Composable to intercept the system back button. ( I58ed5 , b/172154006 )

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

۱۰ فوریه ۲۰۲۱

androidx.activity:activity:1.3.0-alpha01 , androidx.activity:activity-compose:1.3.0-alpha01 , and androidx.activity:activity-ktx:1.3.0-alpha01 are released. Version 1.3.0-alpha01 contains these commits.

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

  • The new activity-compose artifact provides Jetpack Compose specific helpers for androidx.activity specific APIs.
    • ComponentActivity.setContent has moved from androidx.compose.ui.platform.setContent to androidx.activity.compose.setContent . ( Icf416 )

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

  • Using Activity Compose 1.3.0-alpha01 and libraries that depend on it, such as androidx.compose.ui:ui-test-junit4:1.0.0-alpha12 , will result in a NoSuchMethodError: No static method setContent exception. ( b/179911234 )

نسخه ۱.۲.۴

نسخه ۱.۲.۴

۲۱ ژوئیه ۲۰۲۱

androidx.activity:activity:1.2.4 and androidx.activity:activity-ktx:1.2.4 are released. Version 1.2.4 contains these commits.

رفع اشکالات

نسخه ۱.۲.۳

نسخه ۱.۲.۳

۵ مه ۲۰۲۱

androidx.activity:activity:1.2.3 and androidx.activity:activity-ktx:1.2.3 are released. Version 1.2.3 contains these commits.

رفع اشکالات

  • Using the launch() method extension with a custom ActivityResultContract that has a Unit input will no longer cause a NullPointerException ( I76282 , b/183837954 )
  • Fixed a false positive lint error telling you to use Fragment 1.3.0 when using an snapshot, alpha, beta, or RC build of a newer version of Fragments. ( f4a57e , b/184847092 )

نسخه ۱.۲.۲

نسخه ۱.۲.۲

۲۴ مارس ۲۰۲۱

androidx.activity:activity:1.2.2 and androidx.activity:activity-ktx:1.2.2 are released. Version 1.2.2 contains these commits.

رفع اشکالات

  • Fixed an issue in the InvalidFragmentVersionForActivityResult lint check that led to a false positive when using Fragment 1.3.1 or higher. ( I54da1 , b/182388985 )
  • ComponentActivity now avoids a ClassNotFoundException when launching an Intent from an ActivityResultContract that was previously held as an extra in another Intent . ( Ieff05 , b/182906230 )

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

نسخه ۱.۲.۱

نسخه ۱.۲.۱

March 10, 2021

androidx.activity:activity:1.2.1 and androidx.activity:activity-ktx:1.2.1 are released. Version 1.2.1 contains these commits.

رفع اشکالات

  • RequestMultiplePermissions now always returns results for all requested permissions instead of only permissions that weren't previously granted. ( I50bc3 , b/180884668 )
  • ActivityResultRegistry now ensures that in progress launch() requests will return their results even if you unregister() , then register() again with the same key. ( I9ef34 , b/181267562 )

نسخه ۱.۲.۰

نسخه ۱.۲.۰

۱۰ فوریه ۲۰۲۱

androidx.activity:activity:1.2.0 and androidx.activity:activity-ktx:1.2.0 are released. Version 1.2.0 contains these commits.

Major changes since 1.1.0

  • Activity Result APIs : ComponentActivity now provides an ActivityResultRegistry that lets you handle startActivityForResult() + onActivityResult() as well as requestPermissions() + onRequestPermissionsResult() flows without overriding methods in your Activity or Fragment, brings increased type safety via ActivityResultContract , and provides hooks for testing these flows. See the updated Getting a Result from an Activity .
  • ContextAware : ComponentActivity now implements ContextAware , allowing you to add one or more OnContextAvailableListener instances which will receive a callback before the base Activity.onCreate() .

    • A suspending Kotlin extension withContextAvailable() allows you to run a non-suspending block when the Context becomes available and return a result.
    • This API is used by FragmentActivity in Fragment 1.3.0 to restore the state of the FragmentManager . Any listeners added to subclasses of FragmentActivity will run after that listener.
    • This API is used by AppCompatActivity in AppCompat 1.3.0-alpha02 or higher. Any listeners added to subclasses of AppCompatActivity will run after that listener.
  • ViewTree Support : ComponentActivity now supports the ViewTreeLifecycleOwner.get(View) , ViewTreeViewModelStoreOwner.get(View) , and ViewTreeSavedStateRegistryOwner APIs added in Lifecycle 2.3.0 and SavedState 1.1.0 such that it will return the Activity as the LifecycleOwner , ViewModelStoreOwner , and SavedStateRegistryOwner for any Views directly added to the ComponentActivity .

  • reportFullyDrawn() backport - The Activity method of reportFullyDrawn() has been backported in ComponentActivity to work on all API levels, fixing a crash on API 19 and adding tracing for this method for all API levels.

نسخه ۱.۲.۰-rc01

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

androidx.activity:activity:1.2.0-rc01 and androidx.activity:activity-ktx:1.2.0-rc01 are released. Version 1.2.0-rc01 contains these commits.

رفع اشکالات

  • The ActivityResultRegistry now always restores the exact state that was saved. ( Idd56b )
  • Add tracing to ComponentActivity.reportFullyDrawn ( Ic7632 )

مشارکت خارجی

  • ComponentActivity now overrides reportFullyDrawn() , allowing it to be called on all API levels and fixing a crash when calling this method without the appropriate system permission on API 19 devices. Thanks Simon Schiller! ( b/163239764 , #103 )

Version 1.2.0-beta02

۲ دسامبر ۲۰۲۰

androidx.activity:activity:1.2.0-beta02 and androidx.activity:activity-ktx:1.2.0-beta02 are released. Version 1.2.0-beta02 contains these commits.

رفع اشکالات

  • Fixed an issue where the Activity Result API would not wait for the Lifecycle to be STARTED before delivering results when registered with a Lifecycle . ( I109ea )

مشارکت خارجی

  • Updated the documentation for launch() to explicitly call out that it can throw an ActivityNotFoundException . Thanks Michał Zieliński! ( aosp/1493580 )

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

۱ اکتبر ۲۰۲۰

androidx.activity:activity:1.2.0-beta01 and androidx.activity:activity-ktx:1.2.0-beta01 are released. Version 1.2.0-beta01 contains these commits.

رفع اشکالات

  • The ActivityResultRegistry now randomly generates integers until it finds one that is unallocated to use as a request code register() , thus preventing the possible integer overflow caused by incrementing request codes. ( b/168779518 )

  • Lifecycle observers are properly removed when calling unregister() on an ActivityResultLauncher . ( b/165608393 )

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

  • The ActivityResultRegistry now throws an IllegalStateException when attempting to call register() with a LifecycleOwner whose Lifecycle has already reached STARTED . ( b/165435866 )

Documentation Updated

  • ContextAware documentation links to LifecycleOwner to highlight Lifecycle callbacks as the appropriate place for creation and destruction events. ( aosp/1414152 )

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

۱۹ آگوست ۲۰۲۰

androidx.activity:activity:1.2.0-alpha08 and androidx.activity:activity-ktx:1.2.0-alpha08 are released. Version 1.2.0-alpha08 contains these commits.

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

  • ComponentActivity now implements ContextAware , allowing you to add one or more OnContextAvailableListener instances which will receive a callback before the base Activity.onCreate() . ( b/161390636 )
    • A suspending Kotlin extension withContextAvailable() allows you to run a non-suspending block when the Context becomes available and return a result. ( I8290c )
    • This API is used by FragmentActivity in Fragment 1.3.0-alpha08 to restore the state of the FragmentManager . Any listeners added to subclasses of FragmentActivity will run after that listener. ( I513da )
    • This API is used by AppCompatActivity in AppCompat 1.3.0-alpha02 . Any listeners added to subclasses of AppCompatActivity will run after that listener. ( I513da )

رفع اشکالات

  • Fixed an issue with the ActivityResultFragmentVersionDetector Lint check that caused it to break when using Lint 27.1.0 or higher. ( b/162155191 )

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

۲۲ ژوئیه ۲۰۲۰

androidx.activity:activity:1.2.0-alpha07 and androidx.activity:activity-ktx:1.2.0-alpha07 are released. Version 1.2.0-alpha07 contains these commits.

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

  • Added a new InvalidFragmentVersionForActivityResult lint check that verifies that you are using Fragment 1.3.0-alpha07 when using the Activity Result API , avoiding runtime crashes due to “invalid request code” issues and non-functioning permission requests caused by using older versions of Fragments. ( b/152554847 )

مشارکت خارجی

  • Fixed an ArrayIndexOutOfBoundsException when parsing the results for the RequestPermission Activity Result contract. ( I8f9e3 , b/161057605 )

نسخه ۱.۲.۰-alpha06

June 10, 2020

androidx.activity:activity:1.2.0-alpha06 and androidx.activity:activity-ktx:1.2.0-alpha06 are released. Version 1.2.0-alpha06 contains these commits.

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

  • You can now destructure the ActivityResult class in kotlin to directly access the requestCode and intent . ( b/157212935 )
  • ActivityResultLauncher now allows you to get the ActivityResultContract that was used to register the launcher. ( b/156875743 )

تغییرات API

  • Breaking change : The invoke() method on ActivityResultRegistry has been renamed to onLaunch() . ( b/157496491 )
  • The OpenMultipleDocuments contract now returns an empty list instead of null to the registered callback if no result is returned. ( b/157348014 )

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

۲۰ مه ۲۰۲۰

androidx.activity:activity:1.2.0-alpha05 and androidx.activity:activity-ktx:1.2.0-alpha05 are released. Version 1.2.0-alpha05 contains these commits.

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

تغییرات API

  • The TakePicture contract now returns a boolean indicating success rather than a thumbnail Bitmap as this was very rarely supported by camera apps when writing the image to the provided Uri . ( b/154302879 )
  • The invoke() extensions on ActivityResultLauncher have been removed in favor of explicitly using launch() to better indicate that these are asynchronous operations. Kotlin extensions for launch have been added to the androidx.activity.result package for ActivityResultLauncher<Void> and ActivityResultLauncher<Unit> that remove the need to pass in null or Unit , respectively, mirroring that behavior from the previously invoke() extensions. ( aosp/1304674 , aosp/1304675 )
  • The IntentSenderRequest.Builder methods for setFlagsMask() and setFlagsValues() has been combined into a single setFlags() method. ( aosp/1302111 )

رفع اشکالات

  • When registering an ActivityResultCallback with a LifecycleOwner , fixed an issue where the callback would be triggered before the state reaches STARTED . ( aosp/1309744 )

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

  • The ActivityResultRegistry now generates request codes starting at 0xFFFF rather than at 0 , preventing overlap when using startActivityForResult() or requestPermissions() in an activity. ( aosp/1302324 )

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

۲۹ آوریل ۲۰۲۰

androidx.activity:activity:1.2.0-alpha04 and androidx.activity:activity-ktx:1.2.0-alpha04 are released. Version 1.2.0-alpha04 contains these commits.

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

  • Added a contract that can call startIntentSenderForResult to the ActivityResult APIs. ( b/153007517 )

تغییرات API

  • The prepareCall() method has been renamed to registerForActivityResult() , both on ComponentActivity here and in Fragment 1.3.0-alpha04 . ( aosp/1278717 )
  • The GetContents , OpenDocuments , and RequestPermissions contracts have been renamed to GetMultipleContents , OpenMultipleDocuments , and RequestMultiplePermissions , respectively. ( aosp/1280161 )
  • ComponentActivity now implements the ActivityResultRegisteryOwner interface. ( aosp/1290888 )
  • - The startActivityForResult() / onActivityResult() and onRequestPermissionsResult() APIs on ComponentActivity have been deprecated. Please use the Activity Result APIs . ( b/154751887 )

رفع اشکالات

  • When using the GetMultipleContents and OpenMultipleDocuments contracts and selecting a single item, it is now correctly returned to your callback. ( b/152941153 )

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

April 1, 2020

androidx.activity:activity:1.2.0-alpha03 and androidx.activity:activity-ktx:1.2.0-alpha03 are released. Version 1.2.0-alpha03 contains these commits.

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

  • Added the TakeVideo , PickContact , GetContent , GetContents , OpenDocument , OpenDocuments , OpenDocumentTree , and CreateDocument contracts to the set of pre-built contracts provided by ActivityResultContracts . ( aosp/1262482 , aosp/1266916 , aosp/1268960 )
  • The Activity Result APIs now support launching an activity for result with an optional ActivityOptionsCompat . ( b/151860054 )

تغییرات API

  • The TakePicture contract now takes a Uri input for where the image should be stored. The previous contract that does not take any input has been renamed to TakePicturePreview . ( aosp/1262482 )
  • The registerActivityResultCallback() method on ActivityResultRegistry has been renamed to register() . ( aosp/1267621 )
  • The dispose() method on ActivityResultLauncher has been renamed to unregister() and the unregisterResultCallback() on ActivityResultRegistry has been removed. ( aosp/1267621 )
  • The createIntent() method of ActivityResultContact now takes a Context in addition to the input to make it possible to create explicit Intents. ( aosp/1238800 )
  • An ActivityResultContract can now override getSynchronousResult() to deliver a result without calling startActivityForResult . This is used by the RequestPermission and RequestPermissions contracts to correctly deliver a 'granted' status if the requested permissions are already granted. ( b/151110799 )
  • The previously available Dial contract has been removed as that Intent is not meant to be used with startActivityForResult() . ( aosp/1266916 )
  • Many of the Activity Result APIs not meant to be extended are now final . This includes getActivityResultRegistry() , the prepareCall() methods, all methods of ActivityResultRegistry except invoke() , and a number of the default contracts that do not support optional extras. ( b/152439361 )

رفع اشکالات

  • Fixed a NullPointerException in ActivityResultRegistry when attempting to deliver results to a callback that has not yet been re-registered after a configuration change; ActivityResultRegistry now holds onto these pending results and delivers them when the callback is re-registered. ( b/152137004 )

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

۱۸ مارس ۲۰۲۰

androidx.activity:activity:1.2.0-alpha02 and androidx.activity:activity-ktx:1.2.0-alpha02 are released. Version 1.2.0-alpha02 contains these commits.

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

  • ActivityResultRegistry : ComponentActivity now provides an ActivityResultRegistry that lets you handle the startActivityForResult() + onActivityResult() as well as requestPermissions() + onRequestPermissionsResult() flows without overriding methods in your Activity or Fragment, brings increased type safety via ActivityResultContract , and provides hooks for testing these flows. See the updated Getting a Result from an Activity . ( b/125158199 )

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

۴ مارس ۲۰۲۰

androidx.activity:activity:1.2.0-alpha01 and androidx.activity:activity-ktx:1.2.0-alpha01 are released. Version 1.2.0-alpha01 contains these commits.

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

  • Added support for the ViewTreeLifecycleOwner.get(View) API added in Lifecycle 2.3.0-alpha01 such that it will return the Activity as the LifecycleOwner for any Views directly added to the Activity. ( aosp/1182955 )

رفع اشکالات

  • Fixed a regression introduced in Activity 1.1.0 when running on older versions of the platform where onBackPressed() would cause an IllegalStateException due to a bug in the android.app.FragmentManager . ( b/146290338 )

نسخه ۱.۱.۰

نسخه ۱.۱.۰

January 22, 2020

androidx.activity:activity:1.1.0 is released. Version 1.1.0 contains these commits .

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

  • Lifecycle ViewModel SavedState Integration : SavedStateViewModelFactory is now the default factory used when using by viewModels() , the ViewModelProvider constructor, or ViewModelProviders.of() with a ComponentActivity or its subclasses.

نسخه ۱.۱.۰-rc03

December 4, 2019

androidx.activity:activity:1.1.0-rc03 and androidx.activity:activity-ktx:1.1.0-rc03 are released. Version 1.1.0-rc03 contains these commits .

Dependency changes

  • Activity now depends on Lifecycle 2.2.0-rc03 and Lifecycle ViewModel SavedState 1.0.0-rc03 .

نسخه ۱.۱.۰-rc02

November 7, 2019

androidx.activity:activity:1.1.0-rc02 and androidx.activity:activity-ktx:1.1.0-rc02 are released. Version 1.1.0-rc02 contains these commits .

Dependency changes

  • Activity now depends on lifecycle 2.2.0-rc02 .

نسخه ۱.۱.۰-rc01

۲۳ اکتبر ۲۰۱۹

androidx.activity:activity:1.1.0-rc01 and androidx.activity:activity-ktx:1.1.0-rc01 are released with no changes from 1.1.0-beta01 . Version 1.1.0-rc01 contains these commits .

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

October 9, 2019

androidx.activity:activity:1.1.0-beta01 and androidx.activity:activity-ktx:1.1.0-beta01 are released. Version 1.1.0-beta01 contains these commits .

Dependency changes

  • Activity now depends on SavedState 1.0.0 stable.

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

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

androidx.activity:activity:1.1.0-alpha03 and androidx.activity:activity-ktx:1.1.0-alpha03 are released. The commits included in this version can be found here .

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

  • Activity now depends on Core 1.1.0 stable.

رفع اشکالات

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

August 7, 2019

androidx.activity:activity:1.1.0-alpha02 and androidx.activity:activity-ktx:1.1.0-alpha02 are released. The commits included in this version can be found here .

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

  • SavedStateViewModelFactory is now the default factory used when using by viewModels() , the ViewModelProvider constructor, or ViewModelProviders.of() with a ComponentActivity ( b/135716331 )

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

July 2, 2019

androidx.activity:activity:1.1.0-alpha01 and androidx.activity:activity-ktx:1.1.0-alpha01 are released. The commits included in this version can be found here .

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

  • activity now depends on Lifecycle 2.2.0-alpha02 . ( aosp/1007817 )
  • activity-ktx added a dependency on lifecycle-runtime-ktx ; you no longer need to explicitly add it to your dependencies when using activity-ktx or libraries that depend on activity-ktx (such as fragment-ktx ). ( aosp/987162 )

نسخه ۱.۰.۰

نسخه ۱.۰.۰

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

androidx.activity:activity:1.0.0 and androidx.activity:activity-ktx:1.0.0 are released. The commits included in this version can be found here .

Major Features of 1.0.0

  • ComponentActivity : ComponentActivity serves as the new base class for FragmentActivity in Fragment 1.1.0 and, by extension, AppCompatActivity in AppCompat 1.1.0 .
  • activity-ktx : The activity-ktx module includes a by viewModels Kotlin property extension for accessing ViewModels. This module is automatically included when you include fragment-ktx from Fragment 1.1.0 .
  • OnBackPressedDispatcher : As a composable alternative to overriding onBackPressed() , you can now register a OnBackPressedCallback from any LifecycleOwner (such as a fragment) to intercept system back button events. A lambda with receiver version addCallback has been added to activity-ktx . See Provide custom back navigation documentation for more details.
  • onRetainCustomNonConfigurationInstance deprecation : the onRetainCustomNonConfigurationInstance() and the related getLastCustomNonConfigurationInstance() APIs have been deprecated. It is strongly recommended to use ViewModels to store non-configuration state as they offer a composable solution suitable for any ViewModelStoreOwner that makes the ownership of the retained objects clear and provides an onCleared() callback for cleaning up resources when the activity is finally destroyed.

نسخه ۱.۰.۰-rc01

July 2, 2019

androidx.activity:activity:1.0.0-rc01 and androidx.activity:activity-ktx:1.0.0-rc01 are released with no changes from 1.0.0-beta01 . The commits included in this version can be found here .

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

۵ ژوئن ۲۰۱۹

androidx.activity::activity:1.0.0-beta01 and androidx.activity:activity-ktx:1.0.0-beta01 are released with no changes from 1.0.0-alpha08 . The commits included in this version can be found here .

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

۷ مه ۲۰۱۹

androidx.activity:activity:1.0.0-alpha08 and androidx.activity:activity-ktx:1.0.0-alpha08 are released. The commits included in this version can be found here .

تغییرات API

  • Breaking change: The previously deprecated addOnBackPressedCallback and removeOnBackPressedCallback methods on ComponentActivity have been removed. aosp/953857
  • The setEnabled() and isEnabled() methods of OnBackPressedCallback are now final. b/131416833
  • The remove() method of OnBackPressedCallback is now final. aosp/952720
  • OnBackPressedDispatcher now has public constructors, allowing you to construct your own instances for testing, etc. aosp/953431
  • onBackPressed() for ComponentActivity is now explicitly marked as @MainThread aosp/952721

رفع اشکالات

  • Fixed a ConcurrentModificationException when calling remove() from within the handleOnBackPressed() method of a OnBackPressedCalback that was added with a LifecycleOwner . b/131765095

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

April 25th, 2019

androidx.activity:activity:1.0.0-alpha07 and androidx.activity:activity-ktx:1.0.0-alpha07 are released. The commits included in this version can be found here .

تغییرات API

This release makes significant changes to the handling of the onBackPressed() . See the updated custom back documentation for more details.

  • The methods for OnBackPressedCallback and OnBackPressedDispatcher have been marked as @MainThread . ( aosp/943813 )
  • The handleOnBackPressed() method no longer returns a boolean . Instead, OnBackPressedCallback is now an abstract class that can be enabled or disabled - only when the new isEnabled() method returns true will handleOnBackPressed() be called, in which you must handle the back button. ( aosp/944518 )
  • The addCallback methods of OnBackPressedDispatcher no longer return a Cancellable instance. OnBackPressedCallback now contain a remove() method that fulfill this functionality, allowing you to call remove() during handleOnBackPressed() . ( aosp/944519 ) ( aosp/946316 )
  • activity-ktx now contains a receiver scoped callback for addCallback that accepts a lamdba that implements handleOnBackPressed() and has access to isEnabled and remove() ( aosp/944520 )

نسخه ۱.۰.۰-alpha06

April 3rd, 2019

androidx.activity:activity:1.0.0-alpha06 and androidx.activity:activity-ktx:1.0.0-alpha06 are released. The commits included in this version can be found here .

تغییرات API

  • ComponentActivity now contain a second constructor that takes a @LayoutRes int , which replaces the previous behavior of annotating your AppCompatActivity class with @ContentView . This approach works in both app and library modules. ( b/128352521 )
  • The OnBackPressedCallback related APIs on ComponentActivity have been deprecated in favor of the new OnBackPressedDispatcher , retrievable via getOnBackPressedDispatcher() . ( aosp/922523 )
  • Methods to add a new OnBackPressedCallback to the OnBackPressedDispatcher now return a Cancellable object, allowing removal of the callback without requiring an explicit reference to the OnBackPressedDispatcher . ( aosp/922523 )
  • Adding a OnBackPressedCallback with an associated LifecycleOwner now results in adding and removing the OnBackPressedCallback as the Lifecycle is started and stopped, respectively. ( aosp/922523 )

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

March 13th, 2019

androidx.activity:activity:1.0.0-alpha05 and androidx.activity:activity-ktx:1.0.0-alpha05 are released. The full list of commits included in this release can be found here .

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

  • @ContentView annotation lookups are now cached ( b/123709449 )

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

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

androidx.activity:activity 1.0.0-alpha04 and androidx.activity:activity-ktx 1.0.0-alpha04 are released.

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

  • Added support for the @ContentView class annotation that allows you to indicate which layout XML file should be inflated as an alternative to using setContentView() . ( aosp/837619 )

تغییرات API

  • Added a note that getViewModelStore() should not be overridden and will be made final in a future release. Please file a feature request if you are currently overriding this method. ( aosp/837619 )

رفع اشکالات

  • The activity module now depends on version 2.1.0-alpha02 of ViewModel to match the activity-ktx module's dependency.

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

December 17, 2018

androidx.activity 1.0.0-alpha03 is released.

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

  • ComponentActivity now implements BundleSavedStateRegistryOwner and depends on the newly released SavedState library [ aosp/815133 ]
  • ComponentActivity now works around an Android framework bug that would cause InputMethodManager to leak the last focused view [ b/37122102 ]

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

۳ دسامبر ۲۰۱۸

تغییرات API

  • Added a note that getLifecycle() should not be overridden and will be made final in a future release. Please file a feature request if you are currently overriding this method. ( aosp/815834 )

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

November 5, 2018

androidx.activity 1.0.0-alpha01 introduces ComponentActivity , a new base class of the existing FragmentActivity and AppCompatActivity .

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

  • You can now register an OnBackPressedCallback via addOnBackPressedCallback to receive onBackPressed() callbacks without needing to override the method in your activity.
  • Added a new by viewModels() Kotlin property delegate for retrieving ViewModel s from a ComponentActivity .
  • Pending input events (such as clicks) are now canceled in onStop() .

تغییرات API

  • The implementation of LifecycleOwner and ViewModelStoreOwner have been moved from FragmentActivity to ComponentActivity .
  • onRetainCustomNonConfigurationInstance has been deprecated. Use a ViewModel for storing objects that need to survive configuration changes.