জীবনচক্র

লাইফসাইকেল-অ্যাওয়ার কম্পোনেন্টগুলো অন্য কোনো কম্পোনেন্টের (যেমন অ্যাক্টিভিটি এবং ফ্র্যাগমেন্ট) লাইফসাইকেল স্ট্যাটাসের পরিবর্তনের প্রতিক্রিয়ায় বিভিন্ন অ্যাকশন সম্পাদন করে। এই কম্পোনেন্টগুলো আপনাকে আরও সুসংগঠিত এবং প্রায়শই হালকা কোড তৈরি করতে সাহায্য করে, যা রক্ষণাবেক্ষণ করাও সহজ।

এই সারণিতে androidx.lifecycle গ্রুপের অন্তর্গত সমস্ত আর্টিফ্যাক্ট তালিকাভুক্ত করা হয়েছে।

প্রত্নবস্তু স্থিতিশীল রিলিজ রিলিজ প্রার্থী বিটা রিলিজ আলফা রিলিজ
জীবনচক্র-* ২.১০.০ - - ২.১১.০-আলফা০৩
লাইফসাইকেল-ভিউমডেল-নেভিগেশন৩ ২.১০.০ - - ২.১১.০-আলফা০৩
এই লাইব্রেরিটি সর্বশেষ আপডেট করা হয়েছে: ২৫শে মার্চ, ২০২৬

নির্ভরতা ঘোষণা করা

লাইফসাইকেল-এর উপর ডিপেন্ডেন্সি যোগ করতে হলে, আপনাকে আপনার প্রজেক্টে গুগল মেভেন রিপোজিটরি যুক্ত করতে হবে। আরও তথ্যের জন্য গুগলের মেভেন রিপোজিটরি পড়ুন।

আপনার অ্যাপ বা মডিউলের build.gradle ফাইলে প্রয়োজনীয় আর্টিফ্যাক্টগুলোর ডিপেন্ডেন্সি যোগ করুন:

কোটলিন

খাঁজকাটা

    dependencies {
        def lifecycle_version = "2.10.0"
        def arch_version = "2.2.0"

        // ViewModel
        implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
        // ViewModel utilities for Compose
        implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"
        // LiveData
        implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
        // Lifecycles only (without ViewModel or LiveData)
        implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
        // Lifecycle utilities for Compose
        implementation "androidx.lifecycle:lifecycle-runtime-compose:$lifecycle_version"

        // Saved state module for ViewModel
        implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"

        // ViewModel integration with Navigation3
        implementation "androidx.lifecycle:lifecycle-viewmodel-navigation3:2.11.0-alpha03"

        // Annotation processor
        kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
        // alternately - if using Java8, use the following instead of lifecycle-compiler
        implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"

        // optional - helpers for implementing LifecycleOwner in a Service
        implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"

        // optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
        implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version"

        // optional - ReactiveStreams support for LiveData
        implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version"

        // optional - Test helpers for LiveData
        testImplementation "androidx.arch.core:core-testing:$arch_version"

        // optional - Test helpers for Lifecycle runtime
        testImplementation "androidx.lifecycle:lifecycle-runtime-testing:$lifecycle_version"
    }
    

কোটলিন

    dependencies {
        val lifecycle_version = "2.10.0"
        val arch_version = "2.2.0"

        // ViewModel
        implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version")
        // ViewModel utilities for Compose
        implementation("androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version")
        // LiveData
        implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version")
        // Lifecycles only (without ViewModel or LiveData)
        implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version")
        // Lifecycle utilities for Compose
        implementation("androidx.lifecycle:lifecycle-runtime-compose:$lifecycle_version")

        // Saved state module for ViewModel
        implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version")

        // ViewModel integration with Navigation3
        implementation("androidx.lifecycle:lifecycle-viewmodel-navigation3:2.11.0-alpha03")

        // Annotation processor
        kapt("androidx.lifecycle:lifecycle-compiler:$lifecycle_version")
        // alternately - if using Java8, use the following instead of lifecycle-compiler
        implementation("androidx.lifecycle:lifecycle-common-java8:$lifecycle_version")

        // optional - helpers for implementing LifecycleOwner in a Service
        implementation("androidx.lifecycle:lifecycle-service:$lifecycle_version")

        // optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
        implementation("androidx.lifecycle:lifecycle-process:$lifecycle_version")

        // optional - ReactiveStreams support for LiveData
        implementation("androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version")

        // optional - Test helpers for LiveData
        testImplementation("androidx.arch.core:core-testing:$arch_version")

        // optional - Test helpers for Lifecycle runtime
        testImplementation ("androidx.lifecycle:lifecycle-runtime-testing:$lifecycle_version")
    }
    

জাভা

খাঁজকাটা

    dependencies {
        def lifecycle_version = "2.10.0"
        def arch_version = "2.2.0"

        // ViewModel
        implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
        // LiveData
        implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
        // Lifecycles only (without ViewModel or LiveData)
        implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"

        // Saved state module for ViewModel
        implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"

        // Annotation processor
        annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
        // alternately - if using Java8, use the following instead of lifecycle-compiler
        implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"

        // optional - helpers for implementing LifecycleOwner in a Service
        implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"

        // optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
        implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version"

        // optional - ReactiveStreams support for LiveData
        implementation "androidx.lifecycle:lifecycle-reactivestreams:$lifecycle_version"

        // optional - Test helpers for LiveData
        testImplementation "androidx.arch.core:core-testing:$arch_version"

        // optional - Test helpers for Lifecycle runtime
        testImplementation "androidx.lifecycle:lifecycle-runtime-testing:$lifecycle_version"
    }
    

কোটলিন

    dependencies {
        val lifecycle_version = "2.10.0"
        val arch_version = "2.2.0"

        // ViewModel
        implementation("androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version")
        // LiveData
        implementation("androidx.lifecycle:lifecycle-livedata:$lifecycle_version")
        // Lifecycles only (without ViewModel or LiveData)
        implementation("androidx.lifecycle:lifecycle-runtime:$lifecycle_version")

        // Saved state module for ViewModel
        implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version")

        // Annotation processor
        annotationProcessor("androidx.lifecycle:lifecycle-compiler:$lifecycle_version")
        // alternately - if using Java8, use the following instead of lifecycle-compiler
        implementation("androidx.lifecycle:lifecycle-common-java8:$lifecycle_version")

        // optional - helpers for implementing LifecycleOwner in a Service
        implementation("androidx.lifecycle:lifecycle-service:$lifecycle_version")

        // optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
        implementation("androidx.lifecycle:lifecycle-process:$lifecycle_version")

        // optional - ReactiveStreams support for LiveData
        implementation("androidx.lifecycle:lifecycle-reactivestreams:$lifecycle_version")

        // optional - Test helpers for LiveData
        testImplementation("androidx.arch.core:core-testing:$arch_version")

        // optional - Test helpers for Lifecycle runtime
        testImplementation("androidx.lifecycle:lifecycle-runtime-testing:$lifecycle_version")
    }
    

নির্ভরতা সম্পর্কে আরও তথ্যের জন্য, 'বিল্ড নির্ভরতা যোগ করুন ' দেখুন।

প্রতিক্রিয়া

আপনার মতামত জেটপ্যাককে আরও উন্নত করতে সাহায্য করে। আপনি যদি নতুন কোনো সমস্যা খুঁজে পান অথবা এই লাইব্রেরিটি উন্নত করার জন্য কোনো ধারণা থাকে, তবে আমাদের জানান। নতুন কোনো সমস্যা তৈরি করার আগে অনুগ্রহ করে এই লাইব্রেরির বিদ্যমান সমস্যাগুলো দেখে নিন। আপনি তারকা বোতামে ক্লিক করে কোনো বিদ্যমান সমস্যায় আপনার ভোট যোগ করতে পারেন।

একটি নতুন সমস্যা তৈরি করুন

আরও তথ্যের জন্য ইস্যু ট্র্যাকার ডকুমেন্টেশন দেখুন।

সংস্করণ ২.১১

সংস্করণ 2.11.0-alpha03

২৫ মার্চ, ২০২৬

androidx.lifecycle:lifecycle-*:2.11.0-alpha03 প্রকাশিত হয়েছে। সংস্করণ 2.11.0-alpha03-এ এই কমিটগুলো রয়েছে।

এপিআই পরিবর্তন

  • ViewModelStoreProvider কনস্ট্রাক্টরে parentKey একটি ঐচ্ছিক প্যারামিটার করুন, যার ডিফল্ট মান null হবে, এবং এটিকে parentStore বা parentOwner পরে সরিয়ে দিন। যখন একটি শেয়ার্ড স্কোপ কী-এর প্রয়োজন হয় না, তখন এটি ইনস্ট্যানসিয়েশনকে সহজ করে তোলে। ( I66b67 )
  • ViewModelStoreNavEntryDecorator এখন ViewModelStore এর পরিবর্তে ViewModelStoreOwner গ্রহণ করে। এর ফলে Navigation3 প্যারেন্টের ডিফল্ট CreationExtras এবং ViewModelProvider.Factory কে নেস্টেড ViewModel-গুলোতেও প্রয়োগ করতে পারে, যা অ্যাপ্লিকেশন-স্তরের নির্ভরতার জন্য সমর্থন নিশ্চিত করে। ( Ia6018 , b/434651920 )
  • একটি অনন্য কী ব্যবহার করে ViewModelStoreProvider স্টেটকে পৃথক করুন। এটি ডিসপোজালের সময় সিibling প্রোভাইডারদের একে অপরের ViewModel-কে অনিচ্ছাকৃতভাবে মুছে ফেলা থেকে বিরত রাখে। ( I59c0b , b/434651920 )
  • ViewModelProvider.get<VM>(key: String) এক্সটেনশন ফাংশনটি যোগ করা হয়েছে। এর ফলে ডেভেলপাররা কোটলিন রিফাইয়েড টাইপ প্যারামিটার ব্যবহার করে একটি কাস্টম key সাহায্যে আরও সহজে ভিউমডেল পুনরুদ্ধার করতে পারবেন, এবং এর জন্য ক্লাস টাইপ স্পষ্টভাবে পাস করার প্রয়োজন হবে না। ( Ic1f59 )
  • ডিফল্ট SavedState মান দিয়ে ViewModel-গুলি ইনিশিয়ালাইজ করার জন্য ViewModelStoreProviderdefaultArgs সাপোর্ট যোগ করা হয়েছে। ( I1e933 , b/434651920 , b/165642391 )
  • removeViewModelStoreOnPop এবং এর সাথে যুক্ত ViewModelStoreNavEntryDecoratorDefaults এপিআই-কে অপ্রচলিত ঘোষণা করা হলো। এই এপিআইটি কনফিগারেশন পরিবর্তনের জন্য একটি বিকল্প ব্যবস্থা ছিল, যা এখন অভ্যন্তরীণভাবে পরিচালিত হয়। এখন থেকে, পপ করার সময় ViewModel সহ সমস্ত ডেকোরেটর স্টেট অবশ্যই একই সাথে মুছে ফেলতে হবে। যখন ব্যাক স্ট্যাকটি একটি NavDisplay-তে পাঠানো হয়, তার বাইরেও ডেকোরেটর স্টেট ধরে রাখতে, rememberDecoratedNavEntries এপিআই ব্যবহার করুন। ( I852d9 )

বাগ সংশোধন

  • ক্লাসের নাম প্রদর্শন করতে CreationExtras.Key তে toString() যোগ করুন। ( I5de52 )

সংস্করণ 2.11.0-alpha02

১১ মার্চ, ২০২৬

androidx.lifecycle:lifecycle-*:2.11.0-alpha02 প্রকাশিত হয়েছে। সংস্করণ 2.11.0-alpha02-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

স্কোপড ভিউমডেল

  • এই রিলিজে Compose-এ স্কোপড ViewModelStore ইনস্ট্যান্স তৈরি করার জন্য API চালু করা হয়েছে। এর ফলে ViewModels নির্দিষ্ট UI স্কোপের (যেমন স্বতন্ত্র Pager পেজ বা LazyList আইটেম) সাথে যুক্ত করা যায়। এই ViewModels কনফিগারেশন পরিবর্তনের পরেও অক্ষত থাকে এবং যখন এদের সংশ্লিষ্ট Composable-টি হায়ারার্কি থেকে স্থায়ীভাবে সরিয়ে ফেলা হয়, তখন এগুলো স্বয়ংক্রিয়ভাবে মুছে যায়।

    // Hoist the parent provider outside the Pager.
    val provider = rememberViewModelStoreProvider()
    val pagerState = rememberPagerState(pageCount = { 5 })
    
    HorizontalPager(state = pagerState) { page ->
        // Create an owner scoped to the current page.
        val storeOwner = rememberViewModelStoreOwner(provider, key = page)
    
        // Provide the scoped owner to this composition.
        CompositionLocalProvider(LocalViewModelStoreOwner provides storeOwner) {
            // ViewModel is now scoped specifically to this page.
            val viewModel: PageViewModel = viewModel()
        }
    }
    

উল্লেখ্য যে, ViewModelStoreProvider Compose ছাড়াও ব্যবহার করা যায় এবং এটি Activities, Fragments এবং/অথবা Views-এর সাথে ব্যবহার করা যেতে পারে।

নতুন বৈশিষ্ট্য

  • ViewModel Navigation3-এ সকল KMP টার্গেটের জন্য সমর্থন যোগ করুন। ( I60fa5 )
  • কাস্টম ওনার কম্পোনেন্ট তৈরি করার সময় বয়লারপ্লেট কমাতে LifecycleOwner , ViewModelStoreOwner , এবং SavedStateRegistryOwner এর জন্য ফ্যাক্টরি ফাংশন যোগ করুন। ( I9682c )
  • একটি অ্যানোনিমাস অবজেক্ট ইনস্ট্যানশিয়েট না করেই লাইফসাইকেল ইভেন্ট পর্যবেক্ষণ করার জন্য একটি ল্যাম্বডা-ভিত্তিক Lifecycle.addObserver এক্সটেনশন ফাংশন যোগ করুন। ( I94f38 )
  • ViewModelStoreOwnerdefaultViewModelProviderFactory এবং defaultViewModelCreationExtras এক্সটেনশন যোগ করুন। এগুলি HasDefaultViewModelProviderFactory এর সাথে ম্যানুয়াল টাইপ চেকের প্রয়োজন ছাড়াই ডিফল্টগুলিতে নিরাপদ অ্যাক্সেস প্রদান করে। ( Ifa83d )

এপিআই পরিবর্তন

  • Compose-এ সহজে স্কোপড ViewModelStoreOwner তৈরি করতে rememberViewModelStoreOwner যোগ করুন। এই ফাংশনটি এমন একজন মালিককে রিটার্ন করে যিনি Composable-এর লাইফসাইকেলের সাথে যুক্ত থাকেন এবং UI থেকে Composable-টি সরিয়ে ফেলা হলে এর ViewModel-গুলো স্বয়ংক্রিয়ভাবে মুছে ফেলেন। ( I2a15b , b/165642391 )
  • Compose-এ স্কোপড ViewModelStore ইনস্ট্যান্স তৈরি করার জন্য rememberViewModelStoreProvider যোগ করুন। এই ফাংশনটি একটি চাইল্ড স্টোরকে তার প্যারেন্ট মালিকের সাথে লিঙ্ক করে, যা কনফিগারেশন পরিবর্তনের পরেও ViewModel-গুলিকে অক্ষত রাখে এবং হায়ারার্কি থেকে Composable-টি সরিয়ে ফেলা হলে সেগুলিকে স্বয়ংক্রিয়ভাবে মুছে ফেলে। ( I0f57a , b/165642391 )
  • স্কোপড ViewModelStore ইনস্ট্যান্সগুলি পরিচালনা করতে ViewModelStoreProvider যোগ করুন। এই ক্লাসটি এমন চাইল্ড স্কোপ তৈরি করতে সক্ষম করে যা কনফিগারেশন পরিবর্তনের পরেও টিকে থাকে কিন্তু স্বাধীনভাবে পরিষ্কার করা যায়। এটি ViewModelStoreOwner র‍্যাপারও প্রদান করে যা প্যারেন্ট থেকে ডিফল্ট ফ্যাক্টরি এবং ক্রিয়েশন এক্সট্রা উত্তরাধিকার সূত্রে পায়। ( I87f4f , b/434651920 )

সংস্করণ 2.11.0-alpha01

২৫শে ফেব্রুয়ারি, ২০২৬

androidx.lifecycle:lifecycle-*:2.11.0-alpha01 প্রকাশিত হয়েছে। সংস্করণ 2.11.0-alpha01-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

নতুন বৈশিষ্ট্য

  • ViewModel-Compose-এ সমস্ত Kotlin Multiplatform (KMP) টার্গেট সমর্থন করুন। LocalView থেকে ওনার রেজোলিউশনকে বিচ্ছিন্ন করুন, যাতে প্ল্যাটফর্ম হোস্টগুলি একটি ডিফল্ট ViewModelStoreOwner প্রদান করতে পারে এবং একই সাথে Android-এ LocalView একটি নিরাপদ ফলব্যাক হিসেবে বজায় রাখা যায়। ( I09fab , b/434940570 , Ic8526 , b/478146897 )

এপিআই পরিবর্তন

  • ডিবাগিং সহজ করার জন্য ViewModelStore এ একটি toString ইমপ্লিমেন্টেশন যোগ করুন যা সমস্ত সংরক্ষিত কী তালিকাভুক্ত করবে। ( I0a6f4 )
  • HasDefaultViewModelProviderFactory.defaultViewModelProviderFactory এর জন্য একটি ডিফল্ট ইমপ্লিমেন্টেশন যোগ করা হয়েছে, যার ফলে ইন্টারফেসটি ইমপ্লিমেন্ট করার সময় আপনাকে আর এই প্রপার্টিটি স্পষ্টভাবে ওভাররাইড করতে হবে না। ( Ia7095 )
  • ওভাররাইড করা মেথডগুলোর জন্য super.onCleared() কল করার প্রয়োজন নেই, তা স্পষ্টভাবে বোঝানোর জন্য ViewModel.onCleared @EmptySuper দিয়ে অ্যানোটেট করুন। ( I8c226 )

সংস্করণ ২.১০

সংস্করণ ২.১০.০

১৯ নভেম্বর, ২০২৫

androidx.lifecycle:lifecycle-*:2.10.0 প্রকাশিত হয়েছে। সংস্করণ 2.10.0-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

