جهت یابی

ناوبری چارچوبی برای پیمایش بین «مقصدها» در یک برنامه اندرویدی است که یک API ثابت را ارائه می‌کند، خواه مقصدها به‌عنوان بخش‌ها، فعالیت‌ها یا سایر مؤلفه‌ها اجرا شوند.
آخرین به روز رسانی انتشار پایدار نامزد انتشار نسخه بتا انتشار آلفا
24 جولای 2024 2.7.7 - 2.8.0-beta06 -

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

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

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

شیار

dependencies {
  def nav_version = "2.7.7"

  // Java language implementation
  implementation "androidx.navigation:navigation-fragment:$nav_version"
  implementation "androidx.navigation:navigation-ui:$nav_version"

  // Kotlin
  implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
  implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

  // Feature module Support
  implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"

  // Testing Navigation
  androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"

  // Jetpack Compose Integration
  implementation "androidx.navigation:navigation-compose:$nav_version"
}

کاتلین

dependencies {
  val nav_version = "2.7.7"

  // Java language implementation
  implementation("androidx.navigation:navigation-fragment:$nav_version")
  implementation("androidx.navigation:navigation-ui:$nav_version")

  // Kotlin
  implementation("androidx.navigation:navigation-fragment-ktx:$nav_version")
  implementation("androidx.navigation:navigation-ui-ktx:$nav_version")

  // Feature module Support
  implementation("androidx.navigation:navigation-dynamic-features-fragment:$nav_version")

  // Testing Navigation
  androidTestImplementation("androidx.navigation:navigation-testing:$nav_version")

  // Jetpack Compose Integration
  implementation("androidx.navigation:navigation-compose:$nav_version")
}

ارگ ایمن

برای افزودن Safe Args به پروژه خود، classpath زیر را در فایل build.gradle سطح بالای خود قرار دهید:

شیار

buildscript {
    repositories {
        google()
    }
    dependencies {
        def nav_version = "2.7.7"
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
    }
}

کاتلین

