فعالیت
| آخرین بهروزرسانی | انتشار پایدار | کاندیدای انتشار | انتشار بتا | انتشار آلفا |
|---|---|---|---|---|
| ۲۲ اکتبر ۲۰۲۵ | ۱.۱۱.۰ | - | ۱.۱۲.۰-بتا۰۱ | - |
اعلام وابستگیها
برای افزودن وابستگی به Activity، باید مخزن Google Maven را به پروژه خود اضافه کنید. برای اطلاعات بیشتر، مخزن Maven گوگل را مطالعه کنید.
وابستگیهای مربوط به مصنوعات مورد نیاز خود را در فایل build.gradle برای برنامه یا ماژول خود اضافه کنید:
شیار
dependencies { def activity_version = "1.11.0" // Java language implementation implementation "androidx.activity:activity:$activity_version" // Kotlin implementation "androidx.activity:activity-ktx:$activity_version" }
کاتلین
dependencies { val activity_version = "1.11.0" // Java language implementation implementation("androidx.activity:activity:$activity_version") // Kotlin implementation("androidx.activity:activity-ktx:$activity_version") }
برای اطلاعات بیشتر در مورد وابستگیها، به «افزودن وابستگیهای ساخت» مراجعه کنید.
بازخورد
بازخورد شما به بهبود Jetpack کمک میکند. اگر مشکلات جدیدی کشف کردید یا ایدههایی برای بهبود این کتابخانه دارید، به ما اطلاع دهید. لطفاً قبل از ایجاد یک کتابخانه جدید، نگاهی به مشکلات موجود در این کتابخانه بیندازید. میتوانید با کلیک بر روی دکمه ستاره، رأی خود را به یک مشکل موجود اضافه کنید.
برای اطلاعات بیشتر به مستندات ردیاب مشکل مراجعه کنید.
نسخه ۱.۱۲
نسخه ۱.۱۲.۰-بتا۰۱
۲۲ اکتبر ۲۰۲۵
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 شامل این کامیتها است.
تغییرات وابستگی
- فعالیت اکنون به رویداد ناوبری ۱.۰.۰-alpha08 بستگی دارد.
نسخه ۱.۱۲.۰-آلفا۰۸
۱۰ سپتامبر ۲۰۲۵
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 شامل این کامیتها است.
بهروزرسانی وابستگی
- فعالیت اکنون به رویداد ناوبری ۱.۰.۰-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 )
بهروزرسانی وابستگی
- فعالیت اکنون به رویداد ناوبری
1.0.0-alpha07بستگی دارد.
نسخه ۱.۱۲.۰-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
-
minSdkپیشفرض برای AndroidX از API 21 به API 23 منتقل شده است ( Ibdfca ، b/380448311 ، b/435705964 ، b/435705223 )
بهروزرسانیهای مستندات
- KDocs مربوط به
PredictiveBackHandlerبهروزرسانی شد تا یک مشکل زمانبندی شناختهشده را که ممکن است در همان فریمی که غیرفعال است، یک ژست را پردازش کند، فراخوانی کند. ( I5be5c ، b/431534103 ) - KDocs برای
BackHandlerوPredictiveBackHandlerبهروزرسانی شد تا علاوه بر توصیه ترکیب بیقید و شرط با پرچمenabled، رفتار «آخرین بردهای ترکیبشده» را نیز به صراحت بیان کند. ( I7ab94 )
بهروزرسانی وابستگی
- فعالیت اکنون به رویداد ناوبری
1.0.0-alpha06بستگی دارد.
نسخه ۱.۱۲.۰-آلفا۰۵
۳۰ ژوئیه ۲۰۲۵
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 شامل این کامیتها است.
بهروزرسانی وابستگی
- فعالیت اکنون به رویداد ناوبری
1.0.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 شامل این کامیتها است.
تغییرات وابستگی
- فعالیت اکنون به NavigationEvent 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از طریق APINavigationEventDispatcherOwnerبا NavigationEvent1.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 منتشر شدند. نسخه ۱.۱۰.۱ شامل این کامیتها است.
رفع اشکالات
-
ViewTreeOnBackPressedDispatcherOwnersو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وPickMultipleVisualMediaActivity 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وPickMultipleVisualMediaActivity 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 ComposePredictiveBackHandlerبه مدیریت حرکت سیستمی برگشت به عقب در فریمی که غیرفعال شده بود، ادامه دهد، برطرف شد. این مشکل میتوانست منجر به این شود که کتابخانههایی مانند 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 شامل این کامیتها است.
بهروزرسانی وابستگی
- فعالیت اکنون به Profile Installer 1.3.1 بستگی دارد.
نسخه ۱.۹.۰-بتا۰۱
۲۰ مارس ۲۰۲۴
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 شامل این کامیتها است.
هشدار پرز
- APIهای
OnBackPressedCallback،BackHandlerوPredictiveBackHandlerاکنون هنگام فراخوانیonBackPressedDispatcher.onBackPressed()هنگام مدیریت بازگشت، هشدار میدهند زیرا این کار همیشه انیمیشن بازگشت پیشبینیشده را مختل میکند. برای جزئیات بیشتر به راهنمای بهترین شیوهها مراجعه کنید. ( 1e4222 ، 2c950d ، b/287505200 )
رفع اشکالات
- اگر یک رویداد برگشت از سیستمی که در حین اجرای یک حرکت برگشت پیشبینیکننده از قبل شروع شده است، ارسال شود، حرکت برگشت پیشبینیکننده در حال اجرا لغو میشود و رویداد برگشت جدید برای شروع یک حرکت برگشت پیشبینیکننده جدید به کار گرفته میشود. ( 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 را دارد که در قراردادPickVisualMediaActivity Result وجود دارد. ( Id6e21 )
بهروزرسانی وابستگی
- فعالیت اکنون به Core
1.13.0-alpha01بستگی دارد. ( I14f31 )
نسخه ۱.۸
نسخه ۱.۸.۲
۱۳ دسامبر ۲۰۲۳
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()برای زمانی که حرکت بازگشت انجام میشود، فراخوانیهای پیشبینیکننده بازگشت جدیدی را برای مدیریت شروع حرکت بازگشت، پیشرفت در طول حرکت و لغو حرکت بازگشت ارائه میدهد. این همچنین باPredictiveBackHandlerComposable برای مدیریت رویدادهای پیشبینیکننده حرکت بازگشت در 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 یک
PredictiveBackHandlerComposable جدید برای مدیریت رویدادهای پیشبینیکنندهی بازگشت به عقب اضافه کرده است. این یک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 همراه است تا از فراخوانیهای
Flowcollect()اطمینان حاصل شود. ( 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بهenableEdgeToEdgeAPI، اکنون میتوانید پارامتر لامبدا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 منتشر شدند. این از یک شاخه داخلی منتشر شده است.
رفع اشکالات
- از فعالیت ۱.۷.۱ : - هنگام استفاده از
ComponentActivityباActivityScenario، دیگرReportFullyDrawExecuterنشت نمیکند. ( Id2ff2 ، b/277434271 )
نسخه ۱.۸.۰-آلفا۰۳
۱۲ آوریل ۲۰۲۳
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اکنون به جای جاوا از KotlinRandomاستفاده میکند. ( 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 منتشر شدند. این نسخهها از یک شاخه داخلی توسعه داده شدهاند.
بهروزرسانی وابستگی
- از Activity
1.7.0-rc01: Activity اکنون بهLifecycle 2.6.0وابسته است.
نسخه ۱.۸.۰-آلفا۰۱
۸ فوریه ۲۰۲۳
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یک متد تعلیقی میگیرد که وقتی تکمیل میشود، نشان میدهد که شما آماده تعامل هستید.
بهروزرسانیهای وابستگی
- فعالیت اکنون به چرخه حیات
2.6.1بستگی دارد. ( 8fc31d ) - فعالیت اکنون به ProfileInstaller
1.3.0( 83d3b1 ) بستگی دارد.
نسخه ۱.۷.۰-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 شامل این کامیتها است.
بهروزرسانی وابستگی
- فعالیت اکنون به
Lifecycle 2.6.0بستگی دارد.
نسخه ۱.۷.۰-بتا۰۲
۲۲ فوریه ۲۰۲۳
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
- The action and extra used by the
PickVisualMediaandPickMultipleVisualMediacontracts as a fallback for whenMediaStore.ACTION_PICK_IMAGESis 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 )
Version 1.7.0-beta01
۸ فوریه ۲۰۲۳
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 fromIntent, rather than only a single flag. ( Iac04c )
رفع اشکالات
- The fallback for
PickVisualMediafor when the framework Photo Picker is unavailable now correctly limits the handling to apps installed in the device's system image. ( If8ae6 )
Kotlin Conversions
-
ActivityResultRegistryOwneris now written in Kotlin. This is a source incompatible change for those classes written in Kotlin - you must now override theactivityResultRegistryproperty rather than implementing the previousgetActivityResultRegistry()function. ( I0b00e ) -
OnBackPressedDispatcherOwneris now written in Kotlin. This is a source incompatible change for those classes written in Kotlin - you must now override theonBackPressedDispatcherproperty rather than implementing the previousgetOnBackPressedDispatcherfunction. ( Ia277d ) -
ContextAware,ContextAwareHelper,OnContextAvailableListener,IntentSenderRequestandOnBackPressedDispatcherare now written in Kotlin. ( I1a73e , Iada92 , aosp/2410754 , I18ac7 , b/257291701 )
Version 1.7.0-alpha04
۲۵ ژانویه ۲۰۲۳
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
PickVisualMediaandPickMultipleVisualMediaActivity 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. TheisPhotoPickerAvailable()API that only detects the Android system provided Photo Picker has been deprecated. It is recommended to use the newisPhotoPickerAvailable(Context)API, which will return if either Photo Picker is available. ( I55be6 )
Version 1.7.0-alpha03
۱۱ ژانویه ۲۰۲۳
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.
ویژگیهای جدید
-
ComponentDialognow implementsSavedStateRegistryOwnerand has access to its ownSavedStateRegistryand sets theSavedStateRegistryOwnerfor its ViewTree. It is now possible to use Jetpack Compose within aComponentDialogas it meets both theLifecycleOwnerandSavedStateRegistryOwnerattached to the Window via the ViewTree APIs requirements. ( Idca17 , I73468 b/261162296 )
تغییرات API
- Added a
ReportDrawncomposable that immediately marks the activity as ready to callreportFullyDrawn. ( Ic5b14 , b/259687964 )
Kotlin Conversions
- The
ActvitiyResultCallbackandOnBackPressedCallbackclasses have both been converted to Kotlin while maintaining source and binary compatibility. ( Ifc5e5 , Ide1b0 , b/257291701 )
Version 1.7.0-alpha02
۲۴ اکتبر ۲۰۲۲
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 thePickMultipleVisualMediaActivity Result contract not launching on Android R devices when using the default value formaxItems. ( Ie2776 , b/249182130 )
Version 1.7.0-alpha01
۵ اکتبر ۲۰۲۲
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:
-
ReportDrawnWhentakes a predicate (ie,list.count > 0) to indicate when your composable is ready for interaction. -
ReportDrawnAftertakes 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
PickMultipleVisualMediaActivity Result contract not launching on Android R devices when using the default value formaxItems. ( 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.
Important changes since 1.5.0
- Added
ActivityResultContracts.PickVisualMediaandActivityResultContracts.PickMultipleVisualMediafor providing a backward compatible contract that usesMediaStore.ACTION_PICK_IMAGESwhen the Photo Picker is available andIntent.ACTION_OPEN_DOCUMENTwhen it is not available. - Integrated the
OnBackInvokedCallbackin Android 13 into theOnBackPressedDispatchersprovided byComponentActivityandComponentDialog. This ensures that all APIs built onOnBackPressedDispatcherwork 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.
رفع اشکالات
-
OnBackPressedDispatchernow registers theOnBackInvokedCallbackwith thePRIORITY_DEFAULTinstead ofPRIORITY_OVERLAY. ( I3901f ) - Classes that extend
ComponentActivitywill now always have both of theironMultiWindowModeChanged()callbacks dispatched. ( Ic4d85 ) - The
ActivityResultRegistrywill no longer return a result to theActivityResultCallbackwhen thelaunchcall throws anyExceptionand the callback was registered without aLifecycleOwner. ( Ia7ff7 , b/238350794 ) -
ComponentActivitywill now properly dispatch menu calls without the need to call the super function in your activity. ( Ie33c5 , b/238057118 )
Dependency Update
- The
Activitylibrary now depends on Lifecycle2.5.1. ( If6697 )
Version 1.6.0-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
OnBackPressedDispatcherwill no longer causeClassVerificationErrors when using SDK versions prior to 33. ( Ic32e1 ) - Classes that override
ComponentActivity'sonPictureInPictureModeChanged()callback will now always have their callbacks dispatched. ( Ib7fdb )
Version 1.6.0-beta01
۱۰ آگوست ۲۰۲۲
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
startActivityForResultandstartIntentSenderForResultmethods onComponentActivitywith@NonNullbecause passingnullhas always resulted in a crash. ( Id2a25 , b/231476082 )
رفع اشکالات
- From Activity
1.5.1: TheActivityResultRegistrywill no longer return a result to theActivityResultCallbackwhen thelaunchcall throws anyExceptionand the callback was registered without aLifecycleOwner. ( Ia7ff7 , b/238350794 ) - From Activity
1.5.1:ComponentActivitywill now properly dispatch menu calls toonPrepareOptionMenu(),onCreateOptionsMenu()andonOptionsItemSelected()overrides without the need to call the super function. ( Ie33c5 , b/238057118 )
Dependency Update
- From Activity
1.5.1: TheActivitylibrary now depends on theLifecycleversion2.5.1. ( If6697 )
Version 1.6.0-alpha05
۱۵ ژوئن ۲۰۲۲
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
-
minCompileSdkis now 33 to align with Tiramisu Beta 3 SDK
رفع اشکالات
- Fixed crash on older devices when doing SDK extension check for the
PickVisualMediaActivityResultContractso that it should now work withACTION_OPEN_DOCUMENTon devices running Android 10 and lower.
Version 1.6.0-alpha04
۱۸ مه ۲۰۲۲
androidx.activity:activity:1.6.0-alpha04 and androidx.activity:activity-ktx:1.6.0-alpha04 are released.
رفع اشکالات
- Fixed an error in
PickVisualMediaRequestwhere attempting to create a request, either via the Builder or the top level Kotlin function, would result in a stack overflow. - Integrated the
OnBackInvokedCallbackin Android 13 Dev Beta 2 into theOnBackPressedDispatcherprovided byComponentDialog. This ensures that all APIs built onOnBackPressedDispatcherwork when enabling a predictive back gesture .
Version 1.6.0-alpha03
۲۷ آوریل ۲۰۲۲
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.PickVisualMediaandActivityResultContracts.PickMultipleVisualMediafor providing a backward compatible contract that usesMediaStore.ACTION_PICK_IMAGESwhen the Photo Picker is available andIntent.ACTION_OPEN_DOCUMENTwhen it is not available. - Integrated the
OnBackInvokedCallbackin Android 13 Dev Beta 1 into theOnBackPressedDispatcherprovided byComponentActivity. This ensures that all APIs built onOnBackPressedDispatcherwork when enabling a predictive back gesture .
Version 1.6.0-alpha01
۲۳ مارس ۲۰۲۲
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
ActivityResultRegistrywill no longer return a result to theActivityResultCallbackwhen thelaunch()call throws anyExceptionand the callback was registered without aLifecycleOwner. ( Ia7ff7 , b/238350794 )ComponentActivitywill now properly dispatch menu calls toonPrepareOptionMenu(),onCreateOptionsMenu()andonOptionsItemSelected()overrides without the need to call the super function. ( Ie33c5 , b/238057118 )
بهروزرسانی وابستگی
- The
Activitylibrary now depends on the Lifecycle2.5.1. ( If6697 )
نسخه ۱.۵.۰
نسخه ۱.۵.۰
۲۹ ژوئن ۲۰۲۲
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 -
ComponentDialogis a subclass ofDialogthat includes anOnBackPressedDispatcherthat will be called when the system back button is pressed and the dialog is visible. Importantly, this subclass also sets theViewTreeOnBackPressedDispatcherOwner, allowing views a generic way to retrieve the correct dispatcher whether it exists in aComponentActivityor aComponentDialog. - Callback Interfaces -
ComponentActivitynow implements a set of modular callback interfaces that can be used instead of theActivitycallbacks. These interfaces include the following:OnNewIntentProvider,OnConfigurationChangedProvider,OnTrimMemoryProvider,OnPictureInPictureModeChangedProvider,OnMultiWindowModeChangedProvider - CreationExtras Integration -
ComponentActivitynow has the ability to provide a statelessViewModelProvider.Factoryvia Lifecycle2.5.0'sCreationExtras.
تغییرات دیگر
- The no parameter constructor for
ActivityResultContracts.CreateDocumenthas been deprecated and replaced with a new constructor that takes a concrete mime type (eg, "image/png") as is required byIntent.ACTION_CREATE_DOCUMENT.
Version 1.5.0-rc01
۱۱ مه ۲۰۲۲
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.
Version 1.5.0-beta01
۲۰ آوریل ۲۰۲۲
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.
بهروزرسانیهای وابستگی
- Activity now depends on Lifecycle
2.4.0-beta01.
نسخه ۱.۵.۰-آلفا۰۵
۶ آوریل ۲۰۲۲
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'sonPanelClosed()now calls the superonPanelClosed()as well, fixing an issue where theonContextMenuClosedmethod 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.
رفع اشکالات
-
SavedStateViewFactorynow supports usingCreationExtraseven when it was initialized with aSavedStateRegistryOwner. 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
CreationExtrasto the activityby 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.
ویژگیهای جدید
-
ComponentActivitynow implements theOnPictureInPictureModeChangedProviderinterface to allow any component to receive picture-in-picture mode change events. ( I9f567 ) -
ComponentActivitynow implements theOnMultiWindowModeChangedProviderinterface to allow any component to receive multi-window mode change events. ( I62d91 )
Version 1.5.0-alpha01
۲۶ ژانویه ۲۰۲۲
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.
ویژگیهای جدید
-
ComponentActivitynow integrates with ViewModel CreationExtras, introduced as part of Lifecycle2.5.0-alpha01. ( Ie7e00 , b/207012584 ) - Added
ComponentDialog, a subclass ofDialogthat includes anOnBackPressedDispatcherthat will be called when the system back button is pressed when the dialog is visible. Importantly, this subclass also sets theViewTreeOnBackPressedDispatcherOwner, allowing views a generic way to retrieve the correct dispatcher whether it exists in aComponentActivityor aComponentDialog. ( I8a1bc ) -
ComponentActivitynow implements the newOnNewIntentProviderinterface to allow any component to receive these events. ( If1f8b ) -
ComponentActivitynow implements the newOnConfigurationChangedProviderinterface to allow any component to receive these events. ( If623b ) -
ComponentActivitynow implements the newOnTrimMemoryProviderinterface to allow any component to receive these events. ( Ia9295 )
تغییرات API
- The no parameter constructor for
ActivityResultContracts.CreateDocumenthas been deprecated and replaced with a new constructor that takes a concrete mime type (eg,"image/png") as is required byIntent.ACTION_CREATE_DOCUMENT. ( I2bec6 ) - The
OnBackPressedDispatcherOwnerassociated with a View can now be retrieved via theViewTreeOnBackPressedDispatcherOwner, rather than relying on casting theContext. ( I74685 )
رفع اشکالات
- Fixed a crash when accessing a
ViewModelfor the very first time from aregisterForActivityResult()callback or the callbacks to aLifecycleObserveradded as part ofinitof aComponentActivity. ( Ife83f )
نسخه ۱.۴.۰
نسخه ۱.۴.۰
۲۷ اکتبر ۲۰۲۱
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
ComponentActivitynow implements theMenuHostinterface. This allows any component to add menu items to theActionBarby adding aMenuProviderinstance to the activity. EachMenuProvidercan optionally be added with aLifecyclethat will automatically control the visibility of those menu items based on theLifecyclestate and handle the removal of theMenuProviderwhen theLifecycleis destroyed. - The
ActivityResultContractclass 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
ActivityResultContractsclass and its contracts have been rewritten in Kotlin to ensure the proper nullability.
Version 1.4.0-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
ActivityResultRegistrywill no longer return a result to theActivityResultCallbackwhen thelaunchcall throws anyException. ( If4f91 , b/200845664 )
Version 1.4.0-beta01
۲۹ سپتامبر ۲۰۲۱
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.OpenMultipleDocumentsandActivityResultContracts.GetMultipleContentsthat caused then to use an output type ofList<? extends Uri>when using the code from the Java programming language. ( If71de ) - Public constants within the
ActivityResultContracts.StartActivityForResult,ActivityResultContracts.StartIntentSenderForResult, andActivityResultContracts.RequestMultiplePermissionsclasses are now accessible when using Kotlin via their now publicCompanionobjects. ( aosp/1832555 )
Documentation Updates
- The deprecation message for APIs now handled by the Activity Result APIs , namely
startActivityForResult,startIntentSenderForResult,onActivityResult,requestPermissions, andonRequestPermissionsResult, have all been expanded with more details. ( cce80f )
Version 1.4.0-alpha02
۱۵ سپتامبر ۲۰۲۱
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-composeartifact now contains aLaunchDuringCompositionlint error that prevents you from calling thelaunchmethod ofActivityResultLauncheras part of composition as composition should be side-effect free. Use the APIs for handling side-effects . ( 7c2bbe , b/191347220 )
تغییرات API
- The
ActivityResultContractclass 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
ActivityResultContractsclass and its contracts have been rewritten in Kotlin to ensure the proper nullability. ( I69802 )
Version 1.4.0-alpha01
۱ سپتامبر ۲۰۲۱
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
ComponentActivitynow implements theMenuHostinterface.. This allows any component to add menu items to theActionBarby adding aMenuProviderinstance to the activity. EachMenuProvidercan optionally be added with aLifecyclethat will automatically control the visibility of those menu items based on theLifecyclestate and handle the removal of theMenuProviderwhen theLifecycleis 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
ActivityResultRegistrywill now throw anIllegalStateExceptionwhen attempting to calllaunch()on anActivityResultLauncherthat has not be registered or that has been unregistered. ( Ida75d , b/192567522 )
External Contribution
نسخه ۱.۳.۱
نسخه ۱.۳.۱
۴ آگوست ۲۰۲۱
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.
Version 1.3.0
Version 1.3.0
۲۸ ژوئیه ۲۰۲۱
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-composeartifact provides thesetContentextension method for hosting your Jetpack Compose UI in an activity and Compose specific wrappers for interacting with theComponentActivityAPIs for handling the system back button and the Activity Result APIs. See the documentation for more details. - CaptureVideo contract - The
CaptureVideoActivityResultContractreplaces the now deprecatedTakeVideocontract and returns a boolean denoting success that works across many camera apps. - Picture-In-Picture Hint View Tracking - Users of
activity-ktxcan now use thetrackPipAnimationHintViewextension method onActivityto automatically rebuild thePictureInPictureParamswith 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
ActivityResultRegistrycallbacks are now properly saved and restored so callbacks are not duplicated in the savedState. ( I97816 , b/191893160 )
Version 1.3.0-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 .
Version 1.3.0-beta01
۲ ژوئن ۲۰۲۱
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 userememberLauncherForActivityResult(). ( 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
CaptureVideoActivityResultContractreturns a boolean to yourActivityResultCallbackindicating if your video was successfully saved to the given URI. This replaces the now deprecatedTakeVideocontract as camera apps very rarely supported returning a thumbnail bitmap, making the result unhelpful. ( Ie21f2 , b/185938070 ) - Added new API
Activity#setPipAnimationHintViewto update the PipParams' source rect hint whenever the view moves. ( I9063d )
تغییرات API
- The
rememberLauncherForActivityResultfunction now returns a launcher that deprecates theunregister()function - registration and unregistering the launcher is handled automatically byrememberLauncherForActivityResult. ( I2443e )
Compose Compatibility
-
androidx.activity:activity-compose:1.3.0-alpha08is only compatible with Compose version1.0.0-beta07and 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.
رفع اشکالات
-
rememberLauncherForActivityResultnow returns a stable reference to the sameActivityResultLauncherinstance even if the contract changes due to recompositions. ( Id2d6d ) - Using unstable versions of Fragments above
1.3.0will no longer throw a false positive lint error telling you to use1.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 torememberLauncherForActivityResult()to better indicate that the returnedActivityResultLauncheris a managed object that is remembered on your behalf. Attempting to callunregisterthe returnedActivityResultLauncherwill now throw an error. ( I2bb6d ) -
LocalOnBackPressedDispatcherOwner.currentandLocalActivityResultRegistryOwner.currentnow return a nullable value to better determine whether it is available in the current composition. APIs that requires those APIs, such asBackHandlerandrememberLauncherForActivityResult(), respectively, will now throw a more descriptive error if the underlying owner is not found.NavHostnow works even when anOnBackPressedDispatcherOwneris not found, such is the case when previewing theNavHost. ( I7d8b4 )
رفع اشکالات
- The
BackHandlerwill now properly intercept back presses in the event that the Activity isSTOPPED, thenSTARTEDagain, and other callbacks were added with a LifecycleOwner. ( I71de6 , b/182284739 ) - Using the
launch()method extension with a customActivityResultContractthat has aUnitinput will no longer cause aNullPointerException( I76282 , b/183837954 )
Version 1.3.0-alpha05
۲۴ مارس ۲۰۲۱
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
InvalidFragmentVersionForActivityResultlint check that led to a false positive when using Fragment 1.3.1 or higher. ( I54da1 , b/182388985 ) - From Activity 1.2.2 :
ComponentActivitynow avoids aClassNotFoundExceptionwhen launching anIntentfrom anActivityResultContractthat was previously held as an extra in anotherIntent. ( Ieff05 , b/182906230 )
Dependency Updates
- From Activity 1.2.2 : Activity now depends on Lifecycle
2.3.1.
نسخه ۱.۳.۰-آلفا۰۴
۱۰ مارس ۲۰۲۱
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:RequestMultiplePermissionsnow always returns results for all requested permissions instead of only permissions that weren't previously granted. ( I50bc3 , b/180884668 ) - From Activity
1.2.1:ActivityResultRegistrynow ensures that in progresslaunch()requests will return their results even if youunregister(), thenregister()again with the same key. ( I9ef34 , b/181267562 ) - Activity Compose no longer adds test dependencies to the runtime classpath. ( Ifd8b3 )
- Fixed an issue with
BackHandlerwhere the previously setonBacklambda was still being used after recomposition. ( 8eb5eb )
Version 1.3.0-alpha03
۲۴ فوریه ۲۰۲۱
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
registerForActivityResultfunction for getting results from activities within composables. ( Ia7851 , b/172690553 )
تغییرات API
-
LocalOnBackPressedDispatcherOwnernow has aprovidesfunctions that can be used withCompositionLocalProvider, replacing theasProvidableCompositionLocal()API. ( I45d24 )
Version 1.3.0-alpha02
۱۰ فوریه ۲۰۲۱
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-alpha01that causes aNoSuchMethodError: No static method setContentexception when using Compose1.0.0-alpha12. All Compose users should depend on1.3.0-alpha02and above. ( b/179911234 )
تغییرات API
- The
BackHandlerAPI can be used to allow a Composable to intercept the system back button. ( I58ed5 , b/172154006 )
Version 1.3.0-alpha01
۱۰ فوریه ۲۰۲۱
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-composeartifact provides Jetpack Compose specific helpers forandroidx.activityspecific APIs.-
ComponentActivity.setContenthas moved fromandroidx.compose.ui.platform.setContenttoandroidx.activity.compose.setContent. ( Icf416 )
-
مشکلات شناخته شده
- Using Activity Compose
1.3.0-alpha01and libraries that depend on it, such asandroidx.compose.ui:ui-test-junit4:1.0.0-alpha12, will result in aNoSuchMethodError: No static method setContentexception. ( 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.
رفع اشکالات
- From Activity
1.3.0-rc02: The ActivityResultRegistry callbacks are now properly saved and restored so callbacks are not duplicated in the savedState. ( I97816 , b/191893160 )
نسخه ۱.۲.۳
نسخه ۱.۲.۳
May 5, 2021
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 customActivityResultContractthat has aUnitinput will no longer cause aNullPointerException( I76282 , b/183837954 ) - Fixed a false positive lint error telling you to use Fragment
1.3.0when 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
InvalidFragmentVersionForActivityResultlint check that led to a false positive when using Fragment 1.3.1 or higher. ( I54da1 , b/182388985 ) -
ComponentActivitynow avoids aClassNotFoundExceptionwhen launching anIntentfrom anActivityResultContractthat was previously held as an extra in anotherIntent. ( Ieff05 , b/182906230 )
Dependency Updates
- Activity now depends on Lifecycle
2.3.1.
نسخه ۱.۲.۱
نسخه ۱.۲.۱
۱۰ مارس ۲۰۲۱
androidx.activity:activity:1.2.1 and androidx.activity:activity-ktx:1.2.1 are released. Version 1.2.1 contains these commits.
رفع اشکالات
-
RequestMultiplePermissionsnow always returns results for all requested permissions instead of only permissions that weren't previously granted. ( I50bc3 , b/180884668 ) -
ActivityResultRegistrynow ensures that in progresslaunch()requests will return their results even if youunregister(), thenregister()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 :
ComponentActivitynow provides anActivityResultRegistrythat lets you handlestartActivityForResult()+onActivityResult()as well asrequestPermissions()+onRequestPermissionsResult()flows without overriding methods in your Activity or Fragment, brings increased type safety viaActivityResultContract, and provides hooks for testing these flows. See the updated Getting a Result from an Activity .
ContextAware:ComponentActivitynow implementsContextAware, allowing you to add one or moreOnContextAvailableListenerinstances which will receive a callback before the baseActivity.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
FragmentActivityin Fragment 1.3.0 to restore the state of theFragmentManager. Any listeners added to subclasses ofFragmentActivitywill run after that listener. - This API is used by
AppCompatActivityin AppCompat 1.3.0-alpha02 or higher. Any listeners added to subclasses ofAppCompatActivitywill run after that listener.
- A suspending Kotlin extension
ViewTreeSupport :ComponentActivitynow supports theViewTreeLifecycleOwner.get(View),ViewTreeViewModelStoreOwner.get(View), andViewTreeSavedStateRegistryOwnerAPIs added in Lifecycle2.3.0and SavedState1.1.0such that it will return the Activity as theLifecycleOwner,ViewModelStoreOwner, andSavedStateRegistryOwnerfor any Views directly added to theComponentActivity.
- reportFullyDrawn() backport - The
Activitymethod ofreportFullyDrawn()has been backported inComponentActivityto work on all API levels, fixing a crash on API 19 and adding tracing for this method for all API levels.
Version 1.2.0-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
ActivityResultRegistrynow always restores the exact state that was saved. ( Idd56b ) - Add tracing to
ComponentActivity.reportFullyDrawn( Ic7632 )
External Contribution
-
ComponentActivitynow overridesreportFullyDrawn(), 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
STARTEDbefore delivering results when registered with aLifecycle. ( I109ea )
External Contribution
- Updated the documentation for
launch()to explicitly call out that it can throw anActivityNotFoundException. Thanks Michał Zieliński! ( aosp/1493580 )
Version 1.2.0-beta01
۱ اکتبر ۲۰۲۰
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
ActivityResultRegistrynow randomly generates integers until it finds one that is unallocated to use as a request coderegister(), thus preventing the possible integer overflow caused by incrementing request codes. ( b/168779518 )Lifecycleobservers are properly removed when callingunregister()on anActivityResultLauncher. ( b/165608393 )
تغییرات رفتاری
- The
ActivityResultRegistrynow throws anIllegalStateExceptionwhen attempting to callregister()with aLifecycleOwnerwhoseLifecyclehas already reachedSTARTED. ( b/165435866 )
Documentation Updated
-
ContextAwaredocumentation links toLifecycleOwnerto highlightLifecyclecallbacks as the appropriate place for creation and destruction events. ( aosp/1414152 )
Version 1.2.0-alpha08
۱۹ آگوست ۲۰۲۰
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.
ویژگیهای جدید
-
ComponentActivitynow implementsContextAware, allowing you to add one or moreOnContextAvailableListenerinstances which will receive a callback before the baseActivity.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
FragmentActivityin Fragment 1.3.0-alpha08 to restore the state of theFragmentManager. Any listeners added to subclasses ofFragmentActivitywill run after that listener. ( I513da ) - This API is used by
AppCompatActivityin AppCompat 1.3.0-alpha02 . Any listeners added to subclasses ofAppCompatActivitywill run after that listener. ( I513da )
- A suspending Kotlin extension
رفع اشکالات
- Fixed an issue with the
ActivityResultFragmentVersionDetectorLint check that caused it to break when using Lint 27.1.0 or higher. ( b/162155191 )
Version 1.2.0-alpha07
۲۲ ژوئیه ۲۰۲۰
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
InvalidFragmentVersionForActivityResultlint check that verifies that you are using Fragment1.3.0-alpha07when 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 )
External Contribution
- Fixed an
ArrayIndexOutOfBoundsExceptionwhen parsing the results for theRequestPermissionActivity Result contract. ( I8f9e3 , b/161057605 )
Version 1.2.0-alpha06
۱۰ ژوئن ۲۰۲۰
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
ActivityResultclass in kotlin to directly access therequestCodeandintent. ( b/157212935 ) -
ActivityResultLaunchernow allows you to get theActivityResultContractthat was used to register the launcher. ( b/156875743 )
تغییرات API
- Breaking change : The
invoke()method onActivityResultRegistryhas been renamed toonLaunch(). ( b/157496491 ) - The
OpenMultipleDocumentscontract now returns an empty list instead ofnullto the registered callback if no result is returned. ( b/157348014 )
Version 1.2.0-alpha05
۲۰ مه ۲۰۲۰
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.
ویژگیهای جدید
- Added support for
ViewTreeViewModelStoreOwnerfrom Lifecycle2.3.0-alpha03, andViewTreeSavedStateRegistryOwnerfrom SavedState1.1.0-alpha01when using aViewwithin aComponentActivity. ( aosp/1297993 , aosp/1300264 )
تغییرات API
- The
TakePicturecontract now returns abooleanindicating success rather than a thumbnailBitmapas this was very rarely supported by camera apps when writing the image to the providedUri. ( b/154302879 ) - The
invoke()extensions onActivityResultLauncherhave been removed in favor of explicitly usinglaunch()to better indicate that these are asynchronous operations. Kotlin extensions forlaunchhave been added to theandroidx.activity.resultpackage forActivityResultLauncher<Void>andActivityResultLauncher<Unit>that remove the need to pass innullorUnit, respectively, mirroring that behavior from the previouslyinvoke()extensions. ( aosp/1304674 , aosp/1304675 ) - The
IntentSenderRequest.Buildermethods forsetFlagsMask()andsetFlagsValues()has been combined into a singlesetFlags()method. ( aosp/1302111 )
رفع اشکالات
- When registering an
ActivityResultCallbackwith aLifecycleOwner, fixed an issue where the callback would be triggered before the state reachesSTARTED. ( aosp/1309744 )
تغییرات رفتاری
- The
ActivityResultRegistrynow generates request codes starting at0xFFFFrather than at0, preventing overlap when usingstartActivityForResult()orrequestPermissions()in an activity. ( aosp/1302324 )
Version 1.2.0-alpha04
۲۹ آوریل ۲۰۲۰
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 toregisterForActivityResult(), both onComponentActivityhere and in Fragment1.3.0-alpha04. ( aosp/1278717 ) - The
GetContents,OpenDocuments, andRequestPermissionscontracts have been renamed toGetMultipleContents,OpenMultipleDocuments, andRequestMultiplePermissions, respectively. ( aosp/1280161 ) -
ComponentActivitynow implements theActivityResultRegisteryOwnerinterface. ( aosp/1290888 ) - - The
startActivityForResult()/onActivityResult()andonRequestPermissionsResult()APIs onComponentActivityhave been deprecated. Please use the Activity Result APIs . ( b/154751887 )
رفع اشکالات
- When using the
GetMultipleContentsandOpenMultipleDocumentscontracts and selecting a single item, it is now correctly returned to your callback. ( b/152941153 )
Version 1.2.0-alpha03
۱ آوریل ۲۰۲۰
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, andCreateDocumentcontracts to the set of pre-built contracts provided byActivityResultContracts. ( 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
TakePicturecontract now takes aUriinput for where the image should be stored. The previous contract that does not take any input has been renamed toTakePicturePreview. ( aosp/1262482 ) - The
registerActivityResultCallback()method onActivityResultRegistryhas been renamed toregister(). ( aosp/1267621 ) - The
dispose()method onActivityResultLauncherhas been renamed tounregister()and theunregisterResultCallback()onActivityResultRegistryhas been removed. ( aosp/1267621 ) - The
createIntent()method ofActivityResultContactnow takes aContextin addition to the input to make it possible to create explicit Intents. ( aosp/1238800 ) - An
ActivityResultContractcan now overridegetSynchronousResult()to deliver a result without callingstartActivityForResult. This is used by theRequestPermissionandRequestPermissionscontracts to correctly deliver a 'granted' status if the requested permissions are already granted. ( b/151110799 ) - The previously available
Dialcontract has been removed as thatIntentis not meant to be used withstartActivityForResult(). ( aosp/1266916 ) - Many of the Activity Result APIs not meant to be extended are now
final. This includesgetActivityResultRegistry(), theprepareCall()methods, all methods ofActivityResultRegistryexceptinvoke(), and a number of the default contracts that do not support optional extras. ( b/152439361 )
رفع اشکالات
- Fixed a
NullPointerExceptioninActivityResultRegistrywhen attempting to deliver results to a callback that has not yet been re-registered after a configuration change;ActivityResultRegistrynow holds onto these pending results and delivers them when the callback is re-registered. ( b/152137004 )
Version 1.2.0-alpha02
۱۸ مارس ۲۰۲۰
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 :
ComponentActivitynow provides anActivityResultRegistrythat lets you handle thestartActivityForResult()+onActivityResult()as well asrequestPermissions()+onRequestPermissionsResult()flows without overriding methods in your Activity or Fragment, brings increased type safety viaActivityResultContract, and provides hooks for testing these flows. See the updated Getting a Result from an Activity . ( b/125158199 )
Version 1.2.0-alpha01
۴ مارس ۲۰۲۰
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 Lifecycle2.3.0-alpha01such that it will return the Activity as theLifecycleOwnerfor any Views directly added to the Activity. ( aosp/1182955 )
رفع اشکالات
- Fixed a regression introduced in Activity
1.1.0when running on older versions of the platform whereonBackPressed()would cause anIllegalStateExceptiondue to a bug in theandroid.app.FragmentManager. ( b/146290338 )
نسخه ۱.۱.۰
نسخه ۱.۱.۰
۲۲ ژانویه ۲۰۲۰
androidx.activity:activity:1.1.0 is released. Version 1.1.0 contains these commits .
Important changes since 1.0.0
- Lifecycle ViewModel SavedState Integration :
SavedStateViewModelFactoryis now the default factory used when usingby viewModels(), theViewModelProviderconstructor, orViewModelProviders.of()with aComponentActivityor its subclasses.
Version 1.1.0-rc03
۴ دسامبر ۲۰۱۹
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-rc03and Lifecycle ViewModel SavedState1.0.0-rc03.
Version 1.1.0-rc02
۷ نوامبر ۲۰۱۹
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.
Version 1.1.0-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 .
Version 1.1.0-beta01
۹ اکتبر ۲۰۱۹
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.
Version 1.1.0-alpha03
۵ سپتامبر ۲۰۱۹
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.
رفع اشکالات
- Activity now depends on Lifecycle
2.2.0-alpha04.
Version 1.1.0-alpha02
۷ آگوست ۲۰۱۹
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 .
ویژگیهای جدید
-
SavedStateViewModelFactoryis now the default factory used when usingby viewModels(), theViewModelProviderconstructor, orViewModelProviders.of()with aComponentActivity( b/135716331 )
Version 1.1.0-alpha01
۲ ژوئیه ۲۰۱۹
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 .
ویژگیهای جدید
-
activitynow depends on Lifecycle2.2.0-alpha02. ( aosp/1007817 ) -
activity-ktxadded a dependency onlifecycle-runtime-ktx; you no longer need to explicitly add it to your dependencies when usingactivity-ktxor libraries that depend onactivity-ktx(such asfragment-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 :
ComponentActivityserves as the new base class forFragmentActivityin Fragment1.1.0and, by extension,AppCompatActivityin AppCompat1.1.0. - activity-ktx : The
activity-ktxmodule includes aby viewModelsKotlin property extension for accessing ViewModels. This module is automatically included when you includefragment-ktxfrom Fragment1.1.0. - OnBackPressedDispatcher : As a composable alternative to overriding
onBackPressed(), you can now register aOnBackPressedCallbackfrom anyLifecycleOwner(such as a fragment) to intercept system back button events. A lambda with receiver versionaddCallbackhas been added toactivity-ktx. See Provide custom back navigation documentation for more details. - onRetainCustomNonConfigurationInstance deprecation : the
onRetainCustomNonConfigurationInstance()and the relatedgetLastCustomNonConfigurationInstance()APIs have been deprecated. It is strongly recommended to use ViewModels to store non-configuration state as they offer a composable solution suitable for anyViewModelStoreOwnerthat makes the ownership of the retained objects clear and provides anonCleared()callback for cleaning up resources when the activity is finally destroyed.
Version 1.0.0-rc01
۲ ژوئیه ۲۰۱۹
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 .
Version 1.0.0-beta01
۵ ژوئن ۲۰۱۹
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 .
Version 1.0.0-alpha08
۷ مه ۲۰۱۹
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
addOnBackPressedCallbackandremoveOnBackPressedCallbackmethods onComponentActivityhave been removed. aosp/953857 - The
setEnabled()andisEnabled()methods ofOnBackPressedCallbackare now final. b/131416833 - The
remove()method ofOnBackPressedCallbackis now final. aosp/952720 -
OnBackPressedDispatchernow has public constructors, allowing you to construct your own instances for testing, etc. aosp/953431 -
onBackPressed()forComponentActivityis now explicitly marked as@MainThreadaosp/952721
رفع اشکالات
- Fixed a
ConcurrentModificationExceptionwhen callingremove()from within thehandleOnBackPressed()method of aOnBackPressedCalbackthat was added with aLifecycleOwner. b/131765095
Version 1.0.0-alpha07
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
OnBackPressedCallbackandOnBackPressedDispatcherhave been marked as@MainThread. ( aosp/943813 ) - The
handleOnBackPressed()method no longer returns aboolean. Instead,OnBackPressedCallbackis now an abstract class that can be enabled or disabled - only when the newisEnabled()method returns true willhandleOnBackPressed()be called, in which you must handle the back button. ( aosp/944518 ) - The
addCallbackmethods ofOnBackPressedDispatcherno longer return aCancellableinstance.OnBackPressedCallbacknow contain aremove()method that fulfill this functionality, allowing you to callremove()duringhandleOnBackPressed(). ( aosp/944519 ) ( aosp/946316 ) -
activity-ktxnow contains a receiver scoped callback foraddCallbackthat accepts a lamdba that implementshandleOnBackPressed()and has access toisEnabledandremove()( aosp/944520 )
Version 1.0.0-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
OnBackPressedCallbackrelated APIs on ComponentActivity have been deprecated in favor of the newOnBackPressedDispatcher, retrievable viagetOnBackPressedDispatcher(). ( aosp/922523 ) - Methods to add a new
OnBackPressedCallbackto theOnBackPressedDispatchernow return aCancellableobject, allowing removal of the callback without requiring an explicit reference to theOnBackPressedDispatcher. ( aosp/922523 ) - Adding a
OnBackPressedCallbackwith an associatedLifecycleOwnernow results in adding and removing theOnBackPressedCallbackas the Lifecycle is started and stopped, respectively. ( aosp/922523 )
Version 1.0.0-alpha05
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 .
ویژگیهای جدید
-
@ContentViewannotation lookups are now cached ( b/123709449 )
Version 1.0.0-alpha04
۳۰ ژانویه ۲۰۱۹
androidx.activity:activity 1.0.0-alpha04 and androidx.activity:activity-ktx 1.0.0-alpha04 are released.
ویژگیهای جدید
- Added support for the
@ContentViewclass annotation that allows you to indicate which layout XML file should be inflated as an alternative to usingsetContentView(). ( 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
activitymodule now depends on version 2.1.0-alpha02 of ViewModel to match theactivity-ktxmodule's dependency.
Version 1.0.0-alpha03
۱۷ دسامبر ۲۰۱۸
androidx.activity 1.0.0-alpha03 is released.
ویژگیهای جدید
- ComponentActivity now implements
BundleSavedStateRegistryOwnerand 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 madefinalin a future release. Please file a feature request if you are currently overriding this method. ( aosp/815834 )
نسخه ۱.۰.۰-آلفا۰۱
۵ نوامبر ۲۰۱۸
androidx.activity 1.0.0-alpha01 introduces ComponentActivity , a new base class of the existing FragmentActivity and AppCompatActivity .
ویژگیهای جدید
- You can now register an
OnBackPressedCallbackviaaddOnBackPressedCallbackto receiveonBackPressed()callbacks without needing to override the method in your activity. - Added a new
by viewModels()Kotlin property delegate for retrievingViewModels from aComponentActivity. - Pending input events (such as clicks) are now canceled in
onStop().
تغییرات API
- The implementation of
LifecycleOwnerandViewModelStoreOwnerhave been moved fromFragmentActivitytoComponentActivity. -
onRetainCustomNonConfigurationInstancehas been deprecated. Use aViewModelfor storing objects that need to survive configuration changes.