২.৯.০ সংস্করণের পর থেকে গুরুত্বপূর্ণ পরিবর্তনসমূহ:

  • সরাসরি UI-এর মধ্যে স্কোপড লাইফসাইকেল তৈরি করার সুবিধা পেতে একটি rememberLifecycleOwner কম্পোজেবল যোগ করুন। এটি সেইসব কম্পোনেন্টের জন্য উপযোগী যাদের নিজেদের লাইফসাইকেল স্বাধীনভাবে পরিচালনা করার প্রয়োজন হয়, যেমন একটি HorizontalPager যা শুধুমাত্র বর্তমান পেজটিকে RESUMED করতে চায় অথবা Navigation3-এর মতো লাইব্রেরি।

    @Composable
    fun MyComposable() {
        // This LifecycleOwner is automatically moved to DESTROYED when
        // it leaves composition and its maxLifecycle is the maximum of either
        // the maxLifecycle you set or the Lifecycle.State of the parentLifecycleOwner
        val lifecycleOwner = rememberLifecycleOwner(
            maxLifecycle = RESUMED,
            parentLifecycleOwner = LocalLifecycleOwner.current,
        )
        CompositionLocalProvider(LocalLifecycleOwner provides lifecycleOwner) {
            val childLifecycleOwner = LocalLifecycleOwner.current
        }
    }
    
  • lifecycle-viewmodel-navigation3 আর্টিফ্যাক্টটি Navigation3-এর জন্য একটি প্রি-বিল্ট ইন্টিগ্রেশন প্রদান করে, যা আপনাকে rememberViewModelStoreNavEntryDecorator() API ব্যবহার করে ViewModel ইনস্ট্যান্সগুলোকে স্বতন্ত্র স্ক্রিন ('এন্ট্রি')-তে স্কোপিং সক্ষম করতে দেয়:

    @Composable
    fun MyComposable() {
        NavDisplay(
            backStack = backStack,
            entryDecorators =
                listOf(
                    rememberSaveableStateHolderNavEntryDecorator(),
                    // Add this line to automatically scope ViewModels to each entry
                    rememberViewModelStoreNavEntryDecorator(),
                ),
            entryProvider = entryProvider {
                // Add your entries here
            }
        }
    }
    
  • CreationExtras জন্য একটি বিল্ডার ফ্যাক্টরি ফাংশন যোগ করুন, যা আরও সুবিধাজনক এবং প্রচলিত কোটলিন এপিআই প্রদান করবে।

    override val defaultViewModelCreationExtras: CreationExtras
        // Use the CreationExtras builder to add in a custom value to the default
        // CreationExtras in your Activity or Fragment
        get() = super.defaultViewModelCreationExtras + CreationExtras {
            this[CustomKey] = "customValue"
       }
    
  • SavedStateHandle.saved এ নালযোগ্য টাইপের জন্য নেটিভ সাপোর্ট যোগ করা হয়েছে, যা নালযোগ্য প্রোপার্টি সংরক্ষণ ও পুনরুদ্ধারকে আরও সহজ করে।

  • SavedStateHandle কনস্ট্রাক্টরগুলোকে @VisibleForTesting হিসেবে চিহ্নিত করুন।

  • minSdk-টি API 21 থেকে API 23-এ পরিবর্তিত হয়েছে।

সংস্করণ 2.10.0-rc01

০৫ নভেম্বর, ২০২৫

androidx.lifecycle:lifecycle-*:2.10.0-rc01 প্রকাশিত হয়েছে। সংস্করণ 2.10.0-rc01-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

সংস্করণ 2.10.0-beta01

২২ অক্টোবর, ২০২৫

androidx.lifecycle:lifecycle-*:2.10.0-beta01 প্রকাশিত হয়েছে। সংস্করণ 2.10.0-beta01-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

এপিআই পরিবর্তন

  • ViewModelStoreNavEntryDecoratorDefault নাম পরিবর্তন করে ViewModelStoreNavEntryDecoratorDefaults রাখা হয়েছে, যেখানে একটি 's' যুক্ত হয়েছে। ( I6d27b , b/444447434 )

বাগ সংশোধন

  • যদি মালিক Lifeycle.State.CREATED এ যাওয়ার আগে একটি Lifecycle.Event.ON_DESTROY ইভেন্ট পায়, তাহলে rememberLifecycleOwner আর ক্র্যাশ করে না। ( I6f98e , b/444594991 )

সংস্করণ ২.১০.০-আলফা০৫

০৮ অক্টোবর, ২০২৫

androidx.lifecycle:lifecycle-*:2.10.0-alpha05 প্রকাশিত হয়েছে। সংস্করণ 2.10.0-alpha05-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

এপিআই পরিবর্তন

  • removeViewModelStoreOnPopCallback() এখন একটি ViewModelStoreNavEntryDecoratorDefault অবজেক্টের অংশ, যেখান থেকে অন্যান্য প্ল্যাটফর্ম এবং ইমপ্লিমেন্টেশনগুলো ডিফল্টটিকে কল করতে পারে। ( Ia1f23 , b/444447434 )
  • NavEntryDecorator এর ফ্যাক্টরি হিসেবে এর কার্যকারিতা আরও ভালোভাবে প্রতিফলিত করার জন্য ViewModelStoreNavEntryDecorator একটি ফাংশন থেকে ক্লাসে রিফ্যাক্টর করা হয়েছে, এবং এটি স্পষ্ট করার জন্য ডেকোরেটরটির shouldRemoveViewModelStore প্যারামিটারের নাম পরিবর্তন করে removeViewModelStoreOnPop রাখা হয়েছে যে এই কলব্যাকটি শুধুমাত্র তখনই চালু হয় যখন backStack থেকে কোনো এন্ট্রি পপ করা হয়। ( Iefdc5 , b/444447434 )

সংস্করণ ২.১০.০-আলফা০৪

২৪ সেপ্টেম্বর, ২০২৫

androidx.lifecycle:lifecycle-*:2.10.0-alpha04 প্রকাশিত হয়েছে। সংস্করণ 2.10.0-alpha04-এ এই কমিটগুলো রয়েছে।

এপিআই পরিবর্তন

  • LifecycleOwner কম্পোজেবলটিকে rememberLifecycleOwner এ রিফ্যাক্টর করুন। ফাংশনটি এখন সরাসরি LifecycleOwner রিটার্ন করে। কোনো সাব-কম্পোজিশনে এই ওনারটি সরবরাহ করতে CompositionLocalProvider ব্যবহার করুন। ( Ic57f0 , b/444446629 )
  • JetBrains-কে এই টার্গেটগুলো পূরণকারী ফর্ক সরবরাহ করতে এবং এর মাধ্যমে CMP সমর্থন করতে সক্ষম করার জন্য lifecycle-viewmodel-navigation3-এ KMP স্টাব যোগ করুন। ( I44a4c )

সংস্করণ ২.১০.০-আলফা০৩

২৭ আগস্ট, ২০২৫

androidx.lifecycle:lifecycle-*:2.10.0-alpha03 প্রকাশিত হয়েছে। সংস্করণ 2.10.0-alpha03-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

এপিআই পরিবর্তন

  • Compose 1.9.0 সংস্করণে আপডেট করুন। ( I2b9de )

সংস্করণ 2.10.0-alpha02

১৩ আগস্ট, ২০২৫

androidx.lifecycle:lifecycle-*:2.10.0-alpha02 প্রকাশিত হয়েছে। সংস্করণ 2.10.0-alpha02-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

নতুন বৈশিষ্ট্য

  • LifecycleOwner কম্পোজেবলটি এখন একটি স্বতন্ত্র রুট লাইফসাইকেল তৈরি করতে পারে। parent = null (স্পষ্টভাবে) সেট করার মাধ্যমে, নতুন লাইফসাইকেলটি যেকোনো হোস্ট (যেমন Activity , Fragment বা NavBackStackEntry ) থেকে স্বাধীনভাবে কাজ করে। কম্পোজেবলটি কম্পোজিশনে প্রবেশ করার সাথে সাথেই এটি শুরু হয় এবং কম্পোজিশন থেকে বেরিয়ে গেলে স্বয়ংক্রিয়ভাবে ধ্বংস হয়ে যায়। ( I8dfbe , b/433659048 )

    @Composable
    fun IndependentComponent() {
        // Create a standalone lifecycle, not tied to the parent Activity/Fragment.
        LifecycleOwner(parent = null) {
            val rootLifecycle = LocalLifecycleOwner.current.lifecycle
        }
    }
    

এপিআই পরিবর্তন

  • LifecycleOwner কম্পোজেবলে, parentLifecycleOwner প্যারামিটারটির নাম পরিবর্তন করে parent রাখা হয়েছে। ( I080bc )

বাগ সংশোধন

  • LifecycleOwner কম্পোজেবলটি এখন ডিসপোজালের সময় তার লাইফসাইকেলকে সঠিকভাবে DESTROYED এ পরিবর্তন করে। এটি সেইসব এক্সটার্নাল কোডের জন্য সম্ভাব্য মেমরি লিক প্রতিরোধ করে, যেগুলো লাইফসাইকেলটির একটি রেফারেন্স ধারণ করে। ( I9e5b7 , b/433659048 )
  • ডিফল্ট minSdk API 21 থেকে API 23-এ স্থানান্তর করা হচ্ছে ( Ibdfca , b/380448311 , b/435705964 , b/435705223 )

বাহ্যিক অবদান

  • LifecycleOwner থেকে অপ্রয়োজনীয় অভ্যন্তরীণ ব্যাকিং ফিল্ডগুলো অপসারণ করা হয়েছে। অবদানের জন্য জেক হোয়ার্টনকে ধন্যবাদ। ( Ideddb )

সংস্করণ 2.10.0-alpha01

৩০ জুলাই, ২০২৫

androidx.lifecycle:lifecycle-*:2.10.0-alpha01 প্রকাশিত হয়েছে। সংস্করণ 2.10.0-alpha01-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

নতুন বৈশিষ্ট্য

  • সরাসরি UI-এর মধ্যে স্কোপড লাইফসাইকেল তৈরি করার জন্য একটি LifecycleOwner কম্পোজেবল যোগ করুন। এটি সেইসব কম্পোনেন্টের জন্য উপযোগী যাদের নিজেদের লাইফসাইকেল স্বাধীনভাবে পরিচালনা করার প্রয়োজন হয়। Navigation3 কীভাবে এই নতুন কম্পোজেবলটি ইন্টিগ্রেট করে তার একটি উদাহরণের জন্য, aosp/3708610 দেখুন। ( 76cbf7 )

    @Composable
    fun MyComposable() {
        LifecycleOwner(
            maxLifecycle = RESUMED,
            parentLifecycleOwner = LocalLifecycleOwner.current,
        ) {
            val childLifecycleOwner = LocalLifecycleOwner.current
        }
    }
    

এপিআই পরিবর্তন

  • CreationExtras জন্য একটি বিল্ডার ফ্যাক্টরি ফাংশন যোগ করুন, যা আরও সুবিধাজনক এবং প্রচলিত কোটলিন এপিআই প্রদান করবে। ( Iab2bd )
  • SavedStateHandle.saved এ নালযোগ্য টাইপের জন্য নেটিভ সাপোর্ট যোগ করা হয়েছে, যা নালযোগ্য প্রোপার্টি সংরক্ষণ এবং পুনরুদ্ধার করাকে সহজ করে। ( I54d69 , b/421325690 )
  • SavedStateHandle কনস্ট্রাক্টরগুলোকে @VisibleForTesting হিসেবে চিহ্নিত করুন। ( Iff0e0 , b/408002794 )

সংস্করণ ২.৯

সংস্করণ ২.৯.৪

১৭ সেপ্টেম্বর, ২০২৫

androidx.lifecycle:lifecycle-*:2.9.4 প্রকাশিত হয়েছে। সংস্করণ 2.9.4-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

বাগ সংশোধন

  • কম্পোজ কম্পাইলার প্লাগইন প্রয়োগ না হওয়ার একটি ত্রুটি সংশোধন করা হয়েছে, যার কারণে লাইফসাইকেল KMP আর্টিফ্যাক্টগুলো নষ্ট হয়ে যাচ্ছিল। ( Ie95bc , b/443096483 , b/443965665 )

সংস্করণ ২.৯.৩

২৭ আগস্ট, ২০২৫

androidx.lifecycle:lifecycle-*:2.9.3 প্রকাশিত হয়েছে। সংস্করণ 2.9.3-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

নতুন বৈশিষ্ট্য

  • লাইফসাইকেল *-compose আর্টিফ্যাক্টে নতুন কোটলিন মাল্টিপ্ল্যাটফর্ম (KMP) টার্গেট যোগ করা হয়েছে। লাইফসাইকেল এখন মোট নিম্নলিখিত প্ল্যাটফর্মগুলিকে সমর্থন করে: JVM (অ্যান্ড্রয়েড এবং ডেস্কটপ), নেটিভ (লিনাক্স, iOS, watchOS, macOS, MinGW), এবং ওয়েব (জাভাস্ক্রিপ্ট, WasmJS)। ( I0a0e4 )

বাগ সংশোধন

সংস্করণ ২.৯.২

১৬ জুলাই, ২০২৫

androidx.lifecycle:lifecycle-*:2.9.2 প্রকাশিত হয়েছে। সংস্করণ 2.9.2-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

বাগ সংশোধন

  • লাইফসাইকেল আর্টিফ্যাক্টে নতুন কোটলিন মাল্টিপ্ল্যাটফর্ম (KMP) টার্গেট যোগ করা হয়েছে। লাইফসাইকেল এখন মোট নিম্নলিখিত প্ল্যাটফর্মগুলো সমর্থন করে: JVM (অ্যান্ড্রয়েড এবং ডেস্কটপ), নেটিভ (লিনাক্স, iOS, watchOS, macOS, MinGW), এবং ওয়েব (জাভাস্ক্রিপ্ট, WasmJS)। উল্লেখ্য যে, *-compose আর্টিফ্যাক্টে কোনো নতুন KMP টার্গেট যোগ করা হয়নি, কারণ এটি Compose 1.9-এর স্থিতিশীল রিলিজের উপর নির্ভরশীল। ( I01cb8 )।

নির্ভরতা আপডেট

  • নতুন KMP টার্গেটগুলোর ( Ic9e4f , b/397701294 ) সাপোর্ট চালু করার জন্য লাইফসাইকেল এখন অ্যানোটেশন 1.9.1 এর উপর নির্ভরশীল।

সংস্করণ ২.৯.১

৪ জুন, ২০২৫

androidx.lifecycle:lifecycle-*:2.9.1 প্রকাশিত হয়েছে। সংস্করণ 2.9.1-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

বাগ সংশোধন

  • SavedStateHandle.remove(key) দ্বারা SavedStateHandle.getMutableStateFlow(key) এর স্টেটগুলো ক্লিয়ার না হওয়ার সমস্যাটি সমাধান করা হয়েছে। ( d5f939 , b/418746333 )

সংস্করণ ২.৯.০

৭ মে, ২০২৫

androidx.lifecycle:lifecycle-*:2.9.0 প্রকাশিত হয়েছে। সংস্করণ 2.9.0-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

2.8.0 থেকে গুরুত্বপূর্ণ পরিবর্তনসমূহ

  • androidx.lifecycle:lifecycle-viewmodel-testing একটি নতুন KMP আর্টিফ্যাক্ট উপলব্ধ হয়েছে, যা ViewModels বিচ্ছিন্নভাবে পরীক্ষা করার জন্য একটি ViewModelScenario ক্লাস প্রদান করে। এতে onClearedSavedStateHandle এর পাশাপাশি recreate() মাধ্যমে প্রসেসের মৃত্যু ও পুনঃসৃষ্টিও পরীক্ষা করার সুবিধা রয়েছে।
  • একটি MutableStateFlow রিটার্ন করার জন্য SavedStateHandlegetMutableStateFlow যোগ করুন। এই নতুন ফাংশনটি শুধুমাত্র কী-এর জন্য সীমাবদ্ধ এবং getLiveData সাথে ব্যবহার করা যাবে না। একই স্টেট অ্যাক্সেস করার জন্য উভয়টি ব্যবহার করার চেষ্টা করলে একটি এক্সেপশন থ্রো করা হবে।
  • CreationExtras এখন ম্যাপের মতো অপারেটর ওভারলোড অন্তর্ভুক্ত করা হয়েছে, যা কোটলিনে কন্টেন্টের প্রচলিত রীতি অনুযায়ী পরিবর্তন করতে সক্ষম করে। এটি CreationExtras সাথে in , += , এবং + ব্যবহারের সুযোগ দেয়।

কোটলিনএক্স সিরিয়ালাইজেশন সাপোর্ট

  • SavedState 1.3.0 -এ যুক্ত হওয়া KotlinX Serialization-এর সাপোর্টের সাথে, আমরা saved একটি লেজি প্রপার্টি ডেলিগেট চালু করেছি। এর ফলে @Serializable ক্লাসগুলোকে একটি SavedStateHandle এ সহজে সংরক্ষণ করা যায় এবং প্রসেস বন্ধ ও পুনরায় চালু হওয়ার পরেও ক্লাসগুলো স্বয়ংক্রিয়ভাবে পুনরুদ্ধার হয়। অনুগ্রহ করে মনে রাখবেন যে saved ডেলিগেটটি লেজি এবং এটি অ্যাক্সেস না করা পর্যন্ত init ল্যাম্বডাকে কল করবে না বা SavedStateHandle এ কিছু সংরক্ষণ করবে না।

    @Serializable
    data class Person(val firstName: String, val lastName: String)
    
    class MyViewModel(handle: SavedStateHandle) : ViewModel() {
        var person by handle.saved { Person("John", "Doe") }
    
        fun onPersonChanged(person: Person) {
            this.person = person
        }
    }
    

কোটলিন মাল্টিপ্ল্যাটফর্ম

  • lifecycle-testing মডিউলটি এখন KMP-এর সাথে সামঞ্জস্যপূর্ণ, যার মধ্যে TestLifecycleOwner মতো API-গুলোও অন্তর্ভুক্ত।
  • lifecycle-viewmodel-savedstate মডিউলটি এখন KMP-এর সাথে সামঞ্জস্যপূর্ণ, যার মধ্যে SavedStateHandle মতো API-গুলোও অন্তর্ভুক্ত।
  • androidx.compose.ui.platform.LocalLifecycleOwner এখন কমন সোর্স সেটে উপলব্ধ।
  • NewInstanceFactory এখন JVM ডেস্কটপ এবং অ্যান্ড্রয়েড টার্গেটে উপলব্ধ।

আচরণগত পরিবর্তন

  • Lifecycle.DESTROYED অবস্থাটি চূড়ান্ত, এবং এখন থেকে কোনো Lifecycle এই অবস্থা থেকে অন্য কোনো অবস্থায় সরানোর চেষ্টা করলে একটি IllegalStateException দেখা দেবে।
  • SavedStateHandle এখন আর এমন কোনো SavedStateProvider.saveState() অন্তর্ভুক্ত করে না, যেখানে ফেরত আসা Bundle খালি থাকে।

