ناوبری
androidx.navigation
androidx.navigation.compose
ویژگی های androidx.navigation.dynamic
androidx.navigation.dynamicfeatures.fragment
androidx.navigation.dynamicfeatures.fragment.ui
androidx.navigation.fragment
androidx.navigation.fragment.compose
androidx.navigation.testing
androidx.navigation.ui
| آخرین به روز رسانی | انتشار پایدار | کاندید را آزاد کنید | نسخه بتا | انتشار آلفا |
|---|---|---|---|---|
| 24 سپتامبر 2025 | 2.9.5 | - | - | - |
اعلام وابستگی ها
برای افزودن وابستگی به Navigation، باید مخزن Google Maven را به پروژه خود اضافه کنید. برای اطلاعات بیشتر، مخزن Maven Google را بخوانید.
وابستگیهای مصنوعات مورد نیاز خود را در فایل build.gradle برای برنامه یا ماژول خود اضافه کنید:
شیار
plugins { // Kotlin serialization plugin for type safe routes and navigation arguments id 'org.jetbrains.kotlin.plugin.serialization' version '2.0.21' } dependencies { def nav_version = "2.9.5" // Jetpack Compose Integration implementation "androidx.navigation:navigation-compose:$nav_version" // Views/Fragments Integration implementation "androidx.navigation:navigation-fragment:$nav_version" implementation "androidx.navigation:navigation-ui:$nav_version" // Feature module support for Fragments implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version" // Testing Navigation androidTestImplementation "androidx.navigation:navigation-testing:$nav_version" // JSON serialization library, works with the Kotlin serialization plugin. implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3" }
کاتلین
plugins { // Kotlin serialization plugin for type safe routes and navigation arguments kotlin("plugin.serialization") version "2.0.21" } dependencies { val nav_version = "2.9.5" // Jetpack Compose integration implementation("androidx.navigation:navigation-compose:$nav_version") // Views/Fragments integration implementation("androidx.navigation:navigation-fragment:$nav_version") implementation("androidx.navigation:navigation-ui:$nav_version") // Feature module support for Fragments implementation("androidx.navigation:navigation-dynamic-features-fragment:$nav_version") // Testing Navigation androidTestImplementation("androidx.navigation:navigation-testing:$nav_version") // JSON serialization library, works with the Kotlin serialization plugin implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3") }
ارگ ایمن
برای افزودن Safe Args به پروژه خود، classpath زیر را در فایل build.gradle سطح بالای خود قرار دهید:
شیار
buildscript { repositories { google() } dependencies { def nav_version = "2.9.5" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" } }
کاتلین
buildscript { repositories { google() } dependencies { val nav_version = "2.9.5" classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version") } }
همچنین باید یکی از دو افزونه موجود را اعمال کنید.
برای ایجاد کد زبان جاوا مناسب برای جاوا یا ماژول های ترکیبی جاوا و کاتلین، این خط را به فایل build.gradle برنامه یا ماژول خود اضافه کنید:
شیار
plugins { id 'androidx.navigation.safeargs' }
کاتلین
plugins { id("androidx.navigation.safeargs") }
از طرف دیگر، برای تولید کد Kotlin مناسب برای ماژول های فقط Kotlin اضافه کنید:
شیار
plugins { id 'androidx.navigation.safeargs.kotlin' }
کاتلین
plugins { id("androidx.navigation.safeargs.kotlin") }
شما باید android.useAndroidX=true در فایل gradle.properties خود مطابق با مهاجرت به AndroidX داشته باشید.
برای اطلاعات در مورد استفاده از پسوندهای Kotlin، به مستندات ktx مراجعه کنید.
برای اطلاعات بیشتر درباره وابستگیها، به افزودن وابستگیهای ساخت مراجعه کنید.
بازخورد
بازخورد شما به بهتر شدن Jetpack کمک می کند. اگر مسائل جدیدی کشف کردید یا ایده هایی برای بهبود این کتابخانه دارید، به ما اطلاع دهید. لطفاً قبل از ایجاد کتابخانه جدید، به مسائل موجود در این کتابخانه نگاهی بیندازید. با کلیک کردن روی دکمه ستاره می توانید رای خود را به یک موضوع موجود اضافه کنید.
برای اطلاعات بیشتر به مستندات ردیاب مشکل مراجعه کنید.
نسخه 2.9
نسخه 2.9.5
24 سپتامبر 2025
androidx.navigation:navigation-*:2.9.5 منتشر شد. نسخه 2.9.5 حاوی این commit ها است.
رفع اشکال
- Navigation Safe Args اکنون می تواند پشتیبانی AGP 9.0 را برای کاتلین داخلی انجام دهد. ( I1d9d76 )
به روز رسانی وابستگی
- پلاگین Navigation Safe Args اکنون به پلاگین Android Gradle نسخه 8.4.2 بستگی دارد. ( b/431847270 , I5932a )
نسخه 2.9.4
10 سپتامبر 2025
androidx.navigation:navigation-*:2.9.4 منتشر شد. نسخه 2.9.4 حاوی این commit ها است.
رفع اشکال
- هنگامی که یک رویداد پیشبینیکننده برگشت پس از غیرفعال شدن کنترلکننده در انتقال
NavHostدر اواسط فریم ارائه میشود، از خرابی جلوگیری کنید. ( I5667c , b/384186542 )
نسخه 2.9.3
30 جولای 2025
androidx.navigation:navigation-*:2.9.3 منتشر شد. نسخه 2.9.3 شامل این commit ها است.
رفع اشکال
- یک خطا در
NavControllerکه هنگام استفادهOnDestinationChangedListenersباعث ایجاد یکConcurrentModificationExceptionشد، رفع شد. ( If7406 , b/417784831 ) - رفع خطا در هنگام استفاده از
navigate(uri, navOptions,navigationExtras)که در آن موارد اضافی نادیده گرفته می شدند. ( I67fb7 , b/430336813 )
نسخه 2.9.2
16 جولای 2025
androidx.navigation:navigation-*:2.9.2 منتشر شد. نسخه 2.9.2 حاوی این commit ها است.
رفع اشکال
- رفع مشکل عدم از سرگیری ورودی هنگام رد کردن گفتگوی بالای ورودی ( Idb20e , b/418746335 )
- رفع خطای
MissingFieldExceptionهنگام آزمایشSavedStateHandleبا تایپ مسیرهای امن در حین استفادهNavTypesسفارشی. ( I2f843 , b/421002511 )
نسخه 2.9.1
2 ژوئیه 2025
androidx.navigation:navigation-*:2.9.1 منتشر شد. نسخه 2.9.1 شامل این commit ها است.
رفع اشکال
- مشکلی را برطرف کرد که باعث شد
NavEntriesکه با استفاده از رویه تکی نمونه سازی شده بودند هرگز درLifecycle.Stateخود فراتر از CREATED نروند. ( I043ba , b/421095236 )
نسخه 2.9.0
7 مه 2025
androidx.navigation:navigation-*:2.9.0 منتشر شد. نسخه 2.9.0 شامل این commit ها است.
تغییرات مهم از 2.8.0
- اقدامات Args ایمن ناوبری اکنون با حاشیهنویسی
@CheckResultایجاد میشوند تا اطمینان حاصل شود که از آنها استفاده میشود.
پشتیبانی از رابط پنل
- ناوبرهای سفارشی اکنون می توانند مقصد خود را به عنوان در حال پیاده سازی رابط
SupportingPaneعلامت گذاری کنند که بهNavControllerنشان می دهد که این مقاصد در کنار سایر مقاصد نشان داده خواهند شد. به عنوان مثال، با استفاده از این رابط، چندین مقصد را می توان به طور همزمانRESUMED.
چند پلتفرم Kotlin را بنویسید
- Navigation اکنون یک تابع متداول
NavController.handleDeepLink()ارائه می دهد که به جایIntent،NavDeepLinkRequestمی گیرد. این به پلتفرمهایی غیر از اندروید اجازه میدهد تا پیوندهای عمیق را به درستی مدیریت کنند. با تشکر کنستانتین تسخوربوف! - Navigation اکنون
NavUriارائه می دهد، یک تابع تجزیه کننده رایج جدید که یک API سازگار برای URI اندروید در پلتفرم های دیگر است. این امکان ایجاد یک URI را به روشی پلتفرم آگنوستیک فراهم می کند. با تشکر کنستانتین تسخوربوف!
توابع ایمن را تایپ کنید
- نوع API های ایمن که قبلاً فقط از طریق روش های
reifiedقابل دسترسی بودند، به عنوان مثال،composable<YourScreen>اکنون نسخه های غیرتصحیحی دارند که مستقیماً یک نمونهKClassرا می گیرند. - ایمنی نوع ناوبری اکنون از کلاسهای مقدار به عنوان مسیر یا به عنوان نوع آرگومان مسیر پشتیبانی میکند.
نسخه 2.9.0-rc01
23 آوریل 2025
androidx.navigation:navigation-*:2.9.0-rc01 منتشر شد. نسخه 2.9.0-rc01 حاوی این commit ها است.
رفع اشکال
- تمام اهداف پلتفرم غیر اندرویدی را از Jetpack Navigation حذف کرد زیرا آن اهداف در واقع کار نمی کنند. اکنون به جای آن، خردههایی برای پلتفرمهای مختلف ارائه شده است. ( I2877d )
نسخه 2.9.0-beta01
9 آوریل 2025
androidx.navigation:navigation-*:2.9.0-beta01 منتشر شد. نسخه 2.9.0-beta01 حاوی این تعهدات است.
تغییرات API
- API رایج
parseStringAsNavUriبه یک تابع کارخانهNavUriتغییر یافته است که یک رشته می گیرد. ( I4db6e , b/403616316 )
به روز رسانی های وابستگی
- این کتابخانه اکنون سطح زبان Kotlin 2.0 را هدف قرار می دهد و به KGP 2.0.0 یا جدیدتر نیاز دارد. ( Idb6b5 )
نسخه 2.9.0-alpha09
26 مارس 2025
androidx.navigation:navigation-*:2.9.0-alpha09 منتشر شد. نسخه 2.9.0-alpha09 حاوی این commit ها است.
ویژگی های جدید
- ماژول
navigation-testingدر حال حاضر علاوه بر اندروید روی دسکتاپ، لینوکس، macOS و iOS پشتیبانی میکند. ( I2b770 , b/398265336 ) -
NavTypeدر حال حاضر علاوه بر اندروید روی دسکتاپ، لینوکس، macOS و iOS پشتیبانی میشود. ( I297d8 )
نسخه 2.9.0-alpha08
12 مارس 2025
androidx.navigation:navigation-*:2.9.0-alpha08 منتشر شد. نسخه 2.9.0-alpha08 حاوی این تعهدات است.
رفع اشکال
- از Navigation
2.8.9: یک رگرسیون یافت شده در Navigation 2.8.8 که نیاز به پیوند عمیق برای مطابقت با تمام فیلدهای درخواست یا قصد پیوند عمیق دقیقاً دارد تا مطابقت در نظر گرفته شود، رفع شد. این باعث شد که پیوندهای عمیقی که حاوی مسابقات میدانی جزئی بودند و دیگران را نداشتند دیگر کار نکنند. ( Ie5e36 , b/399826566 )
مشارکت خارجی
- تابع تجزیه کننده مشترک جدید برای ایجاد
NavUri. با تشکر کنستانتین تسخوربوف! ( If0a6a )
نسخه 2.9.0-alpha07
26 فوریه 2025
androidx.navigation:navigation-*:2.9.0-alpha07 منتشر شد. نسخه 2.9.0-alpha07 حاوی این commit ها است.
رفع اشکال
- مشکلی را برطرف کرد که در آن تلاش برای
saveStateبا pop غیر فراگیر منجر به یک saveState تهی می شد که می تواند باعث خرابی در بازیابی شود. ( I9f3e8 , b/395091644 ) - از Navigation 2.8.8 : تطبیق
NavDeepLinkدر جایی که یک پیوند عمیق و یک درخواست پیوند عمیق باید دقیقاً در uri، اکشن و mime مطابقت داشته باشند، رفع شده است. اگر فقط یک یا دو فیلد مطابقت داشته باشند، تطبیق دیگر مجاز نیست. ( I3b029 , b/395712033 ) - از Navigation 2.8.8 : رفع اشکالی که در آن مسیرهای دارای مسیرهای عام با یک پیوند عمیق اضافه شده مطابقت ندارند ( I7ea92 , b/389970341 )
مشارکت خارجی
- یک APIهای ناوبری-معمول، ناوبری-زمان اجرا و ناوبری-نوشتن را در پلتفرم مشترک استخراج کنید. با تشکر کنستانتین تسخوربوف! ( I1e626 ، Ica76f ، Idf479 )
مسائل شناخته شده
- با توجه به کار برای آدرس b/395712033 ، پیوندهای عمیق به اشتباه باید همه فیلدهای مشابه درخواست پیوند عمیق و/یا
Intentداشته باشند. پیوندهای عمیق فقط باید برای مطابقت با فیلدهایی که دارند مورد نیاز باشد و فیلدهای غیر شامل باید نادیده گرفته شوند. این مشکل برای نسخه بعدی به عنوان بخشی از b/399826566 برطرف شده است.
نسخه 2.9.0-alpha06
12 فوریه 2025
androidx.navigation:navigation-*:2.9.0-alpha06 منتشر شد. نسخه 2.9.0-alpha06 حاوی این commit ها است.
ویژگی های جدید
- اقدامات Args ایمن ناوبری اکنون با حاشیهنویسی
@CheckResultایجاد میشوند تا اطمینان حاصل شود که از آنها استفاده میشود. ( I14d4c , b/356323084 )
رفع اشکال
- یک خطا در
NavControllerکه در آن حالتهای BackStack به اشتباه زمانی که در فهرست ذخیره میشدند در یک آرایه بازیابی شدند، رفع شد. ( Idfb9b ) - از Navigation
2.8.7: Navigation Safe Args اکنون از مقصدهای قابل ترکیب پشتیبانی می کند. ( I35320 , b/362791955 )
نسخه 2.9.0-alpha05
29 ژانویه 2025
androidx.navigation:navigation-*:2.9.0-alpha05 منتشر شد. نسخه 2.9.0-alpha05 حاوی این commit ها است.
رفع اشکال
- مشکلی را که باعث ایجاد انیمیشن در مقیاس غیرمنتظره در هنگام استفاده از Navigation Compose شده است، برطرف کنید. ( I480f4 , b/353294030 )
- از Navigation
2.8.6: برچسب هایNavDestinationارائه شده از طریق XML از طریقNavType.getتجزیه می شوند تا اطمینان حاصل شود که منطقNavTypeسفارشی رعایت می شود. ( I7ec2f , b/388100796 ) - از Navigation
2.8.6: هنگام پیمایش به فعالیت باdataPattern،ActivityNavigatorاکنون سعی می کند مقدار arg را باNavTypeآرگومان رمزگذاری کند. ( I16376 , b/383616432 ) - From Navigation
2.8.5: مشکلی را برطرف کرد که باعث ایجاد انیمیشن در مقیاس غیرمنتظره هنگام استفاده از Navigation Compose و فراخوانی navigate در همان فریمی شد که انیمیشن فعلی در حال پایان است. ( I26cb1 , b/353294030 )
نسخه 2.9.0-alpha04
11 دسامبر 2024
androidx.navigation:navigation-*:2.9.0-alpha04 منتشر شد. نسخه 2.9.0-alpha04 حاوی این commit ها است.
ویژگی های جدید
- نوع API امنی که قبلاً فقط از طریق روشهای
reifiedدر دسترس بودند ، یعنیcomposable<YourScreen>اکنون نسخههای غیرتصحیحشدهای دارند که مستقیماً یک نمونهKClassرا میگیرند. Ic1bf0 , Iba4ee , If56a5 , Icf969 , I67644 , I6f788 , b/382094941 , b/366291612 , b/381938808 )
جدول زیر API های reified و KClass را ارائه می دهد.
| واقعی شد | کلاس |
|---|---|
composable<TestClass> { } | composable(TestClass::class) { } |
navigation<NestedGraph>(startDestination = TestClass::class) | navigation(route = NestedGraph::class, startDestination = TestClass::class) |
dialog<TestClass> {} | dialog(TestClass::class) {} |
navDeepLink<TestClass>(baseUri) | navDeepLink(TestClass::class, baseUri) |
NavDeepLink.Builder.setUriPattern<TestClass>(baseUri) | NavDeepLink.Builder.setUriPattern(TestClass::class, baseUri) |
NavDestinationBuilder.deepLink<TestDeepLink>(baseUri) { } | NavDestinationBuilder.deepLink(TestDeepLink::class, baseUri) { } |
navController.getBackStackEntry<TestClass>() | navController.getBackStackEntry(TestClass::class) |
navController.popBackStack<TestClass>(true) | navController.popBackStack(TestClass::class, true) |
navController.clearBackStack<TestClass>() | navController.clearBackStack(TestClass::class) |
NavOptions.setPopUpTo<TestClass>() | NavOptions.setPopUpTo(TestClass::class) |
navOptions { popUpTo<TestClass> {...} } | navOptions { popUpTo(TestClass::class) {...} } |
NavGraph.setStartDestination<TestClass>() | NavGraph.setStartDestination(TestClass::class) |
NavGraph.findNode<TestClass>() | NavGraph.findNode(TestClass::class) |
backStackEntry.toRoute<TestClass>() | backStackEntry.toRoute(TestClass::class) |
savedStateHandle.toRoute<TestClass>() | savedStateHandle.toRoute(TestClass::class) |
تغییرات API
- اضافه بار
NavGraph.setStartDestinationمختص kotlin برای ایمنی نوع از منابع جاوا پنهان است. ( Ic640c , b/364634035 )
رفع اشکال
- از Navigation
2.8.5: مشکلی را برطرف کرد که در آنNavHostمیتوانست در داخلPredictiveBackHandlerیک استثنا ایجاد کند، اگر پشته پشتی به 1 ورودی پایین بیاید و یک سیستم به عقب در همان فریم راهاندازی شود. ( I1a429 , b/375343407 ) - از Navigation
2.8.5: هنگام به روز رسانیstartDestinationنمودار،NavDestinationNullPointerExceptionثابت شد. ( I99421 , b/361560785 )
مشارکت خارجی
- از Navigation
2.8.5: ایمنی نوع پیمایش اکنونList<Enum>به عنوان یک نوع آرگومان مسیر بدون نیاز بهNavTypeسفارشی پشتیبانی می کند. با تشکر Csaba Kozák ! ( GH-725 , b/375559962 )
نسخه 2.9.0-alpha03
13 نوامبر 2024
androidx.navigation:navigation-*:2.9.0-alpha03 منتشر شد. نسخه 2.9.0-alpha03 حاوی این commit ها است.
ویژگی های جدید
- ایمنی نوع ناوبری اکنون از کلاسهای مقدار به عنوان مسیر یا به عنوان نوع آرگومان مسیر پشتیبانی میکند. ( I9344a , b/374347483 )
رفع اشکال
- وقتی
LifecycleObserverمتصل بهNavBackStackEntry، هنگامی کهLifecycleOwnerمیزبان مانند Activity یا Fragment حالت چرخه عمر خود را تغییر میدهد، تغییری در پشته پشتی ایجاد میکند، یک ExceptionConcurrentModificationExceptionرا برطرف کرد. ( Ia9494 )
نسخه 2.9.0-alpha02
30 اکتبر 2024
androidx.navigation:navigation-*:2.9.0-alpha02 منتشر شد. نسخه 2.9.0-alpha02 حاوی این commit ها است.
مشارکت خارجی
- متد متداول جدید
NavController.handleDeepLink(request: NavDeepLinkRequest). با تشکر کنستانتین تسخوربوف! ( I3e228 )
نسخه 2.9.0-alpha01
16 اکتبر 2024
androidx.navigation:navigation-*:2.9.0-alpha01 منتشر شد. نسخه 2.9.0-alpha01 حاوی این commit ها است.
ویژگی های جدید
- ناوبرهای سفارشی اکنون می توانند مقصد خود را به عنوان در حال پیاده سازی رابط
SupportingPaneعلامت گذاری کنند که بهNavControllerنشان می دهد که این مقاصد در کنار سایر مقاصد نشان داده خواهند شد. به عنوان مثال، با استفاده از این رابط، چندین مقصد را می توان به طور همزمانRESUMED. ( شناسه 5559 ) - از Navigation
2.8.3: بررسیهای پرز جدید برای ماژولهایnavigation-common،navigation-runtimeوnavigation-composeاضافه شد تا به شناسایی مسیرهای ایمن که به درستی با@Serializableحاشیهنویسی نشدهاند کمک کند. این بررسی برای همه توابع افزونهNavGraphBuilderوNavDeepLinkBuilderاعمال می شود. ( I4a259 , I95402 , Ie601a , Id8c6e , I28bda , b/362725816 ) - از Navigation
2.8.3: بررسیهای پرز جدید برای ماژولهایnavigation-common،navigation-runtimeوnavigation-composeاضافه شد تا به شناسایی مسیرهای ایمن با آرگومانهای Enum کمک کند که به درستی با@Keepحاشیهنویسی نشدهاند. این بررسی برای همه توابع افزونهNavGraphBuilderوNavDeepLinkBuilderاعمال می شود. ( I4a259 , I95402 , Ie601a , Id8c6e , I2b46f , b/358687142 )
تغییرات رفتار
- تلاش برای استفاده از
NavControllerکه قبلاًDESTROYEDاست، اکنون باعث یکIllegalStateExceptionمی شود. ( I520da , b/369616172 )
رفع اشکال
- بهروزرسانی کلاس Enum استثنا یافت نشد تا پیشنهاد استفاده از حاشیهنویسی
@Keepرا در صورتی که کلاس Enum در ساختهای کوچکسازی شده پاک شود را بهروزرسانی کنید. ( I90e79 , b/358137294 )
مسائل شناخته شده
- در قوانین جدید پرز که در
Navigation 2.8.*اضافه شدهاند مشکلی وجود دارد که هنگام تلاش برای اجرای لینت با افزونه Android Gradle نسخه 8.4 و بالاتر، خطایObsolete custom lint checkایجاد میکند. ( b/368070326 , b/371463741 )
نسخه 2.8
نسخه 2.8.9
12 مارس 2025
androidx.navigation:navigation-*:2.8.9 منتشر شد. نسخه 2.8.9 شامل این commit ها است.
رفع اشکال
- یک رگرسیون یافت شده در Navigation 2.8.8 که نیاز به پیوند عمیق برای مطابقت با تمام فیلدهای درخواست یا قصد پیوند عمیق دقیقاً دارد تا مطابقت در نظر گرفته شود، رفع شد. این باعث شد که پیوندهای عمیقی که حاوی مسابقات میدانی جزئی بودند و دیگران را نداشتند دیگر کار نکنند. ( Ie5e36 , b/399826566 )
نسخه 2.8.8
26 فوریه 2025
androidx.navigation:navigation-*:2.8.8 منتشر شد. نسخه 2.8.8 حاوی این commit ها است.
رفع اشکال
- رفع اشکالی که در آن مسیرهای دارای مسیرهای عام با پیوند عمیق اضافه شده مطابقت ندارند. ( I7ea92 , b/389970341 )
- تطبیق
NavDeepLinkدر جایی که یک پیوند عمیق و یک درخواست پیوند عمیق باید دقیقاً در uri، اکشن و mime مطابقت داشته باشند، رفع شده است. اگر فقط یک یا دو فیلد مطابقت داشته باشند، تطبیق دیگر مجاز نیست. ( I3227f , b/395712033 )
مسائل شناخته شده
- با توجه به کار برای آدرس b/395712033 ، پیوندهای عمیق به اشتباه باید همه فیلدهای مشابه درخواست پیوند عمیق و/یا
Intentداشته باشند. پیوندهای عمیق فقط باید برای مطابقت با فیلدهایی که دارند مورد نیاز باشد و فیلدهای غیر شامل باید نادیده گرفته شوند. این مشکل برای نسخه بعدی به عنوان بخشی از b/399826566 برطرف شده است.
نسخه 2.8.7
12 فوریه 2025
androidx.navigation:navigation-*:2.8.7 منتشر شد. نسخه 2.8.7 شامل این commit ها است.
رفع اشکال
- Navigation Safe Args اکنون از مقاصد قابل ترکیب پشتیبانی می کند. ( I35320 , b/362791955 )
نسخه 2.8.6
29 ژانویه 2025
androidx.navigation:navigation-*:2.8.6 منتشر شد. نسخه 2.8.6 حاوی این commit ها است.
رفع اشکال
- برچسب های
NavDestinationارائه شده از طریق XML از طریقNavType.getتجزیه می شوند تا اطمینان حاصل شود که منطقNavTypeسفارشی رعایت می شود. ( Id366d , b/388100796 ) - هنگام پیمایش به فعالیت با
dataPattern،ActivityNavigatorاکنون سعی می کند مقدار arg را باNavTypeآرگومان رمزگذاری کند. ( I1a71d , b/383616432 )
نسخه 2.8.5
11 دسامبر 2024
androidx.navigation:navigation-*:2.8.5 منتشر شد. نسخه 2.8.5 حاوی این commit ها است.
رفع اشکال
- مشکلی را برطرف کرد که در آن
NavHostمیتوانست در داخلPredictiveBackHandlerیک استثنا ایجاد کند، اگر پشته پشتی به 1 ورودی پایین بیاید و یک سیستم به عقب در همان فریم راهاندازی شود. ( I1a429 , b/375343407 ) - هنگام به روز رسانی
startDestinationیک نمودار،NavDestinationNullPointerExceptionبرطرف کرد. ( I99421 , b/361560785 ) - رفع مشکلی که باعث ایجاد یک انیمیشن در مقیاس غیرمنتظره در هنگام استفاده از Navigation Compose و فراخوانی navigate در همان فریمی شد که انیمیشن فعلی در حال پایان است. ( I26cb1 , b/353294030 )
- وقتی
LifecycleObserverمتصل بهNavBackStackEntry، هنگامی کهLifecycleOwnerمیزبان مانند Activity یا Fragment حالت چرخه عمر خود را تغییر میدهد، تغییری در پشته پشتی ایجاد میکند، یک ExceptionConcurrentModificationExceptionرا برطرف کرد. ( Ia9494 )
مشارکت خارجی
- ایمنی نوع پیمایش اکنون از
List<Enum>به عنوان یک نوع آرگومان مسیر بدون نیاز بهNavTypeسفارشی پشتیبانی می کند. با تشکر Csaba Kozák ! ( GH-725 , b/375559962 )
نسخه 2.8.4
13 نوامبر 2024
androidx.navigation:navigation-*:2.8.4 منتشر شد. نسخه 2.8.4 حاوی این commit ها است.
ویژگی های جدید
- از Navigation
2.9.0-alpha03: ایمنی نوع ناوبری اکنون از کلاس مقدار به عنوان مسیر یا به عنوان نوع آرگومان یک مسیر پشتیبانی می کند ( I9344a , b/374347483 )
رفع اشکال
- From Navigation
2.9.0-alpha01: تلاش برای استفاده ازNavControllerکه قبلاًDESTROYEDاست، اکنون باعث یکIllegalStateExceptionمی شود. ( I520da , b/369616172 )
نسخه 2.8.3
16 اکتبر 2024
androidx.navigation:navigation-*:2.8.3 منتشر شد. نسخه 2.8.3 شامل این commit ها است.
ویژگی های جدید
- بررسیهای پرز جدید برای ماژولهای
navigation-common،navigation-runtimeوnavigation-composeاضافه شد تا به شناسایی مسیرهای ایمن که به درستی با@Serializableحاشیهنویسی نشدهاند، کمک کند. این بررسی برای همه توابع افزونهNavGraphBuilderوNavDeepLinkBuilderاعمال می شود. ( I4a259 , I95402 , Ie601a , Id8c6e , I28bda , b/362725816 ) - بررسیهای پرز جدید برای ماژولهای
navigation-common،navigation-runtime، وnavigation-composeاضافه شد تا به شناسایی مسیرهای ایمن با آرگومانهای Enum کمک کند که به درستی با@Keepحاشیهنویسی نشدهاند. این بررسی برای همه توابع افزونهNavGraphBuilderوNavDeepLinkBuilderاعمال می شود. ( I4a259 , I95402 , Ie601a , Id8c6e , I2b46f , b/358687142 )
رفع اشکال
- مشکلی را برطرف کرد که در آن قوانین پرزهای جدید که در
Navigation 2.8.*اضافه شده بودند، هنگام تلاش برای اجرای لینت با پلاگین Android Gradle نسخه 8.4 و بالاتر، باعث خطایObsolete custom lint checkمی شد. ( I1be3d , b/368070326 , b/371463741 )
مسائل شناخته شده
- هنگام تلاش برای اجرای لینت با لینت 16 (AGP 8.7) یا بالاتر، خط ناوبری خطای بررسی پرزهای سفارشی منسوخ را ایجاد می کند. ( b/371926651 )
نسخه 2.8.2
2 اکتبر 2024
androidx.navigation:navigation-*:2.8.2 منتشر شد. نسخه 2.8.2 شامل این commit ها است.
ویژگی های جدید
- Navigation Type Safety اکنون از کلاسهای Serializable پشتیبانی میکند که شامل
Double,Double?,DoubleArray,DoubleArray?،List<Double>وList<Double>?بدون نیاز بهNavTypeسفارشی. ( I570eb , Ibc4c0 , I37461 , I5bed4 , b/359245753 )
رفع اشکال
- پیام خطا برای زمانی که Navigation نتواند آرگومان مسیر را به
NavTypeترسیم کند، بهبود یافته است، پیام خطای جدید حاوی نام آرگومان، نام آرگومان کاملا واجد شرایط و نام کاملاً واجد شرایط مسیر است. ( Id8416 , b/346264232 )
نسخه 2.8.1
18 سپتامبر 2024
androidx.navigation:navigation-*:2.8.1 منتشر شد. نسخه 2.8.1 حاوی این commit ها است.
ویژگی های جدید
- برای اطمینان از استفاده از تابع
popBackStackکه هنگام تلاش برایpopBackStackبا استفاده از APIهای ایمن نوع، یک نوع کلاس اصلاحشده میگیرد، یک قانون پرز جدید اضافه کرد. ( Ief161 , b/358095343 )
رفع اشکال
- اکنون پیمایش مستلزم آن است که مسیری که به
startDestinationیکNavGraphارسال میشود حاوی مقادیری برای همه آرگومانهای مورد نیاز باشد، که شامل آرگومانهایی است که غیر قابل تهی هستند و مقدار پیشفرض ندارند. ( I18e74 , b/362594265 ) - args ایمن ناوبری پشتیبانی از رشتههای غیر قابل تهی را اضافه کرده است، به طوری که مقادیر «تهی» تجزیه و به همان صورت در بسته ذخیره میشوند. این از رفتار موجود که در آن مقادیر "تهی" به یک شی تهی تجزیه می شوند، فاصله می گیرد. این تغییر فقط برای انواع رشته های غیر تهی اعمال می شود. رشته های پوچ بدون تغییر باقی می مانند. ( I08b4a , b/348936238 )
- به
NavDestinationدیگر نمی توان به جز از طریق پیوند عمیقی که صریحاً به مقصد اضافه شده است، به آن پیوند عمیق داد. این همچنین به این معنی است که شما فقط می توانید با اضافه بار تابع پیمایش که مسیر رشته ای را طی می کند، به مسیر مقصد بروید. این یک آسیبپذیری را برطرف میکند که پیوند عمیق به یک مقصد بالقوه محافظت شده را ممکن میسازد. ( Ie30e6 )
به روز رسانی وابستگی
- Navigation Safe Args اکنون به جای Kotlin 2.X به Kotlin 1.9.24 بستگی دارد و اطمینان می دهد که توسعه دهندگان مجبور به به روز رسانی نیستند. ( a4129a )
- Navigation Compose اکنون به Compose
1.7.2بستگی دارد.
نسخه 2.8.0
4 سپتامبر 2024
androidx.navigation:navigation-*:2.8.0 منتشر شد. نسخه 2.8.0 شامل این commit ها است.
تغییرات مهم از 2.7.0
Navigation Kotlin DSL Type-Safety
- اکنون Navigation با استفاده از Kotlin Serialization، ایمنی نوع را برای Kotlin DSL (که توسط Navigation Compose استفاده میشود) فراهم میکند تا به شما امکان میدهد مقصدها را در نمودار ناوبری خود از طریق نوع اشیاء امن و کلاسهای داده تعریف کنید:
// Define a home destination that doesn't take any arguments
@Serializable
object Home
// Define a profile destination that takes an ID
@Serializable
data class Profile(val id: String)
// Now define your NavHost using type safe objects
NavHost(navController, startDestination = Home) {
composable<Home> {
HomeScreen(onNavigateToProfile = { id ->
navController.navigate(Profile(id))
})
}
composable<Profile> { backStackEntry ->
val profile: Profile = backStackEntry.toRoute()
ProfileScreen(profile)
}
}
برای اطلاعات بیشتر به پست وبلاگ ناوبری نوشتن meet Type Safety مراجعه کنید.
ناوبری نوشتن بازگشت پیشگو
- Navigation Compose اکنون از طریق APIهای
SeekableTransitionStateجدید از compose-animation از Predictive درون برنامه ای پشتیبانی می کند. این به شما امکان می دهد قبل از تصمیم به انجام تراکنش از طریق ژست تکمیل شده یا لغو، از ژست برگشت برای دیدن مقصد قبلی با Transition سفارشی خود استفاده کنید.
Navigation Fragment Composable
- یک مصنوع
navigation-fragment-composeجدید اضافه شده است که شامل یکComposableNavHostFragmentجایگزین برایNavHostFragmentاست که به شما امکان می دهد مقصدهای قابل ترکیب را به فایل های Navigation XML خود اضافه کنید. هر مقصدcomposableباید به عنوان یک روش سطح بالا، بدون@Composableبیان شودandroid:nameهنگام حرکت به یکی از این مقاصد، یک قطعه حاوی برای نمایش محتوای قابل ترکیب ایجاد می شود.
// In HomeScreen.kt
@Composable
fun HomeScreen() {
// Your Composable content here
}
// In your navigation.xml
<composable
android:id="@+id/home_screen"
android:name="com.example.HomeScreenKt\$HomeScreen" />
سایر تغییرات
- Navigation Compose اکنون به Compose 1.7.0 بستگی دارد.
- اکنون Navigation یک کلاس
CollectionNavType<T>جدید، یک زیر کلاس ازNavType<T>برای آرگومان های مبتنی بر مجموعه مانند لیست، آرایه ها، نقشه ها ارائه می دهد. همه آرایههای پیشفرضNavType(IntArrayType،LongArrayType،FloatArrayType،BoolArrayType، وStringArrayType) اکنون از این کلاس جدید به ارث میبرند. -
NavTypeاکنون از لیست های Int، String، Boolean، Float و Long پشتیبانی داخلی دارد.
نسخه 2.8.0-rc01
21 آگوست 2024
androidx.navigation:navigation-*:2.8.0-rc01 منتشر شد. نسخه 2.8.0-rc01 حاوی این commit ها است.
رفع اشکال
- رفع خرابی ناوبری هنگام عبور از کلاسهای Enum سطح بالا به عنوان آرگومانهای امن تایپ. ( I0ba76 , b/358137294 )
- Navigation 2.8 اکنون به درستی با SDK 34 کار می کند و تا زمان انتشار نسخه 2.9 به همراه بقیه کتابخانه های AndroidX به SDK 35 تعویض نمی شود. ( b/358798728 )
نسخه 2.8.0-beta07
7 آگوست 2024
androidx.navigation:navigation-*:2.8.0-beta07 منتشر شد. نسخه 2.8.0-beta07 حاوی این تعهدات است.
مسائل شناخته شده
- به دلیل b/358137294 ، فقط Enum های تو در تو در یک کلاس دیگر خارج از جعبه پشتیبانی می شوند. Enums سطح بالا در نسخه بعدی پشتیبانی خواهد شد.
رفع اشکال
- هنگام پیمایش به مقصدهای تکراری یا مشترک، ناوبری رفتن به نزدیکترین مقصد منطبق از مکان فعلی در نمودار را اولویت بندی می کند. ( Ic89a4 , b/352006850 )
- پیمایش در args ایمن اکنون یک
NavType.EnumTypeجدید اضافه کرده است. این بدان معناست که انواعEnumدیگر نیازی بهNavTypeسفارشی ندارند. توجه داشته باشید کهSerialNameEnumباید نام پیشفرض کاملا واجد شرایط باشد. ( I66d22 , b/346475493 ) - پیمایش در args ایمن، پشتیبانی داخلی برای انواع آرگومانهای باطل از جمله
Int?،Long?Float?،Boolean?وEnum<*>?. ( I32d13 , I1c580 , Ifba66 , I978b0 , Ide076 , b/351994237 ) - اگر مسیر
startDestinationارسال شده بهNavGraphدقیقاً برابر باstartDestination.routeباشد،startDestinationNavGraphاکنون از مقادیر آرگومان پیشفرض استفاده میکند. ( I13762 , b/354046047 )
نسخه 2.8.0-beta06
24 جولای 2024
androidx.navigation:navigation-*:2.8.0-beta06 منتشر شد. نسخه 2.8.0-beta06 حاوی این تعهدات است.
رفع اشکال
- مشکلی را برطرف کرد که در آن بررسیهای
WrongStartDestinationTypeاشیاء Companion را در نوع کلاس بررسی نمیکردند و باعث میشد که lint خطا را تشخیص ندهد. ( I92b09 )
نسخه 2.8.0-beta05
10 جولای 2024
androidx.navigation:navigation-*:2.8.0-beta05 منتشر شد. نسخه 2.8.0-beta05 حاوی این تعهدات است.
رفع اشکال
- هنگامی که
NavGraphsتودرتو مسیرstartDestinationرا به اشتراک می گذارند، خرابی پیمایشsingleTopرا برطرف کنید. ( I17b94 , b/294408596 )
نسخه 2.8.0-beta04
26 ژوئن 2024
androidx.navigation:navigation-*:2.8.0-beta04 منتشر شد. نسخه 2.8.0-beta04 حاوی این تعهدات است.
رفع اشکال
- اکنون Navigation از پیمایش با رشته های خالی در آرگومان های مسیر پشتیبانی می کند. ( Ic5dbd , b/339481310 )
- پیام خطا را برای سریالسازهای سفارشی که مستقیماً در فیلدهای کلاس از طریق
@Serializable(with =...)اعلام شده است، بهبود دهید تا مشخص شود که این ویژگی در حال حاضر پشتیبانی نشده است. ( I052b0 , b/341319151 ) - Api تست
SavedStateHandleFactoryاکنون میتواند در تستهای غیر اندرویدی استفاده شود، اما به Robolectric برای پشتیبانی از تجزیه آرگومان با Bundles نیاز دارد. ( I76cdc , b/340966212 ) - رفع خرابی از حالت بازیابی هنگام از سرگیری برنامه پس از مرگ فرآیند با استفاده از ناوبری Type-Safe در نوشتن. ( Ia8f38 , b/341801005 )
- مشکلی در Navigation Compose برطرف شد که در آن پس از لغو ژست بازگشت پیشبینیکننده،
NavBackStackEntryکه کاربر به آن برمیگرداند، هرگز به حالتRESUMEDLifecycle باز نمیگردد. این همچنین تضمین میکند که مقصد برگشتی بهجای اینکه پس از پرت کردن در جای خود قرار گیرد، بهدرستی به داخل حرکت میکند. ( I97a0c , b/346608857 ) - هنگام استفاده از Predictive Back با Navigation Compose، مقصدی که ظاهر می شود اکنون دارای ترتیب z مناسب است و به درستی در بالای مقصد ورودی متحرک می شود. ( I2077b , b/345993681 )
نسخه 2.8.0-beta03
12 ژوئن 2024
androidx.navigation:navigation-*:2.8.0-beta03 منتشر شد. نسخه 2.8.0-beta03 حاوی این تعهدات است.
تغییرات API
-
CollectionNavTypeیک متد انتزاعیemptyCollection()دارد. برای مدیریت یک مجموعه خالی که به عنوان آرگومان ارسال شده است، این مورد را لغو کنید. ( Ie4d84 , b/341723133 )
رفع اشکال
- اسنادی در
NavType.serializeAsValueوserializeAsValuesاضافه شد تا مشخص شود که خروجی های نهایی باید با کد Uri باشند. ( Ida6bd , b/344943214 ) - رفع خرابی هنگام فراخوانی
toRoute<T>با آرگومان تهیCollectionNavType. هنگام پیمایش باCollectionNavTypeتهی، آرگومان خروجی مقدار پیشفرض اعلامشده در کلاس Serializable شما، یا مقدار بازگشتیemptyCollection()در صورت عدم وجود مقدار پیشفرض خواهد بود. ( I84158 , Id630f , b/342672856 )
نسخه 2.8.0-beta02
29 مه 2024
androidx.navigation:navigation-*:2.8.0-beta02 منتشر شد. نسخه 2.8.0-beta02 حاوی این تعهدات است.
رفع اشکال
- رفع خرابی
ClassCastExceptionهنگام استفاده ازNavBackStackEntry.toRouteباNavTypeسفارشی قابل پاک کردن. ( I1c29b , b/342239473 ) - رفع مشکلات مربوط به بازیابی وضعیت پشته پشته ناوبری که هنگام تلاش برای بازیابی ورودی پشته پشته که از طریق شناسه از مقصد فعلی قابل دسترسی نیست، ایجاد شد. از آنجایی که مسیرها توسط شناسه پشتیبانی می شوند، مقاصد ساخته شده با مسیرها نیز تحت تأثیر قرار گرفتند. این همچنین خرابی ناشی از فراخوانی
clearBackStack()که همان مشکل اساسی را داشت برطرف می کند. ( I423c3 , b/339908057 )
نسخه 2.8.0-beta01
14 مه 2024
androidx.navigation:navigation-*:2.8.0-beta01 منتشر شد. نسخه 2.8.0-beta01 حاوی این تعهدات است.
تغییرات API
-
SavedStateHandle.toRoute()اکنون یک پارامترtypeMapبرای انواع آرگومان سفارشی می گیرد. ( Ie39fb , b/339026523 ) - برای ایجاد یک
SavedStateHandleاز یک شی Kotlin Serializable، یک API آزمایشی بهnavigation-testingاضافه کرد. ( ID4867 , b/339080702 )
رفع اشکال
- اسناد پارامتری موجود برای توابع Navigation Kotlin DSL اضافه شده است. ( I26a36 )
نسخه 2.8.0-alpha08
1 مه 2024
androidx.navigation:navigation-*:2.8.0-alpha08 منتشر شد. نسخه 2.8.0-alpha08 حاوی این commit ها است.
Safe Args در Navigation Compose
- کار برای پشتیبانی از ایمنی نوع زمان کامپایل برای Navigation Compose و کاربران Navigation Kotlin DSL مبتنی بر سریال سازی Kotlin کامل شده است و APIهای آزمایشی قبلی اکنون پایدار هستند. ( Iea94d , I0eb0d , I873b7 , I3a64b , I6c3a2 , I11f0b , Ic3032 , I8d394 , I95710 , Ice060 , Id0e55 , I45f8dab , I45f30b , If Ia5c59 ، b/188693139 )
این قابلیت از Kotlin Serialization استفاده می کند تا به شما امکان می دهد مقصدها را در نمودار ناوبری خود از طریق تایپ اشیاء امن و کلاس های داده تعریف کنید:
// Define a home destination that doesn't take any arguments
@Serializable
object Home
// Define a profile destination that takes an ID
@Serializable
data class Profile(val id: String)
// Now define your NavHost using type safe objects
NavHost(navController, startDestination = Home) {
composable<Home> {
HomeScreen(onNavigateToProfile = { id ->
navController.navigate(Profile(id))
})
}
composable<Profile> { backStackEntry ->
val profile: Profile = backStackEntry.toRoute()
ProfileScreen(profile)
}
}
برای اطلاعات بیشتر به پست وبلاگ ناوبری نوشتن meet Type Safety مراجعه کنید.
ویژگی های جدید
- مصنوع
navigation-fragment-composeاکنون یک ترکیبLocalFragmentمحلی به روشهای قابل ترکیب درComposableFragmentارائه میکند. ( If35e5 ) -
NavTypeاکنون از لیست های Int، String، Boolean، Float و Long پشتیبانی داخلی دارد. ( I4b6dd , Ia914c , b/188693139 )
نسخه 2.8.0-alpha07
17 آوریل 2024
androidx.navigation:navigation-*:2.8.0-alpha07 منتشر شد. نسخه 2.8.0-alpha07 حاوی این commit ها است.
ویژگی های جدید
یک مصنوع
navigation-fragment-composeجدید که شاملComposableNavHostFragmentجایگزینی برایNavHostFragmentاست اضافه می کند که به شما امکان می دهد مقصدهایcomposableرا به فایل های Navigation XML خود اضافه کنید. هر مقصدcomposableباید به عنوان یک روش سطح بالا، بدون@Composableبیان شودandroid:nameهنگام حرکت به یکی از این مقاصد، یک قطعه حاوی برای نمایش محتوای قابل ترکیب ایجاد می شود. ( I0ef2e , b/265480755 )// In HomeScreen.kt @Composable fun HomeScreen() { // Your Composable content here }// In your navigation.xml <composable android:id="@+id/home_screen" android:name="com.example.HomeScreenKt\$HomeScreen" />
تغییرات API
- پشتیبانی از Safe Args در Navigation Compose با استفاده از رویکردی مبتنی بر سریال سازی Kotlin ادامه یافت. این APIها تمام نشده اند و با حاشیه نویسی
ExperimentalSafeArgsApiعلامت گذاری شده اند. هنگامی که کل سطح API در نسخه بعدی تکمیل شود، این حاشیه نویسی حذف خواهد شد. ( Iefd95 , I409c8 , I5b5ac , I7e753 , I960f8 , I3eabd , I8ed5a , Ied2c9 , I9b73c , I554db , Ib3aba , Ia668d , b/1396 )
نسخه 2.8.0-alpha06
3 آوریل 2024
androidx.navigation:navigation-*:2.8.0-alpha06 منتشر شد. نسخه 2.8.0-alpha06 حاوی این commit ها است.
تغییرات API
- پشتیبانی از Safe Args در Navigation Compose با استفاده از رویکردی مبتنی بر سریال سازی Kotlin آغاز شده است. این APIها تمام نشده اند و با حاشیه نویسی
ExperimentalSafeArgsApiعلامت گذاری شده اند. هنگامی که کل سطح API در نسخه بعدی تکمیل شود، این حاشیه نویسی حذف خواهد شد. ( I644e7 , I98896 , I2a1c5 , I43a51 , I836a1 , Ic5eec , I39407 , I24e41 , If9e14 , Ibb13e , If44d3 , Icb70f 2f 32b , I891 I20a14 , I262aa , I7de99 , I35990 , I1033d , b/188693139 )
رفع اشکال
-
NavHostاکنون ازAlignment.TopStartبه عنوان آرگومان پیش فرض contentAlignment استفاده می کند. این آن را در راستای پیشفرضAnimatedContentقرار میدهد و برخی از نمونههای مقیاس غیرمنتظره از انتقال مرکز را برطرف میکند. ( I09e72 , b/330111602 ) - هنگامی که در حین استفاده از Navigation Compose، ژست پیشبینی کننده به عقب را تکان میدهید،
NavHostاکنون بهجای اتمام فوری، انتقال سفارشی را به درستی تکمیل میکند. ( I99017 , b/327292110 )
نسخه 2.8.0-alpha05
20 مارس 2024
androidx.navigation:navigation-*:2.8.0-alpha05 منتشر شد. نسخه 2.8.0-alpha05 حاوی این commit ها است.
ویژگی های جدید
- اکنون می توانید آرگومان ها را مستقیماً در مسیر
startDestinationبهstartDestinationNavGraphبدون اتکا بهdefaultValueارسال کنید. این در موردNavGraphstartDestinationsتودرتو نیز صدق می کند. ( I0e0b5 , b/109505019 , b/188693139 )
تغییرات API
- کلاس انتزاعی جدید
CollectionNavType<T>، یک زیر کلاس ازNavType<T>برای آرگومان های مبتنی بر مجموعه مانند لیست، آرایه ها، نقشه ها اضافه شد. ( Ic6d63 , b/188693139 ) - همه آرایه های پیش فرض
NavType(IntArrayType،LongArrayType،FloatArrayType،BoolArrayType، وStringArrayType) اکنون از نوعCollectionNavTypeهستند ( Idcf79 ، b/188693139 ) -
NavTypeاکنون یک API باز جدیدvalueEqualsارائه می دهد که تعیین می کند آیا دو مقدار از یک نوع با یکدیگر برابر هستند یا خیر. ( I6cb97 , b/327229511 )
رفع اشکال
- پارامترهای پرس و جو در پیوندهای عمیق اکنون به مقادیری به شکل پرانتزهای فرفری در اطراف نام آرگومان (یعنی
{argName}) به عنوان مقادیر معتبر برایNavTypesمبتنی بر رشته اجازه می دهد. این مشکل را برطرف می کند که در آن چنین مقداری برای همه انواع نامعتبر (یا عدم وجود مقدار) در نظر گرفته می شود. ( I18302 , b/327274038 ) - توابع
NavControllerکه از مسیرهایی مانندnavigateیاpopBackStackپشتیبانی می کنند، اکنون می توانند مسیرهای پر شده با آرگومان های ArrayNavTypesرا به درستی مطابقت دهند. ( Iea805 , b/327229511 )
نسخه 2.8.0-alpha04
6 مارس 2024
androidx.navigation:navigation-*:2.8.0-alpha04 منتشر شد. نسخه 2.8.0-alpha04 حاوی این commit ها است.
ویژگی های جدید
- اکنون میتوانید
SizeTranformرا برای انتقالهای خود در Navigation Compose با تعریف آنها به عنوان بخشی از مقداردهی اولیه برای توابعcomposableو/یاnavigationمشخص کنید. ( I91062 , b/296912651 )
رفع اشکال
- مشکلی را که در آن
NavHostدر Compose Navigation در هنگام استفاده از System Back بدون اشاره به درستی انتقال را نشان نداد، برطرف شد. ( Iceeae , b/325998468 )
نسخه 2.8.0-alpha03
21 فوریه 2024
androidx.navigation:navigation-*:2.8.0-alpha03 منتشر شد. نسخه 2.8.0-alpha03 حاوی این commit ها است.
تغییرات API
-
NavBackStackEntry.savedStateHandleاکنون به عنوان@MainThreadعلامت گذاری شده است زیرا از کدی استفاده می کند که به هر حال باید در رشته اصلی باشد. ( Ibb988 , b/299523245 )
رفع اشکال
- مشکلی در Navigation برطرف شد که باعث شد
NavGraphViewModels خیلی زودDESTROYEDزیراViewModelورودی مرتبط بخشی از حالت ذخیره شده نبود. ( Ib6bb7 , b/317581849 )
به روز رسانی وابستگی
- Navigation Compose اکنون به Compose 1.7.0-alpha03 بستگی دارد.
نسخه 2.8.0-alpha02
7 فوریه 2024
androidx.navigation:navigation-*:2.8.0-alpha02 منتشر شد. نسخه 2.8.0-alpha02 حاوی این commit ها است.
ویژگی های جدید
- Navigation Compose اکنون از طریق APIهای
SeekableTransitionStateجدید از compose-animation از Predictive درون برنامه ای پشتیبانی می کند. این به شما امکان می دهد قبل از تصمیم به انجام تراکنش از طریق ژست تکمیل شده یا لغو، از ژست برگشت برای دیدن مقصد قبلی با Transition سفارشی خود استفاده کنید. ( I8b8e9 )
نسخه 2.8.0-alpha01
24 ژانویه 2024
androidx.navigation:navigation-*:2.8.0-alpha01 منتشر شد. نسخه 2.8.0-alpha01 حاوی این commit ها است.
رفع اشکال
- رفع نشت
BackStackStateکه در آن چندین تماسsaveStateدر یک مقصد منجر به ذخیره چندین حالت میشود، اما تنها حالت اول میتواند بازیابی شود. ( I598b0 , b/309559751 ) - مشکلی را برطرف کرد که در آن هنگام استفاده از کمککنندههای
NavigationUIبرای پر کردن عنوان نوارهای برنامه، آرگومانهای غیر رشتهای به درستی نمایش داده نمیشدند. ( #636 , b/316676794 )
به روز رسانی وابستگی
- Navigation Compose اکنون بستگی به تشکیل
1.7.0-alpha01دارد که مسئله ای را برطرف می کند که می تواند باعث ایجاد انیمیشن در مقیاس غیر منتظره شود. ( b/297258205 )
مشارکت خارجی
- با تشکر از SimonMarquis برای رفع مشکل نمایش برای آرگومان های غیر رشته هنگام استفاده از یاران
NavigationUIبرای جمع آوری عنوان میله های برنامه.
نسخه 2.7.7
نسخه 2.7.7
7 فوریه 2024
androidx.navigation:navigation-*:2.7.7 منتشر می شود. نسخه 2.7.7 شامل این تعهدات است.
رفع اشکال
- از ناوبری
2.8.0-alpha01: نشت ثابتBackStackStateکه در آن چندینsaveState()تماس با یکNavBackStackEntryمنفرد منجر به نجات چندین حالت می شود ، اما فقط اولین حالت ذخیره شده می تواند بازگردد. ( i598b0 ، b/309559751 ) - از ناوبری
2.8.0-alpha01استفاده شده است: مسئله ای را برطرف کرد که در آن آرگومان های غیر رشته ای هنگام استفاده از یارانNavigationUIبرای جمع آوری عنوان میله های برنامه به درستی نمایش داده نمی شوند. ( #636 ، b/316676794 )
مشارکت خارجی
- با تشکر از SimonMarquis برای رفع مشکل نمایش برای آرگومان های غیر رشته هنگام استفاده از یاران
NavigationUIبرای جمع آوری عنوان میله های برنامه.
نسخه 2.7.6
نسخه 2.7.6
13 دسامبر 2023
androidx.navigation:navigation-*:2.7.6 منتشر می شود. نسخه 2.7.6 شامل این تعهدات است.
رفع اشکال
- عملکرد
NavGraphequals()اکنون به درستی گره های نمودار دیگر را به جای فقط تماس تلفنی در نظر می گیرد. این تضمین می کند که نمودارهایی که دارای گره هایی با شناسه های مختلف هستند دیگر برابر تلقی نمی شوند ( I401CB ، B/311414915 )
نسخه 2.7.5
نسخه 2.7.5
1 نوامبر 2023
androidx.navigation:navigation-*:2.7.5 منتشر می شود. نسخه 2.7.5 شامل این تعهدات است.
بهبود عملکرد
- عملکرد (هم از نظر زمان و هم تعداد تخصیص) از مقایسه دو نمودار را بسیار بهبود بخشید. این بدان معنی است که تماس هایی مانند
setGraphکه در داخل نمودار جدید با مورد موجود مقایسه می شوند بسیار سریعتر هستند و منجر به کمبود فریم های کمتری می شوند. با تشکر از شما Michał Z برای تجزیه و تحلیل کاملی که منجر به این پیشرفت شد. ( i6ad62 ) -
NavHostاکنون به جای نیاز به صبر کردن برای پاس دوم برای خواندن حالت به روز شده ، مقصد شروع را در اولین پاس ترکیب ارائه می دهد. ( i439a7 ، b/304852206 )
رفع اشکال
- مسئله ای را برطرف کرد که در صورت وجود یک مقصد در نمودار شما که حاوی عملی بود که دو مقصد را پیوند می داد ، پشته پشت شما
setGraphبیش از یک بار با همان نمودار درست خوانده اید. ( IEAED7 ) - دیالوگ هایی که به صورت پشت سر هم به سمت آنها حرکت کرده و برکنار شده اند ، دیگر به لیست
NavController.visibleEntriesنشت نمی کنند. ( i67586 ، b/287969970 ) - هنگامی که یک ورودی به دنبال تغییر پیکربندی ظاهر می شود ، اگر
saveStateنادرست باشد ، اکنونViewModelورودی به درستی پاک می شود. ( IDF242 ، B/298164648 ) - مسئله ای را برطرف کرد که
NavControllerمی تواند بیش از یک بار همان پیوند عمیق را اداره کند اگر پشته پشت کاملاً خالی باشد قبل از تغییر پیکربندی یا تماس باsetGraphفقط در صورتی که قصد ورودی داشته باشد ، پرچمFLAG_ACTIVITY_NEW_TASKرا داشته باشد. ( i73c7f )
به روزرسانی های وابستگی
- ناوبری با قطعات اکنون به قطعه 1.6.2 بستگی دارد و مسئله ای را برطرف می کند که در آن نمونه های
ViewModelقطعات تو در تو در هنگام فراخوانیclearBackStackپاک نمی شوند.
نسخه 2.7.4
نسخه 2.7.4
4 اکتبر 2023
androidx.navigation:navigation-*:2.7.4 منتشر می شود. نسخه 2.7.4 شامل این تعهدات است.
ویژگی های جدید
- پشتیبانی اضافه شده از
popUpToبرای استفاده از مسیرهایی با آرگومان برای بازگشت به یک ورودی خاص که از آن آرگومان های دقیق استفاده می کند ، مطابق با پشتیبانی موجود درpopBackStackاست. ( i731f4 ، b/299255572 )
رفع اشکال
- مشکل را برطرف کنید که در آن قطع حرکت با پیمایش با یک حرکت دیگر با
popUpToباعث خرابیFragmentNavigatorشود. ( i3c848 ، b/301887045 ) - مسئله ثابت که در آن مطبوعات سیستم مطبوعات باعث شده است که
currentDestinationبه درستی به روز نشود تا با قطعه نمایش داده شده مطابقت داشته باشد. ( id0d6c ، b/289877514 ) - چرخه حیات
DialogFragmentدر حال حاضر به درستی به حالتRESUMEDمنتقل می شود که گفتگوی بالای آن برکنار شود. ( i88f0d ، b/301811387 )
نسخه 2.7.3
نسخه 2.7.3
20 سپتامبر 2023
androidx.navigation:navigation-*:2.7.3 منتشر می شود. نسخه 2.7.3 شامل این تعهدات است.
رفع اشکال
- مسئله ای را در ناوبری با قطعاتی که باعث شده لیست
visibleEntriesحاوی ورودی های نادرست باشد ، برطرف کرد. ( i5caa9 ، b/288520638 ) - مسئله ای را که باعث شده مقصد پنجره شناور (یعنی
Dialogs،Bottomsheetsو غیره) برطرف نشود ، هرگز یک پاسخ به چرخه چرخه عمرRESUMED. ( i3b866 ، b/287505132 )
نسخه 2.7.2
نسخه 2.7.2
6 سپتامبر 2023
androidx.navigation:navigation-*:2.7.2 منتشر می شود. نسخه 2.7.2 شامل این تعهدات است.
رفع اشکال
- ناوبری اکنون به چرخه عمر
2.6.2بستگی دارد ، و تعامل بینNavHostComposerememberSaveableو ناوبری را ایجاد می کند که باعث می شود وضعیتrememberSaveableاز مقصد و هرگونهViewModelمتعلق به مواردSavedStateHandleباشد که پس از مرگ و تفریح فرآیند ، به درستی ترمیم می شوند. ( B/298059596 ، B/289436035 ) - رفع مشکل هنگام نمایش چندین گفتگوی در ناوبری به طور همزمان در جایی که گفتگوهای جزئی مبهم (به عنوان مثال ، نه بالاترین گفتگوی) در حالت چرخه زندگی
CREATEDو نه حالتSTARTEDمی شود. ( AOSP/2728520 ، B/289257213 ) - رفع مشکل هنگام نمایش چندین گفتگوی در ناوبری به طور همزمان در جایی که رد کردن بالاترین گفتگوی باعث می شود بیشترین گفتگوی جدید در حالت
STARTEDعمر شروع شود نه اینکه به درستی حرکت کند تاRESUMED. ( AOSP/2629401 ، B/286371387 ) - Navigation Safe استدلال می کند که اگر واقعاً اجرا نشود ، دیگر وظیفه خود را مشتاقانه فوری نمی کند. ( i0e385 ، b/260322841 )
به روزرسانی وابستگی
- Navigation Compose اکنون به آهنگسازی 1.5.1 بستگی دارد.
نسخه 2.7.1
نسخه 2.7.1
23 آگوست 2023
androidx.navigation:navigation-*:2.7.1 منتشر می شود. نسخه 2.7.1 شامل این تعهدات است.
رفع اشکال
- رفع مشکلات در ناوبری با آهنگسازی که در هنگام استفاده از
Scaffoldمی توان خطایی را برای تلاش برای دسترسی به یکLifecycle.State.DESTROYEDViewModelدریافت کرد. ( i1dc11 ، b/268422136 )
نسخه 2.7.0
نسخه 2.7.0
9 آگوست 2023
androidx.navigation:navigation-*:2.7.0 منتشر می شود. نسخه 2.7.0 شامل این تعهدات است.
تغییرات مهم از 2.6.0
انیمیشن های همراهی
اکنون که AnimatedContent پایدار است ، ما توانستیم کد را از انیمیشن ناوبری همراهی به سمت ناوبری خود برگردانیم.
این بدان معناست که تمام پشتیبانی برای تنظیم انتقال های سفارشی که در AnimatedNavHost وجود داشته است ، مستقیماً در NavHost پشتیبانی می شود.
هیچ تغییر اضافی برای همراهی با انیمیشن ناوبری ایجاد نمی شود و ما به زودی به طور رسمی آن را از بین می بریم ، به همراه راهنمایی در مورد چگونگی مهاجرت به ناوبری خود ، اما در صورت استفاده از آخرین ALPHA ( 0.31.2-alpha ) ، معکوس راهنمای مهاجرت خواهد بود. ( b/197140101 )
رفع اشکال
- NAVHOST در ناوبری اکنون به درستی پس از متوقف شدن فعالیت و از سرگیری فعالیت ، به طور صحیح تماس های سیستم را رهگیری می کند. ( ICB6DE ، B/279118447 )
به روزرسانی های وابستگی
- ناوبری اکنون به آهنگسازی
1.5.0از1.1.0بستگی دارد.
نسخه 2.7.0-RC01
26 جولای 2023
androidx.navigation:navigation-*:2.7.0-rc01 منتشر می شود. نسخه 2.7.0-RC01 شامل این تعهدات است.
رفع اشکال
- مسئله ای را برطرف کرد که در آن لامبدهای
EnterTransitionوExitTransitionایجاد شده به عنوان بخشی ازNavHostمی توانند حتی پس از حذفNavHostاز ترکیب ، به طور بالقوه در حافظه بمانند. ( i893d0 )
مسائل شناخته شده
- مشکلی از ناوبری 2.6.x وجود دارد که هنگام پیمایش با پوپوپو می توان باعث
IllegalArgumentExceptionشد. این امکان وجود دارد که با تغییر ساختار نمودار شما ، مشابه توصیه های پیشنهادی در اینجا ، از این استثنا جلوگیری شود. ( b/287133013 )
نسخه 2.7.0-beta02
28 ژوئن 2023
androidx.navigation:navigation-*:2.7.0-beta02 منتشر می شود. نسخه 2.7.0-beta02 شامل این تعهدات است.
رفع اشکال
- Navigation Compose اکنون دارای سفارش Z مناسب برای انتقال های سفارشی است که از گزینه
popUpToاستفاده می کنند. ( /IB1C3A ، B /285153947 )
نسخه 2.7.0-beta01
7 ژوئن 2023
androidx.navigation:navigation-*:2.7.0-beta01 منتشر می شود. نسخه 2.7.0-beta01 شامل این تعهدات است.
رفع اشکال
-
NavHostدر ناوبری اکنون به درستی پس ازSTOPPEDفعالیت وRESUMEDActivity، به طور صحیح تماس های سیستم را رهگیری می کند. ( ICB6DE ، B/279118447 )
نسخه 2.7.0-alpha01
24 مه 2023
androidx.navigation:navigation-*:2.7.0-alpha01 منتشر می شود. نسخه 2.7.0-alpha01 شامل این تعهدات است.
انیمیشن های همراهی
اکنون که AnimatedContent پایدار است ، ما توانستیم کد را از انیمیشن ناوبری همراهی به سمت ناوبری خود برگردانیم.
این بدان معناست که تمام پشتیبانی برای تنظیم انتقال های سفارشی که در AnimatedNavHost وجود داشته است ، مستقیماً در NavHost پشتیبانی می شود.
هیچ تغییر اضافی برای همراهی با انیمیشن ناوبری ایجاد نمی شود و ما به زودی به طور رسمی آن را از بین می بریم ، به همراه راهنمایی در مورد چگونگی مهاجرت به ناوبری خود ، اما در صورت استفاده از آخرین ALPHA ( 0.31.2-alpha ) ، معکوس راهنمای مهاجرت خواهد بود. ( b/197140101 )
رفع اشکال
- از Navigation
2.6.0-rc02: مسئله ای را با ناوبری در قطعاتی که در آن پیمایش باpopUpToو ایجاد یک قطعه از پشت پشته بدون بازآفرینی دیدگاه آن ایجاد می کند ، باعث می شود که سیستم بازگردد. ( IEB8D4 ، B/281726455 )
به روزرسانی های وابستگی
- ناوبری اکنون به آهنگسازی
1.5.0-beta01بستگی دارد.
نسخه 2.6.0
نسخه 2.6.0
7 ژوئن 2023
androidx.navigation:navigation-*:2.6.0 منتشر می شود. نسخه 2.6.0 شامل این تعهدات است.
تغییرات مهم در ناوبری از 2.5.0
-
argumentsNavBackStackEntryوargumentsمنتقل شده به یکOnDestinationChangedListenerاکنون فقط یک نسخه از استدلال های تغییر ناپذیر است که هنگام حرکت به مقصد ایجاد شده است. این بدان معناست که هرگونه تغییر در آن دسته از بسته ها در دسترسی های بعدی بهargumentsیا سایر مواردOnDestinationChangedListenerمنعکس نمی شود. -
NavDeepLinkاکنون از مقادیر پیش فرض برای آرایه ها پشتیبانی می کند ، که امکان پشتیبانی از پارامترهای پرس و جو مکرر را فراهم می کند که به نوع آرایه آرگومان می پردازد.NavTypeهمچنین اکنون یک روش پیش فرض را شامل می شود که می تواند برای ترکیب دو مقدار تجزیه شده بیش از حد باشد. - زیر کلاسهای سفارشی
NavTypeاکنون می تواندserializeAsValueتحت الشعاع قرار دهد تا یک مقدار را در یک رشته سریال کند ، و این امکان را می دهد که هم سریال سازی و هم از بین برود (از طریقparseValue) کاملاً در کلاسNavTypeمحصور شود.StringTypeاکنون این روش را برای تماس باUri.encodeدرStringداده شده غلبه می کند.
تغییرات مهمی در ترکیب ناوبری از 2.5.0
- هنگام پیش نمایش یک ترکیب با
NavHost، اکنونstartDestinationNavgraph را به طور پیش فرض نشان می دهد. -
NavController.popBackStack(route)،NavController.getBackStackEntry(route)،NavController.clearBackStack(route)اکنون همه مسیرهای پشتیبانی را با آرگومان های جزئی یا کاملاً پر از آن پشتیبانی می کنند. توجه داشته باشید که آرگومان ها باید با استدلال های ورودی یک مسابقه دقیق باشند. - تلاش برای ایجاد یک
NavDeepLinkخالی با استفاده ازnavDeepLinkKotlin DSL اکنون منجر به هشدار خط می شود که نشان می دهد یک پیوند عمیق به یک URI ، عمل و/یا mimetype نیاز دارد تا معتبر باشد.
تغییرات مهم در ناوبری با قطعات از 2.5.0
-
NavHostFragmentدیگر دکمه عقب سیستم را رهگیری نمی کند. این امر به شما امکان می دهد کهFragmentManagerزیربنایی سیستم را به عقب برگرداند. این اجازه می دهد تا قطعه1.7.0-alpha01و بالاتر باشد تا یک انیمیشن پشتی درون برنامه ای را در دستگاه های Android U فراهم کند. - هنگام استفاده از ناوبری با قطعات ، تلاش برای انجام دستی یک
FragmentTransactionقطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعهIllegalArgumentExceptionFragmentManagerرا به صورت دستی اضافه می کند. شما همیشه باید قطعات را از طریق APInavigate()اضافه کنید. - هنگام استفاده از رشته دقیق
${applicationId}به عنوان نگهدارنده مکان درapp:dataوapp:dataPatternدر عنصر فعالیت یک پرونده XML ناوبری ، محل نگهدارنده به طور خودکار باpackageNameمتن پس از تورم پر می شود. -
FragmentNavigatorاکنون از API های انتقال در هنگام پیمایش و ظاهر شدنNavBackStackEntriesاستفاده می کند. این بدان معنی است کهLifecycleNavBackStackEntryاکنون منتظر ورود و خروج جلوه های ویژه قطعات قبل از حرکتLifecycle.Stateنهایی خود هستند. -
DialogFragmentNavigatorاکنون هنگام پیمایش و ظاهر شدنNavBackStackEntriesاز API های انتقال استفاده می کند. این بدان معناست کهLifecycleNavBackStackEntryاکنون منتظرLifecycleDialogFragmentمی شود تا قبل از حرکت به سمتDESTROYEDخود ، به سمتDESTROYEDحرکت کند. -
NavHostFragmentاکنون به شما امکان می دهد تا به محض وصل کردنNavHostFragmentبهFragmentManager، به جای اینکه فقط پس ازonCreate()وصل شودNavControllerبازیابی کنید. - پشتیبانی ناوبری از ماژول های ویژگی پویا اکنون به کتابخانه تحویل ویژگی بازی گرانول بستگی دارد.
- Navigation Safe Args اکنون به افزونه Android Gradle نسخه 7.3.0 بستگی دارد. این بدان معنی است که اکنون فقط با نسخه های 7.3.0+ سازگار است.
تغییرات مهم در ناوبری از 2.5.0
- هنگام انتقال شناسه نمودار ناوبری به
AppBarConfiguration(مانند از طریقMenu) ،NavigationUIاکنون فقط مقصد شروع آن نمودار ناوبری را به عنوان یک مقصد سطح بالا می داند ، نه اینکه به طور نادرست هر مقصد را در نمودار به عنوان یک مقصد سطح بالا مشخص کنید. رفتار عبور از شناسه یک مقصد فردی بدون تغییر است. این عملکرد مشابه از طریق عملکرد جدیدisTopLevelDestinationدرAppBarConfigurationدر دسترس است. - ادغام های
setupWithNavControllerدرNavigationUIبرای کار با نوار برنامه برتر ، اکنون مقادیرR.stringرا برای آرگومان هایReferenceTypeموجود درandroid:label. -
NavigationUIاکنون در صورت عدم حرکت از طریقMenuItemانتخاب شده ، سیاهههای مربوط را ارائه می دهد.
نسخه 2.6.0-RC02
24 مه 2023
androidx.navigation:navigation-*:2.6.0-rc02 منتشر می شود. نسخه 2.6.0-RC02 شامل این تعهدات است.
رفع اشکال
- مسئله ای را برای ناوبری در قطعاتی که در آن پیمایش با
popUpToو پر کردن یک قطعه از پشته پشت بدون بازآفرینی دیدگاه آن ایجاد می کند ، ایجاد می کند و باعث می شود سیستم متوقف شود. ( IEB8D4 ، B/281726455 )
نسخه 2.6.0-RC01
10 مه 2023
androidx.navigation:navigation-*:2.6.0-rc01 منتشر می شود. نسخه 2.6.0-RC01 شامل این تعهدات است.
رفع اشکال
- رفع مشکل در ناوبری با قطعاتی که حذف یک قطعه از طریق پیمایش با
popUpToدر پاسخ بهonResume()آن باعثIllegalStateExceptionمی شود. ( I21884 ، b/279644470 )
نسخه 2.6.0-beta01
19 آوریل 2023
androidx.navigation:navigation-*:2.6.0-beta01 منتشر می شود. نسخه 2.6.0-beta01 شامل این تعهدات است.
ویژگی های جدید
-
NavBackStackEntryاکنون یک اجرایtoStringسفارشی را ارائه می دهد. ( iff00b )
رفع اشکال
- هنگام استفاده از ناوبری با قطعات ، تلاش برای انجام دستی یک
FragmentTransactionقطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعه قطعهIllegalArgumentExceptionFragmentManagerرا به صورت دستی اضافه می کند. شما همیشه باید قطعات را از طریق APInavigate()اضافه کنید. ( i6d38e ) - هنگامی که یک
navigateوجود دارد که یک ورودی و یکpopBackStackاضافه می کند که آن را در همان قاب حذف می کند ، ورود بالای آن در پشته پشتی اکنون به طور مداوم آن را بهLifecycle.StateRESUMEDاز سر گرفته می کند. ( id8067 ، b/276495952 )
نسخه 2.6.0-alpha09
5 آوریل 2023
androidx.navigation:navigation-*:2.6.0-alpha09 منتشر می شود. نسخه 2.6.0-alpha09 شامل این تعهدات است.
رفع اشکال
- چک های ثابت برای مسیر نامعتبر به گونه ای که اگر یک
NavDestinationحاویNavArgumentغیر قابل کنترل باشد ، این مسیر این مقصد باید دارای متغیرهایی باشد که برای استدلال هایی به نام های غیر قابل تحملNavArgumentنامگذاری شده است. ( IC62BF ، B/274697949 ) - اگر عملیات ناوبری از دست نرود یک
NavArgumentغیر قابل تهی مورد نیاز توسطNavDestinationکهAction/MimeTypeبا آن مطابقت دارد ، اکنون ناوبری های Deeplink بر اساسAction/MimeTypeشکست خواهند خورد. ( IBFA17 ، B/271777424 ) - هنگامی که
NavControllerنمودار را با همان مسیر و مقصد مانند نمودار قبلی تنظیم می کند ، اکنون به درستی گره های نمودار فعلی و مقصد پشته های پشت آن را با موارد جدید جایگزین می کند. این تصادف هنگام استفاده ازonLaunchSingleTopبدون صرفه جویی در وضعیت در آهنگسازی ناوبری را برطرف می کند. این همچنین خطایی را برطرف می کند که در آن حرکت به مقصد های مرتبط با نمودار ریشه و پشته پشت نادرست است. ( i5bc58 ، b/275258161 ، b/275407804 )
نسخه 2.6.0-alpha08
22 مارس 2023
androidx.navigation:navigation-*:2.6.0-alpha08 منتشر می شود. نسخه 2.6.0-alpha08 شامل این تعهدات است.
ویژگی های جدید
-
NavHostFragmentاکنون به شما امکان می دهد تا به محض وصل کردنNavHostFragmentبهFragmentManager، به جای اینکه فقط پس ازonCreate()وصل شودNavControllerبازیابی کنید. ( IC6382 ، B/220186282 )
رفع اشکال
- رفع یک
NullPointerExceptionهنگام ظاهر شدن یک نمودار تو در تو که شامل یک آرگومان غیر قابل تهی است. ( 6B3581 ، b/249988437 ) - هنگام استفاده از سیستم پس از انجام پیمایش با
popUpTo، وضعیتNavControllerبه ورودی صحیح می رسد. ( i3a8ec ، b/270447657 ) -
FragmentNavigatorاکنون به درستی وارد می شود وقتی که پشته پشت از طریق سیستم به عقب یاpopBackStack()و اینکه آیا معامله از جلوه هایی برای این قطعه استفاده می کند یا خیر. ( i81bdf ) - اضافه کردن قطعات به
FragmentNavigatorFragmentManagerبدون استفاده از ناوبری دیگر باعث تصادف نخواهد شد. ( B17204 ، B/274167493 )
به روزرسانی های وابستگی
- ناوبری اکنون به چرخه عمر
2.6.1بستگی دارد. ( 586fe7 ) - ناوبری اکنون به SaveDstate
1.2.1بستگی دارد. ( 078e4e ) - ناوبری اکنون به ProfileInstaller
1.3.0بستگی دارد. ( 512F0C )
نسخه 2.6.0-alpha07
8 مارس 2023
androidx.navigation:navigation-*:2.6.0-alpha07 منتشر می شود. نسخه 2.6.0-alpha07 شامل این تعهدات است.
رفع اشکال
- انواع
getBackStackEntry،popBackStack،clearBackStackAPI که مسیرها را طی می کنند ، اکنون الگوهای مسیر را با آرگومان های قابل برگشت و پارامترهای پرس و جو قابل تهی می گیرند ( I22294 ، B/269302500 ) - مسئله ای که فراخوانی
clearBackStack()ازNavControllerوضعیت ذخیره شده را در مدیر قطعه مرتبط با پشته پشت پاک شده پاک نمی کند. ( IC1CCE ، B/271190202 ) - رگرسیون را در 2.6.0-alpha06 برطرف کرد که باعث شد
MenuItemاشتباه درBottomNavigationViewهنگام استفاده از سیستم بین زبانه ها برجسته شود. ( i634f6 ، b/270447657 ) - رگرسیون ثابت در 2.6.0-alpha06 که باعث شد
NavBackStackEntryS هنگام استفاده ازAnimationبه حالت رزومه منتقل نشود. ( IB3589 ، B/269646882 )
نسخه 2.6.0-alpha06
22 فوریه 2023
androidx.navigation:navigation-*:2.6.0-alpha06 منتشر می شود. نسخه 2.6.0-alpha06 شامل این تعهدات است.
ویژگی های جدید
- هنگام پیش نمایش یک ترکیب با
NavHost، اکنونstartDestinationNavgraph را به طور پیش فرض نشان می دهد. ( i2b89f )
تغییرات API
- تمام اضافه بار
NavControllerاکنون با@MainThreadnavigateنویسی شده اند تا اطمینان حاصل شود که از آنها در موضوع اصلی فراخوانی می شوند. ( I2C0B0 ، B/263427111 )
رفع اشکال
- هنگام تلاش برای حرکت در حین استفاده از ناوبری قطعات پویا ، تصادف را برطرف کرد. ( i3ee29 ، b/268360479 )
- اشکال ثابت که در آن حرکت به قطعه دیگر از طریق دکمه پشت سیستم ، نوار پایین را به مورد انتخاب شده صحیح به روز نمی کند ( IF559F ، B/269044426 )
مسائل شناخته شده
- هنگام استفاده از ناوبری با قطعات ، چرخه عمر
NavBackStackEntryهنگام استفاده از API هایAnimationنتواندRESUMEDشود. ( b/269646882 ) - هنگام استفاده از ناوبری با قطعات و پیمایش با
BottomNavigation، اگر سعی می کنید یک پشته پشتی را با ورودی های متعدد بازیابی کنید ،BottomMenuItemبه درستی به روز نمی شود. ( b/270447657 ) - هنگام استفاده از ناوبری با قطعات ، پس از بازگرداندن حالت ،
LifecycleNavBackStackEntryهنگامDESTROYEDقطعه آنDESTROYED. ( b/270610768 )
نسخه 2.6.0-alpha05
8 فوریه 2023
androidx.navigation:navigation-*:2.6.0-alpha05 منتشر می شود. نسخه 2.6.0-alpha05 شامل این تعهدات است.
ویژگی های جدید
-
NavController.popBackStack(route)،NavController.getBackStackEntry(route)،NavController.clearBackStack(route)اکنون همه مسیرهای پشتیبانی را با آرگومان های جزئی یا کاملاً پر از آن پشتیبانی می کنند. توجه داشته باشید که آرگومان ها باید با استدلال های ورودی یک مسابقه دقیق باشند. ( IEBD28 ، IC678C ، I3B37B ، B/257514373 ) -
FragmentNavigatorاکنون از API های انتقال در هنگام پیمایش و ظاهر شدنNavBackStackEntriesاستفاده می کند. این بدان معنی است کهLifecycleNavBackStackEntryاکنون منتظر ورود و خروج جلوه های ویژه قطعات قبل از حرکتLifecycle.Stateنهایی خود هستند. ( i3cb19 ، b/238686802 ) -
DialogFragmentNavigatorاکنون هنگام پیمایش و ظاهر شدنNavBackStackEntriesاز API های انتقال استفاده می کند. این بدان معناست کهLifecycleNavBackStackEntryاکنون منتظرLifecycleDialogFragmentمی شود تا قبل از حرکت به سمتDESTROYEDخود ، به سمتDESTROYEDحرکت کند. ( i53ee5 ، b/261213893 )
تغییرات API
-
NavigatorStateاکنون APIprepareForTransitionفراهم می کند تاNavigatorبتواندNavBackStackEntriesبهLifecycle.Stateمتوسط منتقل کند. ( i42c21 ، b/238686802 ) - اکنون می توانید از طریق یک ویژگی
backstackبه پشته پشتی مرتبط با یکNavGraphNavigatorیا یکComposeNavigatorاستفاده کنید.ComposeNavigatorهمچنین اکنون پاسخ به تماسonTransitionComplete()را برای علامت گذاری یکNavBackStackEntryکه یک عملیات پیمایش یاpopBackStackرا انجام داده است ، در معرض نمایش قرار می دهد. ( I02062 ، I718DB ، B/257519195 )
رفع اشکال
- Navigator State هنگام استفاده از API های
push/popWithTransitionاکنون بدون آنکه باشد و از قبل وارد آن می شود. ( IADBFA ، B/261213893 ) - هنگام استفاده از
launchSingleTopبا یکNavGraphتو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در توstartDestinationتو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو در تو است. ( id4bea ، b/253256629 ) - ناوبری اکنون هنگام حرکت به همان مقصد با پرچم
launchSingleTopکه روی True قرار دارد ، به درستی جایگزین نمونهDialogFragmentمی شود. ( i45b5a ، b/149572817 ) - Safeargs Navigation در هنگام استفاده از آرگوارهایی که دقیقاً 19 کاراکتر دارند ، دیگر خطای تلفیقی ایجاد نمی کنند. ( id60bc ، b/257110095 )
نسخه 2.6.0-alpha04
9 نوامبر 2022
androidx.navigation:navigation-*:2.6.0-alpha04 منتشر می شود. نسخه 2.6.0-alpha04 شامل این تعهدات است.
ویژگی های جدید
- زیر کلاسهای سفارشی
NavTypeاکنون می تواندserializeAsValueتحت الشعاع قرار دهد تا یک مقدار را در یک رشته سریال کند ، و این امکان را می دهد که هم سریال سازی و هم از بین برود (از طریقparseValue) کاملاً در کلاسNavTypeمحصور شود.StringTypeاکنون این روش را برای تماس باUri.encodeدرStringداده شده غلبه می کند. ( IE5213 ، b/247637434 ) -
NavigationUIاکنون در صورت عدم حرکت از طریقMenuItemانتخاب شده ، سیاهههای مربوط را ارائه می دهد. ( i2af5a ، b/247730357 )
رفع اشکال
- پیوندهای عمیق ناوبری اکنون به جای اینکه در ابتدای نمودار قرار بگیرند که می تواند عملکرد برنامه را در شروع کار بهبود بخشد ، تنبل شده است. ( IAB0AB )
- تصادف ثابت ناشی از پیمایش پس از پیوند عمیق به یک مقصد با آرگومان های پیش فرض تهی. ( i51c24 ، b/243183636 )
به روزرسانی وابستگی
- پشتیبانی ناوبری از ماژول های ویژگی پویا اکنون به کتابخانه تحویل ویژگی بازی گرانول بستگی دارد. ( IB4DDC )
- Navigation Safe Args اکنون به افزونه Android Gradle نسخه 7.3.0 بستگی دارد. این بدان معنی است که اکنون فقط با نسخه های 7.3.0+ سازگار است. ( i47e49 )
نسخه 2.6.0-alpha03
24 اکتبر 2022
androidx.navigation:navigation-*:2.6.0-alpha03 منتشر می شود. نسخه 2.6.0-alpha03 شامل این تعهدات است.
رفع اشکال
- از ناوبری
2.5.3:NavHostدیگر باعث ایجادNoSuchElementExceptionنمی شود وقتی که هیچ مقصدی برای تهیهCrossfadeدر دسترس نباشد. اکنون فقط از این ترکیب پرش خواهد کرد. ( IEB46E ، B/253299416 ) - از ناوبری
2.5.3: مسئله ای را که در آن حالت صرفه جویی شده (به عنوان مثال ، استفاده ازrememberSaveable) فراموش نشده و هنگام بیرون آمدن یک مقصد از پشته پشتی فراموش نشده و حذف نمی شود. ( i64949 )
به روزرسانی های وابستگی
- ناوبری اکنون به قطعه
1.5.4بستگی دارد. ( ICD424 )
نسخه 2.6.0-alpha02
5 اکتبر 2022
androidx.navigation:navigation-*:2.6.0-alpha02 منتشر می شود. نسخه 2.6.0-alpha02 شامل این تعهدات است.
تغییرات رفتار
- هنگام انتقال شناسه نمودار ناوبری به
AppBarConfiguration(مانند از طریقMenu) ،NavigationUIاکنون فقط مقصد شروع آن نمودار ناوبری را به عنوان یک مقصد سطح بالا می داند ، نه اینکه به طور نادرست هر مقصد را در نمودار به عنوان یک مقصد سطح بالا مشخص کنید. رفتار عبور از شناسه یک مقصد فردی بدون تغییر است. این عملکرد مشابه از طریق عملکرد جدیدisTopLevelDestinationدرAppBarConfigurationدر دسترس است. ( IE936E ، B/238496771 )
رفع اشکال
-
navigation:navigation-fragmentاکنون به نسخه1.5.2قطعه بستگی دارد. ( i00ba4 ) - مورد منوی انتخاب شده دیگر هنگام حرکت به یک مقصد
FloatingWindowمانند گفتگو ، دیگر به روز نمی شود. ( i4cde8 ، b/240308330 )
نسخه 2.6.0-alpha01
7 سپتامبر 2022
androidx.navigation:navigation-*:2.6.0-alpha01 منتشر می شود. نسخه 2.6.0-alpha01 شامل این تعهدات است.
ویژگی های جدید
- ادغام های
setupWithNavControllerدرNavigationUIبرای کار با نوار برنامه برتر ، اکنون مقادیرR.stringرا برای آرگومان هایReferenceTypeموجود درandroid:label. ( i5f803 ، b/167959935 ) -
NavDeepLinkاکنون از مقادیر پیش فرض برای آرایه ها پشتیبانی می کند ، که امکان پشتیبانی از پارامترهای پرس و جو مکرر را فراهم می کند که به نوع آرایه آرگومان می پردازد.NavTypeهمچنین اکنون یک روش پیش فرض را شامل می شود که می تواند برای ترکیب دو مقدار تجزیه شده بیش از حد باشد. ( id68c3 ، b/209977108 ) - هنگام استفاده از رشته دقیق
${applicationId}به عنوان نگهدارنده مکان درapp:dataوapp:dataPatternدر عنصر فعالیت یک پرونده XML ناوبری ، محل نگهدارنده به طور خودکار باpackageNameمتن پس از تورم پر می شود. ( iaabde ، b/234223561 ) - تلاش برای ایجاد یک
NavDeepLinkخالی با استفاده ازnavDeepLinkKotlin DSL اکنون منجر به هشدار خط می شود که نشان می دهد یک پیوند عمیق به یک URI ، عمل و/یا mimetype نیاز دارد تا معتبر باشد. ( I08D2F ، B/154038883 )
تغییرات API
- عملکرد جدید پسوند
NavDestinationرا برای تجزیه برچسب های پویا با آرگومان در قالبandroid:label="{arg}"به رشته. با تجزیه مقادیرR.stringدر مقادیر رشته خود ، آرگومان هایReferenceTypeرا پشتیبانی می کند. ( I07D89 ، B/236269380 )
تغییرات رفتار
-
argumentsNavbackstackentry وargumentsمنتقل شده بهOnDestinationChangedListenerاکنون فقط یک نسخه از استدلال های تغییر ناپذیر است که هنگام حرکت به مقصد ایجاد شده است. این بدان معناست که هرگونه تغییر در آن دسته از بسته ها در دسترسی های بعدی بهargumentsیا سایر مواردOnDestinationChangedListenerمنعکس نمی شود. ( i676f5 )
رفع اشکال
- از ناوبری
2.5.2: ناوبری پویا اکنون به درستی سعی در نصب مقصد فعالیت از سایر ماژول ها قبل از حرکت به آنها دارد. ( IA2C16 ، B/240292838 ) - از ناوبری
2.5.2: ناوبری اکنون هنگام حرکت به همان مقصد و تنظیم پرچمlaunchSingleTopبه درستی ، نمونه قطعه را به درستی جایگزین می کند. ( i5a2f1 ، b/237374580 ) - از ناوبری
2.5.2: ثابتIllegalStateExceptionثابت ناشی از پیمایش به یک نمودار دوقلو که والدین را با یک مقصد جدید شروع می کند ، به اشتراک می گذارد. ( i9f7cb ، b/243778589 )
نسخه 2.5
نسخه 2.5.3
24 اکتبر 2022
androidx.navigation:navigation-*:2.5.3 منتشر می شود. نسخه 2.5.3 شامل این تعهدات است.
رفع اشکال
-
NavHostدر صورت عدم وجود مقصدی برای تهیهCrossfade، دیگر باعث ایجادNoSuchElementExceptionنمی شود. اکنون فقط از این ترکیب پرش خواهد کرد. ( IEB46E ، B/253299416 ) - مسئله ای را برطرف کرد که در آن حالت آهنگسازی ذخیره شده (به عنوان مثال ، استفاده از
rememberSaveable) فراموش نشود و هنگام بیرون آمدن مقصد از پشته پشتی ، فراموش و حذف شد. ( i64949 )
نسخه 2.5.2
7 سپتامبر 2022
androidx.navigation:navigation-*:2.5.2 منتشر می شود. نسخه 2.5.2 شامل این تعهدات است.
رفع اشکال
- ناوبری پویا اکنون به درستی سعی در نصب مقصد فعالیت از سایر ماژول ها قبل از حرکت به آنها دارد. ( IA2C16 ، B/240292838 )
- ناوبری اکنون هنگام حرکت به همان مقصد و تنظیم پرچم
launchSingleTopبه درستی ، به درستی جایگزین نمونه قطعه خواهد شد. ( i5a2f1 ، b/237374580 ) - ثابت
IllegalStateExceptionثابت ناشی از پیمایش به یک نمودار دو توخالی که والدین را با یک مقصد شروع جدید به اشتراک می گذارد. ( i9f7cb ، b/243778589 )
به روزرسانی وابستگی
- ناوبری
2.5.2اکنون به قطعه1.5.2بستگی دارد. ( AOSP/2178734 )
نسخه 2.5.1
27 جولای 2022
androidx.navigation:navigation-*:2.5.1 منتشر می شود. نسخه 2.5.1 شامل این تعهدات است.
رفع اشکال
-
Navigation Safe Argsهنگام استفاده از انواع آرگومان سفارشی که در یکBundleذخیره می شوند ، دیگر باعث هشدارهای استهلاک در کلاسهای تولید شده نمی شوند. ( id86ed ، b/237725966 )
به روزرسانی های وابستگی
- کتابخانه ناوبری اکنون به چرخه عمر
2.5.1بستگی دارد. ( IB4451 ) - کتابخانه ناوبری اکنون به فعالیت
1.5.1بستگی دارد. ( i3efe8 ) - اکنون کتابخانه ناوبری به قطعه
1.5.1بستگی دارد. ( i56177 )
نسخه 2.5.0
29 ژوئن 2022
androidx.navigation:navigation-*:2.5.0 منتشر می شود. نسخه 2.5.0 شامل این تعهدات است.
تغییرات مهم از 2.4.0
- ادغام CreationExtras -
Navigationاکنون این توانایی را دارد که یکViewModelProvider.Factoryارائه دهد. از طریقCreationExtrasاز طریق چرخه عمر2.5.0.
Safeargs Navigation
-
Navigation Safe ArgsوابستگیAndroid Gradle Pluginرا به ارتقاء به7.0.4ارتقا داده است و سازگاری را برای نسخه های AGP قبل از7.0کاهش می دهد. - پشتیبانی اضافه شده برای Namespace Build.Gradle ویژگی مورد استفاده به جای ApplicationID.
سایر تغییرات
- API
visibleEntriesدیگر آزمایشی نیست و تابعی برای بازیابی تمام ورودی هایی که مقصد در حال حاضر مطابق باNavControllerقابل مشاهده است ، فراهم می کند.
نسخه 2.5.0-RC02
15 ژوئن 2022
androidx.navigation:navigation-*:2.5.0-rc02 منتشر می شود. نسخه 2.5.0-RC02 شامل این تعهدات است.
رفع اشکال
- تصادف ناشی از تعویض سریع بین مقصد پایین هنگام استفاده از Navhost Compose
NavHostبرطرف کرد. ( i3979a ، b/234054916 ) -
Navigation SafeArgsهنگام استفاده از یکapplicationIdSuffixو Namespace با هیچapplicationId، یا وقتی کهapplicationIdو فضای نام متفاوت هستند ، دیگر خراب نمی شوند. ( i754b1 ، b/233119646 ) -
NavArgumentاکنون یک تابعtoString()سفارشی برای نشان دادن مقادیر داخلی آرگومان دارد. ( i900a8 )
نسخه 2.5.0-RC01
11 مه 2022
androidx.navigation:navigation-*:2.5.0-rc01 منتشر می شود. نسخه 2.5.0-RC01 شامل این تعهدات است.
ویژگی های جدید
- یک قانون جدید برای هشدار دادن به قرار دادن عناصر
<deeplink>در داخل<activity>عناصر موجود در پروندهnavigation.xmlخود اضافه کرد. ( IC15A5 ، b/178403185 )
رفع اشکال
- دامنه های سازنده در
NavHostوDialogHostاکنون به ترتیب مورد انتظار دفع می شوند ، یعنی ترکیب داخلی قبل از ساختهای بیرونی دفع می شوند. ( i157e6 ) - Navigation SafeArgs اکنون از
PathSensitivity.RELATIVEاستفاده می کند. درArgumentsGenerationTaskبه منظور امکان جابجایی حافظه پنهان امکان پذیر است. این بدان معناست که اکنون می توان از ورود به سیستم CI به ساخت محلی استفاده کرد. ( i5f67c ، b/173420454 ) - قانون LINT
UnrememberedGetBackStackEntryDetectorبه روز شده است تا اطمینان حاصل شود که فراخوانrememberدر مورد تماس باgetBackStackEntry()نیز در یک شیءNavBackStackEntryبه عنوان یک کلید عبور می کند. ( IB7081 ، B/227382831 )
نسخه 2.5.0-beta01
20 آوریل 2022
androidx.navigation:navigation-*:2.5.0-beta01 منتشر می شود. نسخه 2.5.0-beta01 شامل این تعهدات است.
رفع اشکال
-
DialogNavigatorاکنون هنگام اجرای یک تماسdismiss()ازpopWithTransitionاستفاده می کند. این یک وضعیت مسابقه را هنگام استفاده از یکViewModelدر مقصدdialogکه باعث ایجادIllegalStateExceptionدر هنگام رد گفتگو با استفاده از سیستم عقب یا ضربه زدن به خارج از گفتگو برای خروج می شود ، برطرف می کند. ( id7376 ، b/226552301 )
به روزرسانی های وابستگی
- ناوبری اکنون به چرخه عمر
2.5.0-beta01بستگی دارد ، و در هنگام استفاده از چندین پشته پشتی ، یکNavHostدر یک Navhost در یکNavHostدر یک Navhost در یک NAVHOST دیگر در یک NAVHOST در یک NAVHOST در یکIllegalStateExceptionایجاد می کند.
نسخه 2.5.0-alpha04
6 آوریل 2022
androidx.navigation:navigation-*:2.5.0-alpha04 منتشر می شود. نسخه 2.5.0-alpha04 شامل این تعهدات است.
تغییرات API
-
visibleEntriesدیگر آزمایشی نیست. ( i4829f ، b/225394514 )
رفع اشکال
- Navhost اکنون به
visibleEntriesازNavControllerبستگی دارد تا مشخص کند کدام ورودی ها را تشکیل می دهد. این بدان معنی است که هنگام استفاده از Navhost تو در تو ،NavHostداخلی اکنون باید به درستی از بین برود. ( i4ba2b ، b/225394514 ) -
visibleEntriesStateFlowارائه شده توسطNavControllerاکنون به جای حالت چرخه عمر فعلی بر اساس حالت حداکثر چرخه حداکثر است. این بدان معنی است که حتی اگر چرخه عمر میزبانnavControllerاز زیر شروع شود ، لیست موارد قابل مشاهده یکسان خواهد بود. ( i9e2a8 ، b/225394514 ) -
SavedStateViewFactoryاکنون از استفاده ازCreationExtrasپشتیبانی می کند حتی وقتی که با یکSavedStateRegistryOwnerاولیه انجام شد. در صورت ارائه اضافی ، استدلال های اولیه نادیده گرفته می شوند. ( i6c43b ، b/224844583 ) -
NavDeepLinkاکنون می تواند URIS را با یک پارامتر پرس و جو واحد و بدون ارزش تجزیه کند. ( i0efe8 ، b/148905489 ) - رشته خالی اکنون به عنوان آرگومان های معتبر در پیوندهای عمیق در نظر گرفته شده است. ( i70a0d ، b/217399862 )
-
Navigation Safe Argswill no longer crash when using namespaces and noAndroidManifest.xmlis present. ( I17ccf , b/227229815 )
Version 2.5.0-alpha03
23 فوریه 2022
androidx.navigation:navigation-*:2.5.0-alpha03 is released. Version 2.5.0-alpha03 contains these commits.
تغییرات API
- You can now pass in
CreationExtrastoby navGraphViewModelsto create aViewModel. ( I29217 , b/217618359 )
رفع اشکال
-
NavDeepLinksnow properly support encoded new line characters embedded in routes/deep link URIs. ( I513d1 , b/217815060 ) -
CreationExtraswill now work correctly when used withNavBackStackEntriesto create ViewModels. ( I69161 , b/217617710 ) - Navigation Safe Args now supports using the namespace defined in the
build.gradlein place of the package in the AndroidManifest. ( I659ef , b/217414933 )
Version 2.5.0-alpha02
9 فوریه 2022
androidx.navigation:navigation-*:2.5.0-alpha02 is released. Version 2.5.0-alpha02 contains these commits.
رفع اشکال
- From Navigation
2.4.1: TheNavHostFragmentwill now properly set theOnBackPressedDispatcherwhen using viewbinding with nested graphs. ( Ifbb51 , b/214577959 ) - From Navigation
2.4.1: When deep linking through multiple nestedNavGraphs the back stack will now properly include intermediate start destinations. ( I504c0 , b/214383060 )
Version 2.5.0-alpha01
26 ژانویه 2022
androidx.navigation:navigation-*:2.5.0-alpha01 is released. Version 2.5.0-alpha01 contains these commits.
ویژگی های جدید
-
NavBackStackEntrynow integrates with ViewModel CreationExtras, introduced as part of Lifecycle2.5.0-alpha01. ( Ib9fe2 , b/207012490 )
رفع اشکال
- Fixed an issue where accessing a
ViewModelcreated viaby navGraphViewModels()from a Fragment'sonCreate()would fail with anIllegalStateException. ( I8a14d ) -
NavDeepLinks will no longer unnecessarily decode args twice, meaning that the proper args are now passed to your final destination. ( I31b0a , b/210711399 )
Safe Args
- Safe Args now depends on Android Gradle Plugin version 7.0.4. This means that Navigation Safe Args will no longer be compatible with Android Studio versions prior to 7.0, but is now compatible with Android Gradle Plugin 7.1.0 and higher. ( I41c88 , b/213086135 , b/207670704 )
Version 2.4.2
Version 2.4.2
6 آوریل 2022
androidx.navigation:navigation-*:2.4.2 is released. Version 2.4.2 contains these commits.
رفع اشکال
- Backported from Navigation
2.5.0-alpha03:NavDeepLinksnow properly support encoded new line characters embedded in routes/deep link URIs. ( I513d1 , b/217815060 ) - Backported from Navigation
2.5.0-alpha03: Navigation SafeArgs now supports using the namespace defined in thebuild.gradlein place of the package in the AndroidManifest. ( I659ef , b/217414933 ) - Backported from Navigation
2.5.0-alpha04:Navigation Safe Argswill no longer crash when using namespaces and noAndroidManifest.xmlis present. ( I17ccf , b/227229815 ) - Backported from Navigation
2.5.0-alpha04: Empty string are now considered as valid arguments in deep links. ( I70a0d , b/217399862 )
نسخه 2.4.1
نسخه 2.4.1
9 فوریه 2022
androidx.navigation:navigation-*:2.4.1 is released. Version 2.4.1 contains these commits.
رفع اشکال
- The
NavHostFragmentwill now properly set theOnBackPressedDispatcherwhen using viewbinding with nested graphs. ( Ifbb51 , b/214577959 ) - When deep linking through multiple nested
NavGraphs the back stack will now properly include intermediate start destinations. ( I504c0 , b/214383060 ) - Backported from Navigation
2.5.0-alpha01: Fixed an issue where accessing a ViewModel created viaby navGraphViewModels()from a Fragment'sonCreate()would fail with anIllegalStateException. ( I8a14d ) - Backported from Navigation
2.5.0-alpha01:NavDeepLinks no longer unnecessarily decode args twice, meaning that the properly decoded args are now passed to your final destination. ( I31b0a , b/210711399 ) - Backported from Navigation
2.5.0-alpha01: Safe Args now depends on Android Gradle Plugin version 7.0.4. This means that Navigation Safe Args will no longer be compatible with Android Studio versions prior to 7.0, but is now compatible with Android Gradle Plugin 7.1.0 and higher. ( I41c88 , b/213086135 , b/207670704 )
نسخه 2.4.0
نسخه 2.4.0
26 ژانویه 2022
androidx.navigation:navigation-*:2.4.0 is released. Version 2.4.0 contains these commits.
Important changes since 2.3.0
- All Navigation artifacts have been rewritten in Kotlin. This has improved the nullability of classes using generics (such as
NavTypesubclasses). All Kotlin extension functions that used to be part of the-ktxartifacts have been moved to their respective main artifacts. The-ktxartifacts will continue to be published, but are completely empty. - The
navigation-fragmentartifact now contains a prebuilt implementation of a two pane layout via the newAbstractListDetailFragment. This fragment uses aSlidingPaneLayoutto manage a list pane (which your subclass provides) and a detail pane, which uses aNavHostFragmentas its implementation, as seen in our example implementation . - The
currentBackStackEntryAsFlow()method onNavControllerprovides aFlowthat emits whenever the currentNavBackStackEntrychanges. This flow can be used as an alternative to manually managing anOnDestinationChangedListener. - NavController now offers the ability to retrieve a list of all visible
NavBackStackEntryinstances as aStateFlowvia the experimentalvisibleEntriesproperty. - It is now possible to extend the
NavTypeclass to create custom NavTypes. Custom types are supported only when building your navigation graph programmatically, such as via the Navigation Graph Kotlin DSL . Navigation now provides
findStartDestination()andgetHierarchy()APIs that can be used to help implement custom NavigationUI.findStartDestination()is an extension function onNavGraphthat will locate the actual start destination that will be displayed when you navigate to the graph, even if thestartDestinationis itself a nestedNavGraph.getHierarchy()is a function onNavDestinationthat can be used to verify if a given destination is within the hierarchy of another.val matchingRoute: Boolean = destination.hierarchy.any { it.route == routeToFind }NavigationUImethods that took aBottomNavigationViewhave been updated to instead take its superclass introduced in Material1.4.0,NavigationBarView. This allows these methods to be used with theNavigationRailView.When inflating an
<action>element via XML, animation attributes can use attributes pulled from your theme using theapp:enterAnim="?attr/transitionEnter"syntax.Safe Args now generates a
fromSavedStateHandle()method for eachNavArgsclass. ( #122 , b/136967621 )class HomeViewModel(savedStateHandle: SavedStateHandle) : ViewModel() { // Create a HomeDestinationArgs class with type safe accessors for each argument // defined on your destination private val args = HomeDestinationArgs.fromSavedStateHandle(savedStateHandle) }
Navigation Routes and the Kotlin DSL
Previous versions of Navigation relied on each destination having a constant integer ID that would uniquely identify it from its sibling destinations and allow you to navigate() to that destination either directly or via an action. While this continues to be valid and useful, particularly in cases where you are defining your navigation graph in XML and can use auto-generated R.id constants or Safe Args (which uses those constants to generate code at build time), this system of unique integers did not capture the semantic meaning and expressiveness needed to support fully dynamic graphs built programmatically at runtime via the Navigation Kotlin DSL .
This release introduces a new option for uniquely identifying a destination in a navigation graph by its route . A route is a String that defines the unique path to a destination. All Kotlin DSL methods that took a destination ID are now deprecated and replaced with an equivalent API that takes a route.
Each route should be treated as the 'path' part of a Uri that defines that destination, eg, home , profile/{userId} , profile/{userId}/friends , etc. When the identity of a destination is associated with a specific piece of content, those dynamic arguments should be part of the route, following the same rules as implicit deep links .
All NavController APIs that used to only take an ID now have an overload that takes a route String . This includes navigate() , popBackStack() , popUpTo() , and getBackStackEntry() .
This has had some API implications:
- The
popUpToKotlin property on the Kotlin DSL has been deprecated in favor ofpopUpToId. - The
getStartDestination()API has been deprecated in favor ofgetStartDestinationId().
Unlike when navigating by ID, navigating by route follows the same rules as implicit deep links in that you can directly navigate to any destination in any nested graph, ensuring that these routes are usable in multi-module projects without explicitly adding an externally visible deep link to each destination.
Navigation Compose
The navigation-compose artifact provides integration between the Navigation Component and Jetpack Compose . It uses @Composable functions as the destinations in your application.
This release provides:
- A
NavHostcomposable that allows you to construct your navigation graph via a Kotlin DSL, usingcomposableanddialogdestinations, plus support for optional Navigators such as those from Accompanist Navigation Material . - Mandatory support for crossfading between destinations. Accompanist Navigation Animation can be used to control the enter and exit transitions using experimental Compose APIs.
- Scoping of a
Lifecycleto each composable destination. Each destination only reaches theRESUMEDstate when any entering transitions finish and immediately drops toSTARTEDwhen any exiting transitions start, thus allowing you to avoid allIllegalStateExceptionand multi-touch issues by only triggering anavigatecall when theLifecycleisRESUMED. - Scoping of
ViewModel(via theviewModel()API of Lifecycle ViewModel Compose2.4.0orhiltViewModel()of Hilt Navigation Compose1.0.0at the destination level, providing a scope that survives configuration changes and being on the back stack (when your Composable content is otherwise disposed) and a signal in the ViewModel'sonCleared()that indicates the permanent disposal and cleaning up of state associated with thatNavBackStackEntry. - Scoping of
rememberSaveablestate at a destination level, ensuring that all composable state is saved and restored automatically when you return to a destination. - Full support for saving and restoring the state of the
NavControllerand its destination's state after process death and recreation. - Automatic integration with the system back button.
Support for passing arguments, attaching deep links to destinations, and returning a result to previous destinations.
Compose specific helpers in
rememberNavController()andcurrentBackStackEntryAsState()to allow hoisting state and connecting theNavControllerto composables outside of theNavHost(such as a bottom navigation bar).
val navController = rememberNavController()
Scaffold { innerPadding ->
NavHost(navController, "home", Modifier.padding(innerPadding)) {
composable("home") {
// This content fills the area provided to the NavHost
HomeScreen()
}
dialog("detail_dialog") {
// This content will be automatically added to a Dialog() composable
// and appear above the HomeScreen or other composable destinations
DetailDialogContent()
}
}
}
See the Compose Navigation guide for more information.
Multiple back stacks
The NavController is responsible for managing the back stack of destinations, adding destinations to the back stack when you navigate() to them and removing them when you call popBackStack() or trigger the system back button. The existing NavOptions class and the integration into <action> elements in the navigation graph XML has been expanded to support saving and restoring the back stack.
As part of this change, the NavigationUI methods of onNavDestinationSelected() , BottomNavigationView.setupWithNavController() and NavigationView.setupWithNavController() now automatically save and restore the state of popped destinations, enabling support for multiple back stacks without any code changes. When using Navigation with Fragments, this is the recommended way to integrate with multiple back stacks.
The underlying APIs for saving and restoring the state are exposed via a number of surfaces:
In Navigation XML, the
<action>element can now use the boolean attributes ofapp:popUpToSaveStateandapp:restoreStateto save the state of any destinations popped viaapp:popUpToand restore the state associated with the destination passed as theapp:destination:<action android:id=”@+id/swap_stack” app:destination=”@id/second_stack” app:restoreState=”true” app:popUpTo=”@id/first_stack_start_destination” app:popUpToSaveState=”true” />In the
navOptionsKotlin DSL , you can add therestoreStateboolean property and thesaveStateboolean property on thepopUpTobuilder :// Use the navigate() method that takes a navOptions DSL Builder navController.navigate(selectedBottomNavRoute) { launchSingleTop = true restoreState = true popUpTo(navController.graph.findStartDestination().id) { saveState = true } }In manually building a
NavOptionsobject via theNavOptions.Builder, you can use thesetRestoreState()and new overload tosetPopUpTo()that takes an additionalsaveStateparameter.NavOptions navOptions = new NavOptions.Builder() .setLaunchSingleTop(true) .setRestoreState(true) .setPopUpTo(NavGraph.findStartDestination(navController.getGraph()).getId(), false, // inclusive true) // saveState .build(); navController.navigate(selectedBottomNavId, null, navOptions);Programmatic calls to
popBackStack()can now include an additionalsaveStateparameter.You can use the
clearBackStack()method to clear any state that was saved withpopBackStack()orpopUpToSaveState.
In all cases, the NavController will save and restore the state of each NavBackStackEntry , including any navigation destination scoped ViewModel instances. The Navigator APIs have been updated to enable each Navigator to support saving and restoring their own state.
تغییر رفتار
-
NavDeepLinkBuildernow addsPendingIntent.FLAG_IMMUTABLEto thePendingIntentreturned bycreatePendingIntent(), ensuring that this API works as expected when targeting Android 12. - Navigation now depends on Lifecycle
2.3.1and now markssetGraph(),popBackStack(),navigateUp(), andnavigate(), the methods that update theNavBackStackEntryLifecycle, as@MainThread, aligning Navigation with the main thread enforcement introduced in Lifecycle2.3.0. - Deep links now verify that all required arguments (those without default values) are present in the
Uri. -
NavDeepLinkparsed arguments now consider pound signs in the same way as question marks as a separator between path segments, preventing an argument from spanning across the pound sign. - When generating actions, Kotlin code generated from Safe Args now puts arguments without default values before those with default values as parameters.
- When generating arguments, Safe Args now puts parameters without default values before those with default values.
- Safe-Args now depends on Android Gradle Plugin 4.2.0. This means you should no longer get the using
applicationIdTextResourcewarning.
مسائل شناخته شده
- Fixed in Navigation
2.5.0-alpha01: accessing aViewModelcreated viaby navGraphViewModels()from a Fragment'sonCreate()will fail with anIllegalStateException. ( b/213504272 ) - Fixed in Navigation
2.5.0-alpha01: Safe Args 2.4.0 is incompatible with Android Gradle Plugin 7.1.0 and higher. ( b/213086135 ) - Deep linking with multiple nested nav graphs doesn't correctly create the full backstack. ( b/214383060 )
Version 2.4.0-rc01
15 دسامبر 2021
androidx.navigation:navigation-*:2.4.0-rc01 is released. Version 2.4.0-rc01 contains these commits.
تغییر رفتار
-
NavDeepLinkparsed arguments now consider pound signs in the same way as question marks as a separator between arguments. ( I21309 , b/180042703 )
رفع اشکال
- Deeplinks will no longer ignore arguments with values that are the same as the name of the placeholder. ( If8017 , b/207389470 )
-
NavControllerwill no longer crash when popping a nested destination using transitions after theNavControllerhas been restored. ( I0f7c9 , b/205021623 ) - The error message when using an invalid
startDestinationwill now default to the start destination's route if one is available. ( I86b9d , b/208041894 )
Navigation Compose Bug Fixes
- Fixed potential crash caused by fast switching between the start destination and another destination using bottom nav menu items. ( Ic8976 , b/208887901 )
- Dialog destination are now properly restored on top of the screen after config changes or process death. ( I4c0dc , b/207386169 )
- Fixed an issue where attempting to retrieve a
ViewModelfrom a dialog'sNavBackStackEntrywould fail when the dialog was dismissed. ( I6b96d , b/206465487 ) - Fixed an issue when using
activitydestinations with Navigation Compose'sNavHostthat would result in infinite recompositions. ( I8f64c ) - Fixed a leak in Navigation Compose where it was holding on to a reference of the old activity after a config change or process death. ( I4efcb , b/204905432 )
Safe Args Bug Fixes
-
SafeArgsno longer crashes when attempting to restore custom parcelable arrays after process death. ( I618e8 , b/207315994 ) - Fixed a bug in safe args that would not allow boolean arrays to have a
nullvalue. ( I8c396 , b/174787525 )
Version 2.4.0-beta02
3 نوامبر 2021
androidx.navigation:navigation-*:2.4.0-beta02 is released. Version 2.4.0-beta02 contains these commits.
تغییرات API
- The handling of both explicit and implicit deep links now automatically adds the
saveStateflag when navigating to another graph, ensuring that code such asNavigationUI.setupWithNavControllerand code using multiple back stacks works as expected. ( Ic8807 )
تغییرات رفتار
- Deep link patterns are now compiled lazily in NavDeepLink instead of during inflation. This should improve the inflation time of navigation graphs that include deep links. ( b8d257 , b/184149935 )
رفع اشکال
- Fixed an issue where NavBackStackEntries were being pushed down to
Lifecycle.State.CREATEDafter moving toLifecycle.State.STARTEDwhen theNavHostis added directly to the activity'ssetContent(). ( Ia5ac1 , b/203536683 ) - Fixed a race condition where popping a
DialogFragmentdestination off of the back stack before the dialog was actually shown would not actually dismiss the dialog, resulting in a crash when the errant dialog was manually dismissed by the user. ( I687e5 ) - Fixed an issue where the
onNavDestinationSelectedAPI onNavigationUIwould returntrueeven if you didn't actuallynavigate()to that navigation graph. It now uses the same logic used internally bysetupWithNavControllerto only select theMenuItemassociated with the current destination using thehierarchyof the destination. ( I2b053 )
Version 2.4.0-beta01
27 اکتبر 2021
androidx.navigation:navigation-*:2.4.0-beta01 is released. Version 2.4.0-beta01 contains these commits.
ویژگی های جدید
- You can now use
by navGraphViewModelwith a route as an alternative to using an ID so as to better support using the Navigation Kotlin DSL with Fragments. ( I901e3 , b/201446416 )
تغییرات API
- The
visibleEntriesAPI is now experimental. ( I93f6f )
رفع اشکال
- ViewModels will no longer be destroyed when transitions are interrupted by navigating back and forth between the same screens ( Id52d8 , b/200817333 )
- Nullable
NavDeepLinkarguments no longer require a default value when adding deep links toNavDestinations. ( I5aad4 , b/201320030 ) - NavBackStackEntries now with different Lifecycles are not longer considered equal. This means NavHost will properly recompose all destinations when doing navigation with singleTop and when reselecting bottom menu items. ( I1b351 , b/196997433 )
- Fixed an issue with
AbstractListDetailFragmentthat caused thelayout_widthandlayout_weightattributes on the list pane returned byonCreateListPaneView()to be incorrectly handled or ignored. ( f5fbf3 ) - The visual state of dialog destinations now correctly stays in sync with the
DialogFragmentNavigator's state. This means that manually calling the asynchronousdismiss()API forDialogFragmentnow properly clears all dialog destinations above the now dismissed dialog. This does not affect cases where you usepopUpToorpopBackStack()to dismiss your dialog. ( I77ba2 ) -
AbstractAppBarOnDestinationChangedListenernow has clearer error messaging foronDestinationChanged(). ( Ie742d )
Version 2.4.0-alpha10
29 سپتامبر 2021
androidx.navigation:navigation-*:2.4.0-alpha10 is released. Version 2.4.0-alpha10 contains these commits.
ویژگی های جدید
- NavController now offers the ability to retrieve a list of all visible
NavBackStackEntryinstances via thevisibleEntriesStateFlow ( Ia964e ) -
rememberNavController()now takes a optional set ofNavigatorinstances that will be added to the returnedNavControllerto better support optional Navigators such as those from Accompanist Navigation Material . ( I4619e )
رفع اشکال
- Dynamic Navigation will no longer crash when the Activity is recreated. ( Ifa6a3 , b/197942869 )
- Fixed an issue with the system back button that occurs only after popping back to a composable destination that contains a
NavHost. ( 3ed148 , b/195668143 ) - SafeArgs now generates the arguments for
fromBundle()andfromSavedStateHandle()in the proper parameter order. ( I824a8 , b/200059831 )
Version 2.4.0-alpha09
15 سپتامبر 2021
androidx.navigation:navigation-*:2.4.0-alpha09 is released. Version 2.4.0-alpha09 contains these commits.
ویژگی های جدید
- You can now use the
clearBackStack()method to clear any state that was saved withpopBackStack()orpopUpToSaveState. ( I80a0f ) - You can now pass in a list of arguments and/or deep links to your nested navigation graph's builder and they will automatically be added to the resulting graph. ( I8a470 , b/182545357 )
تغییرات API
- The
navArgumentKotlin DSL function is now part ofnavigation-commoninstead ofnavigation-compose. This will require updating imports to continue to use this function. ( I1d095 )
تغییرات رفتار
- When generating arguments, Safe Args now puts parameters without default values before those with default values. ( I89709 , b/198493585 )
رفع اشکال
- When using Navigation Compose, NavGraphs will only be
DESTROYEDonce all their children areDESTROYED. ( I86552 , b/198741720 ) - Nullable
NavDeepLinkarguments no longer require a default value. ( Ia14ef , b/198689811 ) - Calling
setGraph()with a new graph will now also clear any saved back stacks in addition to its previous behavior of popping the back stack. ( I97f96 ) - Fixed an issue where
OnDestinationChangedListenerinstances and thecurrentBackStackEntryFlowwere not notified when usinglaunchSingleTop. ( Iaaebc )
Dependency Updates
- Navigation Compose now depends on Activity Compose 1.3.1 . ( I05829 )
- Navigation Compose now depends on Lifecycle ViewModel Compose
2.4.0-beta01. ( Ib86a3 )
Version 2.4.0-alpha08
1 سپتامبر 2021
androidx.navigation:navigation-*:2.4.0-alpha08 is released. Version 2.4.0-alpha08 contains these commits.
ویژگی های جدید
- It is now possible to extend the
NavTypeclass to create custom NavTypes. Custom types are supported only when building your navigation graph programmatically, such as via the Navigation Graph Kotlin DSL . ( I78440 , b/196871885 )
تغییرات رفتار
- When generating actions, Kotlin code generated from Safe Args now puts arguments without default values before those with default values as parameters. ( Idb697 , b/188855904 )
- Deep links now verify that all required arguments (those without default values) are present in the
Uri. ( #204 , b/185527157 )
رفع اشکال
- Using
getBackStackEntryandpreviousBackStackEntryinside composable(), in conjunction withremember(), will no longer cause an exception for no destination being on the back stack. ( I75138 , b/194313238 ) - Navigation Compose now properly recomposes when changing back stack arguments and using
launchSingleTop=true. ( Iebd69 , b/186392337 ) - There will no longer be an
ArrayIndexOutOfBoundsExceptionwhen callingsetGraphwith a graph with 13 or 29 destinations. ( I1a9f1 , b/195171984 ) - The SafeArgs java generator should no longer cause lint warnings when generating Args classes. ( I1a666 , b/185843837 )
مشارکت خارجی
- Thanks ospixd for ensuring that deep links verify that all required arguments (those without default values) are present in the
Uri. ( #204 , b/185527157 )
Version 2.4.0-alpha07
18 آگوست 2021
androidx.navigation:navigation-*:2.4.0-alpha07 is released. Version 2.4.0-alpha07 contains these commits.
رفع اشکال
- Navigation Compose now properly saves state after configuration changes and when changing graphs while using the multiple back stack feature. ( If5a3d , b/195141957 )
- Re-selecting the same tab when using navigation compose with multiple back stacks will no longer result in a blank screen. ( I860dc , b/194925622 )
-
NavHostnow observes for changes in theLifecycle.StateofNavBackStackEntrys which means using aNavHostin a fragment now will properly be recomposed as the lifecycle changes instead of resulting in a blank screen. ( I4eb85 , b/195864489 ) - Fixed an issue where dismissing a
DialogFragmentwould not correctly update theNavControllerstate after recreating your activity (ie, after a configuration change). ( Icd72b ) - Fixed an issue where popping a dialog destination would not update the NavController's system back button handling, potentially causing the NavController to intercept the back button even though it does not have any back stack to pop. ( If3b34 )
- Safe-args now automatically generates a
toSavedStateHandlemethod for arguments which can be used to test yourViewModelcode. ( If1e2d , b/193353880 )
Version 2.4.0-alpha06
4 آگوست 2021
androidx.navigation:navigation-*:2.4.0-alpha06 is released. Version 2.4.0-alpha06 contains these commits.
تغییرات API
- The
requireSlidingPaneLayout()andrequireDetailPaneNavHostFragment()methods onAbstractListDetailFragmenthave been renamed togetSlidingPaneLayout()andgetDetailPaneNavHostFragment(), respectively. ( I34a08 )
تغییرات رفتار
- When navigating with animations (like
Crossfade), the new destination'sLifecyclewill now only reach theRESUMEDwhen the animation completes. ( If0543 , b/172112072 , b/194301889 ) - Navigation Compose's
NavHostnow sets the graph as part of the first composition. ( Ieb7be )
رفع اشکال
- Popping the last destination of a navigation graph no longer throws a
ClassCastException. ( If0543 , b/172112072 , b/194301889 ) - Fixed a
NullPointerExceptionthat would occur when adding a deep link without aUriand navigating via a route or deep link. ( 938a0c , b/193805425 ) - Fixed an issue in Navigation Compose where a deep linked
NavBackStackEntrywould not reach theRESUMEDstate. ( I192c5 ) - Fixed an issue where popping a dialog destination would not update the NavController's system back button handling, potentially causing the NavController to intercept the back button even though it does not have any back stack to pop. ( aosp/1782668 )
Version 2.4.0-alpha05
21 جولای 2021
androidx.navigation:navigation-*:2.4.0-alpha05 is released. Version 2.4.0-alpha05 contains these commits.
تغییرات رفتار
- Navigation Compose's
NavHostnow always uses Crossfades when navigating through destinations. ( I07049 , b/172112072 ) - You can now make changes to the graph of a NavHost. Graphs with the same startDestination and destinations in the graph will be considered equal and will not clear the
NavControllerback stack. ( I0b8db , b/175392262 )
رفع اشکال
- Fixed a
NoSuchElementExceptionwhen callingpopBackStack()from within aLifecycleObserverattached to aNavBackStackEntrycaused by reentrant updates to the NavController's state. ( I64621 ) -
AbstractListDetailFragmentnow allowsSlidingPaneLayoutto be completely stripped from your APK whenAbstractListDetailFragmentis not used. ( I611ad ) -
NavGraphandNavDestinationnow override the equals method so two objects with the same values will be considered equal. ( I166eb , b/175392262 )
Version 2.4.0-alpha04
1 ژوئیه 2021
androidx.navigation:navigation-*:2.4.0-alpha04 is released. Version 2.4.0-alpha04 contains these commits.
ویژگی های جدید
- The
navigation-fragmentartifact now contains a prebuilt implementation of a two pane layout via the newAbstractListDetailFragment. This fragment uses aSlidingPaneLayoutto manage a list pane (which your subclass provides) and a detail pane, which uses aNavHostFragmentas its implementation, as seen in our example implementation . ( Iac4be , b/191276636 ) - The
NavHostof thenavigation-composeartifact now supportsdialogdestinations in addition tocomposabledestinations. These dialog destinations will each be shown within a ComposableDialog, floating above the currentcomposabledestination. ( I011d0 )
val navController = rememberNavController()
Scaffold { innerPadding ->
NavHost(navController, "home", Modifier.padding(innerPadding)) {
composable("home") {
// This content fills the area provided to the NavHost
HomeScreen()
}
dialog("detail_dialog") {
// This content will be automatically added to a Dialog() composable
// and appear above the HomeScreen or other composable destinations
DetailDialogContent()
}
}
}
تغییرات API
- The
addfunction inNavigatorStatehas been renamed topush. All current calls toadd()will need to be changed to push(). ( Ie89fc , b/172112072 ) - Custom
Navigatorinstances can now use thepushWithTransactionandpopWithTransitionAPIs onNavigatorStateto push or pop a destination asynchronously. Note that this APIs are not yet used by any of the included navigators. ( Ic4d7c , b/172112072 )
تغییرات رفتار
-
NavDeepLinkBuildernow addsPendingIntent.FLAG_IMMUTABLEto thePendingIntentreturned bycreatePendingIntent(), ensuring that this API works as expected when targeting Android 12. ( If8c52 )
رفع اشکال
- Fixed an issue with
<include-dynamic>where arguments passed to the graph would not be correctly passed to the dynamically included graph. ( I3e115 ) - Fixed a
NullPointerExceptionwhen navigating to a destination using astring[]argument with a default value of@null. ( I1fbe8 ) - Add ProGuard rules for
@Navigator.Name, fixing issues when using R8 3.1 full mode. ( I2add9 , b/191654433 ) - SafeArgs will no longer fail when building your app with
Kotlinversions before1.5.0. ( Icd1ff , b/190739257 )
Version 2.4.0-alpha03
16 ژوئن 2021
androidx.navigation:navigation-*:2.4.0-alpha03 is released. Version 2.4.0-alpha03 contains these commits.
رفع اشکال
- Fixed an issue where two
navigate()calls were needed to navigate to an included dynamic graph. ( I7785c , b/188859835 ) - Fixed a regression introduced in Navigation
2.4.0-alpha01wheresetupActionBarWithNavController()would not properly remove the Up icon when you are on a top level destination. ( I5d443 , b/189868637 ) - Fixed an
IllegalStateExceptionwhen callingpopBackStack()after previously popping the root graph of the NavController. ( I2a330 , b/190265699 ) - ProGuard rules for
by navArgs()now properly apply when usingnavigation-commonor any artifacts that depend on it. ( I68800 , b/190082521 ) - An
OnDestinationChangedListenerthat callsnavigate()the first time it receives a callback now properly get a second callback with the destination it navigated to. ( Ie5f9e , b/190228815 ) - Safe Args no longer crashes when using it with dynamic feature modules and AGP 7.0+. ( I69518 , b/189966576 )
Known Issue
- Safe Args will fail with an
Unable to find method ''java.lang.String kotlin.text.CarsKt.titleCase(char, java.util.Locale)''error when using Gradle6.7.0due to a dependency on an older version of Kotlin. This can be worked around by updating to use Gradle 7.0. ( b/190739257 )
Version 2.4.0-alpha02
2 ژوئن 2021
androidx.navigation:navigation-*:2.4.0-alpha02 is released. Version 2.4.0-alpha02 contains these commits.
ویژگی های جدید
- Routes are now supported for Activity, Fragment and Dialog destinations, as well as throughout the DynamicNavigation Kotlin DSL. ( Ib5544 , Ia617b , I22f96 , b/188914648 , b/188901565 )
-
NavigationUIhas temporarily added experimental APIs to allow opting out of saving your state. While always saving the state is the correct behavior, there are still uses of deprecated libraries (ie retained fragments), that cannot be supported when saving the state so this gives an opportunity for apps to slowly convert away from any unsupported APIs. ( Idf93c ) Navigation now provides
findDestination()andgetHierarchy()APIs that can be used to help implement custom NavigationUI.findDestination()is an extension function onNavGraphthat will locate a destination within the graph.getHierarchy()is a function onNavDestinationthat can be used to verify if a given destination is within the hierarchy of another.( I2932f , b/188183365 )val matchingRoute: Boolean = destination.hierarchy.any { it.route == routeToFind }NavigationUI methods that took a
BottomNavigationViewhave been updated to instead take its superclass introduced in Material1.4.0,NavigationBarView. This allows these methods to be used with theNavigationRailView. ( Ib0b36 , b/182938895 )When inflating an
<action>element via XML, animation attributes can use attributes pulled from your theme using theapp:enterAnim="?attr/transitionEnter"syntax. ( I07bc1 , b/178291654 )
تغییرات API
- Kotlin DSL builders that use an ID have been deprecated and should be replaced with builders that use routes ( I85b42 , b/188816479 ) ( I9f58f , b/188816479 )
رفع اشکال
-
DialogFragmentNavigatornow uses theNavigatorState.pop()API to inform theNavControllerwhen a dialog is dismissed by hitting the system back button or clicking outside of it, ensuring that theNavControllerstate is always in sync with the Navigator's state. ( I2ead9 ) Navigation no longer gives a
ConcurrentModificationExceptionwhen using manipulating the list ofOnDestinationChangedListenersfrom with anonDestinationChangedcallback. ( Ib1707 , b/188860458 )Safe Args no longer crashes when attempting to generate direction properties in Kotlin. ( Id2416 , b/188564435 )
The setId method on NavDestination is now properly annotated with
@IdRes, so it only accepts resource ids. ( I69b80 )The int parameter of
findNodeis nowresIdinstead ofresid. ( I7711d )
Dependency Update
- Safe-Args now depends on Android Gradle Plugin 4.2.0. This means you should no longer get the using
applicationIdTextResourcewarning. ( I6d67b , b/172824579 )
Version 2.4.0-alpha01
18 مه 2021
androidx.navigation:navigation-*:2.4.0-alpha01 is released. Version 2.4.0-alpha01 contains these commits.
ویژگی های جدید
- The
currentBackStackEntryAsFlow()method onNavControllerprovides aFlowthat emits whenever the currentNavBackStackEntrychanges. This flow can be used as an alternative to manually managing anOnDestinationChangedListener. ( I19c4a , #89 , b/163947280 )
Multiple back stacks
The NavController is responsible for managing the back stack of destinations, adding destinations to the back stack when you navigate() to them and removing them when you call popBackStack() or trigger the system back button. The existing NavOptions class and the integration into <action> entries in the navigation graph XML has been expanded to support saving and restoring the back stack. ( b/80029773 )
As part of this change, the NavigationUI methods of onNavDestinationSelected() , BottomNavigationView.setupWithNavController() and NavigationView.setupWithNavController() now automatically save and restore the state of popped destinations, enabling support for multiple back stacks without any code changes. When using Navigation with Fragments, this is the recommended way to integrate with multiple back stacks. ( Ie07ca )
The underlying APIs for saving and restoring the state are exposed via a number of surfaces:
In Navigation XML, the
<action>element can now use the boolean attributes ofapp:popUpToSaveStateandapp:restoreStateto save the state of any destinations popped viaapp:popUpToand restore the state associated with the destination passed as theapp:destination:<action android:id=”@+id/swap_stack” app:destination=”@id/second_stack” app:restoreState=”true” app:popUpTo=”@id/first_stack_start_destination” app:popUpToSaveState=”true” />In the
navOptionsKotlin DSL , you can add therestoreStateboolean property and thesaveStateboolean property on thepopUpTobuilder :// Use the navigate() method that takes a navOptions DSL Builder navController.navigate(selectedBottomNavRoute) { launchSingleTop = true restoreState = true popUpTo(navController.graph.startDestinationId) { saveState = true } }In manually building a
NavOptionsobject via theNavOptions.Builder, you can use thesetRestoreState()and new overload tosetPopUpTo()that takes an additionalsaveStateparameter.NavOptions navOptions = new NavOptions.Builder() .setLaunchSingleTop(true) .setRestoreState(true) .setPopUpTo(navController.getGraph().getStartDestinationId(), false, // inclusive true) // saveState .build(); navController.navigate(selectedBottomNavId, null, navOptions);Programmatic calls to
popBackStack()can now include an additionalsaveStateparameter.
In all cases, the NavController will save and restore the state of each NavBackStackEntry , including any navigation destination scoped ViewModel instances. The Navigator APIs have been updated to enable each Navigator to support saving and restoring their own state.
The ComposeNavigator used for composable destinations in Navigation Compose and the FragmentNavigator and DynamicFragmentNavigator used for <fragment> destinations in Navigation with Fragments have both been updated to use the new Navigator APIs and support saving and restoring state.
Navigation Routes
A route is a String that uniquely identifies a destination. While previously only used in Navigation Compose , this concept has now graduated to become a part of the core Navigation APIs. This provides an alternative to using integer IDs when constructing your graph through the Navigation Kotlin DSL . ( b/172823546 )
All APIs that used to only take an ID now have an overload that takes a route String . This includes navigate() , popBackStack() , popUpTo() , and getBackStackEntry() .
This has had some API implications:
- The
popUpTokotlin property on the Kotlin DSL has been deprecated in favor ofpopUpToId. ( I59c73 , b/172823546 ) - The
getStartDestination()API has been deprecated in favor ofgetStartDestinationId(). ( I0887f , b/172823546 )
For developers upgrading from previous versions of Navigation Compose to Navigation Compose 2.4.0-alpha01 , this means that the following imports on extension methods are no longer necessary and should be removed:
import androidx.navigation.compose.navigation
import androidx.navigation.compose.createGraph
import androidx.navigation.compose.getBackStackEntry
import androidx.navigation.compose.navigate
import androidx.navigation.compose.popUpTo
The KEY_ROUTE argument has been replaced with the route property on NavDestination , allowing you to call navBackStackEntry.destination.route directly.
تغییرات API
- All Navigation artifacts have been rewritten in Kotlin. This has improved the nullability of classes using generics (such as
NavTypesubclasses). All Kotlin extension functions that used to be part of the-ktxartifacts have been moved to their respective main artifacts. The-ktxartifacts will continue to be published, but are completely empty. ( b/184292145 ) -
NavDeepLinkBuildernow supports adding multiple distinct destinations to the generated back stack. ( I3ee0d , b/147913689 ) - Add factory functions for
DynamicNavHostFragment( Icd515 , b/175222619 ) - The unique ID of a
NavBackStackEntryis now exposed as part of its public API. ( Ie033a ) - The
nameandargumentfields and destructuring functions ofNamedNavArgumentare now public. ( #174 , b/181320559 ) - Introduced a new
NavBackStackEntry#provideToCompositionLocalsextension that provides theNavBackStackEntryto the relevant composition locals. ( #175 , b/187229439 )
Safe Args
Safe Args now generates a
fromSavedStateHandle()method for eachNavArgsclass. ( #122 , b/136967621 )class HomeViewModel(savedStateHandle: SavedStateHandle) : ViewModel() { // Create a HomeDestinationArgs class with type safe accessors for each argument // defined on your destination private val args = HomeDestinationArgs.fromSavedStateHandle(savedStateHandle) }Updated Safe Args to depend on KotlinPoet
1.8.0. ( #172 , b/183990444 )
تغییرات رفتار
- Navigation now depends on Lifecycle
2.3.1and now markssetGraph(),popBackStack(),navigateUp(), andnavigate(), the methods that update theNavBackStackEntryLifecycle, as@MainThread, aligning Navigation with the main thread enforcement introduced in Lifecycle2.3.0. ( b/171125856 ) - Parsing Enum arguments from deep links is now case insensitive, allowing a deep link like
http://www.example.com/redto match awww.example.com/{color}deep link even when the enum has the value ofRED. ( #152 , b/135857840 )
Compose Compatibility
-
androidx.navigation:navigation-compose:2.4.0-alpha01is only compatible with Compose version1.0.0-beta07and above.
رفع اشکال
- Fixed an issue where trailing argument placeholders would take precedence over deep links that have a matching exact suffix. ( #153 , b/184072811 )
-
NavHostFragmentnow supports custom Navigators that use the same@Navigator.Name("dialog")as the defaultDialogFragmentNavigator. ( Ib1c2c , b/175979140 ) - Improved the behavior of
NavigatorProvider#addNavigatorto ensure that calling it repeatedly with the same instance does not cause issues. ( #176 , b/187443146 )
External Contributions
- Thanks simonschiller for building support for Safe Args generating a
fromSavedStateHandle()method for eachNavArgsclass. ( #122 , b/136967621 ) - Thanks Bradleycorn for making parsing Enum arguments from deep links case insensitive. ( #152 , b/135857840 )
- Thanks osipxd for fixing an issue where trailing argument placeholders would take precedence over deep links that have a matching exact suffix. ( #153 , b/184072811 )
- Thanks tatocaster for updating Safe Args to depend on KotlinPoet
1.8.0. ( #172 , b/183990444 ) - Thanks jossiwolf for making the
nameandargumentfields and destructuring functions ofNamedNavArgumentpublic. ( #174 , b/181320559 ) - Thanks jossiwolf for introducing a new
NavBackStackEntry#provideToCompositionLocalsextension that provides theNavBackStackEntryto the relevant composition locals. ( #175 , b/187229439 ) - Thanks jossiwolf for improved the behavior of
NavigatorProvider#addNavigatorto ensure that calling it repeatedly with the same instance does not cause issues. ( #176 , b/187443146 )
Navigation Compose Version 1.0.0
نسخه 1.0.0-alpha10
7 آوریل 2021
androidx.navigation:navigation-compose:1.0.0-alpha10 is released. نسخه 1.0.0-alpha10 شامل این تعهدات است.
تغییرات API
-
NavHostnow accepts aModifier, which is passed down to the composable container that wraps the destination composables. ( I85aca , b/175125483 )
رفع اشکال
-
NavHostnow works even when anOnBackPressedDispatcherOwneris not found, such is the case when previewing theNavHost. ( I7d8b4 ) - Navigation Compose now depends on Navigation
2.3.5, fixing an issue when usingBackHandlerinside aNavHostdestination. ( I7e63b , b/182284739 )
نسخه 1.0.0-alpha09
10 مارس 2021
androidx.navigation:navigation-compose:1.0.0-alpha09 is released. نسخه 1.0.0-alpha09 شامل این تعهدات است.
تغییرات API
-
LocalViewModelStoreOwner.currentnow returns a nullableViewModelStoreOwnerto better determine whether aViewModelStoreOwneris available in the current composition. APIs that require aViewModelStoreOwner, such asviewModel()andNavHost, still throw an exception if aViewModelStoreOwneris not set. ( Idf39a )
رفع اشکال
- Navigation Compose now depends on Navigation 2.3.4 which includes the fix for attempting to set the same ViewModelStore object after the graph has been set. ( I65c24 , b/177825470 )
نسخه 1.0.0-alpha08
24 فوریه 2021
androidx.navigation:navigation-compose:1.0.0-alpha08 is released. نسخه 1.0.0-alpha08 شامل این تعهدات است.
ویژگی های جدید
-
NavHostnow populates theLocalSavedStateRegistryOwnerCompositionLocal with that destination'sNavBackStackEntry, ensuring that any state directly saved into theSavedStateRegistrywill be saved and restored alongside the destination. ( I435d7 , b/179469431 )
نسخه 1.0.0-alpha07
10 فوریه 2021
androidx.navigation:navigation-compose:1.0.0-alpha07 is released. نسخه 1.0.0-alpha07 شامل این تعهدات است.
Dependency Updates
- Navigation Compose now depends on Lifecycle ViewModel Compose 1.0.0-alpha01 to provide
viewModel()support tocomposabledestinations. ( I7a374 ) -
NavHostnow uses the newLocalOnBackPressedDispatcherOwnerfrom Activity-Compose 1.3.0-alpha01 to get theOnBackPressedDispatcherthat is set on theNavController. ( I65b12 )
نسخه 1.0.0-alpha06
28 ژانویه 2021
androidx.navigation:navigation-compose:1.0.0-alpha06 is released. نسخه 1.0.0-alpha06 شامل این تعهدات است.
تغییرات API
- Added a
getBackStackEntry(route: String)extension method onNavControllerthat returns the associatedNavBackStackEntry. ( If8931 )
نسخه 1.0.0-alpha05
13 ژانویه 2021
androidx.navigation:navigation-compose:1.0.0-alpha05 is released. نسخه 1.0.0-alpha05 شامل این تعهدات است.
Updated to depend on Compose 1.0.0-alpha10.
نسخه 1.0.0-alpha04
16 دسامبر 2020
androidx.navigation:navigation-compose:1.0.0-alpha04 is released. نسخه 1.0.0-alpha04 شامل این تعهدات است.
- Updated for compatibility with Compose
1.0.0-alpha09.
نسخه 1.0.0-alpha03
2 دسامبر 2020
androidx.navigation:navigation-compose:1.0.0-alpha03 is released. نسخه 1.0.0-alpha03 شامل این تعهدات است.
رفع اشکال
- Fixed an issue where
popBackStack()andnavigateUp()would not work after a configuration change or process death and recreation. ( Icea47 , b/173281473 ) - Navigating to a nested graph within your NavHost now works properly. ( I0948d , b/173647694 )
نسخه 1.0.0-alpha02
11 نوامبر 2020
androidx.navigation:navigation-compose:1.0.0-alpha02 is released. Version 1.0.0-alpha02 contains these commits.
تغییرات API
- Navigation compose now support NavOptions for using popUpTo and launchSingleTop operations ( If96c3 , b/171468994 )
- Added a navigation function that takes a route instead of an ID that allows you to construct nested graphs in the Navigation Compose DSL. ( I1661d )
- startDestination now comes before the route in the list of a parameters for a NavHost ( Ie620e )
- You can now create a graph using the route as a start destination outside of a NavHost composable. ( Iceb75 )
Version 1.0.0-alpha01
28 اکتبر 2020
android.navigation:navigation-compose:1.0.0-alpha01 is released. نسخه 1.0.0-alpha01 شامل این تعهدات است.
ویژگی های جدید
The navigation-compose artifact provides integration between the Navigation Component and Jetpack Compose . It uses @Composable functions as the destinations in your application.
This initial release provides:
- A
NavHostcomposable that allows you to construct your navigation graph via a Kotlin DSL. - Scoping of lifecycle,
ViewModel, and remembered state at the destination level. - Automatic integration with the system back button.
- Support for passing arguments, attaching deep links to destinations, and returning a result to previous destinations.
- Compose specific helpers in
rememberNavController()andcurrentBackStackEntryAsState()to allow hoisting state and connecting theNavControllerto composables outside of theNavHost(such as a bottom navigation bar).
See the Compose Navigation guide for more information.
Version 2.3.5
Version 2.3.5
7 آوریل 2021
androidx.navigation:navigation-*:2.3.5 is released. Version 2.3.5 contains these commits.
ویژگی های جدید
- When navigating using a
NavDeepLinkRequestorUri, you can now access theUri, action, and mime type in the resulting destination by getting the intent from arguments viaKEY_DEEP_LINK_INTENT, mirroring the functionality already available for external deep linking. ( I975c3 , b/181521877 )
رفع اشکال
-
OnBackPressedCallbacksadded to a dispatcher with theNavBackStackEntryas the LifecycleOwner now properly intercept back after the Activity Lifecycle isSTOPPED, thenSTARTED( Iff94f , b/182284739 ) - Deep link domain parsing is now case insensitive, ensuring that
www.example.commatches bothwww.example.comandwww.Example.com. Note that query parameter names are still case sensitive. ( #144 , b/153829033 ) - Fixed a
NullPointerExceptionthat could occur when a destination has multiple non-nullable default arguments and you navigate to that destination while only overriding a subset of those arguments. ( aosp/1644827 )
Dependency Updates
- The Navigation Safe Args Gradle Plugin now depends on Kotlin Gradle Plugin 1.4.31. ( aosp/1661058 , b/181156413 )
مشارکت خارجی
- Thanks
bentrengrovefor the pull request making deep link domain parsing case insensitive. ( #144 , b/153829033 )
Version 2.3.4
Version 2.3.4
10 مارس 2021
androidx.navigation:navigation-*:2.3.4 is released. Version 2.3.4 contains these commits.
ویژگی های جدید
-
ReferenceTypearguments can now be properly parsed when sent as part of a deeplink URI. This supports both the raw integer value as well as hex values prefixed by0x. ( #127 , b/179166693 ) - The
android:defaultValuefor an argument withapp:argType="float"now supports integer default values, allowing you to useandroid:defaultValue="0"rather than requiring the use of0.0. ( #117 , b/173766247 )
رفع اشکال
- Fix stuck installation progress when using Navigation's support for dynamic features. ( Ib27a7 , b/169636207 )
- Calling
setViewModelStoreorsetLifecycleOwnerwith the same object that has already been set will now be a no-op ( Idf491 , b/177825470 ) - Safe-Args now adds suppress annotations on the proper methods when using java. ( I8fbc5 , b/179463137 )
External Contributions
- Thanks
JvmNamefor the pull request to ensure thatReferenceTypearguments can now be properly parsed when sent as part of a deeplink URI. ( #127 , b/179166693 ) - Thanks
tatocasterfor the pull request to allow thedefaultValuefor an argument withapp:argType=”float”now supports integer default values. ( #117 , b/173766247 )
Version 2.3.3
Version 2.3.3
27 ژانویه 2021
androidx.navigation:navigation-*:2.3.3 is released. Version 2.3.3 contains these commits.
رفع اشکال
- There is no longer a crash when popping a
NavBackStackEntrybefore itsLifecycleis moved toCREATED. ( Ie3ba3 ) - Fixed regression caused by b/171364502 where navigating to an activity with an animation resource value of
0caused aResourceNotFoundException. ( I7aedb , b/176819931 )
نسخه 2.3.2
نسخه 2.3.2
2 دسامبر 2020
androidx.navigation:navigation-*:2.3.2 is released. Version 2.3.2 contains these commits.
رفع اشکال
- Fixed a regression in
NavigationUIwhere using an<activity>destination withonNavDestinationSelectedwould fail to navigate to the Activity. ( I22e34 , b/171364502 ) - Fixed an issue where
navigation-dynamic-features-fragmentwould result in navigating to the newly installed destination multiple times. ( aosp/1486056 , b/169636207 ) - Fixed an issue where default arguments would not be sent to
OnDestinationChangedListenerinstances when usinglaunchSingleTop. ( I2c5cb ) - Fixed an issue where navigating to a nested navigation graph would not create a new graph instance on the back stack. ( Ifc831 )
- Fixed an issue where using
navigate()with apopUpTothat removed the last destination in a navigation graph would not immediately destroy and remove the navigation graph itself from the back stack. ( I910a3 ) - Navigation SafeArgs now uses KotlinPoet version 1.7.2 which adds support for Kotlin's explicit API mode. ( I918b5 )
-
NavHostFragment.findNavController(Fragment)now also checks the root decor view of a DialogFragment in addition to the existing checks of the Fragment hierarchy and Fragment's view hierarchy. This allows you to test dialog fragments that use Navigation withFragmentScenarioandNavigation.setViewNavController(). ( I69e0d )
نسخه 2.3.1
نسخه 2.3.1
14 اکتبر 2020
androidx.navigation:navigation-*:2.3.1 is released. Version 2.3.1 contains these commits.
ویژگی های جدید
- Default Animator resources have been added to Navigation UI and are recommended over the default animation resources. ( b/167430145 )
- NavOptions now overrides the hashcode and equals methods ( b/161586466 )
- Navigation now includes the current destination in the “No destination with ID” IllegalArgumentException, which should improve the developer debugging experience. ( b/168311416 )
رفع اشکال
- Safe Args will no longer wrap the return line, even if the generated argument class name is longer than 100 characters. ( b/168584987 )
Dependency Changes
-
navigation-uinow depends on DrawerLayout 1.1.1 , ensuring thatNavigationUIis able to open the drawer even when usingLOCK_MODE_LOCKED_CLOSEDorLOCK_MODE_LOCKED_OPEN. ( b/162253907 ) - Safe Args now depends on KotlinPoet 1.6.0 ( aosp/1435911 )
- Safe Args now depends on AGP 4.0.1 ( aosp/1442337 )
نسخه 2.3.0
نسخه 2.3.0
24 ژوئن 2020
androidx.navigation:navigation-*:2.3.0 is released. Version 2.3.0 contains these commits.
Major changes since 2.2.0
- Feature Module integration : The
navigation-dynamic-features-runtimeandnavigation-dynamic-features-fragmentartifacts allow you to navigate to destinations that are defined in feature modules, automatically handling the installation of the feature modules as needed. See Navigate with feature modules for more information. - Navigation Testing : The
navigation-testingartifact provides aTestNavHostControllerthat allows you to set the current destination and verify the back stack after navigation operations. See Test Navigation for more information. - Returning a Result : The
NavBackStackEntryassociated with each destination on the Navigation back stack now allows you to access aSavedStateHandlesuitable for storing small amounts of saved state that should be associated with a particular back stack entry. See Returning a result to the previous Destination for more information. -
NavigationUIsupport forOpenable: All usages ofDrawerLayoutinNavigationUIhave been replaced with the more genericOpenableinterface added in CustomView1.1.0and implemented byDrawerLayoutin DrawerLayout1.1.0. - Action and Mime Type support in deep links : Deep linking has been expanded to support
app:actionandapp:mimeTypein addition to theapp:uripreviously available.NavControllernow supports navigating by any combination of these fields via the newNavDeepLinkRequestclass. See Navigate using NavDeepLinkRequest for more information.
مسائل شناخته شده
- Support for deep link actions and mime types is not yet available in Manifest Merger . Until that work is completed, any generated
<intent-filter>elements from the<nav-graph>element in your manifest won't include your mime type in its<data>element or your custom<action>. You must manually add an appropriate<intent-filter>to your manifest.
Version 2.3.0-rc01
10 ژوئن 2020
androidx.navigation:navigation-*:2.3.0-rc01 is released. Version 2.3.0-rc01 contains these commits.
رفع اشکال
- Fixed a
NullPointerExceptionwhen replacing an instance of a destination with no arguments with another instance with arguments withsingleTop. ( b/158006669 ) - All
destination is unknownexceptions thrown byNavControllernow have additional debugging information to help determine the state of theNavController. ( b/157764916 )
Version 2.3.0-beta01
20 مه 2020
androidx.navigation:navigation-*:2.3.0-beta01 are released. Version 2.3.0-beta01 contains these commits.
رفع اشکال
- Fixed an issue where the
Lifecycleof theNavBackStackEntrywould not be properly updated after process death. ( b/155218371 ) -
OnDestinationChangedListenerinstances registered before callingsetGraph()are now properly sent the restored destination after a process death. ( b/155218371 ) - When using
singleTop, theNavBackStackEntrynow correctly has its arguments updated and the updated arguments are sent to allOnDestinationChangeListenerinstances. ( b/156545508 )
Dependency Updates
- The
NavigationUIartifact now depends on CustomView1.1.0-rc01and DrawerLayout1.1.0-rc01. ( aosp/1309696 )
Version 2.3.0-alpha06
29 آوریل 2020
androidx.navigation:navigation-*:2.3.0-alpha06 is released. ( Version 2.3.0-alpha06 contains these commits. )
ویژگی های جدید
- Deep linking has been expanded to support
app:actionandapp:mimeTypein addition to theapp:uripreviously available. NavController now supports navigating by any combination of these fields via the newNavDeepLinkRequestclass. ( b/136573074 , b/135334841 )
تغییرات API
- Greatly expanded the Kotlin DSL support for Dynamic Navigation destinations. ( b/148969800 )
رفع اشکال
- Fixed an issue where deep link Intents would be ignored when using a nested start destination. ( b/154532067 )
Version 2.3.0-alpha05
15 آوریل 2020
androidx.navigation:navigation-*:2.3.0-alpha05 is released. Version 2.3.0-alpha05 contains these commits.
ویژگی های جدید
- For dynamic graph includes using
<include-dynamic>, you no longer need to specifyapp:graphPackageand a default one will be used by addingmoduleNamesuffix to theapplicationIdafter a dot. If you do need to customize yourgraphPackage, an${applicationId}placeholder is now supported. ( b/152696768 ) - The Navigation Graph Kotlin DSL now exposes a
defaultArgumentsMapfor actions, mirroring the ability to set default values on<action>elements in Navigation XML files. ( b/150345605 )
رفع اشکال
- From Navigation 2.2.2 : Fixed an
IllegalStateExceptionwhen deep linking to the start destination of your graph when you have multipleNavHostFragmentinstances in your Activity. ( b/147378752 )
Dependency updates
- Navigation now depends on Fragment
1.2.4. ( aosp/1277325 ) - Dynamic Navigation now depends on Play Core
1.7.2. ( aosp/1282257 )
Version 2.3.0-alpha04
18 مارس 2020
androidx.navigation:navigation-*:2.3.0-alpha04 is released. Version 2.3.0-alpha04 contains these commits.
ویژگی های جدید
- Added support for feature module activity and fragment destinations in the Navigation Kotlin DSL. ( b/148969800 )
تغییرات API
- The
DynamicExtrasclass no longer uses a builder pattern and can now be constructed directly. ( aosp/1253671 ) -
DynamicActivityNavigatornow takes aContextin its constructor rather than anActivity. ( aosp/1250252 )
رفع اشکال
-
NavigationUIno longer ignores empty labels (ie, a destination withandroid:label=””) and now correctly sets the title to an empty string. ( b/148679860 )
Dependency Updates
- The Navigation Dynamic Features artifacts now depend on Play Core
1.6.5. ( b/149556401 )
Version 2.3.0-alpha03
4 مارس 2020
androidx.navigation:navigation-*:2.3.0-alpha03 is released. Version 2.3.0-alpha03 contains these commits.
تغییرات API
- Instead of relying on the concrete
DrawerLayoutclass,AppBarConfigurationnow uses theOpenableinterface introduced in CustomView1.1.0-alpha02(whichDrawerLayoutimplements as of DrawerLayout1.1.0-alpha04), allowing you to use custom implementations ofOpenablewithNavigationUI. ( b/129030452 )
رفع اشکال
- The
navigation-common-ktxProGuard rules now correctly only keep theNavArgsclasses that are used rather than allNavArgsinstances. ( b/150213558 )
Dependency changes
- Navigation has reverted its dependency on Core
1.2.0and now depends on Core1.1.0to avoid forcing developers to move to a newer dependency when Navigation does not depend on any new APIs in Core1.2.0.
Version 2.3.0-alpha02
19 فوریه 2020
androidx.navigation:navigation-*:2.3.0-alpha02 is released. Version 2.3.0-alpha02 contains these commits.
ویژگی های جدید
- The
NavBackStackEntrynow allows you to access aSavedStateHandlesuitable for storing small amounts of saved state that should be associated with a particular back stack entry. See Returning a result for an example use case. ( b/79672220 )
تغییرات API
- Convenience methods of
getCurrentBackStackEntry()andgetPreviousBackStackEntry()have been added to make it easier to retrieve aNavBackStackEntryfor the current and previous destinations. ( b/79672220 )
رفع اشکال
-
navigateUp()now passes the current destination's arguments and theKEY_DEEP_LINK_INTENTto the previous destination when launching your app on your own task stack. ( b/147456890 )
Dependency changes
- Navigation now depends on Core
1.2.0.
Version 2.3.0-alpha01
5 فوریه 2020
androidx.navigation:navigation-*:2.3.0-alpha01 is released. Version 2.3.0-alpha01 contains these commits .
ویژگی های جدید
- The new
navigation-testingartifact provides aTestNavHostControllerclass. This class provides an alternative to using a mockNavControllerwhen testing Navigation that allows you to set the current destination and verify the back stack after navigation operations. ( b/140884273 ) - The new
navigation-dynamic-features-fragment(and its transitive dependency,navigation-dynamic-features-runtime) allows you to include destinations or entire navigation graphs (via<include-dynamic>) from feature modules , providing seamless installation of on-demand feature modules when navigating to those destinations. See Navigate with feature modules for more information. ( b/132170186 )
Bug fixes
- From Navigation
2.2.1: Deep links without query parameters now correctly ignore any query parameters rather than appending them to trailing{argument}elements or not matching the deep link. ( b/147447512 ) - From Navigation
2.2.1: Thenavigation-uiProGuard rules forDrawerArrowDrawablehave been updated to ensure thatandroid.enableJetifier=trueis not required. ( b/147610424 ) - From Navigation
2.2.1: Thenavigation-common-ktxmodule now has a unique manifest package name instead of sharing the same manifest package name asnavigation-runtime-ktx. ( aosp/1141947 )
Dependency updates
- From Navigation
2.2.1: Navigation2.2.1now depends on Lifecycle ViewModel SavedState2.2.0and Fragment1.2.1.
Version 2.2.2
Version 2.2.2
15 آوریل 2020
androidx.navigation:navigation-*:2.2.2 are released. Version 2.2.2 contains these commits.
رفع اشکال
- Fixed an
IllegalStateExceptionwhen deep linking to the start destination of your graph when you have multipleNavHostFragmentinstances in your Activity. ( b/147378752 ) -
NavigationUIno longer ignores empty labels (ie, a destination withandroid:label=””) and now correctly sets the title to an empty string. This was previously released in Navigation 2.3.0-alpha04 . ( b/148679860 ) - The
navigation-common-ktxProGuard rules now correctly only keep theNavArgsclasses that are used rather than allNavArgsinstances. This was previously released in Navigation 2.3.0-alpha03 . ( b/150213558
Dependency updates
- Navigation now depends on Fragment
1.2.4. ( aosp/1277325 )
نسخه 2.2.1
نسخه 2.2.1
5 فوریه 2020
androidx.navigation:navigation-*:2.2.1 is released. Version 2.2.1 contains these commits .
Bug fixes
- Deep links without query parameters now correctly ignore any query parameters rather than appending them to trailing
{argument}elements or not matching the deep link. ( b/147447512 ) - The
navigation-uiProGuard rules forDrawerArrowDrawablehave been updated to ensure thatandroid.enableJetifier=trueis not required. ( b/147610424 ) - The
navigation-common-ktxmodule now has a unique manifest package name instead of sharing the same manifest package name asnavigation-runtime-ktx. ( aosp/1141947 )
Dependency updates
- Navigation
2.2.1now depends on Lifecycle ViewModel SavedState2.2.0and Fragment1.2.1.
نسخه 2.2.0
نسخه 2.2.0
22 ژانویه 2020
androidx.navigation:navigation-*:2.2.0 is released. Version 2.2.0 contains these commits .
Important changes since 2.1.0
- NavBackStackEntry : You can now call
NavController.getBackStackEntry(), passing in the ID of a destination or navigation graph on the back stack. The returnedNavBackStackEntryprovides a Navigation-drivenLifecycleOwner,ViewModelStoreOwner(the same returned byNavController.getViewModelStoreOwner()), andSavedStateRegistryOwner, in addition to providing the arguments used to start that destination. - Lifecycle ViewModel SavedState Integration :
SavedStateViewModelFactoryis now the default factory used when usingby navGraphViewModels()or theViewModelProviderconstructor with aViewModelStoreOwnerreturned byNavController.getBackStackEntry()orNavController.getViewModelStoreOwner(). - Query Parameter Support for Deep Links : Deep links with query parameters now support reordered query parameters; arguments that have a default value or are nullable are now optional when matching deep links.
- Improved Animation Support :
NavHostFragmentnow usesFragmentContainerViewfrom Fragment 1.2.0 , fixing animation z-ordering issues and window insets dispatching to Fragments.
Version 2.2.0-rc04
18 دسامبر 2019
androidx.navigation:navigation-*:2.2.0-rc04 is released. Version 2.2.0-rc04 contains these commits .
Bug fixes
- Adjusted the default fade animations used by
navigation-uito match the adjusted fade animations in Fragment1.2.0-rc04. ( b/145769814 )
Version 2.2.0-rc03
4 دسامبر 2019
androidx.navigation:navigation-*:2.2.0-rc03 is released. Version 2.2.0-rc03 contains these commits .
Bug fixes
- Fixed an issue with deep link parsing when using query parameters and an argument as the last part of the path that prevented more than one character of the final path argument from being parsed. ( b/144554689 )
- Fixed an issue with deep link parsing where optional parameters would receive
"@null"instead ofnull. ( b/141613546 ) -
NavHostFragmentnow correctly restores the graph after a configuration change when used withFragmentContainerView. ( b/143752103 )
Dependency changes
- Navigation now depends on Lifecycle
2.2.0-rc03, Lifecycle ViewModel SavedState1.0.0-rc03, Activity1.1.0-rc03, and Fragment1.2.0-rc03where appropriate.
Version 2.2.0-rc02
7 نوامبر 2019
androidx.navigation:navigation-*:2.2.0-rc02 is released. Version 2.2.0-rc02 contains these commits .
Dependency changes
- Navigation now depends on androidx.lifecycle
2.2.0-rc02.
Version 2.2.0-rc01
23 اکتبر 2019
androidx.navigation:navigation-*:2.2.0-rc01 is released with no changes since 2.2.0-beta01 . Version 2.2.0-rc01 contains these commits .
Version 2.2.0-beta01
9 اکتبر 2019
androidx.navigation:navigation-*:2.2.0-beta01 is released. Version 2.2.0-beta01 contains these commits .
ویژگی های جدید
-
NavDestinationand its subclasses now overridetoString()to provide more helpful information when debugging. ( b/141264986 )
تغییر رفتار
- Extra query parameters are now ignored when matching deep links rather than causing the match to fail. ( b/141482822 )
Bug fixes
- Fixed an issue where arguments in a deep link's path would be ignored if query parameters were also specified. ( b/141505755 )
- The
navArgs()Kotlin extension onActivitynow has a better error message when there are no extras. ( b/141408999 ) - Safe Args generated
DirectionsJava classes now contain default values. ( b/141099045 ) - Safe Args generated
ArgsJava classes now contain default values. ( b/140123727 ) - When using a
Toolbar,NavigationUIno longer animates the text change when moving between two top level destinations. ( b/140848160 )
Version 2.2.0-alpha03
18 سپتامبر 2019
androidx.navigation:navigation-*:2.2.0-alpha03 is released. Version 2.2.0-alpha03 contains these commits .
تغییر رفتار
- Calling
setViewModelStore()after callingsetGraphnow results in anIllegalStateException. This should always be set by theNavHostas part of the initial setup to ensure that allNavBackStackEntryinstances have a consistent storage forViewModelinstances. ( aosp/1111821 )
Bug fixes
- Fixed a
ConcurrentModificationExceptionwhen usingViewModelinstances attached to multiple different navigation graph scopedViewModelStoreinstances. ( aosp/1112257 )
Version 2.2.0-alpha02
5 سپتامبر 2019
androidx.navigation:navigation-*:2.2.0-alpha02 is released. The commits included in this version can be found here .
ویژگی های جدید
- Deep links with query parameters now support reordered query parameters; arguments that have a default value or are nullable are now optional when matching deep links. ( b/133273839 )
- You can now call
NavController.getBackStackEntry(), passing in the ID of a destination or navigation graph on the back stack. The returnedNavBackStackEntryprovides a Navigation-drivenLifecycleOwner,ViewModelStoreOwner(the same returned byNavController.getViewModelStoreOwner()), andSavedStateRegistryOwner, in addition to providing the arguments used to start that destination. ( aosp/1101691 , aosp/1101710 )
Bug fixes
- Fixed an issue where adding a
NavHostFragmenttoViewPager2failed with anIllegalArgumentException. ( b/133640271 ) -
NavInflaternow avoids callinggetResourceName()unnecessarily, speeding up inflation time by up to 40%. ( b/139213740 )
Version 2.2.0-alpha01
7 آگوست 2019
androidx.navigation:navigation-*:2.2.0-alpha01 is released. The commits included in this version can be found here .
ویژگی های جدید
-
SavedStateViewModelFactoryis now the default factory used when usingby navGraphViewModels()or theViewModelProviderconstructor with aViewModelStoreOwnerreturned byNavController.getViewModelStoreOwner(). ( b/135716331 )
API changes
- From Navigation
2.1.0-rc01: The deprecatedgetViewModelStore()API onNavControllerintroduced in2.1.0-alpha02has been removed. ( aosp/1091021 )
Bug fixes
-
NavHostFragmentnow usesFragmentContainerView, fixing animation z-ordering issues and window insets dispatching to Fragments. ( b/137310379 )
نسخه 2.1.0
نسخه 2.1.0
5 سپتامبر 2019
androidx.navigation:navigation-*:2.1.0 is released. The commits included in this version can be found here .
Important changes since 2.0.0
- Scoping ViewModels to a navigation graph : You can now create ViewModels that are scoped at the navigation graph level using the
by navGraphViewModels()property delegate for Kotlin users using the-ktxlibraries or by using thegetViewModelStoreOwner()API added toNavController. See Share UI-related data between destinations for more information. - Dialog destinations : You can now create
<dialog>destinations that will show aDialogFragmentwhen younavigateto them.NavHostFragmentsupports dialog destinations by default. See Create a destination from a DialogFragment for more information. - Navigating by Uri : You can now
navigateusing aUri, which uses the<deepLink>you've added to a destination to navigate there. See Navigate using Uri for more information. - NavHostController : APIs used specifically for constructing a custom
NavHosthave been moved toNavHostController, allowing implementations to connect theirNavControllerto the hostingLifecycleOwner,OnBackPressedDispatcher, andViewModelStore.
Version 2.1.0-rc01
7 آگوست 2019
androidx.navigation:navigation-*:2.1.0-rc01 is released. The commits included in this version can be found here .
API changes
- The deprecated
getViewModelStore()API onNavControllerintroduced in2.1.0-alpha02has been removed. ( aosp/1091021 )
Version 2.1.0-beta02
19 جولای 2019
androidx.navigation:*:2.1.0-beta02 is released. The commits included in this version can be found here .
Bug fixes
- Removed unintentional jacoco dependency that was introduced in
2.1.0-beta01. ( b/137782950 )
Version 2.1.0-beta01
17 جولای 2019
androidx.navigation:*:2.1.0-beta01 is released. The commits included in this version can be found here .
ویژگی های جدید
-
NavigationUInow animates the removal of the Up button when usingsetupWithNavController()with aToolbarorCollapsingToolbarLayout. ( b/131403621 )
Bug fixes
- Fixed a timing issue when using multiple NavHostFragments with the same container with
findNavController(). ( b/136021571 )
Version 2.1.0-alpha06
2 جولای 2019
androidx.navigation:*:2.1.0-alpha06 is released. The commits included in this version can be found here .
ویژگی های جدید
- The
app:navGraphattribute used by NavHostFragment has now been moved to thenavigation-runtimeartifact. Custom navigators that can be added via XML should use this attribute to gain integration with the Navigation Editor's Host panel. ( b/133880955 )
API changes
- The
getViewModelStore()API onNavControllerhas been deprecated in favor of the newgetViewModelStoreOwner()method that returns aViewModelStoreOwner. ( aosp/987010 ) - The implementation of floating window destinations, such as
<dialog>destinations, has been generalized into a marker interface,FloatingWindow, that all<dialog>destinations now implement. NavigationUI methods for interacting with the top app bar now ignoreFloatingWindowdestinations. ( b/133600763 )
تغییر رفتار
- Navigation now correctly keeps its state in sync with what is seen on the screen when using a
<dialog>destination. As a consequence, Navigation now automatically pops<dialog>destinations when you navigate to a non-dialog and non-activity destination, such as a<fragment>destination. ( b/134089818 )
Bug fixes
- Navigation now suppresses the animation that occurs when recreating the activity when handling a deep link, fixing a visual flash. ( b/130362979 )
- Fixed a bug where the Navigation back stack would be out of sync when popping a Fragment as the initial fragment is being added. ( b/133832218 )
Version 2.1.0-alpha05
5 ژوئن 2019
androidx.navigation:*:2.1.0-alpha05 is released. The commits included in this version can be found here .
API changes
- Host related APIs on
NavControllerhave been renamed and moved to a new subclass ofNavController,NavHostController. ( aosp/966091 ) - The
NavControllersetHostOnBackPressedDispatcherOwner()method has been replaced withNavHostController'ssetOnBackPressedDispatcher()method and now requires that you callsetLifecycleOwner()prior to calling it. ( aosp/965409 ) -
NavHostControllernow contains aenableOnBackPressed(boolean)method that replaces theNavHostOnBackPressedManagerclass that was previously returned bysetHostOnBackPressedDispatcherOwner(). ( aosp/966091 )
Bug fixes
- Fixed an issue where the back stack was not correct after navigating by URI. ( b/132509387 )
- Deep links automatically handled by NavController now only trigger once. ( b/132754763 )
Version 2.1.0-alpha04
16 مه 2019
androidx.navigation:*:2.1.0-alpha04 is released. The commits included in this version can be found here .
Bug fixes
-
NavHostFragmentcorrectly respectsapp:defaultNavHostwhen intercepting the system Back button events, fixing a regression in Navigation2.1.0-alpha03. b/132077777 -
DialogFragmentNavigatornow correctly handlespopBackStack()andnavigateUp()operations. b/132576764 - Fixed an
IllegalStateException: unknown destination during restoreissue when repeatedly navigating between nested graphs. b/131733658
Version 2.1.0-alpha03
May 7, 2019
androidx.navigation:*:2.1.0-alpha03 is released. The commits included in this version can be found here .
مسائل شناخته شده
- NavHostFragment continues to intercept the system Back button despite using
app:defaultNavHost="false"b/132077777
ویژگی های جدید
- You can now create
<dialog>destinations that will show aDialogFragmentwhen younavigateto them.NavHostFragmentsupports dialog destinations by default. b/80267254 - In addition to calling
navigatewith a resource id or aNavDirectionsinstance, you can now navigate via aUri, which uses the<deepLink>you've added to a destination to navigate to the correct destination. b/110412864
تغییر رفتار
- The default animations provided by NavigationUI have been sped up from 400ms to 220ms to match the default animation speed of activities and fragments. b/130055522
API changes
- The
createFragmentNavigator()method ofNavHostFragmenthas been deprecated and its functionality moved to the newonCreateNavController()method to make it more clear that this is the correct entry point of adding custom Navigators when subclassingNavHostFragment. b/122802849 - A
hasDeepLink()method has been added toNavDestinationto allow you to check if a givenUrican be handled by that destination or, in the case of aNavGraph, any destination in the navigation graph. b/117437718
Bug fixes
- Default arguments are now correctly passed to
OnDestinationChangedListenerinstances. b/130630686 -
NavHostFragmentnow intercepts system Back events using theOnBackPressedDispatcher, fixing an issue when doing conditional navigation in Fragment lifecycle methods upon returning to a Fragment. b/111598096 - For Safe Args, an
android:defaultValue=”@null”with an unspecifiedapp:argTypeis now properly inferred as astringargument. b/129629192
Version 2.1.0-alpha02
3 آوریل 2019
androidx.navigation:*:2.1.0-alpha02 is released. The commits included in this version can be found here .
ویژگی های جدید
- You can now create ViewModels that are scoped at a navigation graph level via the
by navGraphViewModels()property delegate for Kotlin users or by using thegetViewModelStore()API added toNavController. b/111614463
API changes
- You can now add an
app:targetPackageto an<activity>destination to limit the matching package name. It supportsapp:targetPackage="${applicationId}"for restricting the package to your own application id. b/110975456
Bug fixes
- The
android:namefor<activity>destinations is no longer parsed into a Class at inflation time, preventing ClassNotFoundExceptions when using dynamic features. b/124538597
Version 2.1.0-alpha01
19 مارس 2019
This is the first alpha release of Navigation 2.1.0 .
Dependency changes
- Navigation now depends on
androidx.core:core:1.0.1andandroidx.fragment:fragment:1.1.0-alpha05. This release also removes the dependency onandroidx.legacy:legacy-support-core-utils:1.0.0. b/128632612
تغییرات API
- A new
Navigation.createNavigateOnClickListener(NavDirections)method has been added as an alternative to creating a click listener with a resource ID and Bundle. b/127631752 -
FragmentNavigator.instantiateFragmentis now deprecated. The default implementation now usesFragmentFactoryto instantiate Fragments. b/119054429
رفع اشکال
- Navigation no longer sends a null
Bundlewhen there are arguments attached to a destination, fixing an issue when usingandroid:defaultValue="@null". b/128531879 - Safe Args now depends on KotlinPoet 1.1.0, fixing an issue with extremely long package names. b/123654948
نسخه 2.0.0
نسخه 2.0.0
14 مارس 2019
Navigation 2.0.0 is released with no changes from 2.0.0-rc02 .
Version 2.0.0-rc02
6 مارس 2019
Navigation 2.0.0-rc02 provides new artifacts with the androidx.navigation group ID and changes its dependencies to the AndroidX equivalents.
The behavior of 2.0.0-rc02 is identical to behavior to Navigation 1.0.0-rc02 and no changes to your code should be required to update from 1.0.0-rc02 besides updating your dependencies to match the new dependencies .
Your project must have migrated to AndroidX to use 2.X releases of Navigation. Navigation 1.0 stable will be the last release using the Support Library dependencies; all future development beyond 1.0 will be based on AndroidX and build upon the 2.0 stable release.
Pre-AndroidX Dependencies
For the pre-AndroidX versions of Navigation, include these dependencies:
dependencies {
def nav_version = "1.0.0"
implementation "android.arch.navigation:navigation-fragment:$nav_version" // For Kotlin use navigation-fragment-ktx
implementation "android.arch.navigation:navigation-ui:$nav_version" // For Kotlin use navigation-ui-ktx
}
For Safe args , add the following classpath in your top level build.gradle file
buildscript {
repositories {
google()
}
dependencies {
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0"
}
}
نسخه 1.0.0
نسخه 1.0.0
14 مارس 2019
Navigation 1.0.0 is released with no changes from 1.0.0-rc02 .
Version 1.0.0-rc02
26 فوریه 2019
This is the second release candidate for Navigation's 1.0.0 stable release. This release contains a number of bug fixes.
رفع اشکال
- Fixed an issue where
popBackStack()would be ignored if the root graph did not have an ID b/126251695 -
navigateUp()now correctly handles navigating back to your app's task when called after handling a deep link withoutFLAG_ACTIVITY_NEW_TASKb/126082008 - Fixed an issue with
ActivityNavigator.applyPopAnimationsToPendingTransitionnot applying the correct pop exit animation b/126237567 - Kotlin code generated by Safe Args now properly escapes Kotlin keywords such as
inandfunin the package name associated with theRclass. b/126020455
نسخه 1.0.0-RC01
21 فوریه 2019
This is a release candidate for Navigation's 1.0.0 stable release. This release contains one bug fix.
رفع اشکال
- Fixed an issue when using Fragments and
singleTopnavigation operations b/124294805
نسخه 1.0.0-beta02
12 فوریه 2019
This release includes a number of minor improvements and important bug fixes.
ویژگی های جدید
- You can now use
0as anandroid:defaultValueforreferencearguments. b/124248602
تغییر رفتار
- Exact deep link matches are now prioritized over deep links with
.*or argument matches. b/123969518
رفع اشکال
-
popBackStack()andnavigateUpnow correctly returnfalsewhen popping the last destination on the back stack, fixing a regression introduced in1.0.0-beta01. b/123933201 - Navigation now correctly sets the
ClassLoaderduring restoration of saved instance state, avoiding issues when using custom classes inNavigatorsaved state or in arguments sent to aNavDestination. b/123893858 - Safe Args generated NavArgs classes no longer crash when restoring a
Parcelable[]argument from saved instance state. b/123963545 - Safe Args now properly cleans up unnecessary generated Kotlin classes. b/124120883
Version 1.0.0-beta01
4 فوریه 2019
This is the first beta release of Navigation; moving forward, the Navigation API is expected to stay stable until the next version unless there is a critical problem. This release contains some bug fixes and behavior changes.
تغییر رفتار
- Navigation now ensures that argument default values are treated identically at runtime and through Safe Args. As a consequence, only arguments with an
app:argType="reference"can have a default value point to another resource (for example,@color/colorPrimary). Attempting to use a reference default value with a differentapp:argTypewill result in an exception when parsing the navigation XML. b/123551990 - Safe Args now depends on Android Gradle Plugin 3.3.0 aosp/888413
- Safe Args now depends on Kotlin 1.3.20 aosp/888414
رفع اشکال
- Safe Args can now be used in library and feature modules on all versions of the Android Gradle Plugin. b/121304903
- Fixed a regression that would cause a single
popBackStack()operation to pop all copies of a destination off the top of the back stack, rather than just a single destination at a time. b/123552990 - Fixed an issue where the
FragmentNavigatorstate would desynchronize with theNavController's state, causing anIllegalStateExceptionwhen attempting to restore the back stack. b/123803044 - Fixed an issue where the
NavigationUIhandled back arrow would not appear when using ProGuard with obfuscation. b/123449431 - The code generated by Safe Args now properly handles using an
app:argTypepointing to a static inner class in the format.OuterClass$InnerClass. b/123736741 - The Java code generated by Safe Args now properly handles global actions and deeply nested destinations. b/123347762
Version 1.0.0-alpha11
23 ژانویه 2019
This is a hotfix release of 1.0.0-alpha10 that fixes an issue with Safe Args.
رفع اشکال
- Fixes an issue where Safe Args would fail to import the Directions class associated with global actions. b/123307342
نسخه 1.0.0-alpha10
23 ژانویه 2019
مسائل شناخته شده
- Safe Args fails to import the Directions class associated with global actions. b/123307342
This release contains breaking API changes; please see the Breaking Changes section below.
ویژگی های جدید
- Kotlin users can now use the
by navArgs()property delegate to lazily get a reference to a Safe Args generatedNavArgsclass in anActivityorFragment. b/122603367 - Safe Args now allows you to generate Kotlin code by applying the
androidx.navigation.safeargs.kotlinplugin. The Kotlin code is built specifically for Kotlin only modules, using default arguments and immutable classes over the builder pattern that is still available via the previousandroidx.navigation.safeargsplugin. b/110263087
تغییرات رفتار
- Matching deep links are now biased towards the deep link that has the most matching arguments. b/118393029
- Calling
setGraph()on aNavControllerwill now reset the back stack. b/111450672 - Unknown deep links no longer throw an
IllegalStateException, but are ignored, fixing issues with nested or multipleNavHostFragments. b/121340440
Breaking Changes
- The
NavOptions.applyPopAnimationsToPendingTransition()method for applying pop animations to an Activity has been moved toActivityNavigator. b/122413117 - Safe Args now avoids duplicating identical classes for actions without arguments. The return type for no argument methods in generated NavDirections classes is now
NavDirections. b/123233147 - Safe Args generated Directions classes no longer have a public constructor - you should only be interacting with the generated static methods. b/123031660
- Safe Args generated
NavDirectionsclasses no longer have a public constructor - they should only be generated via the static methods in the generated Directions classes. b/122963206 - The returned
BundlefromNavDirections'getArguments()is now marked as@NonNullrather than@Nullable. b/123243957
رفع اشکال
-
NavDeepLinkBuildernow correctly handles multiple simultaneousPendingIntents to the same destination by using the arguments you pass in to determine the uniqueness. b/120042732 -
NavControllernow correctly handlespopBackStack()operations when using a nestedNavHostFragmentor other child Fragments with a back stack. b/122770335 -
NavigationUInow correctly sets the content description of the Up button. b/120395362 - Safe Args generated Directions classes now correctly handle global actions that have the same id as an action on a destination. b/122962504
- Safe Args generated
NavDirectionsclasses now correctly have equalhashCode()values whenequals()would return true. b/123043662 -
FragmentNavigatornow throws a better error message if you attempt to do customFragmentTransactionson theNavHostFragment'sFragmentManager. You should always usegetChildFragmentManager(). b/112927148
نسخه 1.0.0-alpha09
18 دسامبر 2018
This release contains breaking API changes; please see the Breaking Changes section below.
We have chosen not to continue development of the android.arch.navigation:navigation-testing artifact. While it has proven helpful for internal testing of NavController , we strongly recommend alternate testing strategies, such as mocking the NavController instance in order to verify that the correct navigate() calls are being done. This approach is discussed in detail in the Single Activity talk at AndroidDevSummit 2018 and we'll be working on additional documentation specifically around testing with Navigation.
ویژگی های جدید
-
MenuItems withmenuCategory="secondary"will no longer pop the back stack when used withNavigationUImethods. b/120104424 -
AppBarConfigurationnow allows you to set a fallbackOnNavigateUpListenerinstance which will be called whennavController.navigateUp()returnsfalse. b/79993862 b/120690961
Breaking Changes
- When using an
<argument>with anargType="reference", Navigation no longer parses the reference, instead providing the raw resource ID itself. b/111736515 -
onNavDestinationSelected()now pops back to the start destination of your navigation graph by default, making them consistent with thesetupmethods. AddmenuCategory="secondary"to yourMenuItemto avoid popping the back stack. aosp/852869 - The
fromBundle()methods of generatedArgsclasses now take a non-nullBundleinstead of a nullableBundleaosp/845616
رفع اشکال
- Arguments are now properly parsed from deep links as the correct
argTypeinstead of always as strings b/110273284 - Navigation now correctly exports its public resources b/121059552
- Safe Args is now compatible with Android Gradle Plugin 3.4 Canary 4 and higher b/119662045
نسخه 1.0.0-alpha08
6 دسامبر 2018
This release contains breaking API changes; please see the Breaking Changes section below.
ویژگی های جدید
- Destination labels, when used with
NavigationUImethods, will now automatically replace{argName}instances in yourandroid:labelwith the correct argument b/80267266 - Navigation now depends on Support Library 28.0.0 b/120293333
Breaking Changes
-
OnNavigatedListenerhas been renamed toOnDestinationChangedListenerb/118670572 -
OnDestinationChangedListenernow also passes theBundleof arguments aosp/837142 - The
app:clearTaskandapp:launchDocumentattributes and their associated methods have been removed. Useapp:popUpTowith the root of your graph to remove all destinations from your back stack. b/119628354 -
ActivityNavigator.Extrasnow uses aBuilderpattern and adds the ability to set anyIntent.FLAG_ACTIVITY_flags aosp/828140 -
NavController.onHandleDeepLinkhas been renamed tohandleDeepLinkaosp/836063 - Many classes and methods not meant for subclassing, such as
NavOptions,NavInflater,NavDeepLinkBuilder, andAppBarConfiguration, have been madefinalaosp/835681 - The deprecated
NavHostFragment.setGraph()method has been removed aosp/835684 - The deprecated
NavigationUI.navigateUp(DrawerLayout, NavController)method has been removed. aosp/835684 - Fragment creation has been moved to
FragmentNavigator, making it easier to delegate Fragment creation to aFragmentFactory. b/119054429 - The constructor for
NavGraphNavigatorno longer takes aContextaosp/835340 - NavigatorProvider is now a class, rather than an interface. The
NavigatorProviderreturned bygetNavigatorProvider()has not changed its functionality. aosp/830660 -
NavDestination.navigate()has been removed. Callnavigate()on theNavigatorinstead. aosp/830663 - Significant refactoring of
Navigator, removing the need forOnNavigatorNavigatedListenerand instead havingnavigatereturn theNavDestinationthat was navigated to. -
Navigatorinstances can no longer send pop events to theNavController. Consider using aOnBackPressedCallbackto intercept back button presses and callnavController.popBackStack(). aosp/833716
رفع اشکال
-
popUpTonow works consistently when the destination is a<navigation>element b/116831650 - Fixed a number of bugs that resulted in an
IllegalArgumentExceptionwhen using nested graphs b/118713731 b/113611083 b/113346925 b/113305559 - The
dataPatternattribute of<activity>destinations will now populate arguments from non-String arguments by callingtoString()b/120161365
Safe Args
- Safe Args supports Serializable objects, including Enum values. Enum types can set a default value by using the enum literal without the class name (eg
app:defaultValue="READ") b/111316353 - Safe Args supports arrays of all supported types b/111487504
- Safe Args now ignores subfolders of resource directories b/117893516
- Safe Args adds
@Overrideannotations where appropriate b/117145301
نسخه 1.0.0-alpha07
29 اکتبر 2018
ویژگی های جدید
- A new AppBarConfiguration class allows you to customize which destinations are considered top-level destinations. See the updated documentation for details. b/117333663
- You can now pass arguments to the start destination of your graph b/110300470
- Deep links now support custom schemes with periods, hyphens, and plus signs. b/112806402
Breaking Changes
- The
navigation-testing-ktxmodule has been folded into thenavigation-testing artifactand will no longer be published. - The
navigation-testingartifact now has a dependency on the Kotlin standard library. The API has been changed to be more consistent with Kotlin conventions, but you can continue to use it for tests written in Java. - Metadata manifest registered navigation graphs are no longer supported. b/118355937
- Actions can no longer be attached to <activity> destinations. aosp/785539
رفع اشکال
- Deep links now correctly parse query parameters. b/110057514
- Activity destinations now correctly apply all enter and exit animations. b/117145284
- Fixed crash that occurs after configuration changes when using custom Navigators. b/110763345
Safe Args
- Safe args now have a fixed dependency on Android Gradle Plugin 3.2.1. b/113167627
- Directions can now be generated for inner classes. b/117407555
- Fixed an issue with generating Directions to an <include> graph. b/116542123
نسخه 1.0.0-alpha06
20 سپتامبر 2018
ویژگی های جدید
- Shared Element Transitions for Fragment and Activity destinations are now supported b/79665225 . For more information, see Implement navigation with the Navigation Architecture Component
- Selecting an item in
NavigationViewwill now close any containing bottom sheet b/112158843
تغییرات API
- Breaking Change: The Navigator
navigate()method now takes aNavigator.Extrasparameter. - NavController's
getGraph()method is nowNonNullb/112243286
رفع اشکال
-
NavigationUI.setupWithNavController()no longer leaks views if used with views from individual destinations b/111961977 - Navigator
onSaveState()is now only called once b/112627079
Safe Args
- Navigation destination Directions classes now extend their parent's Directions class if it exists b/79871405
- Directions and Args classes now have a useful
toString()implementation b/111843389
نسخه 1.0.0-alpha05
10 آگوست 2018
رفع اشکال
- Fix a bug which cause incorrect backstack behavior. b/111907708
- Fix a bug in
equals()of Generated Args classes. b/111450897 - Fix a build failure in Safe Args. b/109409713
- Fix a conversion from resource identifiers to java names b/111602491
- Fix error messages about nullability in Safe Args plugin.
- Add missing nullability annotations.
نسخه 1.0.0-alpha04
19 جولای 2018
Navigation 1.0.0-alpha04 and the associated Safe Args gradle plugin contains a number of API changes, behavior changes, and bug fixes.
API / Behavior Changes
- NavHostFragment will always set the current Fragment as the primary navigation fragment, ensuring that child fragment managers are popped before the outer NavController is popped b/111345778
Safe Args
- Breaking Change:
app:typehas been changed toapp:argTypeto avoid conflicts with other libraries such as ConstraintLayout 2.0.0-alpha1 b/111110548 - Error messages from Safe Args are now clickable b/111534438
- Args classes now confirms that
NonNullattributes are actually not null b/111451769 - Additional
NonNullannotations have been added to NavDirections and Args generated classes b/111455455 b/111455456
رفع اشکال
- Fixed an issue with the system back button after deep linking to a fragment destination b/111515685
نسخه 1.0.0-alpha03
12 جولای 2018
Navigation 1.0.0-alpha03 and the associated Safe Args gradle plugin contains a number of API changes, behavior changes, and bug fixes.
API / Behavior Changes
- A NavigationUI.setupWithNavController method for Toolbar has been added b/109868820
- A NavigationUI.setupWithNavController method for CollapsingToolbarLayout has been added b/110887183
- popBackStack() now returns false when the back stack is empty or when the given destination ID is not in the back stack b/110893637
- FragmentNavigator now ignores navigation operations after FragmentManager has saved state, avoiding “Can not perform this action after onSaveInstanceState” exceptions b/110987825
Safe Args
- Breaking Change: Non-alphanumeric characters in action and argument names will be replaced by camel casing in the respective NavDirections method names
- Eg
DemoController.indexwill becomesetDemoControllerIndexb/79995048 - Eg
action_show_settingswill becomeactionShowSettingsb/79642240
- Eg
- Breaking Change: Arguments are now considered non-null by default. To allow null values on string and parcelable arguments, add
app:nullable="true"b/79642307 - You can now use
app:type="long"with defaultValues in the form of “123L” b/79563966 - Parcelable arguments are now supported, using a fully qualified class name for
app:type. The only default value supported is"@null"b/79563966 - Args classes now implement
equals()andhashCode()b/79642246 - The Safe Args plugin can now be applied to library projects b/80036553
- The Safe Args plugin can now be applied to feature projects b/110011752
رفع اشکال
- Fixed issues when navigating during Fragment lifecycle methods b/109916080
- Fixed issues when navigating through nested graphs multiple times b/110178671
- Fixed issues when using
setPopUpTowith the first destination in the graph b/109909461 - Fixed issue where all
app:defaultValuevalues were being passed as Strings b/110710788 - aapt2 bundled with Android Gradle Plugin 3.2 Beta 01 now adds keep rules for every
android:nameattribute in Navigation XML files b/79874119 - Fixed memory leak when replacing the default FragmentNavigator b/110900142
نسخه 1.0.0-alpha02
7 ژوئن 2018
تغییرات رفتار
FragmentNavigatornow usessetReorderingAllowed(true). b/109826220Navigation now URLDecodes arguments parsed from deep links URLs. b/79982454
رفع اشکال
Fixed an
IllegalStateExceptionwhen calling navigate from Fragment lifecycle methods. b/79632233Navigation now depends on Support Library 27.1.1 to fix flickering when using animations. b/80160903
Fixed an
IllegalArgumentExceptionwhen using defaultNavHost="true" as a child fragment. b/79656847Fixed a
StackOverflowErrorwhen using NavDeepLinkBuilder. b/109653065Fixed an
IllegalArgumentExceptionwhen navigating back to a nested graph. b/80453447Fixed an issue with overlapping Fragments when using
launchSingleTop. b/79407969Navigation now builds the correct synthetic back stack for nested graphs. b/79734195
NavigationUI will now highlight the correct item when using a nested graph as a
MenuItem. b/109675998
تغییرات API
The
clearTaskattribute for actions and the associated API inNavOptionshas been deprecated. b/80338878The
launchDocumentattribute for actions and the associated API inNavOptionshas been deprecated. b/109806636
Version 1.0.0-alpha01
8 مه 2018
Navigation provides a framework for building in-app navigation. This initial release is 1.0.0-alpha01 .