buildscript {
    repositories {
        google()
    }
    dependencies {
        val nav_version = "2.7.7"
        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.8

نسخه 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 که کاربر به آن برمی‌گرداند، هرگز به حالت RESUMED Lifecycle باز نمی‌گردد. این همچنین تضمین می‌کند که مقصد برگشتی به‌جای اینکه پس از پرت کردن در جای خود قرار گیرد، به‌درستی به داخل حرکت می‌کند. ( 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

این قابلیت از 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 باید به عنوان یک android:name سطح بالا، بدون @Composable بیان شود. هنگام حرکت به یکی از این مقاصد، یک قطعه حاوی برای نمایش محتوای قابل ترکیب ایجاد می شود. ( 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

رفع اشکال

  • 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 به startDestination NavGraph بدون اتکا به defaultValue ارسال کنید. این در مورد NavGraph startDestinations تودرتو نیز صدق می کند. ( 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 پشتیبانی می کنند، اکنون می توانند مسیرهای پر شده با آرگومان های Array NavTypes را به درستی مطابقت دهند. ( 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 برطرف شد که باعث شد NavGraph ViewModels خیلی زود DESTROYED زیرا ViewModel ورودی مرتبط بخشی از حالت ذخیره شده نبود. ( Ib6bb7 , b/317581849 )

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

نسخه 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 اکنون به 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 حاوی این commit ها است.

رفع اشکال

  • بکپورت شده از Navigation 2.8.0-alpha01 : رفع نشت BackStackState که در آن چندین saveState() در یک NavBackStackEntry منفرد باعث ذخیره چندین حالت می شد، اما فقط اولین حالت ذخیره شده می تواند بازیابی شود. ( I598b0 , b/309559751 )
  • پس‌پورت‌شده از Navigation 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 حاوی این commit ها است.

رفع اشکال

  • تابع NavGraph equals() اکنون به‌جای گره فراخوان گره‌های گراف دیگر را به درستی در نظر می‌گیرد. این تضمین می‌کند که نمودارهایی که دارای گره‌هایی با شناسه‌های مختلف هستند دیگر برابر در نظر گرفته نخواهند شد ( I401cb , b/311414915 )

نسخه 2.7.5

نسخه 2.7.5

1 نوامبر 2023

androidx.navigation:navigation-*:2.7.5 منتشر شد. نسخه 2.7.5 حاوی این commit ها است.

بهبود عملکرد

  • عملکرد مقایسه دو نمودار (هم از نظر زمان و هم از نظر تعداد تخصیص) را به شدت بهبود بخشید. این بدان معنی است که فراخوانی هایی مانند setGraph که به صورت داخلی نمودار جدید را با نمودار موجود مقایسه می کند بسیار سریعتر است و منجر به فریم های کمتری می شود که رد شده اند. متشکرم Michał Z برای تجزیه و تحلیل کاملی که منجر به این بهبود شد. ( I6ad62 )
  • NavHost اکنون به جای اینکه برای خواندن وضعیت به روز شده منتظر پاس دوم باشد، مقصد شروع را در اولین پاس ترکیبی ارائه می کند. ( I439a7 , b/304852206 )

رفع اشکال

  • اگر بیش از یک بار با همان نمودار با setGraph تماس بگیرید، تنها در صورتی که مقصدی در نمودار شما وجود داشته باشد که حاوی عملکردی باشد که دو مقصد را به هم مرتبط می‌کند، مشکلی را برطرف می‌کند. ( Ieaed7 )
  • دیالوگ‌هایی که به‌سرعت پیمایش شده و رد شده‌اند، دیگر به فهرست NavController.visibleEntries نشت خواهند کرد. ( I67586 , b/287969970 )
  • هنگامی که یک ورودی ظاهر می شود و به دنبال آن تغییری در پیکربندی ایجاد می شود، اگر saveState نادرست باشد، ViewModel ورودی به درستی پاک می شود. ( Idf242 , b/298164648 )
  • اگر پشته پشتی قبل از تغییر پیکربندی یا فراخوانی setGraph کاملاً خالی بود، فقط زمانی که Intent دارای پرچم FLAG_ACTIVITY_NEW_TASK تنظیم شده بود، NavController می‌توانست یک پیوند عمیق را بیش از یک بار مدیریت کند. ( I73c7f )

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

  • پیمایش با Fragments اکنون به Fragment 1.6.2 بستگی دارد و مشکلی را برطرف می کند که در آن نمونه های ViewModel قطعات تودرتو هنگام فراخوانی clearBackStack پاک نمی شوند.

نسخه 2.7.4

نسخه 2.7.4

4 اکتبر 2023

androidx.navigation:navigation-*:2.7.4 منتشر شد. نسخه 2.7.4 حاوی این commit ها است.

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

  • پشتیبانی از 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 حاوی این commit ها است.

رفع اشکال

  • مشکلی در Navigation with Fragments که باعث می شد لیست 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 حاوی این commit ها است.

رفع اشکال

  • پیمایش اکنون به Lifecycle 2.6.2 بستگی دارد، که تعاملی بین rememberSaveable و NavHost Navigation Compose را برطرف می‌کند که باعث می‌شود وضعیت rememberSaveable مقصدها و هر نمونه SavedStateHandle متعلق به ViewModel به درستی پس از مرگ فرآیند و بازیابی بازیابی شود. ( b/298059596 , b/289436035 )
  • مشکلی در نمایش همزمان چند دیالوگ در Navigation Compose که در آن دیالوگ‌های تا حدی مبهم (مثلاً نه بالاترین محاوره) در حالت CREATED Lifecycle به جای حالت STARTED هستند، برطرف شد. ( aosp/2728520 , b/289257213 )
  • مشکلی در نمایش همزمان چند دیالوگ در «نوشتن پیمایش» برطرف شد که رد کردن بالاترین گفتگو باعث می‌شد که بالاترین گفتگوی جدید به جای انتقال صحیح به RESUMED ، در وضعیت چرخه حیات STARTED گیر کند. ( aosp/2629401 , b/286371387 )
  • Navigation Safe Args دیگر اگر واقعاً اجرا نشود، کار خود را مشتاقانه انجام نمی دهد. ( I0e385 , b/260322841 )

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

  • Navigation Compose اکنون به Compose 1.5.1 بستگی دارد.

نسخه 2.7.1

نسخه 2.7.1

23 آگوست 2023

androidx.navigation:navigation-*:2.7.1 منتشر شد. نسخه 2.7.1 حاوی این commit ها است.

رفع اشکال

  • مشکلی را در Navigation با Compose برطرف کرد که در آن هنگام استفاده از Scaffold ممکن بود برای دسترسی به Lifecycle.State.DESTROYED ViewModel خطا دریافت شود. ( I1dc11 , b/268422136 )

نسخه 2.7.0

نسخه 2.7.0

9 آگوست 2023

androidx.navigation:navigation-*:2.7.0 منتشر شد. نسخه 2.7.0 حاوی این commit ها است.

تغییرات مهم از 2.6.0

انیمیشن ها از Accompanist

اکنون که AnimatedContent پایدار است، توانستیم کد را از Accompanist Navigation Animation به خود Navigation Compose برگردانیم.

این به این معنی است که تمام پشتیبانی برای تنظیم انتقال های سفارشی که در AnimatedNavHost وجود داشت مستقیماً در NavHost پشتیبانی می شود.

هیچ تغییر دیگری در Accompanist Navigation Animation اعمال نمی‌شود و به‌زودی آن را به‌طور رسمی منسوخ خواهیم کرد، همراه با راهنمایی در مورد نحوه بازگشت به خود Navigation Compose، اما این برعکس راهنمای مهاجرت خواهد بود و نیازی به تغییرات API دیگری نیست. اگر در حال حاضر از آخرین آلفای Accompanist ( 0.31.2-alpha ) استفاده می کنید. ( b/197140101 )

رفع اشکال

  • NavHost در Navigation Compose اکنون حتی پس از توقف و ازسرگیری فعالیت، تماس‌های سیستم را به درستی قطع می‌کند. ( Icb6de , b/279118447 )

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

  • اکنون پیمایش به Compose 1.5.0 از 1.1.0 بستگی دارد.

نسخه 2.7.0-rc01

26 جولای 2023

androidx.navigation:navigation-*:2.7.0-rc01 منتشر شد. نسخه 2.7.0-rc01 حاوی این commit ها است.

رفع اشکال

  • مشکلی را برطرف کرد که در آن لامبداهای EnterTransition و ExitTransition ایجاد شده به عنوان بخشی از NavHost می‌توانند به طور بالقوه در حافظه باقی بمانند، حتی پس از حذف NavHost از ترکیب. ( I893d0 )

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

  • مشکلی از Navigation 2.6.x وجود دارد که هنگام پیمایش با popUpTo ممکن است یک IllegalArgumentException ایجاد شود. ممکن است با تغییر ساختار نمودار خود، مانند توصیه‌ای که در اینجا پیشنهاد شده است، از این استثنا جلوگیری شود. ( b/287133013 )

نسخه 2.7.0-beta02

28 ژوئن 2023

androidx.navigation:navigation-*:2.7.0-beta02 منتشر شد. نسخه 2.7.0-beta02 حاوی این تعهدات است.

رفع اشکال

  • Navigation Compose اکنون ترتیب z مناسب را برای انتقال‌های سفارشی دارد که از navigate با گزینه popUpTo استفاده می‌کنند. ( /Ib1c3a ، b/285153947 )

نسخه 2.7.0-beta01

7 ژوئن 2023

androidx.navigation:navigation-*:2.7.0-beta01 منتشر شد. نسخه 2.7.0-beta01 حاوی این تعهدات است.

رفع اشکال

  • NavHost در Navigation Compose اکنون به درستی تماس های سیستم را حتی پس از STOPPED و RESUMED Activity رهگیری می کند. ( Icb6de , b/279118447 )

نسخه 2.7.0-alpha01

24 مه 2023

androidx.navigation:navigation-*:2.7.0-alpha01 منتشر شد. نسخه 2.7.0-alpha01 حاوی این commit ها است.

انیمیشن ها از Accompanist

اکنون که AnimatedContent پایدار است، توانستیم کد را از Accompanist Navigation Animation به خود Navigation Compose برگردانیم.

این به این معنی است که تمام پشتیبانی برای تنظیم انتقال های سفارشی که در AnimatedNavHost وجود داشت مستقیماً در NavHost پشتیبانی می شود.

هیچ تغییر دیگری در Accompanist Navigation Animation اعمال نمی‌شود و به‌زودی آن را به‌طور رسمی منسوخ خواهیم کرد، همراه با راهنمایی در مورد نحوه بازگشت به خود Navigation Compose، اما این برعکس راهنمای مهاجرت خواهد بود و نیازی به تغییرات API دیگری نیست. اگر در حال حاضر از آخرین آلفای Accompanist ( 0.31.2-alpha ) استفاده می کنید. ( b/197140101 )

رفع اشکال

  • From Navigation 2.6.0-rc02 : مشکلی در Navigation در Fragments برطرف شد که در آن پیمایش با popUpTo و بیرون آوردن یک قطعه از پشته پشتی بدون ایجاد مجدد نمای آن باعث می‌شود سیستم از کار بیفتد. ( Ieb8d4 , b/281726455 )

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

  • پیمایش اکنون به Compose 1.5.0-beta01 بستگی دارد.

نسخه 2.6.0

نسخه 2.6.0

7 ژوئن 2023

androidx.navigation:navigation-*:2.6.0 منتشر شد. نسخه 2.6.0 حاوی این commit ها است.

تغییرات مهم در Navigation از 2.5.0

  • arguments NavBackStackEntry و arguments ارسال شده به OnDestinationChangedListener اکنون فقط یک کپی از آرگومان‌های تغییرناپذیر هستند که هنگام حرکت به مقصد ایجاد شده‌اند. این بدان معناست که هرگونه تغییری که در آن دسته‌ها ایجاد شده باشد، در دسترسی‌های بعدی به arguments یا سایر نمونه‌های OnDestinationChangedListener منعکس نخواهد شد.
  • NavDeepLink اکنون از مقادیر پیش‌فرض برای آرایه‌ها پشتیبانی می‌کند، که امکان پشتیبانی از پارامترهای پرس و جوی مکرر را فراهم می‌کند که به نوع آرایه آرگومان نگاشت می‌شوند. NavType همچنین اکنون شامل یک روش پیش فرض است که می تواند برای ترکیب دو مقدار تجزیه شده لغو شود.
  • زیر کلاس‌های سفارشی NavType اکنون می‌توانند serializeAsValue برای سریال‌سازی یک مقدار در یک رشته لغو کنند، و اجازه می‌دهند هم سریال‌سازی و هم deserialization (از طریق parseValue ) به طور کامل در کلاس NavType کپسوله شوند. StringType اکنون این روش را لغو می کند تا Uri.encode در String داده شده فراخوانی کند.

تغییرات مهم در Navigation Compose از نسخه 2.5.0

  • هنگام پیش‌نمایش یک Composable با NavHost ، اکنون به طور پیش‌فرض startDestination NavGraph را نشان می‌دهد.
  • NavController.popBackStack(route) ، NavController.getBackStackEntry(route) ، NavController.clearBackStack(route) اکنون همه مسیرهایی را پشتیبانی می کنند که آرگومان هایی به طور جزئی یا کامل پر شده است. توجه داشته باشید که آرگومان ها باید دقیقاً با آرگومان های ورودی مطابقت داشته باشند.
  • تلاش برای ایجاد یک NavDeepLink خالی با استفاده از navDeepLink Kotlin DSL اکنون منجر به یک اخطار پرز می شود که نشان می دهد پیوند عمیق برای معتبر بودن به uri، اقدام و/یا mimetype نیاز دارد.

تغییرات مهم در Navigation with Fragments از نسخه 2.5.0

  • NavHostFragment دیگر خود دکمه بازگشت سیستم را قطع نمی کند. این به FragmentManager زیربنایی اجازه می دهد تا سیستم را مدیریت کند. این به Fragment 1.7.0-alpha01 و بالاتر اجازه می‌دهد تا یک انیمیشن بازگشتی پیش‌بینی‌کننده درون برنامه‌ای را در دستگاه‌های Android U ارائه دهد.
  • هنگام استفاده از Navigation with Fragments، تلاش برای انجام دستی FragmentTransaction که قطعه ای را به پشته FragmentManager اضافه می کند، اکنون یک IllegalArgumentException ایجاد می کند. همیشه باید قطعات را از طریق navigate() API اضافه کنید.
  • هنگام استفاده از رشته دقیق ${applicationId} به‌عنوان مکان‌نما در ویژگی‌های app:data و app:dataPattern در عنصر فعالیت یک فایل XML ناوبری، پس از تورم، متغیر محل به طور خودکار با packageName متن پر می‌شود.
  • FragmentNavigator اکنون از API های انتقال هنگام پیمایش و نمایش NavBackStackEntries استفاده می کند. این بدان معناست که Lifecycle NavBackStackEntry اکنون منتظر می ماند تا جلوه های ویژه قطعه ورودی و خروجی قبل از انتقال Lifecycle.State نهایی خود کامل شود.
  • DialogFragmentNavigator اکنون هنگام پیمایش و نمایش NavBackStackEntries از APIهای انتقال استفاده می کند. این بدان معناست که Lifecycle NavBackStackEntry اکنون منتظر می ماند تا Lifecycle DialogFragment به DESTROYED منتقل شود و سپس به DESTROYED خود منتقل شود.
  • NavHostFragment اکنون به شما این امکان را می دهد که NavController به محض اینکه NavHostFragment به FragmentManager متصل شد، بازیابی کنید، نه تنها پس از onCreate() .
  • پشتیبانی ناوبری از ماژول‌های ویژگی پویا اکنون به کتابخانه توزیع ویژگی Play وابسته است.
  • Navigation Safe Args اکنون به پلاگین Android Gradle نسخه 7.3.0 بستگی دارد. این بدان معناست که اکنون فقط با نسخه های 7.3.0 و بالاتر سازگار است.

تغییرات مهم در NavigationUI از نسخه 2.5.0

  • هنگام ارسال شناسه یک نمودار ناوبری به AppBarConfiguration (مانند از طریق یک MenuNavigationUI اکنون فقط مقصد شروع آن نمودار پیمایش را به عنوان مقصد سطح بالا در نظر می گیرد، نه اینکه به اشتباه هر مقصد را در نمودار به عنوان مقصد سطح بالا علامت گذاری کند. رفتار ارسال شناسه یک مقصد فردی بدون تغییر است. این عملکرد مشابه از طریق تابع جدید 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 حاوی این commit ها است.

رفع اشکال

  • مشکلی در Navigation in Fragments برطرف شد که در آن پیمایش با popUpTo و بیرون آوردن یک قطعه از پشته پشتی بدون ایجاد مجدد نمای آن باعث می‌شود سیستم از کار بیفتد. ( Ieb8d4 , b/281726455 )

نسخه 2.6.0-rc01

10 مه 2023

androidx.navigation:navigation-*:2.6.0-rc01 منتشر شد. نسخه 2.6.0-rc01 حاوی این commit ها است.

رفع اشکال

  • مشکلی در Navigation با قطعات برطرف شد که در آن حذف یک قطعه از طریق navigate با popUpTo در چرخه حیات onResume() 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 )

رفع اشکال

  • هنگام استفاده از Navigation with Fragments، تلاش برای انجام دستی FragmentTransaction که قطعه ای را به پشته FragmentManager اضافه می کند، اکنون یک IllegalArgumentException ایجاد می کند. همیشه باید قطعات را از طریق navigate() API اضافه کنید. ( I6d38e )
  • هنگامی که یک navigate وجود دارد که یک ورودی اضافه می‌کند و یک popBackStack که آن را در همان قاب حذف می‌کند، ورودی بالایی که در پشته پشتی ایجاد می‌شود، اکنون به طور مداوم به RESUMED Lifecycle.State برمی‌گردد. ( ID8067 , b/276495952 )

نسخه 2.6.0-alpha09

5 آوریل 2023

androidx.navigation:navigation-*:2.6.0-alpha09 منتشر شد. نسخه 2.6.0-alpha09 حاوی این commit ها است.

رفع اشکال

  • بررسی‌های مسیر نامعتبر را برطرف کرد، به طوری که اگر NavDestination حاوی NavArgument غیر قابل تهی باشد، مسیر مقصد باید حاوی مکان‌بان‌هایی برای آرگ‌هایی باشد که همان نام‌های NavArgument غیر قابل تهی است. ( IC62bf , b/274697949 )
  • پیمایش‌های پیوند عمیق مبتنی بر Action/MimeType اکنون در صورتی که عملیات پیمایش یک NavArgument غیر قابل ته‌سازی مورد نیاز NavDestination را که Action/MimeType با آن مطابقت دارد، نداشته باشد، از بین می‌رود. ( Ibfa17 , b/271777424 )
  • وقتی NavController یک گراف را با همان مسیر و مقاصد نمودار قبلی تنظیم می‌کند، اکنون به درستی گره‌های نمودار فعلی و مقصدهای پشته پشته خود را با نمونه‌های جدید جایگزین می‌کند. این کار هنگام استفاده از onLaunchSingleTop بدون ذخیره حالت در Navigation Compose، خرابی را برطرف می‌کند. این همچنین خطایی را که در هنگام پیمایش به مقصدهای مرتبط با نمودار ریشه ایجاد می‌شود و پشته پشتی نادرست را برطرف می‌کند. ( I5bc58 , b/275258161 , b/275407804 )

نسخه 2.6.0-alpha08

22 مارس 2023

androidx.navigation:navigation-*:2.6.0-alpha08 منتشر شد. نسخه 2.6.0-alpha08 حاوی این commit ها است.

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

  • NavHostFragment اکنون به شما این امکان را می دهد که NavController به محض اینکه NavHostFragment به FragmentManager متصل شد، بازیابی کنید، نه تنها پس از onCreate() . ( Ic6382 , b/220186282 )

رفع اشکال

  • هنگام نمایش یک نمودار تودرتو که شامل یک آرگومان غیر قابل تهی است، یک NullPointerException رفع شد. ( 6b3581 , b/249988437 )
  • هنگام استفاده از سیستم پس از انجام پیمایش با popUpTo ، وضعیت NavController به ورودی صحیح ظاهر می شود. ( I3a8ec , b/270447657 )
  • FragmentNavigator اکنون وقتی پشته پشتی از طریق system back یا popBackStack() باز می‌شود و اینکه آیا تراکنش از افکت‌ها برای قطعه استفاده می‌کند یا نه، ورودی‌ها را به درستی پاپ می‌کند. ( I81bdf )
  • افزودن قطعات به FragmentManager FragmentNavigator بدون استفاده از ناوبری دیگر باعث خرابی نمی شود. ( b17204 , b/274167493 )

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

نسخه 2.6.0-alpha07

8 مارس 2023

androidx.navigation:navigation-*:2.6.0-alpha07 منتشر شد. نسخه 2.6.0-alpha07 حاوی این commit ها است.

رفع اشکال

  • انواع getBackStackEntry ، popBackStack ، clearBackStack API که مسیرها را انتخاب می‌کنند، اکنون الگوهای مسیر را با آرگومان‌های nullable و پارامترهای query nullable می‌گیرند ( I22294 , b/269302500 )
  • مشکلی را برطرف کرد که در آن فراخوانی clearBackStack() از NavController ، وضعیت ذخیره شده در مدیر قطعه مرتبط با پشته پاک شده را پاک نمی کرد. ( Ic1cce , b/271190202 )
  • یک رگرسیون در 2.6.0-alpha06 رفع شد که باعث می‌شد هنگام استفاده از System در بین برگه‌ها، MenuItem اشتباه در BottomNavigationView برجسته شود. ( I634f6 , b/270447657 )
  • رگرسیون ثابت در 2.6.0-alpha06 که باعث شد NavBackStackEntry در هنگام استفاده از Animation s به حالت RESUMED منتقل نشود. ( Ib3589 , b/269646882 )

نسخه 2.6.0-alpha06

22 فوریه 2023

androidx.navigation:navigation-*:2.6.0-alpha06 منتشر شد. نسخه 2.6.0-alpha06 حاوی این commit ها است.

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

  • هنگام پیش نمایش یک composable با NavHost ، اکنون به طور پیش فرض startDestination NavGraph را نشان می دهد. ( I2b89f )

تغییرات API

  • همه بارهای اضافه navigate NavController اکنون با @MainThread حاشیه نویسی می شوند تا اطمینان حاصل شود که آنها در رشته اصلی فراخوانی می شوند. ( I2c0b0 , b/263427111 )

رفع اشکال

  • رفع خرابی هنگام تلاش برای پیمایش در حین استفاده از ناوبری قطعه پویا. ( I3ee29 , b/268360479 )
  • اشکال رفع شد که در آن پیمایش به بخش دیگری از طریق دکمه بازگشت سیستم، نوار پایین را به مورد صحیح انتخاب شده به روز نمی کند ( If559f , b/269044426 )

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

  • هنگام استفاده از Navigation with Fragments، چرخه حیات NavBackStackEntry هنگام استفاده از APIهای Animation به RESUMED نمی رسد. ( b/269646882 )
  • هنگام استفاده از Navigation with Fragments، و پیمایش با BottomNavigation ، اگر سعی کنید پشته پشتی را با چندین ورودی بازیابی کنید، BottomMenuItem به درستی به روز نمی شود. ( b/270447657 )
  • هنگام استفاده از Navigation with Fragments، پس از بازیابی وضعیت، Lifecycle NavBackStackEntry زمانی که قطعه آن DESTROYED می رود، DESTROYED نمی شود. ( b/270610768 )

نسخه 2.6.0-alpha05

8 فوریه 2023

androidx.navigation:navigation-*:2.6.0-alpha05 منتشر شد. نسخه 2.6.0-alpha05 حاوی این commit ها است.

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

  • NavController.popBackStack(route) ، NavController.getBackStackEntry(route) ، NavController.clearBackStack(route) اکنون همه مسیرهایی را پشتیبانی می کنند که آرگومان هایی به طور جزئی یا کامل پر شده است. توجه داشته باشید که آرگومان ها باید دقیقاً با آرگومان های ورودی مطابقت داشته باشند. ( Iebd28 , Ic678c , I3b37b , b/257514373 )
  • FragmentNavigator اکنون از API های انتقال هنگام پیمایش و نمایش NavBackStackEntries استفاده می کند. این بدان معناست که Lifecycle NavBackStackEntry اکنون منتظر می ماند تا جلوه های ویژه قطعه ورودی و خروجی قبل از انتقال Lifecycle.State نهایی خود کامل شود. ( I3cb19 , b/238686802 )
  • DialogFragmentNavigator اکنون هنگام پیمایش و نمایش NavBackStackEntries از APIهای انتقال استفاده می کند. این بدان معناست که Lifecycle NavBackStackEntry اکنون منتظر می ماند تا Lifecycle DialogFragment به DESTROYED منتقل شود و سپس به DESTROYED خود منتقل شود. ( I53ee5 , b/261213893 )

تغییرات API

  • NavigatorState اکنون API prepareForTransition را ارائه می دهد تا به Navigator اجازه دهد NavBackStackEntries به Lifecycle.State میانی منتقل کند. ( I42c21 , b/238686802 )
  • اکنون می توانید از طریق یک ویژگی backstack به پشته پشتی مرتبط با NavGraphNavigator یا ComposeNavigator دسترسی داشته باشید. ComposeNavigator همچنین اکنون فراخوانی onTransitionComplete() برای علامت‌گذاری یک NavBackStackEntry که عملیات navigate یا popBackStack را کامل انجام داده است، نشان می‌دهد. ( I02062 , I718db , b/257519195 )

رفع اشکال

  • حالت Navigator اکنون در هنگام استفاده از push/popWithTransition API ها غیرفعال می شود و ورودی از قبل در حال مدیریت است. ( 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 )

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

نسخه 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 خالی با استفاده از navDeepLink Kotlin DSL اکنون منجر به هشدار خط می شود که نشان می دهد یک پیوند عمیق به یک URI ، عمل و/یا mimetype نیاز دارد تا معتبر باشد. ( I08D2F ، B/154038883 )

تغییرات API

  • عملکرد جدید پسوند NavDestination را برای تجزیه برچسب های پویا با آرگومان در قالب android:label="{arg}" به رشته. با تجزیه مقادیر R.string در مقادیر رشته خود ، آرگومان های ReferenceType را پشتیبانی می کند. ( I07D89 ، B/236269380 )

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

  • arguments Navbackstackentry و 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.1

27 جولای 2022

androidx.navigation:navigation-*:2.5.1 منتشر می شود. نسخه 2.5.1 شامل این تعهدات است.

رفع اشکال

  • Navigation Safe Args هنگام استفاده از انواع آرگومان سفارشی که در یک Bundle ذخیره می شوند ، دیگر باعث هشدارهای استهلاک در کلاسهای تولید شده نمی شوند. ( id86ed ، b/237725966 )

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

نسخه 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 بستگی دارد ، و در هنگام استفاده از چندین پشته پشتی ، یک IllegalStateException در یک NavHost در یک Navhost در یک Navhost در یک NavHost دیگر در یک NAVHOST در یک NAVHOST در یک NAVHOST ایجاد می کند.

نسخه 2.5.0-alpha04

6 آوریل 2022

androidx.navigation:navigation-*:2.5.0-alpha04 منتشر می شود. نسخه 2.5.0-alpha04 شامل این تعهدات است.

تغییرات API

رفع اشکال

  • Navhost اکنون به visibleEntries از NavController بستگی دارد تا مشخص کند کدام ورودی ها را تشکیل می دهند. این بدان معنی است که هنگام استفاده از Navhost تو در تو ، NavHost داخلی اکنون باید به درستی از بین برود. ( i4ba2b ، b/225394514 )
  • visibleEntries StateFlow ارائه شده توسط NavController اکنون به جای حالت چرخه عمر فعلی بر اساس حالت حداکثر چرخه حداکثر است. این بدان معنی است که حتی اگر چرخه عمر میزبان navController از زیر شروع شود ، لیست موارد قابل مشاهده یکسان خواهد بود. ( i9e2a8 ، b/225394514 )
  • SavedStateViewFactory اکنون از استفاده از CreationExtras پشتیبانی می کند حتی وقتی که با یک SavedStateRegistryOwner اولیه انجام شد. در صورت ارائه اضافی ، استدلال های اولیه نادیده گرفته می شوند. ( i6c43b ، b/224844583 )
  • NavDeepLink اکنون می تواند URIS را با یک پارامتر پرس و جو واحد و بدون ارزش تجزیه کند. ( i0efe8 ، b/148905489 )
  • رشته خالی اکنون به عنوان آرگومان های معتبر در پیوندهای عمیق در نظر گرفته شده است. ( i70a0d ، b/217399862 )
  • Navigation Safe Args هنگام استفاده از مکانهای نام دیگر خراب نمی شود و هیچ AndroidManifest.xml وجود ندارد. ( i17ccf ، b/227229815 )

نسخه 2.5.0-alpha03

23 فوریه 2022

androidx.navigation:navigation-*:2.5.0-alpha03 منتشر می شود. نسخه 2.5.0-alpha03 شامل این تعهدات است.

تغییرات API

  • اکنون می توانید برای ایجاد یک ViewModel در CreationExtras به by navGraphViewModels منتقل شوید. ( I29217 ، b/217618359 )

رفع اشکال

  • NavDeepLinks اکنون به درستی از شخصیت های خط جدید رمزگذاری شده تعبیه شده در مسیرها/URI های پیوند عمیق پشتیبانی می کند. ( i513d1 ، b/217815060 )
  • CreationExtras اکنون هنگام استفاده از NavBackStackEntries برای ایجاد ViewModels به درستی کار خواهد کرد. ( i69161 ، b/217617710 )
  • Navigation Safe Args اکنون با استفاده از فضای نام تعریف شده در build.gradle به جای بسته در AndroidManifest پشتیبانی می کند. ( i659ef ، b/217414933 )

نسخه 2.5.0-alpha02

9 فوریه 2022

androidx.navigation:navigation-*:2.5.0-alpha02 منتشر می شود. نسخه 2.5.0-alpha02 شامل این تعهدات است.

رفع اشکال

  • از ناوبری 2.4.1 : NavHostFragment اکنون هنگام استفاده از مشاهده با نمودارهای تو در تو ، به درستی تنظیم OnBackPressedDispatcher را تنظیم می کند. ( IFBB51 ، b/214577959 )
  • از ناوبری 2.4.1 : هنگامی که پیوند عمیق از طریق NavGraph چند تو در تو در تو قرار می گیرد ، پشته عقب اکنون به درستی شامل مقصد شروع متوسط ​​خواهد بود. ( I504C0 ، B/214383060 )

نسخه 2.5.0-alpha01

26 ژانویه 2022

androidx.navigation:navigation-*:2.5.0-alpha01 منتشر می شود. نسخه 2.5.0-alpha01 شامل این تعهدات است.

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

رفع اشکال

  • مسئله ای را برطرف کرد که دسترسی به یک ViewModel ایجاد شده از طریق by navGraphViewModels() از یک قطعه onCreate() IllegalStateException توسط آن ( i8a14d )
  • NavDeepLink S دیگر دو بار Args را رمزگشایی نمی کند ، به این معنی که آرگومان های مناسب اکنون به مقصد نهایی شما منتقل می شوند. ( i31b0a ، b/210711399 )

استدلال های امن

  • Args Safe اکنون به افزونه Android Gradle نسخه 7.0.4 بستگی دارد. این بدان معنی است که Args Safe Navigation دیگر قبل از 7.0 با نسخه های Android Studio سازگار نخواهد بود ، اما اکنون با افزونه Android Gradle 7.1.0 و بالاتر سازگار است. ( I41C88 ، B/213086135 ، B/207670704 )

نسخه 2.4.2

نسخه 2.4.2

6 آوریل 2022

androidx.navigation:navigation-*:2.4.2 منتشر می شود. نسخه 2.4.2 شامل این تعهدات است.

رفع اشکال

  • Backported از ناوبری 2.5.0-alpha03 : NavDeepLinks اکنون به درستی از شخصیت های خط جدید رمزگذاری شده تعبیه شده در مسیرها/URI های پیوند عمیق پشتیبانی می کند. ( i513d1 ، b/217815060 )
  • از ناوبری 2.5.0-alpha03 استفاده شده است: Navigation SafeArgs اکنون با استفاده از فضای نام تعریف شده در build.gradle به جای بسته در AndroidManifest پشتیبانی می کند. ( i659ef ، b/217414933 )
  • از ناوبری 2.5.0-alpha04 : Navigation Safe Args هنگام استفاده از فضای نام دیگر خراب نمی شود و هیچ AndroidManifest.xml وجود ندارد. ( i17ccf ، b/227229815 )
  • از ناوبری 2.5.0-alpha04 : رشته خالی اکنون به عنوان استدلال های معتبر در پیوندهای عمیق در نظر گرفته شده است. ( i70a0d ، b/217399862 )

نسخه 2.4.1

نسخه 2.4.1

9 فوریه 2022

androidx.navigation:navigation-*:2.4.1 منتشر شده است. نسخه 2.4.1 شامل این تعهدات است.

رفع اشکال

  • NavHostFragment اکنون هنگام استفاده از دیدگاه با نمودارهای تو در تو ، به درستی OnBackPressedDispatcher تنظیم می کند. ( IFBB51 ، b/214577959 )
  • هنگامی که پیوند عمیق از طریق NavGraph چند تو در تو وجود دارد ، پشته عقب اکنون به درستی شامل مقصد شروع میانی خواهد بود. ( I504C0 ، B/214383060 )
  • از ناوبری 2.5.0-alpha01 استفاده شده است: مسئله ای را برطرف کرد که در آن دسترسی به یک ViewModel ایجاد شده از by navGraphViewModels() از یک قطعه onCreate() با یک IllegalStateException است. ( i8a14d )
  • از ناوبری 2.5.0-alpha01 : NavDeepLink S دیگر دو بار Args را رمزگشایی نمی کند ، به این معنی که ARG های رمزگشایی شده به درستی اکنون به مقصد نهایی شما منتقل می شوند. ( i31b0a ، b/210711399 )
  • Backported از ناوبری 2.5.0-alpha01 : Args Safe اکنون به افزونه Android Gradle نسخه 7.0.4 بستگی دارد. این بدان معنی است که Args Safe Navigation دیگر قبل از 7.0 با نسخه های Android Studio سازگار نخواهد بود ، اما اکنون با افزونه Android Gradle 7.1.0 و بالاتر سازگار است. ( I41C88 ، B/213086135 ، B/207670704 )

نسخه 2.4.0

نسخه 2.4.0

26 ژانویه 2022

androidx.navigation:navigation-*:2.4.0 منتشر می شود. نسخه 2.4.0 شامل این تعهدات است.

تغییرات مهم از 2.3.0

  • تمام مصنوعات ناوبری در کوتلین بازنویسی شده اند. این امر باعث بهبودی کلاس ها با استفاده از ژنرال ها (مانند زیر کلاس های NavType ) شده است. تمام توابع پسوند Kotlin که قبلاً بخشی از مصنوعات -ktx بودند ، به مصنوعات اصلی مربوطه منتقل شده اند. آثار -ktx همچنان منتشر می شوند ، اما کاملاً خالی هستند.
  • مصنوعات navigation-fragment در حال حاضر حاوی اجرای پیش ساخته یک طرح دو صفحه از طریق AbstractListDetailFragment جدید است. این قطعه برای مدیریت یک صفحه لیست (که زیر کلاس شما در آن ارائه می دهد) و یک صفحه جزئیات ، که از یک NavHostFragment به عنوان اجرای آن استفاده می کند ، SlidingPaneLayout می کند ، همانطور که در اجرای مثال ما مشاهده می شود.
  • روش currentBackStackEntryAsFlow() در NavController Flow فراهم می کند که هر زمان که NavBackStackEntry فعلی تغییر می کند ، منتشر می شود. این جریان می تواند به عنوان جایگزینی برای مدیریت دستی یک OnDestinationChangedListener استفاده شود.
  • NavController اکنون امکان بازیابی لیستی از کلیه موارد قابل مشاهده NavBackStackEntry را به عنوان یک StateFlow از طریق خاصیت تجربی visibleEntries ارائه می دهد.
  • اکنون می توان کلاس NavType را برای ایجاد Navtypes سفارشی گسترش داد. انواع سفارشی فقط در هنگام ساختن نمودار ناوبری شما به صورت برنامه ای ، مانند از طریق نمودار ناوبری Kotlin DSL پشتیبانی می شود.
  • Navigation اکنون API های findStartDestination() و getHierarchy() را فراهم می کند که می تواند برای کمک به اجرای NavigationUI سفارشی استفاده شود. findStartDestination() یک تابع برنامه افزودنی در NavGraph است که مقصد شروع واقعی را که هنگام حرکت به نمودار نمایش داده می شود ، پیدا می کند ، حتی اگر startDestination خود یک NavGraph تو در تو باشد. getHierarchy() تابعی در مورد NavDestination است که می تواند برای تأیید اینکه آیا یک مقصد معین در سلسله مراتب دیگری قرار دارد ، استفاده شود.

    val matchingRoute: Boolean = destination.hierarchy.any { it.route == routeToFind }
    
  • روشهای NavigationUI که از BottomNavigationView استفاده کرده است به روز شده است تا در عوض ، ابرقهرمان خود را در مواد 1.4.0 ، NavigationBarView معرفی کند. این اجازه می دهد تا از این روش ها با NavigationRailView استفاده شود.

  • هنگام باد کردن یک عنصر <action> از طریق XML ، ویژگی های انیمیشن می توانند از ویژگی های کشیده شده از موضوع شما با استفاده از app:enterAnim="?attr/transitionEnter" نحو.

  • Args Safe اکنون یک روش fromSavedStateHandle() را برای هر کلاس NavArgs ایجاد می کند. ( #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)
    }
    

مسیرهای ناوبری و Kotlin DSL

نسخه های قبلی ناوبری به هر مقصد متکی است که دارای یک شناسه عدد صحیح ثابت است که آن را منحصر به فرد از مقصد خواهر و برادر خود شناسایی می کند و به شما امکان می دهد تا مستقیم یا از طریق یک عمل به آن مقصد navigate() . در حالی که این امر همچنان معتبر و مفید است ، به ویژه در مواردی که نمودار ناوبری خود را در XML تعریف می کنید و می توانید از ثابت های R.id تولید شده توسط خودکار یا استدلال های ایمن استفاده کنید (که از آن ثابت برای تولید کد در زمان ساخت استفاده می کند) ، این سیستم از اعداد صحیح منحصر به فرد معنای معنایی و بیان مورد نیاز برای پشتیبانی از نمودارهای کاملاً پویا ساخته شده را به صورت برنامه ای در زمان اجرا از طریق ناوبری Kotlin DSL ضبط نکردند.

این نسخه گزینه جدیدی را برای شناسایی منحصر به فرد یک مقصد در یک نمودار ناوبری توسط مسیر خود معرفی می کند. یک مسیر String است که مسیر منحصر به فرد به یک مقصد را تعریف می کند. تمام روشهای Kotlin DSL که شناسه مقصد را گرفتند ، اکنون با یک API معادل که مسیری را طی می کند ، مستهلک می شوند و جایگزین می شوند.

هر مسیر باید به عنوان قسمت "مسیر" از Uri رفتار شود که آن مقصد را تعریف می کند ، به عنوان مثال ، home ، profile/{userId} ، profile/{userId}/friends و غیره. وقتی هویت یک مقصد با یک خاص همراه است مطالب ، آن استدلال های پویا باید بخشی از مسیر باشد ، پیروی از همان قوانینی که پیوندهای عمیق ضمنی دارند .

تمام API های NavController که قبلاً فقط شناسه می گرفتند ، اکنون دارای اضافه بار هستند که یک String مسیر را می گیرد. این شامل navigate() ، popBackStack() ، popUpTo() و getBackStackEntry() است.

این پیامدهای API داشته است:

  • خاصیت popUpTo کوتلین در Kotlin DSL به نفع popUpToId کاهش یافته است.
  • API getStartDestination() به نفع getStartDestinationId() کاهش یافته است.

بر خلاف هنگام پیمایش توسط شناسه ، پیمایش از طریق مسیر همان قوانینی را دنبال می کند که پیوندهای عمیق ضمنی در آن می توانید به طور مستقیم به هر مقصد در هر نمودار توخالی حرکت کنید ، و اطمینان حاصل کنید که این مسیرها در پروژه های چند ماژول قابل استفاده هستند بدون اینکه صریحاً یک لینک عمیق قابل مشاهده را اضافه کنند. به هر مقصد

ناوبری

مصنوعات اجباری navigation-compose ادغام بین مؤلفه ناوبری و آهنگسازی JetPack را فراهم می کند. از توابع @Composable به عنوان مقصد در برنامه شما استفاده می کند.

این نسخه ارائه می دهد:

  • یک ترکیب NavHost که به شما امکان می دهد نمودار ناوبری خود را از طریق Kotlin DSL ، با استفاده از مقصد های composable و dialog ، به علاوه پشتیبانی از ناوگان های اختیاری مانند مواد از مواد ناوبری همراهی بسازید .
  • پشتیبانی اجباری برای تقاطع بین مقصد. انیمیشن ناوبری همراه می تواند برای کنترل انتقال Enter و خروج با استفاده از API های ترکیب آزمایشی استفاده شود.
  • جابجایی Lifecycle به هر مقصد ترکیب. هر مقصد فقط هنگامی که هرگونه انتقال ورود به پایان می رسد و بلافاصله از زمان شروع هرگونه انتقال خروجی به STARTED RESUMED رسد ، بنابراین به شما امکان می دهد با ایجاد یک تماس navigate هنگام RESUMED Lifecycle ، از همه موارد IllegalStateException و چند لمسی جلوگیری کنید.
  • Scoping of ViewModel (از طریق viewModel() API از چرخه عمر ViewModel 2.4.0 یا hiltViewModel() از Navigation Hilt 1.0.0 را در سطح مقصد تشکیل می دهد ، زمینه ای را فراهم می کند که از تغییرات پیکربندی زنده مانده و در قسمت پشتی شما قرار دارد (هنگامی که سازنده شما است. محتوا در غیر این صورت دفع شده است) و سیگنال در onCleared() که نشانگر دفع دائمی و تمیز کردن حالت مرتبط با آن NavBackStackEntry است.
  • Scoping از حالت rememberSaveable در سطح مقصد ، اطمینان حاصل می کند که هنگام بازگشت به یک مقصد ، تمام حالت های سازنده ذخیره می شود و به طور خودکار ترمیم می شود.
  • پشتیبانی کامل برای صرفه جویی و بازگرداندن وضعیت NavController و وضعیت مقصد آن پس از فرآیند مرگ و تفریح.
  • ادغام خودکار با دکمه پشت سیستم.
  • پشتیبانی از استدلال ها ، پیوستن پیوندهای عمیق به مقصد و بازگشت نتیجه به مقصد های قبلی.

  • یاران خاص را در rememberNavController() و currentBackStackEntryAsState() تهیه کنید تا حالت بلند کردن و اتصال NavController به ترکیبات خارج از NavHost (مانند نوار ناوبری پایین) امکان پذیر باشد.

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()
        }
    }
}

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

پشته های متعدد

NavController وظیفه مدیریت پشته پشت مقصد را بر عهده دارد و هنگام navigate() مقصد را به پشت پشته اضافه می کند و هنگام تماس با popBackStack() یا ایجاد دکمه عقب سیستم ، آنها را از بین می برد. کلاس NavOptions موجود و ادغام در عناصر <action> در نمودار ناوبری XML برای پشتیبانی از صرفه جویی و بازگرداندن پشته پشت گسترش یافته است.

به عنوان بخشی از این تغییر ، روشهای NavigationUI از onNavDestinationSelected() ، BottomNavigationView.setupWithNavController() و NavigationView.setupWithNavController() اکنون به طور خودکار ذخیره و بازیابی وضعیت مقاصد پشته شده ، و امکان پشتیبانی از چندین پشته های پشتی بدون تغییر کد را فراهم می کند. هنگام استفاده از ناوبری با قطعات ، این روش توصیه شده برای ادغام با چندین پشته پشت است.

API های اساسی برای پس انداز و بازگرداندن دولت از طریق تعدادی از سطوح در معرض دید قرار می گیرند:

  • در ناوبری XML ، عنصر <action> هم اکنون می تواند از ویژگی های بولی app:popUpToSaveState و app:restoreState برای نجات وضعیت هر مقصد از طریق app:popUpTo و بازگرداندن وضعیت مرتبط با مقصد به عنوان app: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” />
    
  • در navOptions Kotlin DSL ، می توانید املاک Boolean restoreState و دارایی saveState Boolean را در سازنده popUpTo اضافه کنید:

    // Use the navigate() method that takes a navOptions DSL Builder
    navController.navigate(selectedBottomNavRoute) {
      launchSingleTop = true
      restoreState = true
      popUpTo(navController.graph.findStartDestination().id) {
        saveState = true
      }
    }
    
  • در ساخت دستی یک شیء NavOptions از طریق NavOptions.Builder ، می توانید از setRestoreState() و اضافه بار جدید برای setPopUpTo() استفاده کنید که یک پارامتر اضافی saveState را می گیرد.

    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);
    
  • تماس های برنامه ای به popBackStack() اکنون می تواند یک پارامتر اضافی saveState را شامل شود.

  • می توانید از روش clearBackStack() برای پاک کردن هر وضعیتی که با popBackStack() یا popUpToSaveState ذخیره شده است ، استفاده کنید.

در همه موارد ، NavController وضعیت هر NavBackStackEntry را ذخیره و بازیابی می کند ، از جمله هر نمونه از ViewModel مقصد ناوبری. API های Navigator به روز شده اند تا هر Navigator بتواند از پس انداز و بازگرداندن وضعیت خود پشتیبانی کند.

تغییر رفتار

  • NavDeepLinkBuilder اکنون در انتظار است PendingIntent.FLAG_IMMUTABLE به PendingIntent بازگشت توسط createPendingIntent() ، اطمینان حاصل می کند که این API همانطور که انتظار می رود هنگام هدف قرار دادن Android 12 باشد ، کار می کند.
  • ناوبری اکنون به چرخه عمر 2.3.1 بستگی دارد و اکنون علائم setGraph() ، popBackStack() ، navigateUp() و navigate() را نشان می دهد ، روش هایی که به روزرسانی Lifecycle NavBackStackEntry را به روز می کنند ، به عنوان @MainThread ، تراز کردن ناوبری با اجرای نخ اصلی معرفی شده در چرخه عمر 2.3.0 .
  • پیوندهای عمیق اکنون تأیید می کنند که تمام آرگومان های مورد نیاز (آنهایی که دارای مقادیر پیش فرض هستند) در Uri وجود دارند.
  • استدلال های NavDeepLink اکنون علائم پوند را به همان روشی که علائم سؤال به عنوان جداکننده بین بخش های مسیر است ، در نظر می گیرند و مانع از آن می شود که یک استدلال از روی علامت پوند استفاده کند.
  • هنگام تولید اقدامات ، کد کوتلین تولید شده از Args Safe اکنون آرگومان ها را بدون مقادیر پیش فرض قبل از مقادیر پیش فرض به عنوان پارامترها قرار می دهد.
  • هنگام تولید آرگومان ، Args Safe اکنون پارامترهایی را بدون مقادیر پیش فرض قبل از مقادیر پیش فرض قرار می دهد.
  • SAFE-ARGS اکنون به افزونه Android Gradle 4.2.0 بستگی دارد. این بدان معنی است که شما دیگر نباید از هشدار applicationIdTextResource استفاده کنید.

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

  • ثابت در ناوبری 2.5.0-alpha01 : دسترسی به یک ViewModel ایجاد شده از by navGraphViewModels() از یک قطعه قطعه onCreate() با یک IllegalStateException است. ( b/213504272 )
  • ثابت در ناوبری 2.5.0-alpha01 : Args Safe 2.4.0 با افزونه Android Gradle 7.1.0 و بالاتر ناسازگار است. ( b/213086135 )
  • پیوند عمیق با چندین نمودار NAV تو در تو در توجیه به درستی پشتی کامل ایجاد نمی کند. ( b/214383060 )

نسخه 2.4.0-RC01

15 دسامبر 2021

androidx.navigation:navigation-*:2.4.0-rc01 منتشر می شود. نسخه 2.4.0-RC01 شامل این تعهدات است.

تغییر رفتار

  • استدلال های NavDeepLink اکنون علائم پوند را به همان روشی که علائم سؤال به عنوان جداکننده بین استدلال ها در نظر می گیرد ، در نظر می گیرند. ( I21309 ، b/180042703 )

رفع اشکال

  • Deeplinks دیگر آرگومان ها را با مقادیری که همان نام مکان نگهدارنده است ، نادیده نمی گیرد. ( IF8017 ، b/207389470 )
  • NavController دیگر هنگام ترمیم یک مقصد تو در NavController در تو در تو در می آید. ( I0F7C9 ، B/205021623 )
  • پیام خطا هنگام استفاده از startDestination نامعتبر در صورت وجود ، به طور پیش فرض در مسیر شروع مقصد پیش فرض خواهد شد. ( i86b9d ، b/208041894 )

رفع اشکال در حال تنظیم ناوبری

  • تصادف بالقوه ثابت ناشی از تعویض سریع بین مقصد شروع و مقصد دیگر با استفاده از موارد منوی NAV پایین. ( IC8976 ، b/208887901 )
  • مقصد گفتگو پس از تغییر پیکربندی یا مرگ فرآیند ، اکنون به درستی در بالای صفحه بازیابی می شود. ( i4c0dc ، b/207386169 )
  • مسئله ای را برطرف کرد که تلاش برای بازیابی یک ViewModel از Dialog's NavBackStackEntry هنگام رد گفتگو شکست می خورد. ( i6b96d ، b/206465487 )
  • هنگام استفاده از مقصد activity با NavHost Navigation که منجر به بازپرداختهای نامتناهی می شود ، مسئله ای را برطرف کرد. ( i8f64c )
  • یک نشت در پیمانکاری ناوبری که در آن به مرجع فعالیت قدیمی پس از تغییر پیکربندی یا مرگ پردازش می شود ، برطرف شد. ( i4efcb ، b/204905432 )

رفع اشکال Args Safe

  • SafeArgs دیگر هنگام تلاش برای بازگرداندن آرایه های بسته بندی شده سفارشی پس از مرگ فرآیند ، دیگر تصادف نمی کند. ( i618e8 ، b/207315994 )
  • رفع اشکال در استدلال های ایمن که به آرایه های بولی اجازه نمی دهد مقدار null داشته باشند. ( i8c396 ، b/174787525 )

نسخه 2.4.0-beta02

3 نوامبر 2021

androidx.navigation:navigation-*:2.4.0-beta02 منتشر می شود. نسخه 2.4.0-beta02 شامل این تعهدات است.

تغییرات API

  • رسیدگی به هر دو پیوندهای عمیق صریح و ضمنی اکنون به طور خودکار پرچم saveState را هنگام حرکت به نمودار دیگر اضافه می کند ، و اطمینان حاصل می کند که کدی مانند NavigationUI.setupWithNavController و کد با استفاده از چندین پشته پشت کار می کند. ( IC8807 )

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

  • الگوهای پیوند عمیق اکنون به جای تورم ، در Navdeeplink تنبلی در Navdeeplink گردآوری می شوند. این باید زمان تورم نمودارهای ناوبری را که شامل پیوندهای عمیق است ، بهبود بخشد. ( B8D257 ، B/184149935 )

رفع اشکال

  • مسئله ای را برطرف کرد که در آن Navbackstackentries به Lifecycle.State.CREATED هل داده می شود. state.Created پس از حرکت به Lifecycle.State.STARTED هنگامی که NavHost مستقیماً به setContent() اضافه می شود. ( IA5AC1 ، B/203536683 )
  • رفع یک شرط مسابقه که در آن می توان مقصد DialogFragment از پشته پشتی خارج کرد قبل از اینکه گفتگوی نشان داده شود ، در واقع گفتگو را رد نمی کند و در نتیجه تصادف هنگامی که گفتگوی ناخوشایند توسط کاربر به طور دستی رد شد. ( i687e5 )
  • مسئله ای را برطرف کرد که در آن API onNavDestinationSelected در NavigationUI حتی اگر واقعاً به آن نمودار ناوبری navigate() نکردید ، true باز می گردد. اکنون از همان منطق مورد استفاده در داخل توسط setupWithNavController استفاده می کند تا تنها با استفاده از hierarchy مقصد MenuItem مرتبط با مقصد فعلی را انتخاب کند. ( I2B053 )

نسخه 2.4.0-beta01

27 اکتبر 2021

androidx.navigation:navigation-*:2.4.0-beta01 منتشر می شود. نسخه 2.4.0-beta01 شامل این تعهدات است.

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

  • اکنون می توانید by navGraphViewModel با مسیری به عنوان جایگزینی برای استفاده از شناسه استفاده کنید تا بتوانید با استفاده از Navigation Kotlin DSL با قطعات بهتر پشتیبانی کنید. ( i901e3 ، b/201446416 )

تغییرات API

  • API visibleEntries اکنون آزمایشی است. ( i93f6f )

رفع اشکال

  • با قطع شدن انتقال با حرکت به جلو و عقب بین همان صفحه ها ، ViewModels دیگر از بین نمی روند ( ID52D8 ، B/200817333 )
  • آرگومان های NavDeepLink قابل قبول دیگر هنگام افزودن پیوندهای عمیق به NavDestination S دیگر به مقدار پیش فرض احتیاج ندارند. ( i5aad4 ، b/201320030 )
  • NavBackstackentries اکنون با چرخه های مختلف زندگی دیگر برابر نیست. این بدان معناست که Navhost هنگام انجام ناوبری با Singletop و در هنگام انتخاب مجدد موارد منو پایین ، تمام مقصد ها را به درستی بازیابی می کند. ( i1b351 ، b/196997433 )
  • مسئله ای را با AbstractListDetailFragment که باعث ایجاد ویژگی های layout_width و layout_weight در صفحه لیست شده توسط onCreateListPaneView() شده است ، رفع شد تا نادرست انجام شود یا نادیده گرفته شود. ( F5FBF3 )
  • وضعیت بصری مقصد های گفتگو اکنون به درستی در همگام سازی با وضعیت DialogFragmentNavigator باقی می ماند. این بدان معناست که تماس دستی API ناهمزمان dismiss() API برای DialogFragment اکنون به درستی تمام مقصد های گفتگو را در بالای گفتگوی اکنون رد شده پاک می کند. این امر در مواردی که popUpTo یا popBackStack() استفاده می کنید برای رد گفتگوی خود تأثیر نمی گذارد. ( i77ba2 )
  • AbstractAppBarOnDestinationChangedListener اکنون پیام خطای واضح تری برای onDestinationChanged() دارد. ( IE742D )

نسخه 2.4.0-alpha10

29 سپتامبر 2021

androidx.navigation:navigation-*:2.4.0-alpha10 منتشر می شود. نسخه 2.4.0-alpha10 شامل این تعهدات است.

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

  • NavController اکنون امکان بازیابی لیستی از کلیه موارد قابل مشاهده NavBackStackEntry از طریق visibleEntries Stateflow ( IA964E ) ارائه می دهد.
  • rememberNavController() اکنون مجموعه ای از موارد اختیاری از Navigator را انتخاب می کند که برای پشتیبانی بهتر از ناوبرهای اختیاری مانند مواردی که از مواد ناوبری همراهی استفاده می شود ، به NavController برگشتی اضافه می شود. ( i4619e )

رفع اشکال

  • ناوبری پویا هنگام بازآفرینی فعالیت دیگر خراب نمی شود. ( IFA6A3 ، B/197942869 )
  • با دکمه پشت سیستم که فقط پس از بازگشت به یک مقصد ترکیبی که حاوی یک NavHost است ، مسئله ای را برطرف کرد. ( 3ed148 ، b/195668143 )
  • Safeargs اکنون آرگومان هایی را برای fromBundle() و fromSavedStateHandle() به ترتیب پارامتر مناسب ایجاد می کند. ( i824a8 ، b/200059831 )

نسخه 2.4.0-alpha09

15 سپتامبر 2021

androidx.navigation:navigation-*:2.4.0-alpha09 منتشر می شود. نسخه 2.4.0-alpha09 شامل این تعهدات است.

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

  • اکنون می توانید از روش clearBackStack() برای پاک کردن هر وضعیتی که با popBackStack() یا popUpToSaveState ذخیره شده است ، استفاده کنید. ( i80a0f )
  • اکنون می توانید لیستی از آرگومان ها و/یا پیوندهای عمیق را به سازنده نمودار ناوبری تو در تو در تو منتقل کنید و آنها به طور خودکار به نمودار حاصل اضافه می شوند. ( i8a470 ، b/182545357 )

تغییرات API

  • عملکرد navArgument Kotlin DSL اکنون به جای اینکه navigation-compose بخشی از navigation-common است. این امر برای ادامه استفاده از این عملکرد به به روزرسانی واردات نیاز دارد. ( i1d095 )

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

  • هنگام تولید آرگومان ، Args Safe اکنون پارامترهایی را بدون مقادیر پیش فرض قبل از مقادیر پیش فرض قرار می دهد. ( i89709 ، b/198493585 )

رفع اشکال

  • هنگام استفاده از آهنگسازی ناوبری ، پس از DESTROYED همه فرزندانشان ، ناوگرافها فقط DESTROYED می شوند. ( i86552 ، b/198741720 )
  • آرگومان های NavDeepLink قابل برگشت دیگر به مقدار پیش فرض احتیاج ندارند. ( 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 OnDestinationChangedListener instances and the currentBackStackEntryFlow were not notified when using launchSingleTop . ( Iaaebc )

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

نسخه 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 NavType class 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 getBackStackEntry and previousBackStackEntry inside composable(), in conjunction with remember() , 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 ArrayIndexOutOfBoundsException when calling setGraph with 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 )

External Contribution

  • 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 )
  • NavHost now observes for changes in the Lifecycle.State of NavBackStackEntry s which means using a NavHost in 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 DialogFragment would not correctly update the NavController state 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 toSavedStateHandle method for arguments which can be used to test your ViewModel code. ( If1e2d , b/193353880 )

نسخه 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() and requireDetailPaneNavHostFragment() methods on AbstractListDetailFragment have been renamed to getSlidingPaneLayout() and getDetailPaneNavHostFragment() , respectively. ( I34a08 )

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

  • When navigating with animations (like Crossfade ), the new destination's Lifecycle will now only reach the RESUMED when the animation completes. ( If0543 , b/172112072 , b/194301889 )
  • Navigation Compose's NavHost now 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 NullPointerException that would occur when adding a deep link without a Uri and navigating via a route or deep link. ( 938a0c , b/193805425 )
  • Fixed an issue in Navigation Compose where a deep linked NavBackStackEntry would not reach the RESUMED state. ( 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 )

نسخه 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 NavHost now 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 NavController back stack. ( I0b8db , b/175392262 )

رفع اشکال

  • Fixed a NoSuchElementException when calling popBackStack() from within a LifecycleObserver attached to a NavBackStackEntry caused by reentrant updates to the NavController's state. ( I64621 )
  • AbstractListDetailFragment now allows SlidingPaneLayout to be completely stripped from your APK when AbstractListDetailFragment is not used. ( I611ad )
  • NavGraph and NavDestination now override the equals method so two objects with the same values will be considered equal. ( I166eb , b/175392262 )

نسخه 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-fragment artifact now contains a prebuilt implementation of a two pane layout via the new AbstractListDetailFragment . This fragment uses a SlidingPaneLayout to manage a list pane (which your subclass provides) and a detail pane, which uses a NavHostFragment as its implementation, as seen in our example implementation . ( Iac4be , b/191276636 )
  • The NavHost of the navigation-compose artifact now supports dialog destinations in addition to composable destinations. These dialog destinations will each be shown within a Composable Dialog , floating above the current composable destination. ( 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 add function in NavigatorState has been renamed to push . All current calls to add() will need to be changed to push(). ( Ie89fc , b/172112072 )
  • Custom Navigator instances can now use the pushWithTransaction and popWithTransition APIs on NavigatorState to push or pop a destination asynchronously. Note that this APIs are not yet used by any of the included navigators. ( Ic4d7c , b/172112072 )

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

  • NavDeepLinkBuilder now adds PendingIntent.FLAG_IMMUTABLE to the PendingIntent returned by createPendingIntent() , 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 NullPointerException when navigating to a destination using a string[] 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 Kotlin versions before 1.5.0 . ( Icd1ff , b/190739257 )

نسخه 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-alpha01 where setupActionBarWithNavController() would not properly remove the Up icon when you are on a top level destination. ( I5d443 , b/189868637 )
  • Fixed an IllegalStateException when calling popBackStack() after previously popping the root graph of the NavController. ( I2a330 , b/190265699 )
  • ProGuard rules for by navArgs() now properly apply when using navigation-common or any artifacts that depend on it. ( I68800 , b/190082521 )
  • An OnDestinationChangedListener that calls navigate() 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 )

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

  • Safe Args will fail with an Unable to find method ''java.lang.String kotlin.text.CarsKt.titleCase(char, java.util.Locale)'' error when using Gradle 6.7.0 due to a dependency on an older version of Kotlin. This can be worked around by updating to use Gradle 7.0. ( b/190739257 )

نسخه 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 )
  • NavigationUI has 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() and getHierarchy() APIs that can be used to help implement custom NavigationUI. findDestination() is an extension function on NavGraph that will locate a destination within the graph. getHierarchy() is a function on NavDestination that 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 BottomNavigationView have been updated to instead take its superclass introduced in Material 1.4.0 , NavigationBarView . This allows these methods to be used with the NavigationRailView . ( Ib0b36 , b/182938895 )

  • When inflating an <action> element via XML, animation attributes can use attributes pulled from your theme using the app:enterAnim="?attr/transitionEnter" syntax. ( I07bc1 , b/178291654 )

تغییرات API

رفع اشکال

  • DialogFragmentNavigator now uses the NavigatorState.pop() API to inform the NavController when a dialog is dismissed by hitting the system back button or clicking outside of it, ensuring that the NavController state is always in sync with the Navigator's state. ( I2ead9 )
  • Navigation no longer gives a ConcurrentModificationException when using manipulating the list of OnDestinationChangedListeners from with an onDestinationChanged callback. ( 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 findNode is now resId instead of resid . ( I7711d )

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

  • Safe-Args now depends on Android Gradle Plugin 4.2.0. This means you should no longer get the using applicationIdTextResource warning. ( I6d67b , b/172824579 )

نسخه 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 on NavController provides a Flow that emits whenever the current NavBackStackEntry changes. This flow can be used as an alternative to manually managing an OnDestinationChangedListener . ( I19c4a , #89 , b/163947280 )

پشته های متعدد

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 of app:popUpToSaveState and app:restoreState to save the state of any destinations popped via app:popUpTo and restore the state associated with the destination passed as the app: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 navOptions Kotlin DSL , you can add the restoreState boolean property and the saveState boolean property on the popUpTo builder :

    // 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 NavOptions object via the NavOptions.Builder , you can use the setRestoreState() and new overload to setPopUpTo() that takes an additional saveState parameter.

    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 additional saveState parameter.

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 popUpTo kotlin property on the Kotlin DSL has been deprecated in favor of popUpToId . ( I59c73 , b/172823546 )
  • The getStartDestination() API has been deprecated in favor of getStartDestinationId() . ( 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 NavType subclasses). All Kotlin extension functions that used to be part of the -ktx artifacts have been moved to their respective main artifacts. The -ktx artifacts will continue to be published, but are completely empty. ( b/184292145 )
  • NavDeepLinkBuilder now 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 NavBackStackEntry is now exposed as part of its public API. ( Ie033a )
  • The name and argument fields and destructuring functions of NamedNavArgument are now public. ( #174 , b/181320559 )
  • Introduced a new NavBackStackEntry#provideToCompositionLocals extension that provides the NavBackStackEntry to the relevant composition locals. ( #175 , b/187229439 )

Safe Args

  • Safe Args now generates a fromSavedStateHandle() method for each NavArgs class. ( #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.1 and now marks setGraph() , popBackStack() , navigateUp() , and navigate() , the methods that update the NavBackStackEntry Lifecycle , as @MainThread , aligning Navigation with the main thread enforcement introduced in Lifecycle 2.3.0 . ( b/171125856 )
  • Parsing Enum arguments from deep links is now case insensitive, allowing a deep link like http://www.example.com/red to match a www.example.com/{color} deep link even when the enum has the value of RED . ( #152 , b/135857840 )

Compose Compatibility

  • androidx.navigation:navigation-compose:2.4.0-alpha01 is only compatible with Compose version 1.0.0-beta07 and above.

رفع اشکال

  • Fixed an issue where trailing argument placeholders would take precedence over deep links that have a matching exact suffix. ( #153 , b/184072811 )
  • NavHostFragment now supports custom Navigators that use the same @Navigator.Name("dialog") as the default DialogFragmentNavigator . ( Ib1c2c , b/175979140 )
  • Improved the behavior of NavigatorProvider#addNavigator to 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 each NavArgs class. ( #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 name and argument fields and destructuring functions of NamedNavArgument public. ( #174 , b/181320559 )
  • Thanks jossiwolf for introducing a new NavBackStackEntry#provideToCompositionLocals extension that provides the NavBackStackEntry to the relevant composition locals. ( #175 , b/187229439 )
  • Thanks jossiwolf for improved the behavior of NavigatorProvider#addNavigator to ensure that calling it repeatedly with the same instance does not cause issues. ( #176 , b/187443146 )

Version 1.0.0-alpha10

7 آوریل 2021

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

تغییرات API

  • NavHost now accepts a Modifier , which is passed down to the composable container that wraps the destination composables. ( I85aca , b/175125483 )

رفع اشکال

  • NavHost now works even when an OnBackPressedDispatcherOwner is not found, such is the case when previewing the NavHost . ( I7d8b4 )
  • Navigation Compose now depends on Navigation 2.3.5 , fixing an issue when using BackHandler inside a NavHost destination. ( I7e63b , b/182284739 )

Version 1.0.0-alpha09

10 مارس 2021

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

تغییرات API

  • LocalViewModelStoreOwner.current now returns a nullable ViewModelStoreOwner to better determine whether a ViewModelStoreOwner is available in the current composition. APIs that require a ViewModelStoreOwner , such as viewModel() and NavHost , still throw an exception if a ViewModelStoreOwner is 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 )

Version 1.0.0-alpha08

24 فوریه 2021

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

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

  • NavHost now populates the LocalSavedStateRegistryOwner CompositionLocal with that destination's NavBackStackEntry , ensuring that any state directly saved into the SavedStateRegistry will be saved and restored alongside the destination. ( I435d7 , b/179469431 )

Version 1.0.0-alpha07

10 فوریه 2021

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

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

Version 1.0.0-alpha06

28 ژانویه 2021

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

تغییرات API

  • Added a getBackStackEntry(route: String) extension method on NavController that returns the associated NavBackStackEntry . ( If8931 )

Version 1.0.0-alpha05

13 ژانویه 2021

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

Updated to depend on Compose 1.0.0-alpha10.

Version 1.0.0-alpha04

16 دسامبر 2020

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

  • Updated for compatibility with Compose 1.0.0-alpha09 .

Version 1.0.0-alpha03

2 دسامبر 2020

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

رفع اشکال

  • Fixed an issue where popBackStack() and navigateUp() 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 )

Version 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. Version 1.0.0-alpha01 contains these commits.

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

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 NavHost composable 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() and currentBackStackEntryAsState() to allow hoisting state and connecting the NavController to composables outside of the NavHost (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 NavDeepLinkRequest or Uri , you can now access the Uri , action, and mime type in the resulting destination by getting the intent from arguments via KEY_DEEP_LINK_INTENT , mirroring the functionality already available for external deep linking. ( I975c3 , b/181521877 )

رفع اشکال

  • OnBackPressedCallbacks added to a dispatcher with the NavBackStackEntry as the LifecycleOwner now properly intercept back after the Activity Lifecycle is STOPPED , then STARTED ( Iff94f , b/182284739 )
  • Deep link domain parsing is now case insensitive, ensuring that www.example.com matches both www.example.com and www.Example.com . Note that query parameter names are still case sensitive. ( #144 , b/153829033 )
  • Fixed a NullPointerException that 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 )

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

External Contribution

نسخه 2.3.4

نسخه 2.3.4

10 مارس 2021

androidx.navigation:navigation-*:2.3.4 is released. Version 2.3.4 contains these commits.

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

  • ReferenceType arguments 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 by 0x . ( #127 , b/179166693 )
  • The android:defaultValue for an argument with app:argType="float" now supports integer default values, allowing you to use android:defaultValue="0" rather than requiring the use of 0.0 . ( #117 , b/173766247 )

رفع اشکال

  • Fix stuck installation progress when using Navigation's support for dynamic features. ( Ib27a7 , b/169636207 )
  • Calling setViewModelStore or setLifecycleOwner with 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 JvmName for the pull request to ensure that ReferenceType arguments can now be properly parsed when sent as part of a deeplink URI. ( #127 , b/179166693 )
  • Thanks tatocaster for the pull request to allow the defaultValue for an argument with app: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 NavBackStackEntry before its Lifecycle is moved to CREATED . ( Ie3ba3 )
  • Fixed regression caused by b/171364502 where navigating to an activity with an animation resource value of 0 caused a ResourceNotFoundException . ( 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 NavigationUI where using an <activity> destination with onNavDestinationSelected would fail to navigate to the Activity. ( I22e34 , b/171364502 )
  • Fixed an issue where navigation-dynamic-features-fragment would 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 OnDestinationChangedListener instances when using launchSingleTop . ( 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 a popUpTo that 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 with FragmentScenario and Navigation.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-ui now depends on DrawerLayout 1.1.1 , ensuring that NavigationUI is able to open the drawer even when using LOCK_MODE_LOCKED_CLOSED or LOCK_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-runtime and navigation-dynamic-features-fragment artifacts 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-testing artifact provides a TestNavHostController that 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 NavBackStackEntry associated with each destination on the Navigation back stack now allows you to access a SavedStateHandle suitable 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.
  • NavigationUI support for Openable : All usages of DrawerLayout in NavigationUI have been replaced with the more generic Openable interface added in CustomView 1.1.0 and implemented by DrawerLayout in DrawerLayout 1.1.0 .
  • Action and Mime Type support in deep links : Deep linking has been expanded to support app:action and app:mimeType in addition to the app:uri previously available. NavController now supports navigating by any combination of these fields via the new NavDeepLinkRequest class. 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 NullPointerException when replacing an instance of a destination with no arguments with another instance with arguments with singleTop . ( b/158006669 )
  • All destination is unknown exceptions thrown by NavController now have additional debugging information to help determine the state of the NavController . ( 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 Lifecycle of the NavBackStackEntry would not be properly updated after process death. ( b/155218371 )
  • OnDestinationChangedListener instances registered before calling setGraph() are now properly sent the restored destination after a process death. ( b/155218371 )
  • When using singleTop , the NavBackStackEntry now correctly has its arguments updated and the updated arguments are sent to all OnDestinationChangeListener instances. ( b/156545508 )

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

نسخه 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:action and app:mimeType in addition to the app:uri previously available. NavController now supports navigating by any combination of these fields via the new NavDeepLinkRequest class. ( 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 )

نسخه 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 specify app:graphPackage and a default one will be used by adding moduleName suffix to the applicationId after a dot. If you do need to customize your graphPackage , an ${applicationId} placeholder is now supported. ( b/152696768 )
  • The Navigation Graph Kotlin DSL now exposes a defaultArguments Map for actions, mirroring the ability to set default values on <action> elements in Navigation XML files. ( b/150345605 )

رفع اشکال

  • From Navigation 2.2.2 : Fixed an IllegalStateException when deep linking to the start destination of your graph when you have multiple NavHostFragment instances in your Activity. ( b/147378752 )

Dependency updates

نسخه 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 DynamicExtras class no longer uses a builder pattern and can now be constructed directly. ( aosp/1253671 )
  • DynamicActivityNavigator now takes a Context in its constructor rather than an Activity . ( aosp/1250252 )

رفع اشکال

  • NavigationUI no longer ignores empty labels (ie, a destination with android:label=”” ) and now correctly sets the title to an empty string. ( b/148679860 )

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

  • 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

رفع اشکال

  • The navigation-common-ktx ProGuard rules now correctly only keep the NavArgs classes that are used rather than all NavArgs instances. ( b/150213558 )

Dependency changes

  • Navigation has reverted its dependency on Core 1.2.0 and now depends on Core 1.1.0 to avoid forcing developers to move to a newer dependency when Navigation does not depend on any new APIs in Core 1.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 NavBackStackEntry now allows you to access a SavedStateHandle suitable 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() and getPreviousBackStackEntry() have been added to make it easier to retrieve a NavBackStackEntry for the current and previous destinations. ( b/79672220 )

رفع اشکال

  • navigateUp() now passes the current destination's arguments and the KEY_DEEP_LINK_INTENT to the previous destination when launching your app on your own task stack. ( b/147456890 )

Dependency changes

نسخه 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-testing artifact provides a TestNavHostController class. This class provides an alternative to using a mock NavController when 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 )

رفع اشکال

  • 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 : The navigation-ui ProGuard rules for DrawerArrowDrawable have been updated to ensure that android.enableJetifier=true is not required. ( b/147610424 )
  • From Navigation 2.2.1 : The navigation-common-ktx module now has a unique manifest package name instead of sharing the same manifest package name as navigation-runtime-ktx . ( aosp/1141947 )

Dependency updates

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 IllegalStateException when deep linking to the start destination of your graph when you have multiple NavHostFragment instances in your Activity. ( b/147378752 )
  • NavigationUI no longer ignores empty labels (ie, a destination with android: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-ktx ProGuard rules now correctly only keep the NavArgs classes that are used rather than all NavArgs instances. This was previously released in Navigation 2.3.0-alpha03 . ( b/150213558

Dependency updates

Version 2.2.1

Version 2.2.1

5 فوریه 2020

androidx.navigation:navigation-*:2.2.1 is released. Version 2.2.1 contains these commits .

رفع اشکال

  • 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-ui ProGuard rules for DrawerArrowDrawable have been updated to ensure that android.enableJetifier=true is not required. ( b/147610424 )
  • The navigation-common-ktx module now has a unique manifest package name instead of sharing the same manifest package name as navigation-runtime-ktx . ( aosp/1141947 )

Dependency updates

Version 2.2.0

Version 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 returned NavBackStackEntry provides a Navigation-driven LifecycleOwner , ViewModelStoreOwner (the same returned by NavController.getViewModelStoreOwner() ), and SavedStateRegistryOwner , in addition to providing the arguments used to start that destination.
  • Lifecycle ViewModel SavedState Integration : SavedStateViewModelFactory is now the default factory used when using by navGraphViewModels() or the ViewModelProvider constructor with a ViewModelStoreOwner returned by NavController.getBackStackEntry() or NavController.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 : NavHostFragment now uses FragmentContainerView from Fragment 1.2.0 , fixing animation z-ordering issues and window insets dispatching to Fragments.

نسخه 2.2.0-rc04

18 دسامبر 2019

androidx.navigation:navigation-*:2.2.0-rc04 is released. Version 2.2.0-rc04 contains these commits .

رفع اشکال

نسخه 2.2.0-rc03

4 دسامبر 2019

androidx.navigation:navigation-*:2.2.0-rc03 is released. Version 2.2.0-rc03 contains these commits .

رفع اشکال

  • 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 of null . ( b/141613546 )
  • NavHostFragment now correctly restores the graph after a configuration change when used with FragmentContainerView . ( b/143752103 )

Dependency changes

  • Navigation now depends on Lifecycle 2.2.0-rc03 , Lifecycle ViewModel SavedState 1.0.0-rc03 , Activity 1.1.0-rc03 , and Fragment 1.2.0-rc03 where appropriate.

نسخه 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 .

نسخه 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 .

نسخه 2.2.0-beta01

9 اکتبر 2019

androidx.navigation:navigation-*:2.2.0-beta01 is released. Version 2.2.0-beta01 contains these commits .

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

  • NavDestination and its subclasses now override toString() 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 )

رفع اشکال

  • 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 on Activity now has a better error message when there are no extras. ( b/141408999 )
  • Safe Args generated Directions Java classes now contain default values. ( b/141099045 )
  • Safe Args generated Args Java classes now contain default values. ( b/140123727 )
  • When using a Toolbar , NavigationUI no longer animates the text change when moving between two top level destinations. ( b/140848160 )

نسخه 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 calling setGraph now results in an IllegalStateException . This should always be set by the NavHost as part of the initial setup to ensure that all NavBackStackEntry instances have a consistent storage for ViewModel instances. ( aosp/1111821 )

رفع اشکال

  • Fixed a ConcurrentModificationException when using ViewModel instances attached to multiple different navigation graph scoped ViewModelStore instances. ( 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 returned NavBackStackEntry provides a Navigation-driven LifecycleOwner , ViewModelStoreOwner (the same returned by NavController.getViewModelStoreOwner() ), and SavedStateRegistryOwner , in addition to providing the arguments used to start that destination. ( aosp/1101691 , aosp/1101710 )

رفع اشکال

  • Fixed an issue where adding a NavHostFragment to ViewPager2 failed with an IllegalArgumentException . ( b/133640271 )
  • NavInflater now avoids calling getResourceName() unnecessarily, speeding up inflation time by up to 40%. ( b/139213740 )

نسخه 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 .

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

  • SavedStateViewModelFactory is now the default factory used when using by navGraphViewModels() or the ViewModelProvider constructor with a ViewModelStoreOwner returned by NavController.getViewModelStoreOwner() . ( b/135716331 )

API changes

رفع اشکال

  • NavHostFragment now uses FragmentContainerView , 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 -ktx libraries or by using the getViewModelStoreOwner() API added to NavController . See Share UI-related data between destinations for more information.
  • Dialog destinations : You can now create <dialog> destinations that will show a DialogFragment when you navigate to them. NavHostFragment supports dialog destinations by default. See Create a destination from a DialogFragment for more information.
  • Navigating by Uri : You can now navigate using a Uri , 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 NavHost have been moved to NavHostController , allowing implementations to connect their NavController to the hosting LifecycleOwner , OnBackPressedDispatcher , and ViewModelStore .

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 on NavController introduced in 2.1.0-alpha02 has 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 .

رفع اشکال

  • 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 .

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

  • NavigationUI now animates the removal of the Up button when using setupWithNavController() with a Toolbar or CollapsingToolbarLayout . ( b/131403621 )

رفع اشکال

  • 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:navGraph attribute used by NavHostFragment has now been moved to the navigation-runtime artifact. 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 on NavController has been deprecated in favor of the new getViewModelStoreOwner() method that returns a ViewModelStoreOwner . ( 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 ignore FloatingWindow destinations. ( 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 )

رفع اشکال

  • 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 NavController have been renamed and moved to a new subclass of NavController , NavHostController . ( aosp/966091 )
  • The NavController setHostOnBackPressedDispatcherOwner() method has been replaced with NavHostController 's setOnBackPressedDispatcher() method and now requires that you call setLifecycleOwner() prior to calling it. ( aosp/965409 )
  • NavHostController now contains a enableOnBackPressed(boolean) method that replaces the NavHostOnBackPressedManager class that was previously returned by setHostOnBackPressedDispatcherOwner() . ( aosp/966091 )

رفع اشکال

  • 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 .

رفع اشکال

  • NavHostFragment correctly respects app:defaultNavHost when intercepting the system Back button events, fixing a regression in Navigation 2.1.0-alpha03 . b/132077777
  • DialogFragmentNavigator now correctly handles popBackStack() and navigateUp() operations. b/132576764
  • Fixed an IllegalStateException: unknown destination during restore issue when repeatedly navigating between nested graphs. b/131733658

Version 2.1.0-alpha03

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 a DialogFragment when you navigate to them. NavHostFragment supports dialog destinations by default. b/80267254
  • In addition to calling navigate with a resource id or a NavDirections instance, you can now navigate via a Uri , 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 of NavHostFragment has been deprecated and its functionality moved to the new onCreateNavController() method to make it more clear that this is the correct entry point of adding custom Navigators when subclassing NavHostFragment . b/122802849
  • A hasDeepLink() method has been added to NavDestination to allow you to check if a given Uri can be handled by that destination or, in the case of a NavGraph , any destination in the navigation graph. b/117437718

رفع اشکال

  • Default arguments are now correctly passed to OnDestinationChangedListener instances. b/130630686
  • NavHostFragment now intercepts system Back events using the OnBackPressedDispatcher , 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 unspecified app:argType is now properly inferred as a string argument. 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 the getViewModelStore() API added to NavController . b/111614463

API changes

  • You can now add an app:targetPackage to an <activity> destination to limit the matching package name. It supports app:targetPackage="${applicationId}" for restricting the package to your own application id. b/110975456

رفع اشکال

  • The android:name for <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.1 and androidx.fragment:fragment:1.1.0-alpha05 . This release also removes the dependency on androidx.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.instantiateFragment is now deprecated. The default implementation now uses FragmentFactory to instantiate Fragments. b/119054429

رفع اشکال

  • Navigation no longer sends a null Bundle when there are arguments attached to a destination, fixing an issue when using android: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 without FLAG_ACTIVITY_NEW_TASK b/126082008
  • Fixed an issue with ActivityNavigator.applyPopAnimationsToPendingTransition not applying the correct pop exit animation b/126237567
  • Kotlin code generated by Safe Args now properly escapes Kotlin keywords such as in and fun in the package name associated with the R class. 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 singleTop navigation operations b/124294805

Version 1.0.0-beta02

12 فوریه 2019

This release includes a number of minor improvements and important bug fixes.

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

  • You can now use 0 as an android:defaultValue for reference arguments. b/124248602

تغییر رفتار

  • Exact deep link matches are now prioritized over deep links with .* or argument matches. b/123969518

رفع اشکال

  • popBackStack() and navigateUp now correctly return false when popping the last destination on the back stack, fixing a regression introduced in 1.0.0-beta01 . b/123933201
  • Navigation now correctly sets the ClassLoader during restoration of saved instance state, avoiding issues when using custom classes in Navigator saved state or in arguments sent to a NavDestination . 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

نسخه 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 different app:argType will 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 FragmentNavigator state would desynchronize with the NavController 's state, causing an IllegalStateException when attempting to restore the back stack. b/123803044
  • Fixed an issue where the NavigationUI handled back arrow would not appear when using ProGuard with obfuscation. b/123449431
  • The code generated by Safe Args now properly handles using an app:argType pointing 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

Version 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 generated NavArgs class in an Activity or Fragment . b/122603367
  • Safe Args now allows you to generate Kotlin code by applying the androidx.navigation.safeargs.kotlin plugin. 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 previous androidx.navigation.safeargs plugin. b/110263087

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

  • Matching deep links are now biased towards the deep link that has the most matching arguments. b/118393029
  • Calling setGraph() on a NavController will now reset the back stack. b/111450672
  • Unknown deep links no longer throw an IllegalStateException , but are ignored, fixing issues with nested or multiple NavHostFragment s. b/121340440

شکستن تغییرات

  • The NavOptions.applyPopAnimationsToPendingTransition() method for applying pop animations to an Activity has been moved to ActivityNavigator . 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 NavDirections classes no longer have a public constructor - they should only be generated via the static methods in the generated Directions classes. b/122963206
  • The returned Bundle from NavDirections ' getArguments() is now marked as @NonNull rather than @Nullable . b/123243957

رفع اشکال

  • NavDeepLinkBuilder now correctly handles multiple simultaneous PendingIntent s to the same destination by using the arguments you pass in to determine the uniqueness. b/120042732
  • NavController now correctly handles popBackStack() operations when using a nested NavHostFragment or other child Fragments with a back stack. b/122770335
  • NavigationUI now 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 NavDirections classes now correctly have equal hashCode() values when equals() would return true. b/123043662
  • FragmentNavigator now throws a better error message if you attempt to do custom FragmentTransactions on the NavHostFragment 's FragmentManager . You should always use getChildFragmentManager() . b/112927148

Version 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.

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

  • MenuItem s with menuCategory="secondary" will no longer pop the back stack when used with NavigationUI methods. b/120104424
  • AppBarConfiguration now allows you to set a fallback OnNavigateUpListener instance which will be called when navController.navigateUp() returns false . b/79993862 b/120690961

شکستن تغییرات

  • When using an <argument> with an argType="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 the setup methods. Add menuCategory="secondary" to your MenuItem to avoid popping the back stack. aosp/852869
  • The fromBundle() methods of generated Args classes now take a non-null Bundle instead of a nullable Bundle aosp/845616

رفع اشکال

  • Arguments are now properly parsed from deep links as the correct argType instead 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

Version 1.0.0-alpha08

6 دسامبر 2018

This release contains breaking API changes; please see the Breaking Changes section below.

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

  • Destination labels, when used with NavigationUI methods, will now automatically replace {argName} instances in your android:label with the correct argument b/80267266
  • Navigation now depends on Support Library 28.0.0 b/120293333

شکستن تغییرات

  • OnNavigatedListener has been renamed to OnDestinationChangedListener b/118670572
  • OnDestinationChangedListener now also passes the Bundle of arguments aosp/837142
  • The app:clearTask and app:launchDocument attributes and their associated methods have been removed. Use app:popUpTo with the root of your graph to remove all destinations from your back stack. b/119628354
  • ActivityNavigator.Extras now uses a Builder pattern and adds the ability to set any Intent.FLAG_ACTIVITY_ flags aosp/828140
  • NavController.onHandleDeepLink has been renamed to handleDeepLink aosp/836063
  • Many classes and methods not meant for subclassing, such as NavOptions , NavInflater , NavDeepLinkBuilder , and AppBarConfiguration , have been made final aosp/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 a FragmentFactory . b/119054429
  • The constructor for NavGraphNavigator no longer takes a Context aosp/835340
  • NavigatorProvider is now a class, rather than an interface. The NavigatorProvider returned by getNavigatorProvider() has not changed its functionality. aosp/830660
  • NavDestination.navigate() has been removed. Call navigate() on the Navigator instead. aosp/830663
  • Significant refactoring of Navigator , removing the need for OnNavigatorNavigatedListener and instead having navigate return the NavDestination that was navigated to.
  • Navigator instances can no longer send pop events to the NavController . Consider using a OnBackPressedCallback to intercept back button presses and call navController.popBackStack() . aosp/833716

رفع اشکال

  • popUpTo now works consistently when the destination is a <navigation> element b/116831650
  • Fixed a number of bugs that resulted in an IllegalArgumentException when using nested graphs b/118713731 b/113611083 b/113346925 b/113305559
  • The dataPattern attribute of <activity> destinations will now populate arguments from non-String arguments by calling toString() 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 @Override annotations where appropriate b/117145301

Version 1.0.0-alpha07

29 اکتبر 2018

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

شکستن تغییرات

  • The navigation-testing-ktx module has been folded into the navigation-testing artifact and will no longer be published.
  • The navigation-testing artifact 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

Version 1.0.0-alpha06

20 سپتامبر 2018

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

تغییرات API

  • Breaking Change: The Navigator navigate() method now takes a Navigator.Extras parameter.
  • NavController's getGraph() method is now NonNull b/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

Version 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.

Version 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:type has been changed to app:argType to 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 NonNull attributes are actually not null b/111451769
  • Additional NonNull annotations 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

Version 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.index will become setDemoControllerIndex b/79995048
    • Eg action_show_settings will become actionShowSettings b/79642240
  • 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() and hashCode() 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 setPopUpTo with the first destination in the graph b/109909461
  • Fixed issue where all app:defaultValue values were being passed as Strings b/110710788
  • aapt2 bundled with Android Gradle Plugin 3.2 Beta 01 now adds keep rules for every android:name attribute in Navigation XML files b/79874119
  • Fixed memory leak when replacing the default FragmentNavigator b/110900142

Version 1.0.0-alpha02

7 ژوئن 2018

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

  • FragmentNavigator now uses setReorderingAllowed(true) . b/109826220

  • Navigation now URLDecodes arguments parsed from deep links URLs. b/79982454

رفع اشکال

  • Fixed an IllegalStateException when calling navigate from Fragment lifecycle methods. b/79632233

  • Navigation now depends on Support Library 27.1.1 to fix flickering when using animations. b/80160903

  • Fixed an IllegalArgumentException when using defaultNavHost="true" as a child fragment. b/79656847

  • Fixed a StackOverflowError when using NavDeepLinkBuilder. b/109653065

  • Fixed an IllegalArgumentException when navigating back to a nested graph. b/80453447

  • Fixed an issue with overlapping Fragments when using launchSingleTop . b/79407969

  • Navigation 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 clearTask attribute for actions and the associated API in NavOptions has been deprecated. b/80338878

  • The launchDocument attribute for actions and the associated API in NavOptions has 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 .