সংস্করণ 2.9.0-rc01

২৩ এপ্রিল, ২০২৫

androidx.lifecycle:lifecycle-*:2.9.0-rc01 প্রকাশিত হয়েছে। সংস্করণ 2.9.0-rc01-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

লিন্ট এপিআই সামঞ্জস্যতা সতর্কতা

  • JetBrains, KaCallableMemberCall একটি ক্লাস থেকে ইন্টারফেসে পরিবর্তন করেছে, যা বাইনারি সামঞ্জস্য নষ্ট করে। আপনার প্রোজেক্টের AGP ভার্সন যদি লিন্ট চেক কম্পাইল করতে ব্যবহৃত ভার্সন থেকে ভিন্ন হয়, তবে এটি ক্র্যাশ ঘটাতে পারে। এই আপডেটটি aosp/3577172- এ করা হয়েছিল কিন্তু রিলিজ নোটে এটি উল্লেখ ছিল না — আমরা এখানে বিষয়টি স্পষ্ট করছি। প্রস্তাবিত সমাধান: সর্বশেষ স্থিতিশীল AGP-তে আপডেট করুন। যদি আপনি সম্পূর্ণ আপডেট করতে না পারেন, তবে আপনার AGP ভার্সনের সাথে লিন্ট চেকগুলো মেলানোর জন্য android.experimental.lint.version ব্যবহার করুন — বিস্তারিত জানতে Compose Runtime-এর আচরণগত পরিবর্তনসমূহ দেখুন।

সংস্করণ ২.৯.০-বিটা০১

৯ এপ্রিল, ২০২৫

androidx.lifecycle:lifecycle-*:2.9.0-beta01 প্রকাশিত হয়েছে। সংস্করণ 2.9.0-beta01-এ এই কমিটগুলো রয়েছে।

এপিআই পরিবর্তন

  • Lifecycle ViewModel Compose এখন কম্পোজ রানটাইম ১.৭.১ এবং তার পরবর্তী সংস্করণগুলোর মতো একই কোটলিন মাল্টিপ্ল্যাটফর্ম সেটআপ ব্যবহার করে - -desktop আর্টিফ্যাক্টগুলো এখন সরিয়ে ফেলা হয়েছে এবং -jvmStubs-linuxx64Stubs আর্টিফ্যাক্টগুলো যোগ করা হয়েছে। এই টার্গেটগুলোর কোনোটিই ব্যবহারের জন্য নয়, এগুলো জেটব্রেইনসের কম্পোজ প্রচেষ্টাকে সাহায্য করার জন্য প্লেসহোল্ডার হিসেবে রয়েছে। ( I5cb14 , b/406592090 )

নির্ভরতা আপডেট

  • এই লাইব্রেরিটি এখন কোটলিন ২.০ ল্যাঙ্গুয়েজ লেভেলকে টার্গেট করে এবং এর জন্য কেজিপি ২.০.০ বা তার নতুন সংস্করণ প্রয়োজন। ( Idb6b5 )
  • Lifecycle ViewModel Compose এখন কম্পোজ ১.৭.৮-এর উপর নির্ভরশীল। ( I5cb14 , b/406592090 )

সংস্করণ ২.৯.০-আলফা১৩

২৬ মার্চ, ২০২৫

androidx.lifecycle:lifecycle-*:2.9.0-alpha13 কোনো উল্লেখযোগ্য পাবলিক পরিবর্তন ছাড়াই প্রকাশ করা হয়েছে। সংস্করণ 2.9.0-alpha13-এ এই কমিটগুলো রয়েছে।

সংস্করণ ২.৯.০-আলফা১২

১২ মার্চ, ২০২৫

androidx.lifecycle:lifecycle-*:2.9.0-alpha12 প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha12-এ এই কমিটগুলো রয়েছে।

এপিআই পরিবর্তন

  • সকল সমর্থিত KMP প্ল্যাটফর্মে ViewModelProvider.get@MainThread অ্যানোটেশন যোগ করুন। ( I7e8dd , b/397736115 )
  • SavedState*Delegates SavedState*Delegate এ পুনঃনামকরণ করুন। ( I8589b , b/399629301 )

সংস্করণ ২.৯.০-আলফা১১

২৬ ফেব্রুয়ারি, ২০২৫

androidx.lifecycle:lifecycle-*:2.9.0-alpha11 প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha11-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

এপিআই পরিবর্তন

  • saved() ডেলিগেটগুলিতে SavedStateConfig প্যারামিটার যোগ করুন ( I39b3a )

সংস্করণ ২.৯.০-আলফা১০

১২ ফেব্রুয়ারী, ২০২৫

androidx.lifecycle:lifecycle-*:2.9.0-alpha10 প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha10-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

এপিআই পরিবর্তন

  • MutableStateSerializer lifecycle-viewmodel-compose থেকে savedstate-compose এ স্থানান্তর করা হয়েছে। ( I4f690 , b/378895074 )

বাহ্যিক অবদান

  • কম্পোজিশনের সময় Lifecycle::currentState কল করার জন্য একটি নতুন লিন্ট ইস্যু যোগ করা হয়েছে। এর পরিবর্তে currentStateAsalue().value ব্যবহার করার পরামর্শ দেওয়া হচ্ছে, যাতে লাইফসাইকেল স্টেটের পরিবর্তনগুলো সঠিকভাবে রিকম্পোজিশন ঘটাতে পারে। ধন্যবাদ স্টিভেন শোয়েন! ( Iad484 )

সংস্করণ ২.৯.০-আলফা০৯

২৯ জানুয়ারী, ২০২৫

androidx.lifecycle:lifecycle-*:2.9.0-alpha09 প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha09-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

নতুন বৈশিষ্ট্য

  • androidx.compose.runtime.MutableState কে সিরিয়ালাইজ করার জন্য MutableStateSerializer যোগ করা হয়েছে। ( Idfc48 , b/378895074 )

এপিআই পরিবর্তন

  • ডিফল্ট প্যারামিটার সহ ওভারলোডেড SavedStateHandle.saved() ডেলিগেট ফাংশনগুলি প্রতিস্থাপন করুন ( Icd1c1 )
  • AbstractSavedStateViewModelFactory এখন আর ব্যবহার করা হয় না, কারণ এটি প্রতিটি ViewModel জন্য একটি SavedStateHandle তৈরি করে, যা অপ্রয়োজনীয় অতিরিক্ত কাজের চাপ সৃষ্টি করে। আরও কার্যকরভাবে ViewModel তৈরির জন্য এর পরিবর্তে ViewModelProvider.Factory সাথে CreationExtras.createSavedStateHandle ব্যবহার করুন। ( Ia920b , b/388590327 )

সংস্করণ ২.৯.০-আলফা০৮

১১ ডিসেম্বর, ২০২৪

androidx.lifecycle:lifecycle-*:2.9.0-alpha08 প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha08-এ এই কমিটগুলো রয়েছে।

নতুন বৈশিষ্ট্য

  • পরীক্ষাধীন ViewModel এবং এর সাথে যুক্ত সমস্ত উপাদান পুনরায় তৈরি করে একটি সিস্টেম প্রসেস ডেথ অনুকরণ করতে ViewModelScenario.recreate যোগ করুন। ( Id6a69 , b/381063087 )
  • তাদের নিজ নিজ findViewTree API-এর মাধ্যমে প্রাপ্ত LifecycleOwner এবং ViewModelStoreOwner ইনস্ট্যান্সগুলিকে এখন একটি ভিউ-এর বিচ্ছিন্ন প্যারেন্ট, যেমন একটি ViewOverlay মাধ্যমে সমাধান করা যাবে। বিচ্ছিন্ন ভিউ প্যারেন্ট সম্পর্কে আরও তথ্যের জন্য core-এর রিলিজ নোট অথবা ViewTree.setViewTreeDisjointParent এর ডকুমেন্টেশন দেখুন। ( I800f4 )

এপিআই পরিবর্তন

  • SavedStateRegistryOwnerDelegate ( I8c135 , b/376026744 ) এর সাথে নামকরণ এবং প্যাকেজ সংগঠনকে আরও সামঞ্জস্যপূর্ণ করুন।

বাগ সংশোধন

  • এই লাইব্রেরিটি এখন JSpecify নালনেস অ্যানোটেশন ব্যবহার করে, যা টাইপ-ইউজ। সঠিক ব্যবহার নিশ্চিত করতে কোটলিন ডেভেলপারদের নিম্নলিখিত কম্পাইলার আর্গুমেন্টটি ব্যবহার করা উচিত: -Xjspecify-annotations=strict (কোটলিন কম্পাইলারের ২.১.০ সংস্করণ থেকে এটি ডিফল্ট হিসেবে ব্যবহৃত হয়)। ( Ie4340 , b/326456246 )
  • ডকুমেন্ট ViewModel.onCleared ক্লিয়ারিং সিকোয়েন্স। ( I586c7 , b/363984116 )

সংস্করণ ২.৯.০-আলফা০৭

১৩ নভেম্বর, ২০২৪

androidx.lifecycle:lifecycle-*:2.9.0-alpha07 প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha07-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

কোটলিন মাল্টিপ্ল্যাটফর্ম সামঞ্জস্যতা

  • লাইফসাইকেল ViewModel SavedState এখন কেএমপি (KMP) সামঞ্জস্যপূর্ণ। এর ফলে আপনি সাধারণ কোডে SavedStateHandle ) ব্যবহার করতে পারবেন। ( Ib6394 , b/334076622 )

কোটলিনএক্স সিরিয়ালাইজেশন সাপোর্ট

  • SavedState 1.3.0-alpha05 এ যুক্ত হওয়া KotlinX Serialization-এর সাপোর্টের সাথে, আমরা saved একটি লেজি প্রপার্টি ডেলিগেট চালু করেছি। এর ফলে @Serializable ক্লাসগুলোকে একটি SavedStateHandle এ সহজে সংরক্ষণ করা যায় এবং প্রসেস বন্ধ ও পুনরায় চালু হওয়ার পরেও ক্লাসগুলো স্বয়ংক্রিয়ভাবে পুনরুদ্ধার হয়। অনুগ্রহ করে মনে রাখবেন যে saved ডেলিগেটটি লেজি এবং এটি অ্যাক্সেস না করা পর্যন্ত init ল্যাম্বডাকে কল করবে না বা SavedStateHandle এ কিছু সংরক্ষণ করবে না। ( I47a88 , b/376026744 )

    @Serializable
    data class Person(val firstName: String, val lastName: String)
    
    class MyViewModel(handle: SavedStateHandle) : ViewModel() {
        var person by handle.saved { Person("John", "Doe") }
    
        fun onPersonChanged(person: Person) {
            this.person = person
        }
    }
    

এপিআই পরিবর্তন

  • একটি MutableStateFlow রিটার্ন করার জন্য SavedStateHandlegetMutableStateFlow যোগ করুন। এই নতুন ফাংশনটি কী-এক্সক্লুসিভ এবং getLiveData সাথে ব্যবহার করা যাবে না। একই স্টেট অ্যাক্সেস করার জন্য উভয়টি ব্যবহার করার চেষ্টা করলে একটি এক্সেপশন থ্রো করা হবে। ( I04a4f , b/375408415 )

সংস্করণ ২.৯.০-আলফা০৬

৩০ অক্টোবর, ২০২৪

androidx.lifecycle:lifecycle-*:2.9.0-alpha06 প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha06-এ এই কমিটগুলো রয়েছে।

আচরণগত পরিবর্তন

  • Lifecycle.DESTROYED অবস্থাটি চূড়ান্ত, এবং এখন থেকে কোনো Lifecycle এই অবস্থা থেকে অন্য কোনো অবস্থায় সরানোর চেষ্টা করলে একটি IllegalStateException দেখা দেবে। ( I116c4 , b/370577987 )
  • SavedStateHandle এখন আর এমন কোনো SavedStateProvider.saveState() অন্তর্ভুক্ত করে না, যেখানে ফেরত আসা Bundle খালি থাকে। ( I910b5 , b/370577987 )

বাগ সংশোধন

  • Lifecycle DESTROYED হলে Lifecycle.eventFlow এখন সঠিকভাবে সম্পন্ন হয় ( I293b2 , b/374043130 )

সংস্করণ ২.৯.০-আলফা০৫

১৬ অক্টোবর, ২০২৪

androidx.lifecycle:lifecycle-*:2.9.0-alpha05 কোনো উল্লেখযোগ্য পরিবর্তন ছাড়াই প্রকাশ করা হয়েছে। সংস্করণ 2.9.0-alpha05-এ এই কমিটগুলো রয়েছে।

সংস্করণ ২.৯.০-আলফা০৪

২ অক্টোবর, ২০২৪

androidx.lifecycle:lifecycle-*:2.9.0-alpha04 প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha04-এ এই কমিটগুলো রয়েছে।

কোটলিন মাল্টিপ্ল্যাটফর্ম

  • ভবিষ্যতের কোনো রিলিজে SavedStateHandle মতো API-গুলো কমন সোর্স সেটে উপলব্ধ করার প্রস্তুতির অংশ হিসেবে lifecycle-viewmodel-savedstate মডিউলটিকে এখন KMP-উপযোগী করে কনফিগার করা হয়েছে। ( I503ed , I48764 , b/334076622 )

সংস্করণ ২.৯.০-আলফা০৩

১৮ সেপ্টেম্বর, ২০২৪

androidx.lifecycle:lifecycle-*:2.9.0-alpha03 প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha03-এ এই কমিটগুলো রয়েছে।

বাগ সংশোধন

  • লাইফসাইকেল 2.8.6 থেকে: NullSafeMutableLiveData লিন্ট এররটিতে স্মার্ট কাস্টের জন্য উন্নত সাপোর্ট যুক্ত করা হয়েছে, যা ফলস পজিটিভ এড়ায়। ( 85fed6 , b/181042665 )

নির্ভরতা আপডেট

সংস্করণ ২.৯.০-আলফা০২

৪ সেপ্টেম্বর, ২০২৪

androidx.lifecycle:lifecycle-*:2.9.0-alpha02 প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha02-এ এই কমিটগুলো রয়েছে।

বাগ সংশোধন

  • লাইফসাইকেল 2.8.5 থেকে: অবফাসকেশন অনুমোদনের জন্য androidx.lifecycle.ReportFragment ProGuard নিয়মগুলো আপডেট করুন। ( ff898e1 )

বাহ্যিক অবদান

  • androidx.compose.ui.platform.LocalLifecycleOwner কে কমন সোর্স সেট (KMP)-এ স্থানান্তর করা হয়েছে। অবদানের জন্য JetBrains-এর ইভান ম্যাটকভকে ধন্যবাদ। ( 8cd5d03 )
  • লাইফসাইকেল 2.8.5 থেকে: `SavedStateHandle.saveable` এক্সটেনশন ডেলিগেট এখন নাল (null) ভ্যালু সমর্থন করে। এই অবদানের জন্য রোমান কালুকিউইচকে ধন্যবাদ। ( 0d78ea6 )

সংস্করণ ২.৯.০-আলফা০১

৭ আগস্ট, ২০২৪

androidx.lifecycle:lifecycle-*:2.9.0-alpha01 প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha01-এ এই কমিটগুলো রয়েছে।

কোটলিন মাল্টিপ্ল্যাটফর্ম

  • lifecycle-testing এখন KMP সামঞ্জস্যপূর্ণ। ( Iea41e )
  • linuxArm64 কোটলিন মাল্টিপ্ল্যাটফর্ম টার্গেটের জন্য সমর্থন যোগ করা হয়েছে ( I139d3 , b/338268719 )

নতুন বৈশিষ্ট্য

  • একটি নতুন androidx.lifecycle:lifecycle-viewmodel-testing KMP আর্টিফ্যাক্ট উপলব্ধ হয়েছে, যা ViewModel-গুলিকে বিচ্ছিন্নভাবে পরীক্ষা করার জন্য একটি ViewModelScenario ক্লাস প্রদান করে এবং এতে onCleared (সকল প্ল্যাটফর্মের জন্য) ও SavedStateHandle (শুধুমাত্র অ্যান্ড্রয়েডের জন্য) সাপোর্ট রয়েছে। ( 337f68d , c9b3409 , 9799a95c , b/264602919 )
  • ViewModelProvider ব্যবহার করে ViewModel তৈরি করা এখন থ্রেড সেফ; @MainThread অ্যানোটেশনগুলো সরিয়ে ফেলা হয়েছে। ( Ifd978 , b/237006831 )

এপিআই পরিবর্তন

  • বেনামী CreationExtras.Key অবজেক্ট তৈরি সহজ করার জন্য CreationExtras.Key() ফ্যাক্টরি ফাংশনটি যোগ করুন। ( I970ee )
  • CreationExtras এখন ম্যাপের মতো অপারেটর ওভারলোড অন্তর্ভুক্ত করা হয়েছে, যা কোটলিনে কন্টেন্টের প্রচলিত রীতি অনুযায়ী পরিবর্তন করতে সক্ষম করে। এটি CreationExtras সাথে in , += , এবং + ব্যবহারের সুযোগ দেয়। ( Ib4353 )
  • CreationExtras এখন equals , hashCode , এবং toString মেথডগুলো ইমপ্লিমেন্ট করে। ( Ib4353 )
  • NewInstanceFactory এখন JVM ডেস্কটপ এবং অ্যান্ড্রয়েড টার্গেটে উপলব্ধ। ( d3d0892 )
  • কোটলিন ভাষা সংস্করণ ২.০ ( I39df2 )-এ অন্তর্নিহিত অ্যাপ্লিকেশনকে নিরাপদে প্রকাশ করার জন্য ইনলাইন এক্সটেনশন প্রপার্টি।

বাগ সংশোধন

  • নতুন প্ল্যাটফর্ম এপিআই-গুলিতে অ্যাক্সেসের ম্যানুয়াল রূপরেখা সরিয়ে দেওয়া হয়েছে, কারণ AGP 7.3 বা তার পরবর্তী সংস্করণের (যেমন R8 সংস্করণ 3.3) সাথে R8 ব্যবহার করার সময় এবং AGP 8.1 বা তার পরবর্তী সংস্করণের (যেমন D8 সংস্করণ 8.1) সাথে সমস্ত বিল্ডের জন্য এটি এপিআই মডেলিংয়ের মাধ্যমে স্বয়ংক্রিয়ভাবে ঘটে। যেসব ক্লায়েন্ট AGP ব্যবহার করছেন না, তাদের D8 সংস্করণ 8.1 বা তার পরবর্তী সংস্করণে আপডেট করার পরামর্শ দেওয়া হচ্ছে। আরও বিস্তারিত জানতে এই নিবন্ধটি দেখুন। ( If6b4c , b/345472586 )

সংস্করণ ২.৮

সংস্করণ ২.৮.৭

৩০ অক্টোবর, ২০২৪

androidx.lifecycle:lifecycle-*:2.8.7 প্রকাশিত হয়েছে। সংস্করণ 2.8.7-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

এপিআই পরিবর্তন

  • androidx.compose.ui.platform.LocalLifecycleOwner এখন কমন সোর্স সেট (KMP)-এ উপলব্ধ। ( 6a3f5b3 )
  • lifecycle-runtime-compose : desktop আর্টিফ্যাক্টগুলো সরানো হয়েছে এবং -jvmStubs-linuxx64Stubs আর্টিফ্যাক্টগুলো যোগ করা হয়েছে। এই টার্গেটগুলোর কোনোটিই ব্যবহারের জন্য নয়, এগুলো Jetbrains Compose-এর কাজে সহায়তার জন্য প্লেসহোল্ডার হিসেবে রয়েছে। ( 6a3f5b3 )

সংস্করণ ২.৮.৬

১৮ সেপ্টেম্বর, ২০২৪

androidx.lifecycle:lifecycle-*:2.8.6 প্রকাশিত হয়েছে। সংস্করণ 2.8.6-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

বাগ সংশোধন

  • NullSafeMutableLiveData Lint error-টিতে স্মার্ট কাস্টের জন্য উন্নত সাপোর্ট দেওয়া হয়েছে, যা ফলস পজিটিভ এড়ায়। ( 85fed6 , b/181042665 )

নির্ভরতা আপডেট

সংস্করণ ২.৮.৫

৪ সেপ্টেম্বর, ২০২৪

androidx.lifecycle:lifecycle-*:2.8.5 প্রকাশিত হয়েছে। সংস্করণ 2.8.5-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

বাগ সংশোধন

  • অবফাসকেশন অনুমোদনের জন্য androidx.lifecycle.ReportFragment ProGuard নিয়মগুলো আপডেট করুন। ( ff898e1 )

বাহ্যিক অবদান

  • SavedStateHandle.saveable এক্সটেনশন ডেলিগেট এখন নাল (null) ভ্যালু সমর্থন করে। এই অবদানের জন্য রোমান কালুকিউইচকে ধন্যবাদ। ( 0d78ea6 )

সংস্করণ ২.৮.৪

২৪ জুলাই, ২০২৪

androidx.lifecycle:lifecycle-*:2.8.4 প্রকাশিত হয়েছে। সংস্করণ 2.8.4-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

বাগ সংশোধন

  • LiveData.asFlow() এখন সেইসব পরিস্থিতি সঠিকভাবে সামাল দেয় যেখানে LiveData তে আগে থেকেই সেট করা কোনো মান পাওয়ার পর রিটার্ন করা Flow-টি সাথে সাথেই সম্পন্ন হয়ে যায় (উদাহরণস্বরূপ, take(1) ব্যবহার করার সময়)। ( I9c566 )
  • Lifecycle*Effect কমপ্লিশন এখন আইডম্পোটেন্ট (অর্থাৎ, যদি লাইফসাইকেল বন্ধ হওয়ার কারণে onStopOrDispose কল করা হয়ে থাকে, তবে ডিসপোজালের সময় এটি দ্বিতীয়বার কল করা হবে না, যদি না লাইফসাইকেলটি আবার STARTED অবস্থায় ফিরে যায়)। ( I5f607 , b/352364595 )

সংস্করণ ২.৮.৩

১ জুলাই, ২০২৪

androidx.lifecycle:lifecycle-*:2.8.3 প্রকাশিত হয়েছে। সংস্করণ 2.8.3-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

বাগ সংশোধন

  • কোড শ্রিংকিং ব্যবহার করার সময় Compose 1.6.0 এবং তার নিম্নতর সংস্করণগুলোর সাথে Lifecycle 2.8-এর ব্যাকওয়ার্ড কম্প্যাটিবিলিটির একটি সমস্যা সমাধান করা হয়েছে। ( aosp/3133056 , b/346808608 )

সংস্করণ ২.৮.২

১২ জুন, ২০২৪

androidx.lifecycle:lifecycle-*:2.8.2 প্রকাশিত হয়েছে। সংস্করণ 2.8.2-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

বাগ সংশোধন

  • Compose 1.6.X বা তার আগের সংস্করণের সাথে Lifecycle 2.8.X ব্যবহার করার সময় CompositionLocal LocalLifecycleOwner not present ' ত্রুটিগুলো সমাধান করা হয়েছে - এখন আপনি কোনো বিকল্প পদ্ধতি ছাড়াই Compose-এর যেকোনো সংস্করণের সাথে Lifecycle 2.8.2 ব্যবহার করতে পারবেন। ( aosp/3105647 , b/336842920 )
  • পূর্ববর্তী সংস্করণের compileOnly লাইফসাইকেল ডিপেন্ডেন্সিগুলোকে 2.8+ সংস্করণের সাথে মিশ্রিত করলে ViewModelProvider আর ক্র্যাশ করবে না, এর ফলে LeakCanary-এর মতো লাইব্রেরিগুলোর সমস্যা সমাধান হয়েছে। ( I80383 , b/341792251 )

সংস্করণ ২.৮.১

২৯ মে, ২০২৪

androidx.lifecycle:lifecycle-*:2.8.1 প্রকাশিত হয়েছে। সংস্করণ 2.8.1-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

বাগ সংশোধন

  • lifecycle-viewmodel-compose এখন শুধুমাত্র compose-runtime উপর একটি সাধারণ নির্ভরতা রাখে, যার ফলে compose-ui উপর থেকে এর সাধারণ নির্ভরতা দূর হয়েছে। সামঞ্জস্যের জন্য অ্যান্ড্রয়েড আর্টিফ্যাক্টটি তার compose-ui ধরে রেখেছে। ( aosp/3079334 , b/339562627 )
  • প্রপার্টি ডেলিগেট ব্যবহার করে ViewModel এর saveable ইন্টিগ্রেশন এখন স্বয়ংক্রিয়ভাবে তৈরি হওয়া কী-এর অংশ হিসেবে ক্লাসের নাম ব্যবহার করে, ফলে একাধিক ক্লাস একই SavedStateHandle ব্যবহার করলে দ্বন্দ্ব এড়ানো যায়। ( aosp/3063463 )

সংস্করণ ২.৮.০

১৪ মে, ২০২৪

androidx.lifecycle:lifecycle-*:2.8.0 প্রকাশিত হয়েছে। সংস্করণ 2.8.0-এ এই কমিটগুলো অন্তর্ভুক্ত রয়েছে।

২.৭.০ সংস্করণ থেকে গুরুত্বপূর্ণ পরিবর্তনসমূহ

  • LocalLifecycleOwner Compose UI থেকে lifecycle-runtime-compose এ স্থানান্তর করা হয়েছে, যাতে এর Compose-ভিত্তিক হেল্পার API-গুলো Compose UI-এর বাইরেও ব্যবহার করা যায়।
  • lifecycle-runtime-compose আর্টিফ্যাক্টটিতে এখন dropUnlessResumed এবং dropUnlessStarted API রয়েছে, যা আপনাকে এমন ক্লিক বা অন্যান্য ইভেন্ট বাদ দেওয়ার সুযোগ দেয় যা LifecycleOwner প্রদত্ত Lifecycle.State এর নিচে নেমে যাওয়ার পরেও ঘটে। উদাহরণস্বরূপ, অন্য স্ক্রিনে ট্রানজিশন শুরু হয়ে যাওয়ার পরে ক্লিক ইভেন্ট হ্যান্ডেল করা এড়াতে এটি Navigation Compose-এর সাথে ব্যবহার করা যেতে পারে: onClick: () -> Unit = dropUnlessResumed { navController.navigate(NEW_SCREEN) }
  • ViewModel.viewModelScope এখন একটি ওভাররাইডযোগ্য কনস্ট্রাক্টর প্যারামিটার, যা আপনাকে আপনার নিজস্ব ডিসপ্যাচার এবং SupervisorJob() ইনজেক্ট করার অথবা runTest মধ্যে উপলব্ধ backgroundScope ব্যবহার করে ডিফল্টটিকে ওভাররাইড করার সুযোগ দেয়। ( I2817c , b/264598574 )

    class MyViewModel(
      // Make Dispatchers.Main the default, rather than Dispatchers.Main.immediate
      viewModelScope: CoroutineScope = Dispatchers.Main + SupervisorJob()
    ) : ViewModel(viewModelScope) {
      // Use viewModelScope as before, without any code changes
    }
    
    // Allows overriding the viewModelScope in a test
    fun Test() = runTest {
      val viewModel = MyViewModel(backgroundScope)
    }
    
  • ViewModel কোটলিনে নতুন করে লেখা হয়েছে এবং এখন এটি Closeable এর পরিবর্তে AutoClosable ব্যবহার করে। এটি এখন এমন একটি key ) সহ AutoCloseable অবজেক্ট যোগ করা সমর্থন করে, যার মাধ্যমে getCloseable() ব্যবহার করে সেগুলোকে পুনরুদ্ধার করা যায়।

  • এই API-গুলো যে DisposableEffect API-কে অনুকরণ করে, তার প্রচলিত নিয়ম অনুসরণ করে এখন কোনো কী (key) ছাড়া LifecycleStartEffect এবং LifecycleResumeEffect কল করলে ত্রুটি দেখা দেয়।

  • LiveDataReactiveStreams.toPublisher(lifecycleOwner, liveData) এর পরিবর্তে LiveData.toPublisher(lifecycleOwner) ব্যবহার করা হচ্ছে।

  • lifecycle-livedata-core-ktx কোটলিন এক্সটেনশনগুলো এখন lifecycle-livedata-core মডিউলে স্থানান্তরিত করা হয়েছে।

  • অনেক ভুল শনাক্তকরণ এড়ানোর জন্য NullSafeMutableLiveData কে রিফ্যাক্টর করা হয়েছে।

লাইফসাইকেল কোটলিন মাল্টিপ্ল্যাটফর্ম সামঞ্জস্যতা

Lifecycle , LifecycleOwner , LifecycleObserver , Lifecycle.State , Lifecycle.Event এবং LifecycleRegistry এর মতো মূল লাইফসাইকেল এপিআইগুলো এখন কোটলিন মাল্টিপ্ল্যাটফর্মের সাথে সামঞ্জস্যপূর্ণ আর্টিফ্যাক্ট হিসেবে অন্তর্ভুক্ত করা হয়েছে।

প্রভাবিত প্রত্নবস্তুসমূহ:

  • lifecycle-common বেশিরভাগ API-কে common এ স্থানান্তরিত করে এবং Android-এর পাশাপাশি jvm ও iOS-কে সমর্থন করে।
  • lifecycle-runtime বেশিরভাগ এপিআই-কে common -এ স্থানান্তরিত করে এবং অ্যান্ড্রয়েডের পাশাপাশি জেভিএম ও আইওএস সমর্থন করে।
  • lifecycle-runtime-ktx এখন খালি, কারণ এর সমস্ত API-কে lifecycle-runtime এ স্থানান্তর করা হয়েছে।
  • lifecycle-runtime-compose সমস্ত API-কে common এর অন্তর্ভুক্ত করে এবং একটি Android আর্টিফ্যাক্ট প্রদান করে, যা androidx.compose এর মাল্টিপ্ল্যাটফর্ম সমর্থনের সাথে সামঞ্জস্যপূর্ণ।

ভিউমডেল কোটলিন মাল্টিপ্ল্যাটফর্ম সামঞ্জস্যতা

lifecycle-viewmodel আর্টিফ্যাক্ট এবং ViewModel , ViewModelStore , ViewModelStoreOwner , ও ViewModelProvider এর মতো এপিআইগুলো এখন কোটলিন মাল্টিপ্ল্যাটফর্মের সাথে সামঞ্জস্যপূর্ণ আর্টিফ্যাক্ট হিসেবে অন্তর্ভুক্ত করা হয়েছে।

এই পরিবর্তনটি সমন্বয় করার জন্য, ViewModelProvider এর মতো যেসব মেথড java.lang.Class<T> গ্রহণ করত, সেগুলোর এখন একটি সমতুল্য মেথড রয়েছে যা kotlin.reflect.KClass<T> গ্রহণ করে।

অ্যান্ড্রয়েডে বাইনারি সামঞ্জস্যতা বজায় রাখা হয়েছে, কিন্তু অ্যান্ড্রয়েড এপিআই সারফেসের সাথে সাধারণ এপিআই সারফেসের তুলনা করলে কয়েকটি উল্লেখযোগ্য পরিবর্তন দেখা যায়:

  • এখন সরাসরি কনস্ট্রাক্টরকে কল করার পরিবর্তে ViewModelProvider.create() মেথডের মাধ্যমে একটি ViewModelProvider ইনস্ট্যান্স তৈরি করা হয়।
  • ViewModelProvider.NewInstanceFactory এবং ViewModelProvider.AndroidViewModelFactory শুধুমাত্র অ্যান্ড্রয়েডে উপলব্ধ।
    • কাস্টম ফ্যাক্টরিগুলোর জন্য ViewModelProvider.Factory থেকে এক্সটেন্ড করা এবং CreationExtras গ্রহণকারী create মেথড অথবা viewModelFactory Kotlin DSL ব্যবহার করার পরামর্শ দেওয়া হয়।
  • নন-জেভিএম প্ল্যাটফর্মে কাস্টম ফ্যাক্টরি ছাড়া ViewModelProvider ব্যবহার করলে একটি UnsupportedOperationException দেখা দেবে। জেভিএম প্ল্যাটফর্মে, কাস্টম ফ্যাক্টরি প্রদান করা না হলে নো-আর্গস ViewModel কনস্ট্রাক্টর ব্যবহার করে সামঞ্জস্যতা বজায় রাখা হয়।
  • যেসব প্ল্যাটফর্মে Dispatchers.Main উপলব্ধ নয় (যেমন, লিনাক্স), সেখানে viewModelScope একটি EmptyCoroutineContext এ ফিরে যাবে।

প্রভাবিত প্রত্নবস্তুসমূহ:

  • lifecycle-viewmodel বেশিরভাগ এপিআই-কে common এ নিয়ে আসে এবং অ্যান্ড্রয়েডের পাশাপাশি জেভিএম ও আইওএস সমর্থন করে।
  • lifecycle-viewmodel-ktx এখন খালি, কারণ এর সমস্ত API-কে lifecycle-viewmodel এ স্থানান্তর করা হয়েছে।
  • lifecycle-viewmodel-compose সমস্ত API-কে common এ স্থানান্তরিত করে এবং একটি Android আর্টিফ্যাক্ট সরবরাহ করে, যা androidx.compose এর মাল্টিপ্ল্যাটফর্ম সমর্থনের সাথে সামঞ্জস্যপূর্ণ।

আচরণগত পরিবর্তন

  • InitializerViewModelFactory ( viewModelFactory বিল্ডার ফাংশন সহ) এখন একটি IllegalArgumentException থ্রো করবে যদি একই clazz: KClass<VM : ViewModel> সহ একটি initializer আগে থেকেই যোগ করা হয়ে থাকে। ( Ic3a36 )

পরিচিত সমস্যা

  • lifecycle-*:2.8.0 জন্য Compose এর ন্যূনতম সংস্করণ 1.7.0-alpha05 ( b/336842920 ) প্রয়োজন।

সংস্করণ 2.8.0-rc01

১ মে, ২০২৪

androidx.lifecycle:lifecycle-*:2.8.0-rc01 প্রকাশিত হয়েছে। সংস্করণ 2.8.0-rc01-এ এই কমিটগুলো রয়েছে।

বাগ সংশোধন

  • lifecycle-common ক্লাসগুলির বেসলাইন প্রোফাইল সঠিকভাবে প্যাকেজ না হওয়ার সমস্যাটি সমাধান করা হয়েছে। এগুলি এখন lifecycle-runtime AAR-এ প্যাকেজ করা হয়েছে। ( aosp/3038274 , b/322382422 )
  • একটি ViewModel-এর সাথে সংযুক্ত AutoCloseable ইনস্ট্যান্সগুলি যেভাবে ক্লিয়ার করা হতো, সেই পদ্ধতিতে একটি অনিচ্ছাকৃত পরিবর্তন সংশোধন করা হয়েছে - পূর্ববর্তী ক্রম অর্থাৎ প্রথমে addCloseable(String, AutoCloseable) , তারপর addClosable(AutoCloseable) , এবং সবশেষে onCleared() পুনরুদ্ধার করা হয়েছে। ( aosp/3041632 )
  • নেটিভ এবং জেভিএম ডেস্কটপ এনভায়রনমেন্টের জন্য viewModelScope এর ডিফল্ট তৈরির আচরণ উন্নত করুন। ( aosp/3039221 )

বাহ্যিক অবদান

  • JVM ডেস্কটপে প্রধান থ্রেডের চেকিং উন্নত করার জন্য ভিক্টর ক্রপকে ধন্যবাদ। ( aosp/3037116 )

সংস্করণ 2.8.0-beta01

১৭ এপ্রিল, ২০২৪

androidx.lifecycle:lifecycle-*:2.8.0-beta01 প্রকাশিত হয়েছে। সংস্করণ 2.8.0-beta01-এ এই কমিটগুলো রয়েছে।

নতুন বৈশিষ্ট্য

  • lifecycle-runtime-compose আর্টিফ্যাক্টটি এখন Kotlin Multiplatform-এর সাথে সামঞ্জস্যপূর্ণ। এর কোড common এ স্থানান্তরিত করা হয়েছে এবং এটি androidx.compose এর মাল্টিপ্ল্যাটফর্ম সমর্থনের সাথে মিল রেখে একটি Android আর্টিফ্যাক্টও সরবরাহ করে। ( If7a71 , I4f4a0 , b/331769623 )

সংস্করণ 2.8.0-alpha04

৩ এপ্রিল, ২০২৪

androidx.lifecycle:lifecycle-*:2.8.0-alpha04 প্রকাশিত হয়েছে। সংস্করণ 2.8.0-alpha04-এ এই কমিটগুলো রয়েছে।

নতুন বৈশিষ্ট্য

  • ` lifecycle-viewmodel-compose আর্টিফ্যাক্টটি এখন কোটলিন মাল্টিপ্ল্যাটফর্মের সাথে সামঞ্জস্যপূর্ণ। এর কোড ` common এ স্থানান্তরিত করা হয়েছে এবং এটি একটি অ্যান্ড্রয়েড আর্টিফ্যাক্ট সরবরাহ করে, যা androidx.compose এর মাল্টিপ্ল্যাটফর্ম সমর্থনের সাথে মেলে। এই পরিবর্তনটি সমন্বয় করার জন্য, `Composable viewModel মেথডটি এখন ` java.lang.Class এর পাশাপাশি একটি KClass ও গ্রহণ করে। ( b/330323282 )

বাগ সংশোধন

  • অনেক ভুল শনাক্তকরণ এড়ানোর জন্য NullSafeMutableLiveData কে রিফ্যাক্টর করা হয়েছে। ( I2d8c1 , Iafb18 , I03463 , I7ecef )

নির্ভরতা আপডেট

সংস্করণ ২.৮.০-আলফা০৩

২০ মার্চ, ২০২৪

androidx.lifecycle:lifecycle-*:2.8.0-alpha03 is released. Version 2.8.0-alpha03 contains these commits .

নতুন বৈশিষ্ট্য

  • ViewModel.viewModelScope is now an overridable constructor parameter, allowing you to inject your own dispatcher and SupervisorJob() or to override the default by using the backgroundScope available within runTest . ( I2817c , b/264598574 )

    class MyViewModel(
      // Make Dispatchers.Main the default, rather than Dispatchers.Main.immediate
      viewModelScope: CoroutineScope = Dispatchers.Main + SupervisorJob()
    ) : ViewModel(viewModelScope) {
      // Use viewModelScope as before, without any code changes
    }
    
    // Allows overriding the viewModelScope in a test
    fun Test() = runTest {
      val viewModel = MyViewModel(backgroundScope)
    }
    

Kotlin Multiplatform Compatibility

The lifecycle-viewmodel artifact and APIs like ViewModel , ViewModelStore , ViewModelStoreOwner , and ViewModelProvider are now shipped in artifacts compatible with Kotlin Multiplatform. ( b/214568825 )

To accommodate this change, methods such as those on ViewModelProvider that took a java.lang.Class<T> now have an equivalent method that takes a kotlin.reflect.KClass<T> .

Binary compatibility on Android has been maintained, but there are a few notable changes when comparing the Android API surface to the common API surface:

  • Constructing a ViewModelProvider instance is now done through the ViewModelProvider.create() methods rather than directly calling its constructor.
  • ViewModelProvider.NewInstanceFactory and ViewModelProvider.AndroidViewModelFactory are only available on Android.
    • Custom Factories are recommended to extend from ViewModelProvider.Factory and use the create method that takes a CreationExtras or use the viewModelFactory Kotlin DSL.
  • Using ViewModelProvider without a custom factory on non-JVM platforms will result in an UnsupportedOperationException . On JVM platforms, compatibility is preserved by using the no-args ViewModel constructor if a custom factory is not provided.
  • viewModelScope will fallback to an EmptyCoroutineContext in platforms where Dispatchers.Main is not available (eg, Linux).

আচরণগত পরিবর্তন

  • InitializerViewModelFactory (including viewModelFactory builder function) will now throw an IllegalArgumentException if a initializer with the same clazz: KClass<VM : ViewModel> has already been added. ( Ic3a36 )

বাগ সংশোধন

  • ViewModel.getCloseable now handles duplicated keys: if the key already has an AutoCloseable resource associated with it, the old resource will be replaced and closed immediately. ( Ibeb67 )
  • Accessing the viewModelScope of a ViewModel is now thread safe. ( If4766 , b/322407038 )

বাহ্যিক অবদান

  • LocalLifecycleOwner moved from Compose UI to lifecycle-runtime-compose so that its Compose-based helper APIs can be used outside of Compose UI. Thanks Jake Wharton for the contribution. ( I6c41b , b/328263448 )

Version 2.8.0-alpha02

২১শে ফেব্রুয়ারি, ২০২৪

androidx.lifecycle:lifecycle-*:2.8.0-alpha02 is released. Version 2.8.0-alpha02 contains these commits.

নতুন বৈশিষ্ট্য

  • The dropUnlessResumed and dropUnlessStarted APIs have been added which allow you to drop click or other events that occur even after the LifecycleOwner has dropped below the given Lifecycle.State . For example, this can be used with Navigation Compose to avoid handling click events after a transition to another screen has already begun: onClick: () -> Unit = dropUnlessResumed { navController.navigate(NEW_SCREEN) } ( Icba83 , b/317230685 )

Kotlin Conversions

  • ViewModel is now written in Kotlin ( I16f26 , b/214568825 )
  • The lifecycle-viewmodel-ktx kotlin extensions have now been moved to the base lifecycle module. ( Id787b , b/274800183 )
  • The lifecycle-runtime-ktx kotlin extensions have now been moved to the base lifecycle module. ( Ic3686 , b/274800183 )
  • The lifecycle-livedata-core-ktx kotlin extensions have now been moved to the base lifecycle module. ( I54a3d , b/274800183 )

Kotlin Multiplatform Compatibility

  • The core Lifecycle APIs in Lifecycle , LifecycleOwner , LifecycleObserver , Lifecycle.State , Lifecycle.Event , and LifecycleRegistry are now shipped in artifacts compatible with Kotlin Multiplatform. ( b/317249252 )

এপিআই পরিবর্তন

  • Calling LifecycleStartEffect and LifecycleResumeEffect without a key is now an error, following the same convention as the DisposableEffect API that these APIs mirror. ( Ib0e0c , b/323518079 )
  • ViewModel now uses AutoCloseable instead of Closeable . That is a backward compatible change. ( I27f8e , b/214568825 )
  • Deprecated LiveDataReactiveStreams.toPublisher(lifecycleOwner, liveData) in favor of LiveData.toPublisher(lifecycleOwner) . ( Iabe29 , b/262623005 )

বাহ্যিক অবদান

  • Thanks Ivan Matkov from Jetbrains for helping move Lifecycle to Kotlin Multiplatform. ( aosp/2926690 , I0c5ac , If445d )

Version 2.8.0-alpha01

২৪ জানুয়ারী, ২০২৪

androidx.lifecycle:lifecycle-*:2.8.0-alpha01 is released. Version 2.8.0-alpha01 contains these commits.

নতুন বৈশিষ্ট্য

  • ViewModel now supports adding Closeable objects with a key that allows retrieving them via getCloseable() . ( I3cf63 )

সংস্করণ ২.৭

সংস্করণ ২.৭.০

১০ জানুয়ারী, ২০২৪

androidx.lifecycle:lifecycle-*:2.7.0 is released. Version 2.7.0 contains these commits.

Important changes since 2.6.0

  • TestLifecycleOwner now includes a suspending function setCurrentState() which ensures that the state change and all LifecycleObserver callbacks are completed before returning. Notably, unlike setting the currentState property directly, this does not use runBlocking , making it safe to use within a coroutine such as one provided by runTest .
  • The LiveData extensions of map and switchMap now mirror the behavior of distinctUntilChanged - if the LiveData has a value set, the map / switchMap function will be immediately called to populate the value of the returned LiveData . This ensures that the initial value will be set as part of the first composition (when used with observeAsState() ), but does not change the observation behavior - updates values from the source LiveData will still only apply once you start observing the LiveData .
  • This release fixes an issue where SavedStateHandle would not properly restore custom Parcelable classes after process death and recreation. Due to type information that is lost by the Android framework, arrays of custom Parcelables require additional work (manually creating a typed array of the right type) and the documentation on get , getLiveData , and getStateFlow now specifically calls this limitation out.
  • The proguard keep rules associated with LifecycleObserver have been removed. This means that proguarded code that wishes to use APIs via reflection (such as using the long since deprecated @OnLifecycleEvent annotation) will need to provide their own keep rules for their specific use case.

Lifecycle Event Observability

  • As an alternative to using a LifecycleEventObserver , you can now observe a Flow of Lifecycle.Event via the Lifecycle.asFlow() extension method.
  • Jetpack Compose users can now use LifecycleEventEffect to run Compose side effects based on Lifecycle.Event .
@Composable
fun HomeScreen(viewModel: HomeViewModel = viewModel()) {
  LifecycleEventEffect(Lifecycle.Event.ON_RESUME) {
    viewModel.refreshData()
  }
  // …
}
  • Jetpack Compose users can use LifecycleStartEffect and LifecycleResumeEffect to handle pairs of events - started to stopped and resumed to paused, respectively. This API mirrors the one found in DisposableEffect and is suitable for cases where the change being made when the state is going up needs to be reversed when going back down.
fun HomeScreen(viewModel: HomeViewModel = viewModel()) {
  LifecycleStartEffect(viewModel) {
    val timeTracking = viewModel.startTrackingTimeOnScreen()
    onStopOrDispose {
      timeTracking.stopTrackingTimeOnScreen()
    }
  }
  // …
}

See Run code on lifecycle events for more information.

Lifecycle State Observability

  • The current Lifecycle.State can now be observed via the Lifecycle.currentStateFlow property, which returns a StateFlow where the value is the current Lifecycle.State .
  • Jetpack Compose users can use the Lifecycle.currentStateAsState() extension to directly expose Lifecycle.State as Compose State . This is equivalent (and a shorter alternative) to lifecycle.currentStateFlow.collectAsState() .

See Collect lifecycle state with flows for more information.

Version 2.7.0-rc02

১৩ ডিসেম্বর, ২০২৩

androidx.lifecycle:lifecycle-*:2.7.0-rc02 is released. Version 2.7.0-rc02 contains these commits.

বাগ সংশোধন

  • Fixed an issue where SavedStateHandle would not properly restore custom Parcelable classes after process death and recreation. Due to type information that is lost by the Android framework, arrays of custom Parcelables require additional work (manually creating a typed array of the right type) and the documentation on get , getLiveData , and getStateFlow now specifically calls this limitation out. ( I0b55a )

Version 2.7.0-rc01

১৫ নভেম্বর, ২০২৩

androidx.lifecycle:lifecycle-*:2.7.0-rc01 is released. Version 2.7.0-rc01 contains these commits.

বাগ সংশোধন

  • LifecycleStartEffect and LifecycleResumeEffect now correctly dispose and recreate the effect block if the LifecycleOwner is changed. ( Ia25c6 )

Version 2.7.0-beta01

১ নভেম্বর, ২০২৩

androidx.lifecycle:lifecycle-*:2.7.0-beta01 is released with no changes. Version 2.7.0-beta01 contains these commits.

  • A beta version bump, no major changes to this release version.

Version 2.7.0-alpha03

১৮ অক্টোবর, ২০২৩

androidx.lifecycle:lifecycle-*:2.7.0-alpha03 is released. Version 2.7.0-alpha03 contains these commits.

নতুন বৈশিষ্ট্য

  • lifecycle-runtime-testing now contains a new Lint check to avoid setting the Lifecycle.State of the TestLifecycleOwner by using the currentState field when inside of a coroutine. The Lint check now suggests the suspending setCurrentState which allows setting the Lifecycle.State without blocking. ( Icf728 , b/297880630 )

বাগ সংশোধন

  • Fixed an issue with LiveData.switchMap where returning the same LiveData instance both on the initial call and a subsequent call would prevent the LiveData instance from being added as a source. ( Ibedcba7 )

Version 2.7.0-alpha02

৬ সেপ্টেম্বর, ২০২৩

androidx.lifecycle:lifecycle-*:2.7.0-alpha02 is released. Version 2.7.0-alpha02 contains these commits.

নতুন বৈশিষ্ট্য

  • TestLifecycleOwner now includes the suspending function setCurrentState() to give users the option of using TestLifecycleOwner from within a coroutine such as one provided by runTest . ( I329de , b/259344129 )

এপিআই পরিবর্তন

  • All files from the lifecycle-livedata-ktx modules have been moved into the main lifecycle-livedata module. ( I10c6f , b/274800183 )

আচরণগত পরিবর্তন

  • The LiveData.map() and LiveData.switchMap() extensions now sets the value of the returned LiveData if the previous LiveData has had a value set on it, ensuring that using the resulting LiveData in Jetpack Compose has the right state on the initial composition. ( I91d2b , b/269479952 )
  • ViewModel 's addCloseable() now immediately closes the Closeable if the ViewModel has already received a call to onCleared() . ( I4712e , b/280294730 )

বাগ সংশোধন

  • From Lifecycle 2.6.2 : Fixed an issue where SavedStateHandle would not correctly be restored after process death if the state was restored, save() was called without actually saving the state in the parent SavedStateRegistry , and then the state was restored again. This fixes the interaction between rememberSaveable and Navigation Compose's NavHost . ( aosp/2729289 )

Version 2.7.0-alpha01

২৬ জুলাই, ২০২৩

androidx.lifecycle:lifecycle-*:2.7.0-alpha01 is released. Version 2.7.0-alpha01 contains these commits.

এপিআই পরিবর্তন

  • Lifecycle.State is now Compose-observable via Lifecycle.currentStateFlow , which returns a StateFlow where the value is the current Lifecycle.State . ( Ib212d , b/209684871 )
  • Lifecycle.Event s can now able to be observed as a Flow with Lifecycle.asFlow(). ( If2c0f , b/176311030 )
  • LifecycleResumeEffect API has been added to run Compose SideEffect s based on both Lifecycle.Event.ON_RESUME and Lifecycle.Event.ON_PAUSE event callbacks. ( I60386 , b/235529345 )
  • LifecycleStartEffect API has been added to run Compose SideEffect s based on Lifecycle.Event.ON_START and Lifecycle.Event.ON_STOP event callbacks. ( I5a8d1 , b/235529345 )
  • LifecycleEventEffect API has been added to run Compose SideEffect s based on Lifecycle.Event . ( Ic9794 , b/235529345 )
  • Lifecycle.collectAsState() extension has been added to directly expose Lifecycle.State as Compose State . This is equivalent (and a shorter alternative) to lifecycle.currentStateFlow.collectAsState() . ( I11015 , b/235529345 )

বাগ সংশোধন

  • The LiveData.distinctUntilChanged() extension now sets the value of the returned LiveData if the previous LiveData has had a value set on it. This does not change the observation behavior - updated values from the source LiveData will still only apply once you start observing the LiveData returned from distinctUntilChanged() . ( Ib482f )
  • The proguard keep rules associated with LifecycleObserver have been removed. This means that proguarded code that wishes to use APIs via reflection will need to provide their own keep rules for their specific use case. ( Ia12fd )

সংস্করণ ২.৬

Version 2.6.2

৬ সেপ্টেম্বর, ২০২৩

androidx.lifecycle:lifecycle-*:2.6.2 is released. Version 2.6.2 contains these commits.

বাগ সংশোধন

  • Fixed an issue where SavedStateHandle would not correctly be restored after process death if the state was restored, save() was called without actually saving the state in the parent SavedStateRegistry , and then the state was restored again. This fixes the interaction between rememberSaveable and Navigation Compose's NavHost . ( aosp/2729289 )

সংস্করণ ২.৬.১

২২ মার্চ, ২০২৩

androidx.lifecycle:lifecycle-*:2.6.1 is released. Version 2.6.1 contains these commits.

Dependency Updates

সংস্করণ ২.৬.০

৮ মার্চ, ২০২৩

androidx.lifecycle:lifecycle-*:2.6.0 is released. Version 2.6.0 contains these commits.

Important changes since 2.5.0

  • LiveData now includes a new isInitialized property that indicates whether an explicit value has ever been set on the LiveData , allowing you to distinguish between liveData.value returning null because no value has ever been set or an explicit null value.
  • MediatorLiveData now includes a constructor to set an initial value.
  • Added a new extension on StateFlow and Flow of collectAsStateWithLifecycle() that collect from flows and represents its latest value as Compose State in a lifecycle-aware manner.
  • Lifecycle.launchWhenX methods and Lifecycle.whenX methods have been deprecated as the use of a pausing dispatcher can lead to wasted resources in some cases. It is recommended to use Lifecycle.repeatOnLifecycle . For more information about one-time suspending work, please see this explanation on why this is inherently unsafe.
  • Kotlin Conversion - A large number of Lifecycle classes have been converted to Kotlin. All converted classes still retain their binary compatibility with previous versions. The following classes have source incompatible changes for classes written in Kotlin: ViewTreeLifecycleOwner , LiveDataReactiveStreams , HasDefaultViewModelProviderFactory , ViewTreeViewModelStoreOwner , Transformations , ViewModelStoreOwner , LifecycleOwner

The table below provides the source conversions for the new version of lifecycle.

Lifecycle 2.5 Lifecycle 2.5 (KTX) Lifecycle 2.6
Transformations.switchMap(liveData) {...} liveData.switchMap {...} liveData.switchMap {...}
Transformations.map(liveData) {...} liveData.map {...} liveData.map {...}
Transformations.distinctUntilChanged(liveData) {...} liveData.distinctUntilChanged{...} liveData.distinctUntilChanged{...}
LiveDataReactiveStreams.fromPublisher(publisher) publisher.toLiveData() publisher.toLiveData()
LiveDataReactiveStreams.toPublisher(lifecycleOwner, liveData) liveData.toPublisher(lifecycleOwner) liveData.toPublisher(lifecycleOwner)
override fun getDefaultViewModelProviderFactory(): ViewModelProvider.Factory = factory override fun getDefaultViewModelProviderFactory(): ViewModelProvider.Factory = factory override val defaultViewModelProviderFactory = factory
override fun getDefaultViewModelCreationExtras(): CreationExtras = extras override fun getDefaultViewModelCreationExtras(): CreationExtras = extras override val defaultViewModelProviderCreationExtras = extras
ViewTreeLifecycleOwner.set(view, owner) ViewTreeLifecycleOwner.set(view, owner) view.setViewTreeLifecycleOwner(owner)
ViewTreeLifecycleOwner.get(view) view.findViewTreeLifecycleOwner() view.findViewTreeLifecycleOwner()
override fun getViewModelStore(): ViewModelStore = store override fun getViewModelStore(): ViewModelStore = store override val viewModelStore: ViewModelStore = store
override fun getLifecycle(): Lifecycle = registry override fun getLifecycle(): Lifecycle = registry override val lifecycle: Lifecycle get() = registry
  • The nullability of the onChanged method of a Observer created in Kotlin now matches the nullability of the generic type. If you want Observer.onChanged() to accept a nullable type, you must instantiate the Observer with a nullable type.
  • These classes were also converted to Kotlin, but remain source compatible: DefaultLifecycleObserver , LifecycleEventObserver , Lifecycle , LifecycleRegistry , LifecycleObserver , ViewModelStore , AndroidViewModel , AbstractSavedStateViewModelFactory , LifecycleService , ServiceLifecycleDispatcher , and ProcessLifecycleOwner

Version 2.6.0-rc01

২২ ফেব্রুয়ারী, ২০২৩

androidx.lifecycle:lifecycle-*:2.6.0-rc01 is released. Version 2.6.0-rc01 contains these commits.

বাগ সংশোধন

  • The LiveData.distinctUntilChanged() extension now sets the value of the returned LiveData if the previous LiveData has had a value set on it. This does not change the observation behavior - updated values from the source LiveData will still only apply once you start observing the LiveData returned from distinctUntilChanged() . ( Ib482f )

Version 2.6.0-beta01

৮ ফেব্রুয়ারী, ২০২৩

androidx.lifecycle:lifecycle-*:2.6.0-beta01 is released. Version 2.6.0-beta01 contains these commits.

Kotlin Conversions

  • LifecycleOwner is now written in Kotlin. This is a source incompatible change for classes written in Kotlin - they must now override the lifecycle property rather than implementing the previous getLifecycle() function. ( I75b4b , b/240298691 )
  • ViewModelStoreOwner is now in Kotlin. This is a source incompatible change for classes written in Kotlin - they must now override the viewModelStore property rather than implementing the previous getViewModelStore() function. ( I86409 , b/240298691 )
  • The Kotlin extension on LifecycleOwner that provides the lifecycleScope field has been moved to the lifecycle-common artifact from lifecycle-runtime-ktx . ( I41d78 , b/240298691 )
  • The Kotlin extension on Lifecycle that provides the coroutineScope field has been moved to the lifecycle-common artifact from lifecycle-runtime-ktx . ( Iabb91 , b/240298691 )

Version 2.6.0-alpha05

২৫শে জানুয়ারী, ২০২৩

androidx.lifecycle:lifecycle-*:2.6.0-alpha05 is released. Version 2.6.0-alpha05 contains these commits.

Kotlin Conversions

  • Transformations is now written in Kotlin. This is a source incompatible change for those classes written in Kotlin that were directly using syntax such as Transformations.map - Kotlin code must now use the Kotlin extension method syntax that was previously only available when using lifecycle-livedata-ktx . When using the Java programming language, the versions of these methods that take an androidx.arch.core.util.Function method are deprecated and replaced with the versions that take a Kotlin Function1 . This change maintains binary compatibility. ( I8e14f )
  • ViewTreeViewModelStoreOwner is now written in Kotlin. This is a source incompatible change for those classes written in Kotlin - you must now directly import and use the Kotlin extension methods on View of androidx.lifecycle.setViewTreeViewModelStoreOwner and androidx.lifecycle.findViewTreeViewModelStoreOwner to set and find a previously set owner. This is binary compatible and remains source compatible for implementations written in the Java programming language. ( Ia06d8 , Ib22d8 , b/240298691 )
  • The HasDefaultViewModelProviderFactory interface is now written in Kotlin. This is a source incompatible change for classes written in Kotlin - they must now override the defaultViewModelProviderFactory and defaultViewModelCreationExtras properties rather than implementing the previous corresponding functions. ( Iaed9c , b/240298691 )
  • Observer is now written in Kotlin. Its onChanged() method now uses the name value for its parameter. ( Iffef2 , I4995e , b/240298691 )
  • AndroidViewModel , AbstractSavedStateViewModelFactory , LifecycleService , ServiceLifecycleDispatcher , and ProcessLifecycleOwner are now written in Kotlin ( I2e771 , Ibae40 , I160d7 , I08884 , I1cda7 , b/240298691 )

Version 2.6.0-alpha04

১১ জানুয়ারী, ২০২৩

androidx.lifecycle:lifecycle-*:2.6.0-alpha04 is released. Version 2.6.0-alpha04 contains these commits.

নতুন বৈশিষ্ট্য

  • LiveData now includes a new isInitialized property that indicates whether an explicit value has ever been set on the LiveData , allowing you to distinguish between liveData.value returning null because no value has ever been set or an explicit null value. ( Ibd018 )

এপিআই পরিবর্তন

  • The collectAsStateWithLifecycle() APIs of lifecycle-runtime-compose are no longer in experimental status. ( I09d42 , b/258835424 )
  • Lifecycle.launchWhenX methods and Lifecycle.whenX methods have been deprecated as the use of a pausing dispatcher can lead to wasted resources in some cases. It is recommended to use Lifecycle.repeatOnLifecycle . ( Iafc54 , b/248302832 )

Kotlin Conversions

  • ViewTreeLifecycleOwner is now written in Kotlin. This is a source incompatible change for those classes written in Kotlin - you must now directly import and use the Kotlin extension methods on View of androidx.lifecycle.setViewTreeLifecycleOwner and androidx.lifecycle.findViewTreeLifecycleOwner to set and find a previously set owner. This replaces the previous Kotlin extension in lifecycle-runtime-ktx . This is binary compatible and remains source compatible for implementations written in the Java programming language. ( I8a77a , I5234e , b/240298691 )
  • LiveDataReactiveStreams is now written in Kotlin. The Kotlin extensions previously in lifecycle-reactivestreams-ktx have been moved into the lifecycle-reactivestreams module and have become the primary surface for code written in Kotlin. This is a source incompatible change for code written in Kotlin if you were not already using the Kotlin extension method APIs. ( I2b1b9 , I95d22 , b/240298691 )
  • DefaultLifecycleObserver , LifecycleEventObserver , Lifecycle , LifecycleRegistry , LifecycleObserver , and ViewModelStore are now written in Kotlin ( Iadffd , ( I60034 , I8c52c , I9593d , I01fe1 , I59a23 , b/240298691 )

বাগ সংশোধন

  • SavedStateHandle no longer crashes with a ClassCastException when calling get() with the incorrect class type. ( I6ae7c )

Version 2.6.0-alpha03

২৪ অক্টোবর, ২০২২

androidx.lifecycle:lifecycle-*:2.6.0-alpha03 is released. Version 2.6.0-alpha03 contains these commits.

বাগ সংশোধন

  • Fixed an issue with constraints between different Lifecycle modules not working as intended. ( I18d0d , b/249686765 )
  • Errors thrown by LifecycleRegistry.moveToState() now include a more helpful error messaging that informs developers of the component causing the error. ( Idf4b2 , b/244910446 )

Version 2.6.0-alpha02

৭ সেপ্টেম্বর, ২০২২

androidx.lifecycle:lifecycle-*:2.6.0-alpha02 is released. Version 2.6.0-alpha02 contains these commits.

এপিআই পরিবর্তন

  • MediatorLiveData now includes a constructor to set an initial value. ( Ib6cc5 , b/151244085 )

বাগ সংশোধন

  • Lifecycle artifacts now include constraints that ensure that all inter-dependent Lifecycle artifacts use the same version, automatically upgrading other dependencies when one is upgraded. b/242871265
  • FlowLiveData.asFlow() now creates a callbackFlow rather than using its own Channel implementation to ensure thread-safety and context preservation. ( I4a8b2 , b/200596935 )
  • FlowLiveData 's asLiveData function will now preserve the initial value of a StateFlow when creating the new LiveData object. ( I3f530 , b/157380488 )
  • From Lifecycle 2.5.1 : Custom implementations of AndroidViewModelFactory now correctly calls the create(modelClass) function when using the stateful constructor with Lifecycle 2.4+ ( I5b315 , b/238011621 )

Version 2.6.0-alpha01

২৯ জুন, ২০২২

androidx.lifecycle:lifecycle-*:2.6.0-alpha01 is released. Version 2.6.0-alpha01 contains these commits.

নতুন বৈশিষ্ট্য

  • Added a new extension on StateFlow and Flow of collectAsStateWithLifecycle that collect from flows and represents its latest value as Compose State in a lifecycle-aware manner. The flow is collected and the new emission is set to the State's value when the lifecycle is at least in a certain Lifecycle.State . When the lifecycle falls below that Lifecycle.State , the flow collection stops and the State's value is not updated. ( I1856e , b/230557927 )

সংস্করণ ২.৫

সংস্করণ ২.৫.১

২৭ জুলাই, ২০২২

androidx.lifecycle:lifecycle-*:2.5.1 is released. Version 2.5.1 contains these commits.

বাগ সংশোধন

  • Custom implementations of AndroidViewModelFactory now correctly call the create(modelClass) function when using the stateful AndroidViewModelFactory constructor with Lifecycle 2.4+. ( I5b315 , b/238011621 )

Version 2.5.0

২৯ জুন, ২০২২

androidx.lifecycle:lifecycle-*:2.5.0 is released. Version 2.5.0 contains these commits.

Important changes since 2.4.0

  • SavedStateHandle now offers a getStateFlow() API that returns a Kotlin StateFlow for monitoring value changes as an alternative to using LiveData .

  • ViewModel CreationExtras - when writing a custom ViewModelProvider.Factory , it is no longer required to extend AndroidViewModelFactory or AbstractSavedStateViewModelFactory to gain access to an Application or SavedStateHandle , respectively. Instead, these fields are provided to every ViewModelProvider.Factory subclass as CreationExtras via the new overload of create : create(Class<T>, CreationExtras) . These extras are provided automatically by your Activity or Fragment when using Activity 1.5.0 and Fragment 1.5.0 , respectively.

    class CustomFactory : ViewModelProvider.Factory {
        override fun <T : ViewModel> create(modelClass: Class<T>, extras: CreationExtras): T {
            return when (modelClass) {
                HomeViewModel::class -> {
                    // Get the Application object from extras
                    val application = checkNotNull(extras[ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY])
                    // Pass it directly to HomeViewModel
                    HomeViewModel(application)
                }
                DetailViewModel::class -> {
                    // Create a SavedStateHandle for this ViewModel from extras
                    val savedStateHandle = extras.createSavedStateHandle()
                    DetailViewModel(savedStateHandle)
                }
                else -> throw IllegalArgumentException("Unknown class $modelClass")
            } as T
        }
    }
    
  • lifecycle-viewmodel now provides a viewModelFactory Kotlin DSL that allows you define your ViewModelProvider.Factory in terms of one or more lambda initializers, one for each particular ViewModel class your custom factory supports, using CreationExtras as the primary data source.

    val customFactory = viewModelFactory {
        // The return type of the lambda automatically sets what class this lambda handles
        initializer {
            // Get the Application object from extras provided to the lambda
            val application = checkNotNull(get(ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY))
            HomeViewModel(application)
        }
        initializer {
            val savedStateHandle = createSavedStateHandle()
            DetailViewModel(savedStateHandle)
        }
    }
    
  • lifecycle-viewmodel-compose now offers a viewModel() API that takes a lambda factory for creating a ViewModel instance without requiring the creation of a custom ViewModelProvider.Factory .

    // Within a @Composable, you can now skip writing a custom Factory
    // and instead write a lambda to do the initialization of your ViewModel
    val detailViewModel = viewModel {
      // This lambda is only called the first time the ViewModel is created
      // and all CreationExtras are available inside the lambda
      val savedStateHandle = createSavedStateHandle()
      DetailViewModel(savedStateHandle)
    }
    
  • SavedStateHandle Compose Saver Integration - the lifecycle-viewmodel-compose artifact now contains new experimental APIs in SavedStateHandle.saveable that allow rememberSaveable like behavior backed by the SavedStateHandle of a `ViewModel.

    class ListScreenViewModel(handle: SavedStateHandle): ViewModel() {
        // This value survives both configuration changes and process death and recreation
        val editMode by handle.saveable { mutableStateOf(false) }
    }
    
  • Added an addCloseable() API and a new constructor overload that allow you to add one or more Closeable objects to the ViewModel that will be closed when the ViewModel is cleared without requiring any manual work in onCleared() .

    For instance, to create a coroutine scope that you can inject into a ViewModel, but control via testing, you can create a CoroutineScope that implements Closeable :

    class CloseableCoroutineScope(
        context: CoroutineContext = SupervisorJob() + Dispatchers.Main.immediate
    ) : Closeable, CoroutineScope {
        override val coroutineContext: CoroutineContext = context
        override fun close() {
            coroutineContext.cancel()
       }
    }
    

    Which can then be used in your ViewModel constructor while maintaining the same lifetime as viewModelScope :

    class TestScopeViewModel(
        val customScope: CloseableCoroutineScope = CloseableCoroutineScope()
    ) : ViewModel(customScope) {
        // You can now use customScope in the same way as viewModelScope
    }
    

আচরণের পরিবর্তন

  • Attempting to move the Lifecycle.State from INITIALIZED to DESTROYED will now always throw an IllegalStateException regardless of whether the Lifecycle has an attached observer.
  • LifecycleRegistry will now clear their observers when they reach the DESTROYED state.

Version 2.5.0-rc02

১৫ জুন, ২০২২

androidx.lifecycle:lifecycle-*:2.5.0-rc02 is released. Version 2.5.0-rc02 contains these commits.

বাগ সংশোধন

  • ViewModelProvider will no longer crash when mixing previous versions of compileOnly Lifecycle dependencies with versions 2.5+. ( I81a66 , b/230454566 )

Version 2.5.0-rc01

১১ মে, ২০২২

androidx.lifecycle:lifecycle-*:2.5.0-rc01 is released. Version 2.5.0-rc01 contains these commits.

বাগ সংশোধন

  • MediatorLiveData.addSource() now throws a NullPointerException when passed a null source instead of propagating the null source to observers.( Ibd0fb , b/123085232 )

Version 2.5.0-beta01

২০ এপ্রিল, ২০২২

androidx.lifecycle:lifecycle-*:2.5.0-beta01 is released. Version 2.5.0-beta01 contains these commits.

এপিআই পরিবর্তন

  • Added SavedStateHandle.saveable property delegates to use property names as keys for persisting state into the SavedStateHandle ( I8bb86 , b/225014345 )

বাগ সংশোধন

  • Fixed an issue where nesting one NavHost within another NavHost in a non-primary bottom navigation tab would lead to an IllegalStateException when using multiple back stacks. ( I11bd5 , b/228865698 )

Version 2.5.0-alpha06

৬ এপ্রিল, ২০২২

androidx.lifecycle:lifecycle-*:2.5.0-alpha06 is released. Version 2.5.0-alpha06 contains these commits.

নতুন বৈশিষ্ট্য

  • Add experimental MutableState overload to SavedStateHandle.saveable for parity with rememberSaveable ( I38cfe , b/224565154 )

এপিআই পরিবর্তন

  • CreationExtras is now abstract instead of sealed. ( Ib8a7a )

বাগ সংশোধন

  • Fixed an IllegalStateException: Already attached to lifecycleOwner error caused by SavedStateHandleController . ( I7ea47 , b/215406268 )

Version 2.5.0-alpha05

২৩ মার্চ, ২০২২

androidx.lifecycle:lifecycle-*:2.5.0-alpha05 is released. Version 2.5.0-alpha05 contains these commits.

নতুন বৈশিষ্ট্য

  • The lifecycle-viewmodel-compose module now provides SavedStateHandleSaver , an experimental API that ensures values in a SavedStateHandle are integrated correctly with the same saved instance state that rememberSaveable uses. ( Ia88b7 , b/195689777 )

এপিআই পরিবর্তন

  • Fixed a compatibility issue with Lifecycle 2.3 and newer Lifecycle versions in Java. ( I52c8a , b/219545060 )

বাগ সংশোধন

  • SavedStateViewFactory now supports using CreationExtras even when it was initialized with a SavedStateRegistryOwner . If extras are provided, the initialized arguments are ignored. ( I6c43b , b/224844583 )

Version 2.5.0-alpha04

৯ মার্চ, ২০২২

androidx.lifecycle:lifecycle-*:2.5.0-alpha04 is released. Version 2.5.0-alpha04 contains these commits.

এপিআই পরিবর্তন

  • SavedStateHandle now offers a getStateFlow() API that returns a Kotlin StateFlow for monitoring value changes as an alternative to using LiveData . ( Iad3ab , b/178037961 )

Version 2.5.0-alpha03

২৩শে ফেব্রুয়ারি, ২০২২

androidx.lifecycle:lifecycle-*:2.5.0-alpha03 is released. Version 2.5.0-alpha03 contains these commits.

নতুন বৈশিষ্ট্য

  • Added an addCloseable() API and a new constructor overload that allow you to add one or more Closeable objects to the ViewModel that will be closed when the ViewModel is cleared without requiring any manual work in onCleared() . ( I55ea0 )
  • lifecycle-viewmodel now provides an InitializerViewModelFactory that allows you to add lambda for handling particular ViewModel classes, using CreationExtras as the primary data source. ( If58fc , b/216687549 )
  • lifecycle-viewmodel-compose now offers a viewModel() API that takes a lambda factory for creating a ViewModel instance without requiring the creation of a custom ViewModelProvider.Factory . ( I97fbb , b/216688927 )

এপিআই পরিবর্তন

  • You can now create a ViewModel with CreationExtras via lifecycle-viewmodel-compose . ( I08887 , b/216688927 )

আচরণের পরিবর্তন

  • Attempting to move the Lifecycle.State from INITIALIZED to DESTROYED will now always throw an IllegalStateException regardless of whether the Lifecycle has an attached observer. ( I7c390 , b/177924329 )
  • LifecycleRegistry will now clear their observers when they reach the DESTROYED state. ( I4f8dd , b/142925860 )

Version 2.5.0-alpha02

৯ ফেব্রুয়ারী, ২০২২

androidx.lifecycle:lifecycle-*:2.5.0-alpha02 is released. Version 2.5.0-alpha02 contains these commits.

এপিআই পরিবর্তন

  • SavedStateHandle and SavedStateViewModelFactory have been converted to Kotlin. This has improved the nullability of the generics in both classes. ( Ib6ce2 , b/216168263 , I9647a , b/177667711 )
  • The LiveData switchMap function parameter can now have a nullable output. ( I40396 , b/132923666 )
  • The LiveData -ktx extensions are now annotated with @CheckResult to enforce that the result is used when calling these functions. ( Ia0f05 , b/207325134 )

আচরণের পরিবর্তন

  • SavedStateHandle now properly stores the defaultValue when no value for the specified key exists. ( I1c6ce , b/178510877 )

বাগ সংশোধন

  • From Lifecycle 2.4.1 : Updated lifecycle-process to depend on Startup 1.1.1 to ensure that fixes that prevent ProcessLifecycleInitializer from throwing a StartupException are available by default. ( Ib01df , b/216490724 )
  • There is now an improved error message when custom AndroidViewModel classes have parameters in the wrong order and attempt to create a ViewModel . ( I340f7 , b/177667711 )
  • You can now create a view model via CreationExtras using the AndroidViewModelFactory without setting an application. ( I6ebef , b/217271656 )

Version 2.5.0-alpha01

২৬ জানুয়ারী, ২০২২

androidx.lifecycle:lifecycle-*:2.5.0-alpha01 is released. Version 2.5.0-alpha01 contains these commits.

ViewModel CreationExtras

With this release, we are laying the groundwork for restructuring how a ViewModel is constructed. Instead of a rigid set of subclasses of ViewModelProvider.Factory that each add additional functionality (allowing an Application constructor parameter via AndroidViewModelFactory , allowing a SavedStateHandle constructor parameter via SavedStateViewModelFactory and AbstractSavedStateViewModelFactory , etc.), we are moving to a world of stateless factories that rely on a new concept, CreationExtras . ( Ia7343 , b/188691010 , b/188541057 )

With this change, ViewModelProvider no longer makes direct calls into the previous create(Class<T>) method of ViewModelProvider.Factory . Instead, it calls into a new overload of create : create(Class<T>, CreationExtras) . This means that any direct implementation of the ViewModelProvider.Factory instance now has access to each of these new CreationExtras :

  • ViewModelProvider.NewInstanceFactory.VIEW_MODEL_KEY : this String provides access to the custom key you passed to ViewModelProvider.get() .
  • ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY provides access to the Application class.
  • SavedStateHandleSupport.SAVED_STATE_REGISTRY_OWNER_KEY provides access to the SavedStateRegistryOwner that is being used to construct this ViewModel.
  • SavedStateHandleSupport.VIEW_MODEL_STORE_OWNER_KEY provides access to the ViewModelStoreOwner that is being used to construct this ViewModel.
  • SavedStateHandleSupport.DEFAULT_ARGS_KEY provides access to the Bundle of arguments that should be used to construct a SavedStateHandle .

These extras are provided by default when using Activity 1.5.0-alpha01 , Fragment 1.5.0-alpha01 , and Navigation 2.5.0-alpha01 . If you use an earlier version of those libraries, your CreationExtras will be empty - all of the existing subclasses of ViewModelProvider.Factory have been rewritten to support both the legacy creation path used by earlier versions of those libraries and the CreationExtras path which will be used going forward.

These CreationExtras allow you to construct a ViewModelProvider.Factory that passes just the information you need to each ViewModel without relying on a strict hierarchy of Factory subclasses:

class CustomFactory : ViewModelProvider.Factory {
    override fun <T : ViewModel> create(modelClass: Class<T>, extras: CreationExtras): T {
        return when (modelClass) {
            HomeViewModel::class -> {
                // Get the Application object from extras
                val application = checkNotNull(extras[ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY])
                // Pass it directly to HomeViewModel
                HomeViewModel(application)
            }
            DetailViewModel::class -> {
                // Create a SavedStateHandle for this ViewModel from extras
                val savedStateHandle = extras.createSavedStateHandle()
                DetailViewModel(savedStateHandle)
            }
            else -> throw IllegalArgumentException("Unknown class $modelClass")
        } as T
    }
}

We use the createSavedStateHandle() Kotlin extension function on CreationExtras from SavedStateHandleSupport to construct a SavedStateHandle only for the one ViewModel that needs it. ( Ia6654 , b/188541057 )

Custom CreationExtras can be provided by overriding getDefaultViewModelCreationExtras() in your ComponentActivity or Fragment , thus making them available to your custom ViewModelProvider.Factory as a built in form of assisted injection. These extras will automatically be made available to your custom Factory when used directly with ViewModelProvider or when using the by viewModels() and by activityViewModels() Kotlin property extensions. ( I79f2b , b/207012584 , b/207012585 , b/207012490 )

বাগ সংশোধন

  • Fixed an issue where the default value provided to a SavedStateHandle would reappear after process death and recreation, even if it was specifically removed from the SavedStateHandle . As a consequence of this, SavedStateHandle will no longer merge default values and restored values together, instead only using the restored values as the source of truth. ( I53a4b )

সংস্করণ ২.৪

Version 2.4.1

৯ ফেব্রুয়ারী, ২০২২

androidx.lifecycle:lifecycle-*:2.4.1 is released. Version 2.4.1 contains these commits.

বাগ সংশোধন

  • Backported from Lifecycle 2.5.0-alpha01 : Fixed an issue where the default value provided to a SavedStateHandle would re-appear after process death and recreation, even if it was specifically removed from the SavedStateHandle . As a consequence of this, SavedStateHandle will no longer merge default values and restored values together, instead only using the restored values as the source of truth. ( I53a4b )
  • lifecycle-process now depends on Androidx Startup 1.1.1 which fixed a regression in where using ProcessLifecycleInitializer would cause an StartupException . ( b/216490724 )

সংস্করণ ২.৪.০

২৭ অক্টোবর, ২০২১

androidx.lifecycle:lifecycle-*:2.4.0 is released. Version 2.4.0 contains these commits.

Important changes since 2.3.0

  • @OnLifecycleEvent was deprecated. LifecycleEventObserver or DefaultLifecycleObserver should be used instead.
  • androidx.lifecycle:lifecycle-viewmodel-compose library was added. It provides viewModel() composable and LocalViewModelStoreOwner .
    • Source-breaking change : ViewModelProvider has been rewritten in Kotlin. ViewModelProvider.Factory.create method no longer allows nullable generic.
  • New coroutines API were added to androidx.lifecycle:lifecycle-runtime-ktx :
  • Lifecycle.repeatOnLifecycle , API that executes a block of code in a coroutine when the Lifecycle is at least in a certain state. The block will cancel and re-launch as the lifecycle moves in and out of the target state;
  • Flow.flowWithLifecycle , API that emits values from the upstream Flow when the lifecycle is at least in a certain state.
  • DefaultLifecycleObserver was moved from lifecycle.lifecycle-common-java8 to lifecycle.lifecycle-common . lifecycle.lifecycle-common-java8 doesn't provide anymore any additional functionality on top of lifecycle.lifecycle-common , so dependency on it can be replaced by lifecycle.lifecycle-common .
  • Non coroutines API from lifecycle-viewmodel-ktx have been moved to the lifecycle-viewmodel module.
  • lifecycle-process now uses androidx.startup to initialize the ProcessLifecycleOwner .

    Previously, this was being done by androidx.lifecycle.ProcessLifecycleOwnerInitializer .

    If you used tools:node="remove" the ContentProvider being used to initialize process lifecycle in the past, then you need to do the following instead.

     <provider
        android:name="androidx.startup.InitializationProvider"
        android:authorities=\"${applicationId}.androidx-startup"
        android:exported="false"
        tools:node=\"merge">
        <!-- If you are using androidx.startup to initialize other components -->
        <meta-data
            android:name="androidx.lifecycle.ProcessLifecycleInitializer"
            android:value="androidx.startup"
            tools:node="remove" />
     </provider>
    

    (অথবা)

     <!-- If you want to disable androidx.startup completely. -->
     <provider
        android:name="androidx.startup.InitializationProvider"
        android:authorities="${applicationId}.androidx-startup"
        tools:node="remove">
     </provider>
    

Version 2.4.0-rc01

September 29, 2021

androidx.lifecycle:lifecycle-*:2.4.0-rc01 is released with no changes from Lifecycle 2.4.0-beta01. Version 2.4.0-rc01 contains these commits.

Version 2.4.0-beta01

১৫ সেপ্টেম্বর, ২০২১

androidx.lifecycle:lifecycle-*:2.4.0-beta01 is released. Version 2.4.0-beta01 contains these commits.

এপিআই পরিবর্তন

  • @OnLifecycleEvent was deprecated. LifecycleEventObserver or DefaultLifecycleObserver should be used instead. ( I5a8fa )
  • DefaultLifecycleObserver was moved from androidx.lifecycle.lifecycle-common-java8 to androidx.lifecycle.lifecycle-common . androidx.lifecycle.lifecycle-common-java8 doesn't provide anymore any additional functionality on top of androidx.lifecycle.lifecycle-common , so dependency on it can be replaced by androidx.lifecycle.lifecycle-common . ( I021aa )
  • Non coroutines API from lifecycle-viewmodel-ktx have been moved to the lifecycle-viewmodel module. ( I6d5b2 )

বাহ্যিক অবদান

  • Thanks dmitrilc for fixing a type in the ViewModel documentation! ( #221 )

Version 2.4.0-alpha03

৪ আগস্ট, ২০২১

androidx.lifecycle:lifecycle-*:2.4.0-alpha03 is released. Version 2.4.0-alpha03 contains these commits.

এপিআই পরিবর্তন

  • Source-breaking change : ViewModelProvider has been rewritten in Kotlin. ViewModelProvider.Factory.create method no longer allows nullable generic. ( I9b9f6 )

আচরণগত পরিবর্তন

  • The Lifecycle.repeatOnLifecycle : block is now always invoked serially when repeating execution. ( Ibab33 )

বাহ্যিক অবদান

  • Thanks chao2zhang for fixing the code snippets in the repeatOnLifecycle documentation. #205 .

Version 2.4.0-alpha02

১৬ জুন, ২০২১

androidx.lifecycle:lifecycle-*:2.4.0-alpha02 is released. Version 2.4.0-alpha02 contains these commits.

নতুন বৈশিষ্ট্য

  • Added a new RepeatOnLifecycleWrongUsage lint check to lifecycle-runtime-ktx that detects when repeateOnLifecycle is incorrectly used in onStart() or onResume() . ( 706078 , b/187887400 )

এপিআই পরিবর্তন

  • The LifecycleOwner.addRepeatingJob API is removed in favor of Lifecycle.repeatOnLifecycle that respects structured concurrency and is easier to reason about. ( I4a3a8 )
  • Make ProcessLifecycleInitializer public so other androidx.startup.Initializer s can use these as dependencies. ( I94c31 )

বাগ সংশোধন

  • Fixed an issue with the NullSafeMutableLiveData lint check when the field has modifiers. ( #147 , b/183696616 )
  • Fixed another issue with the NullSafeMutableLiveData lint check when using generics. ( #161 , b/184830263 )

বাহ্যিক অবদান

Version 2.4.0-alpha01

২৪ মার্চ, ২০২১

androidx.lifecycle:lifecycle-*:2.4.0-alpha01 is released. Version 2.4.0-alpha01 contains these commits.

আচরণগত পরিবর্তন

  • lifecycle-process now uses androidx.startup to initialize the ProcessLifecycleOwner .

    Previously, this was being done by androidx.lifecycle.ProcessLifecycleOwnerInitializer .

    If you used tools:node="remove" the ContentProvider being used to initialize process lifecycle in the past, then you need to do the following instead.

     <provider
        android:name="androidx.startup.InitializationProvider"
        android:authorities=\"${applicationId}.androidx-startup"
        android:exported="false"
        tools:node=\"merge">
        <!-- If you are using androidx.startup to initialize other components -->
        <meta-data
            android:name="androidx.lifecycle.ProcessLifecycleInitializer"
            android:value="androidx.startup"
            tools:node="remove" />
     </provider>
    

    (অথবা)

     <!-- If you want to disable androidx.startup completely. -->
     <provider
        android:name="androidx.startup.InitializationProvider"
        android:authorities="${applicationId}.androidx-startup"
        tools:node="remove">
     </provider>
    

এপিআই পরিবর্তন

  • Added a Flow.flowWithLifecycle API that emits values from the upstream Flow when the lifecycle is at least in a certain state using the Lifecycle.repeatOnLifecycle API. This is an alternative to the also new LifecycleOwner.addRepeatinJob API. ( I0f4cd )

বাগ সংশোধন

  • From Lifecycle 2.3.1 : The NonNullableMutableLiveData lint rule can now properly differentiate between field variables with different nullability. ( b/169249668 )

Lifecycle Viewmodel Compose Version 1.0.0

সংস্করণ 1.0.0-alpha07

১৬ জুন, ২০২১

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

Breaking API Changes

  • viewModel() now takes an optional ViewModelStoreOwner , making it easier to work with owners other than the LocalViewModelStoreOwner . For example, you can now use viewModel(navBackStackEntry) to retrieve a ViewModel associated with a particular navigation graph. ( I2628d , b/188693123 )

সংস্করণ 1.0.0-alpha06

২ জুন, ২০২১

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

Updated to be compatible with Compose version 1.0.0-beta08 .

সংস্করণ 1.0.0-alpha05

১৮ মে, ২০২১

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

নতুন বৈশিষ্ট্য

  • Updated to be compatible with Compose version 1.0.0-beta07 .

বাগ সংশোধন

  • The AndroidManifest files from ui-test-manifest and ui-tooling-data are now compatible with Android 12 ( I6f9de , b/184718994 )

সংস্করণ 1.0.0-alpha04

৭ এপ্রিল, ২০২১

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

Dependency Changes

  • This version allows androidx.hilt:hilt-navigation-compose and androidx.navigation:navigation-compose to sync dependencies on androidx.compose.compiler:compiler:1.0.0-beta04 and androidx.compose.runtime:runtime:1.0.0-beta04 . For 1.0.0, it is required that the compiler and runtime match.

সংস্করণ 1.0.0-alpha03

March 10, 2021

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

এপিআই পরিবর্তন

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

Lifecycle-Viewmodel-Compose Version 1.0.0-alpha02

February 24, 2021

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

এপিআই পরিবর্তন

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

Lifecycle-Viewmodel-Compose Version 1.0.0-alpha01

১০ ফেব্রুয়ারী, ২০২১

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

নতুন বৈশিষ্ট্য

  • The viewModel() composable and LocalViewModelStoreOwner were moved from androidx.compose.ui.viewinterop to this artifact in the androidx.lifecycle.viewmodel.compose package. ( I7a374 )

সংস্করণ ২.৩.১

Lifecycle Version 2.3.1

২৪ মার্চ, ২০২১

androidx.lifecycle:lifecycle-*:2.3.1 is released. Version 2.3.1 contains these commits.

বাগ সংশোধন

  • The NonNullableMutableLiveData lint rule can now properly differentiate between field variables with different nullability. ( b/169249668 )

সংস্করণ ২.৩.০

সংস্করণ ২.৩.০

১০ ফেব্রুয়ারী, ২০২১

androidx.lifecycle:lifecycle-*:2.3.0 is released. Version 2.3.0 contains these commits.

Major changes since 2.2.0

  • SavedStateHandle support for non-parcelable classes : SavedStateHandle now supports lazy serialization by allowing you to call setSavedStateProvider() for a given key, providing a SavedStateProvider that will get a callback to saveState() when the SavedStateHandle is asked to save its state. See Saving non-parcelable classes .
  • Lifecycle Behavior Enforcement :
    • LifecycleRegistry now enforces DESTROYED as a terminal state.
    • LifecycleRegistry now verifies that its methods are called on main thread. It was always a requirement for lifecycles of activities, fragments etc. An addition of observers from non-main threads resulted in hard to catch crashes in runtime. For LifecycleRegistry objects that owned by your own components, you can explicitly opt out from checks by using LifecycleRegistry.createUnsafe(...) , but then you have to ensure that a proper synchronization is in place when this LifecycleRegistry is accessed from different threads.
  • Lifecycle State and Event Helpers : Added static helper methods of downFrom(State) , downTo(State) , upFrom(State) , upTo(State) to Lifecycle.Event for generating the Event given a State and transition direction. Added the getTargetState() method that provides the State that the Lifecycle will transition to directly following the Event .
  • withStateAtLeast : Added Lifecycle.withStateAtLeast APIs that await a lifecycle state and run a non-suspending block of code synchronously at the point of state change, then resume with the result. These APIs differ from the existing when* methods as they do not permit running suspending code and do not employ a custom dispatcher. ( aosp/1326081 )
  • ViewTree APIs : A new ViewTreeLifecycleOwner.get(View) and ViewTreeViewModelStoreOwner.get(View) API allows you to retrieve the containing LifecycleOwner and ViewModelStoreOwner , respectively, given a View instance. You must upgrade to Activity 1.2.0 and Fragment 1.3.0 , and AppCompat 1.3.0-alpha01 or higher to populate this correctly. The findViewTreeLifecycleOwner and findViewTreeViewModelStoreOwner Kotlin extensions are available in lifecycle-runtime-ktx and lifecycle-viewmodel-ktx , respectively.
  • LiveData.observe() Kotlin extension deprecation : The LiveData.observe() Kotlin extension necessary to use lambda syntax is now deprecated as it is not necessary when using Kotlin 1.4.

Version 2.3.0-rc01

১৬ ডিসেম্বর, ২০২০

androidx.lifecycle:lifecycle-*:2.3.0-rc01 is released. Version 2.3.0-rc01 contains these commits.

বাগ সংশোধন

  • The keys() method of SavedStateHandle is now consistent before and after the state is saved - it now includes keys previously used with setSavedStateProvider() in addition to the keys used with set() and getLiveData() . ( aosp/1517919 , b/174713653 )

বাহ্যিক অবদান

Version 2.3.0-beta01

১ অক্টোবর, ২০২০

androidx.lifecycle:lifecycle-*:2.3.0-beta01 is released. Version 2.3.0-beta01 contains these commits.

এপিআই পরিবর্তন

  • The LiveData.observe() Kotlin extension necessary to use lambda syntax is now deprecated as it is not necessary when using Kotlin 1.4. ( I40d3f )

বাগ সংশোধন

Documentation Changes

  • The liveData builder and asLiveData() docs have been updated to include details about changing the given timeout values. ( aosp/1122324 )

Version 2.3.0-alpha07

August 19, 2020

androidx.lifecycle:lifecycle-*:2.3.0-alpha07 is released. Version 2.3.0-alpha07 contains these commits.

বাগ সংশোধন

  • Fixed a crash issue in the NullSafeMutableLiveData Lint check. ( aosp/1395367 )

Version 2.3.0-alpha06

২২ জুলাই, ২০২০

androidx.lifecycle:lifecycle-*:2.3.0-alpha06 is released. Version 2.3.0-alpha06 contains these commits.

নতুন বৈশিষ্ট্য

  • Added static helper methods of downFrom(State) , downTo(State) , upFrom(State) , upTo(State) to Lifecycle.Event for generating the Event given a State and transition direction. Added the getTargetState() method that provides the State that the Lifecycle will transition to directly following the Event . ( I00887 )
  • Added Lifecycle.withStateAtLeast APIs that await a lifecycle state and run a non-suspending block of code synchronously at the point of state change, then resume with the result. These APIs differ from the existing when* methods as they do not permit running suspending code and do not employ a custom dispatcher. ( aosp/1326081 )

আচরণগত পরিবর্তন

  • LifecycleRegistry now enforces DESTROYED as a terminal state. ( I00887 )
  • LifecycleRegistry now verifies that its methods are called on main thread. It was always a requirement for lifecycles of activities, fragments etc. An addition of observers from non-main threads resulted in hard to catch crashes in runtime. For LifecycleRegistry objects that owned by your own components, you can explicitly opt out from checks by using LifecycleRegistry.createUnsafe(...) , but then you have to ensure that a proper synchronization is in place when this LifecycleRegistry is accessed from different threads ( Ie7280 , b/137392809 )

বাগ সংশোধন

  • Fixed a crash in NullSafeMutableLiveData . ( b/159987480 )
  • Fixed an ObsoleteLintCustomCheck for Lint checks bundled with lifecycle-livedata-core-ktx (and specifically NullSafeMutableLiveData ). ( b/158699265 )

Version 2.3.0-alpha05

২৪ জুন, ২০২০

androidx.lifecycle:lifecycle-*:2.3.0-alpha05 is released. Version 2.3.0-alpha05 contains these commits.

বাগ সংশোধন

  • LiveData now better handles reentrant cases, avoiding duplicate calls to onActive() or onInactive() . ( b/157840298 )
  • Fixed an issue where Lint checks would not run when using Android Studio 4.1 Canary 6 or higher. ( aosp/1331903 )

Version 2.3.0-alpha04

June 10, 2020

androidx.lifecycle:lifecycle-*:2.3.0-alpha04 is released. Version 2.3.0-alpha04 contains these commits.

বাগ সংশোধন

  • Fixed a crash in the NonNullableMutableLiveData Lint check. ( b/157294666 )
  • The NonNullableMutableLiveData Lint check now covers significantly more cases where a null value was set on a MutableLiveData with a non-null type parameter. ( b/156002218 )

Version 2.3.0-alpha03

২০ মে, ২০২০

androidx.lifecycle:lifecycle-*:2.3.0-alpha03 are released. Version 2.3.0-alpha03 contains these commits.

নতুন বৈশিষ্ট্য

  • SavedStateHandle now supports lazy serialization by allowing you to call setSavedStateProvider() for a given key, providing a SavedStateProvider that will get a callback to saveState() when the SavedStateHandle is asked to save its state. ( b/155106862 )
  • A new ViewTreeViewModelStoreOwner.get(View) API allows you to retrieve the containing ViewModelStoreOwner given a View instance. You must upgrade to Activity 1.2.0-alpha05 , Fragment 1.3.0-alpha05 , and AppCompat 1.3.0-alpha01 to populate this correctly. A findViewModelStoreOwner() Kotlin extension has been added to lifecycle-viewmodel-ktx . ( aosp/1295522 )

বাগ সংশোধন

  • Fixed an issue that caused the MutableLiveData Lint checks released in Lifecycle 2.3.0-alpha01 from being published alongside the lifecycle-livedata-core-ktx artifact. ( b/155323109 )

Version 2.3.0-alpha02

২৯ এপ্রিল, ২০২০

androidx.lifecycle:lifecycle-*:2.3.0-alpha02 is released. Version 2.3.0-alpha02 contains these commits.

এপিআই পরিবর্তন

  • SavedStateViewModelFactory now allows you to pass a null Application to its constructor to better support cases where one is not readily available and support for AndroidViewModel is not needed. ( aosp/1285740 )

বাগ সংশোধন

  • Improved cold start performance by avoiding class verification failure on API 28 and lower devices. ( aosp/1282118 )

Version 2.3.0-alpha01

৪ মার্চ, ২০২০

androidx.lifecycle:lifecycle-*:2.3.0-alpha01 is released. Version 2.3.0-alpha01 contains these commits.

নতুন বৈশিষ্ট্য

  • A new ViewTreeLifecycleOwner.get(View) API allows you to retrieve the containing LifecycleOwner given a View instance. You must upgrade to Activity 1.2.0-alpha01 and Fragment 1.3.0-alpha01 to populate this correctly. A findViewTreeLifecycleOwner Kotlin extension is available in lifecycle-runtime-ktx . ( aosp/1182361 , aosp/1182956 )
  • Added a new Lint check that warns you when setting a null value on a MutableLiveData that has been defined in Kotlin as non-null. This is available when using the livedata-core-ktx or livedata-ktx artifacts. ( aosp/1154723 , aosp/1159092 )
  • A new lifecycle-runtime-testing artifact is available that provides a TestLifecycleOwner that implements LifecycleOwner and provides a thread safe mutable Lifecycle . ( aosp/1242438 )

বাগ সংশোধন

  • The lifecycle-runtime artifact now has a unique package name. ( aosp/1187196 )

সংস্করণ ২.২.০

ViewModel-Savedstate Version 2.2.0

৫ ফেব্রুয়ারি, ২০২০

androidx.lifecycle:lifecycle-viewmodel-savedstate:2.2.0 is released. Version 2.2.0 contains these commits .

Lifecycle ViewModel SavedState now shares the same version as other Lifecycle artifacts. The behavior of 2.2.0 is identical to the behavior of 1.0.0 .

সংস্করণ ২.২.০

২২ জানুয়ারী, ২০২০

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

Important changes since 2.1.0

  • Lifecycle Coroutine Integration : The new lifecycle-runtime-ktx artifact adds integration between Lifecycle and Kotlin coroutines. The lifecycle-livedata-ktx has also been expanded to take advantage of coroutines. See Use Kotlin coroutines with Architecture Components for more details.
  • ViewModelProviders.of() deprecation : ViewModelProviders.of() has been deprecated. You can pass a Fragment or FragmentActivity to the new ViewModelProvider(ViewModelStoreOwner) constructor to achieve the same functionality when using Fragment 1.2.0 .
  • lifecycle-extensions Artifact Deprecation : With the above deprecation of ViewModelProviders.of() , this release marks the deprecation of the last API in lifecycle-extensions and this artifact should now be considered deprecated in its entirety. We strongly recommend depending on the specific Lifecycle artifacts you need (such as lifecycle-service if you're using LifecycleService and lifecycle-process if you're using ProcessLifecycleOwner ) rather than lifecycle-extensions as there will not be a future 2.3.0 release of lifecycle-extensions .
  • Gradle Incremental Annotation Processor : Lifecycle's annotation processor is incremental by default. If your app is written in the Java 8 programming language you can use DefautLifecycleObserver instead; and if it's written in the Java 7 programming language you can use LifecycleEventObserver .

Version 2.2.0-rc03

৪ ডিসেম্বর, ২০১৯

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

বাগ সংশোধন

  • Fixed a failure occurring when a mocked ViewModel was stored in ViewModelStore and queried later with default factory.
  • Fix a usage of Dispatchers.Main.immediate in launchWhenCreated and similar methods to be called synchronously during corresponding lifecycle event. ( aosp/1156203 )

External contributions

  • Thanks to Anders Järleberg for contributing the fix! ( aosp/1156203 )
  • Thanks to Vsevolod Tolstopyatov from Jetbrains for reviewing an implementation of inlined execution.

Dependency changes

  • Lifecycle Extensions now depends on Fragment 1.2.0-rc03 .

Version 2.2.0-rc02

November 7, 2019

androidx.lifecycle:lifecycle-*:2.2.0-rc02 is released. Version 2.2.0-rc02 contains these commits .

বাগ সংশোধন

  • Fixed a bug in the proguard setup of the library that affected devices running API 28+ if the target API is below 29. ( b/142778206 )

Version 2.2.0-rc01

২৩ অক্টোবর, ২০১৯

androidx.lifecycle:lifecycle-*:2.2.0-rc01 is released. Version 2.2.0-rc01 contains these commits .

বাগ সংশোধন

  • Fixed an issue where launchWhenCreated and related methods would run one frame later than the associated lifecycle method due to its use of Dispatchers.Main instead of Dispatchers.Main.immediate . ( aosp/1145596 )

External contributions

  • Thanks to Nicklas Ansman for contributing the fix! ( aosp/1145596 )

Version 2.2.0-beta01

৯ অক্টোবর, ২০১৯

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

বাগ সংশোধন

  • Fixed a regression introduced in Lifecycle 2.2.0-alpha05 in the ordering of ProcessLifecycleOwner and the activity's LifecycleOwner moving to started and resumed on Android 10 devices. ( aosp/1128132 )
  • Fixed a regression introduced in Lifecycle 2.2.0-alpha05 which would cause a NullPointerException when using version 2.0.0 or 2.1.0 of lifecycle-process . ( b/141536990 )

Version 2.2.0-alpha05

১৮ সেপ্টেম্বর, ২০১৯

androidx.lifecycle:lifecycle-*:2.2.0-alpha05 is released. Version 2.2.0-alpha05 contains these commits .

বাগ সংশোধন

  • Fixed a race condition in coroutine livedata builder. b/140249349

Version 2.2.0-alpha04

৫ সেপ্টেম্বর, ২০১৯

androidx.lifecycle:lifecycle-*:2.2.0-alpha04 is released. The commits included in this version can be found here .

নতুন বৈশিষ্ট্য

  • lifecycleScope , whenCreated , whenStarted , whenResumed , viewModelScope , and the underlying implementation of liveData now use Dispatchers.Main.immediate instead of Dispatchers.Main . ( b/139740492 )

External contributions

  • Thanks to Nicklas Ansman for contributing the move to Dispatchers.Main.immediate ! ( aosp/1106073 )

Version 2.2.0-alpha03

৭ আগস্ট, ২০১৯

androidx.lifecycle:lifecycle-*:2.2.0-alpha03 is released. The commits included in this version can be found here .

নতুন বৈশিষ্ট্য

API changes

  • ViewModelProviders.of() has been deprecated. You can pass a Fragment or FragmentActivity to the new ViewModelProvider(ViewModelStoreOwner) constructor to achieve the same functionality. ( aosp/1009889 )

Version 2.2.0-alpha02

২ জুলাই, ২০১৯

androidx.lifecycle:*:2.2.0-alpha02 is released. The commits included in this version can be found here .

API changes

  • Replaced LiveDataScope.initialValue with LiveDataScope.latestValue which will track the current emitted value of the liveData block.
  • Added a new overload to the liveData builder that receives timeout parameter as type Duration

Version 2.2.0-alpha01

৭ মে, ২০১৯

androidx.lifecycle:*:2.2.0-alpha01 is released. The commits included in this version can be found here .

নতুন বৈশিষ্ট্য

  • This release adds new features that adds support for Kotlin coroutines for Lifecycle and LiveData. Detailed documentation on them can be found here .

ViewModel-SavedState Version 1.0.0

সংস্করণ ১.০.০

২২ জানুয়ারী, ২০২০

androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0 is released. Version 1.0.0 contains these commits .

Important features in 1.0.0

  • New SavedStateHandle class was added. It enables your ViewModel classes to access and to contribute to the saved state. This object can be received in constructor of ViewModel class and factories provided by default by Fragments and AppCompatActivity will inject SavedStateHandle automatically.
  • AbstractSavedStateViewModelFactory was added. It allows you to create custom factories for your ViewModel and provide them access to SavedStateHandle .

ViewModel-Savedstate Version 1.0.0-rc03

৪ ডিসেম্বর, ২০১৯

androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-rc03 is released. Version 1.0.0-rc03 contains these commits .

Dependency changes

  • Lifecycle ViewModel SavedState now depends on Lifecycle 2.2.0-rc03 .

Viewmodel-Savedstate Version 1.0.0-rc02

November 7, 2019

androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-rc02 is released. Version 1.0.0-rc02 contains these commits .

Dependency changes

  • Now depends on lifecycle 2.2.0-rc02 .

ViewModel-SavedState Version 1.0.0-rc01

২৩ অক্টোবর, ২০১৯

androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-rc01 is released with no changes from 1.0.0-beta01 . Version 1.0.0-rc01 contains these commits .

ViewModel-Savedstate Version 1.0.0-beta01

৯ অক্টোবর, ২০১৯

androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-beta01 is released. Version 1.0.0-beta01 contains these commits .

বাগ সংশোধন

  • Fixed an issue where accessing a SavedState ViewModel for the first time in Activity.onActivityResult() would result in an IllegalStateException . ( b/139093676 )
  • Fixed an IllegalStateException when using AbstractSavedStateViewModelFactory . ( b/141225984 )

ViewModel-SavedState Version 1.0.0-alpha05

১৮ সেপ্টেম্বর, ২০১৯

androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha05 is released. Version 1.0.0-alpha05 contains these commits .

API changes

  • SavedStateViewModelFactory no longer extends AbstractSavedStateViewModelFactory and SavedStateHandle is created only for ViewModels that requested have it ( aosp/1113593 )

ViewModel-SavedState Version 1.0.0-alpha03

৭ আগস্ট, ২০১৯

androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha03 is released. The commits included in this version can be found here .

Breaking Changes

ViewModel-SavedState Version 1.0.0-alpha02

২ জুলাই, ২০১৯

androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha02 is released. The commits included in this version can be found here .

নতুন বৈশিষ্ট্য

  • Added SavedStateHandle.getLiveData() overload which accepts a default value.

এপিআই পরিবর্তন

  • SavedStateVMFactory is renamed to SavedStateViewModelFactory .
  • AbstractSavedStateVMFactory is renamed to AbstractSavedStateViewModelFactory .

ViewModel-Savedstate Version 1.0.0-alpha01

১৩ মার্চ, ২০১৯

androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha01 is released. The full commit log for this initial release can be found here .

নতুন বৈশিষ্ট্য

  • Now ViewModels can contribute to savedstate. To do that you use newly introduced viewmodel's factory SavedStateVMFactory and your ViewModel should have a constructor that receives SavedStateHandle object as a parameter.

সংস্করণ ২.১.০

Important changes since 2.0.0

  • Added LifecycleEventObserver for the cases when a stream of lifecycle events is needed. It is a public API instead of a hidden GenericLifecycleObserver class.
  • Added ktx extensions for LiveData.observe methods and Transformations.* methods.
  • Added Transformations.distinctUntilChanged , which creates a new LiveData object that does not emit a value until the source LiveData value has been changed.
  • Added coroutine support in ViewModels by adding the extension property ViewModel.viewModelScope .

সংস্করণ ২.১.০

৫ সেপ্টেম্বর, ২০১৯

androidx.lifecycle:lifecycle-*:2.1.0 is released. The commits included in this version can be found here .

Version 2.1.0-rc01

২ জুলাই, ২০১৯

androidx.lifecycle:*:2.1.0-rc01 is released with no changes from androidx.lifecycle:*:2.1.0-beta01 . The commits included in this version can be found here .

Version 2.1.0-beta01

৭ মে, ২০১৯

androidx.lifecycle:*:2.1.0-beta01 is released. The commits included in this version can be found here .

নতুন বৈশিষ্ট্য

  • Lifecycles are graduated to beta: api introduced in previous alphas such as liveData extension functions for transformations and observations, ViewModel initialisation with property delegation and others are stabilised and not going to change.

Version 2.1.0-alpha04

৩ এপ্রিল, ২০১৯

androidx.lifecycle:*:2.1.0-alpha04 is released. The commits included in this version can be found here .

API changes

  • Breaking change: the underlying API behind by viewModels() and by activityViewModels() has been changed to support a ViewModelStore directly, rather than only a ViewModelStoreOwner . ( aosp/932932 )

Version 2.1.0-alpha03

১৩ মার্চ, ২০১৯

androidx.lifecycle:*:2.1.0-alpha03 is released. The full list of commits included in this version can be found here .

API changes

  • ViewModelProvider.KeyedFactory was removed. Second interface in addition to ViewModelProvider.Factory didn't compose well with new features as property delegation in Kotlin by viewmodels {} . ( aosp/914133 )

Version 2.1.0-alpha02

৩০ জানুয়ারী, ২০১৯

androidx.lifecycle 2.1.0-alpha02 is released.

API changes

  • LifecycleRegistry now contains a setCurrentState() method that replaces the now deprecated setState() method. ( aosp/880715 )

বাগ সংশোধন

  • Fixed an issue where mock ViewModel instances would crash when the containing ViewModelStore was cleared. b/122273087

Version 2.1.0-alpha01

১৭ ডিসেম্বর, ২০১৮

androidx.lifecycle 2.1.0-alpha01 is released.

নতুন বৈশিষ্ট্য

  • Added LifecycleEventObserver for the cases when a stream of lifecycle events is needed. It is a public api instead of a hidden GenericLifecycleObserver class.
  • Added ktx extensions for LiveData.observe methods and Transformations.* methods.
  • Method Transformations.distinctUntilChanged was added. It creates a new LiveData object that does not emit a value until the source LiveData value has been changed.
  • Coroutine support in ViewModels: extension property ViewModel.viewModelScope was added.
  • Added ViewModelProvider.KeyedFactory , a factory for ViewModels that receives key and Class in create method.

সংস্করণ ২.০.০

সংস্করণ ২.০.০

২১ সেপ্টেম্বর, ২০১৮

Lifecycle 2.0.0 is released with one bugfix from 2.0.0-rc01 in ViewModel.

বাগ সংশোধন

  • Fixed a ViewModel proguard rule that incorrectly removed constructors b/112230489

Version 2.0.0-beta01

২ জুলাই, ২০১৮

বাগ সংশোধন

  • Fixed LifecycleObserver proguard rule to keep only implementations, not subinterfaces b/71389427
  • Fixed ViewModel proguard rules to allow obfuscation and shrinking

Pre-AndroidX Versions

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

dependencies {
    def lifecycle_version = "1.1.1"

    // ViewModel and LiveData
    implementation "android.arch.lifecycle:extensions:$lifecycle_version"
    // alternatively - just ViewModel
    implementation "android.arch.lifecycle:viewmodel:$lifecycle_version" // For Kotlin use viewmodel-ktx
    // alternatively - just LiveData
    implementation "android.arch.lifecycle:livedata:$lifecycle_version"
    // alternatively - Lifecycles only (no ViewModel or LiveData).
    //     Support library depends on this lightweight import
    implementation "android.arch.lifecycle:runtime:$lifecycle_version"

    annotationProcessor "android.arch.lifecycle:compiler:$lifecycle_version" // For Kotlin use kapt instead of annotationProcessor
    // alternately - if using Java8, use the following instead of compiler
    implementation "android.arch.lifecycle:common-java8:$lifecycle_version"

    // optional - ReactiveStreams support for LiveData
    implementation "android.arch.lifecycle:reactivestreams:$lifecycle_version"

    // optional - Test helpers for LiveData
    testImplementation "android.arch.core:core-testing:$lifecycle_version"
}

সংস্করণ ১.১.১

২১ মার্চ, ২০১৮

Only one small change: android.arch.core.util.Function is moved from arch:runtime to arch:common . This allows it to be used without the runtime dependency, eg in paging:common below.

lifecycle:common is a dependency of lifecycle:runtime , so this change doesn't affect lifecycle:runtime directly, only modules that depend directly on lifecycle:common , as Paging does.

সংস্করণ ১.১.০

২২ জানুয়ারী, ২০১৮

Packaging Changes

New, much smaller dependencies are now available:

  • android.arch.lifecycle:livedata:1.1.0
  • android.arch.lifecycle:viewmodel:1.1.0

এপিআই পরিবর্তন

  • The deprecated LifecycleActivity and LifecycleFragment have now been removed - please use FragmentActivity , AppCompatActivity or support Fragment .
  • @NonNull annotations have been added to ViewModelProviders and ViewModelStores
  • ViewModelProviders constructor has been deprecated - please use its static methods directly
  • ViewModelProviders.DefaultFactory has been deprecated - please use ViewModelProvider.AndroidViewModelFactory
  • The static ViewModelProvider.AndroidViewModelFactory.getInstance(Application) method has been added to retrieve a static Factory suitable for creating ViewModel and AndroidViewModel instances.