জীবনচক্র
এই টেবিলটি androidx.lifecycle
গ্রুপের সমস্ত শিল্পকর্মের তালিকা করে।
আর্টিফ্যাক্ট | স্থিতিশীল রিলিজ | প্রার্থী মুক্তি | বিটা রিলিজ | আলফা রিলিজ |
---|---|---|---|---|
জীবনচক্র-* | 2.8.7 | - | - | 2.9.0-আলফা10 |
জীবনচক্র-ভিউ মডেল-কম্পোজ | 2.8.7 | - | - | 2.9.0-আলফা10 |
নির্ভরতা ঘোষণা করা
জীবনচক্রের উপর নির্ভরতা যোগ করতে, আপনাকে অবশ্যই আপনার প্রকল্পে Google Maven সংগ্রহস্থল যোগ করতে হবে। আরও তথ্যের জন্য Google এর Maven সংগ্রহস্থল পড়ুন।
আপনার অ্যাপ বা মডিউলের জন্য build.gradle
ফাইলে আপনার প্রয়োজনীয় আর্টিফ্যাক্টগুলির জন্য নির্ভরতা যোগ করুন:
কোটলিন
গ্রোভি
dependencies { def lifecycle_version = "2.8.7" 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" // 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.8.7" 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") // 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.8.7" 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.8.7" 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.9
সংস্করণ 2.9.0-alpha10
ফেব্রুয়ারি 12, 2025
androidx.lifecycle:lifecycle-*:2.9.0-alpha10
প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha10-এ এই কমিট রয়েছে।
এপিআই পরিবর্তন
-
lifecycle-viewmodel-compose
থেকেsavedstate-compose
করতেMutableStateSerializer
সরান। ( I4f690 , b/378895074 )
বাহ্যিক অবদান
-
Lifecycle::currentState
কম্পোজিশনে কল করার জন্য একটি নতুন লিন্ট ইস্যু যোগ করে, পরিবর্তেcurrentStateAsalue().value
ব্যবহার করে লাইফসাইকেল অবস্থার পরিবর্তনগুলি সঠিকভাবে পুনর্গঠন ঘটায় তা নিশ্চিত করার জন্য পরামর্শ দেয়৷ ধন্যবাদ স্টিভেন শোয়েন! ( Iad484 )
সংস্করণ 2.9.0-alpha09
জানুয়ারী 29, 2025
androidx.lifecycle:lifecycle-*:2.9.0-alpha09
প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha09-এ এই কমিট রয়েছে।
নতুন বৈশিষ্ট্য
-
androidx.compose.runtime.MutableState
সিরিয়ালাইজ করার জন্যMutableStateSerializer
যোগ করুন। ( আইডিএফসি৪৮ , বি/৩৭৮৮৯৫০৭৪ )
এপিআই পরিবর্তন
- ওভারলোড করা
SavedStateHandle.saved()
ডেলিগেট ফাংশনকে ডিফল্ট প্যারামিটার দিয়ে প্রতিস্থাপন করুন ( Icd1c1 ) -
AbstractSavedStateViewModelFactory
অপ্রয়োজনীয় ওভারহেড সৃষ্টি করে, প্রতিটিViewModel
এর জন্য একটিSavedStateHandle
তৈরি করে বলে অবহেলিত হয়েছে। আরও দক্ষViewModel
তৈরির জন্যCreationExtras.createSavedStateHandle
এর পরিবর্তেViewModelProvider.Factory
ব্যবহার করুন। ( IA920b , b/388590327 )
সংস্করণ 2.9.0-alpha08
11 ডিসেম্বর, 2024
androidx.lifecycle:lifecycle-*:2.9.0-alpha08
প্রকাশিত হয়েছে। 2.9.0-alpha08 সংস্করণে এই কমিট রয়েছে।
নতুন বৈশিষ্ট্য
- একটি সিস্টেম প্রসেস ডেথ অনুকরণ করতে
ViewModelScenario.recreate
যোগ করুন যা পরীক্ষার অধীনেViewModel
পুনরায় তৈরি করে এবং সমস্ত সংশ্লিষ্ট উপাদান। ( Id6a69 , b/381063087 ) -
LifecycleOwner
এবংViewModelStoreOwner
তাদের নিজ নিজfindViewTree
API-এর মাধ্যমে পুনরুদ্ধার করা দৃষ্টান্তগুলি এখনViewOverlay
এর মতো একটি ভিউয়ের বিচ্ছিন্ন পিতামাতার মাধ্যমে সমাধান করা যেতে পারে।ViewTree.setViewTreeDisjointParent
এ কোর-এর রিলিজ নোট বা ডকুমেন্টেশনগুলিকে ডিসজয়েন্ট ভিউ অভিভাবকদের সম্পর্কে আরও তথ্যের জন্য দেখুন। ( I800f4 )
এপিআই পরিবর্তন
-
SavedStateRegistryOwnerDelegate
( I8c135 , b/376026744 ) এর সাথে নামকরণ এবং প্যাকেজ সংগঠনকে আরও সামঞ্জস্যপূর্ণ করুন
বাগ ফিক্স
- এই লাইব্রেরিটি এখন JSpecify nullness টীকা ব্যবহার করে, যা টাইপ-ব্যবহার। Kotlin ডেভেলপারদের সঠিক ব্যবহার প্রয়োগ করতে নিম্নলিখিত কম্পাইলার আর্গুমেন্ট ব্যবহার করা উচিত:
-Xjspecify-annotations=strict, -Xtype-enhancement-improvements-strict-mode
( Ie4340 , b/326456246 ) - ডকুমেন্ট
ViewModel.onCleared
ক্লিয়ারিং সিকোয়েন্স। ( I586c7 , b/363984116 )
সংস্করণ 2.9.0-alpha07
13 নভেম্বর, 2024
androidx.lifecycle:lifecycle-*:2.9.0-alpha07
প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha07-এ এই কমিট রয়েছে।
কোটলিন মাল্টিপ্ল্যাটফর্ম সামঞ্জস্য
- লাইফসাইকেল
ViewModel SavedState
এখন KMP সামঞ্জস্যপূর্ণ। এটি আপনাকে সাধারণ কোডেSavedStateHandle
ব্যবহার করতে দেয়। ( Ib6394 , b/334076622 )
KotlinX সিরিয়ালাইজেশন সমর্থন
SavedState
1.3.0-alpha05
এ যোগ করা KotlinX সিরিয়ালাইজেশনের সমর্থনের সাথে, আমরা একটিSavedStateHandle
এ@Serializable
ক্লাসগুলিকে সহজে সংরক্ষণ করতে এবং সেই ক্লাসগুলিকে স্বয়ংক্রিয়ভাবে প্রক্রিয়া মৃত্যু এবং বিনোদন জুড়ে পুনরুদ্ধার করার জন্যsaved
, একটি অলস সম্পত্তি প্রতিনিধি প্রবর্তন করেছি। অনুগ্রহ করে মনে রাখবেন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
ফেরত দিতেSavedStateHandle
এgetMutableStateFlow
যোগ করুন। এই নতুন ফাংশনটি কী-এক্সক্লুসিভ এবংgetLiveData
সাথে ব্যবহার করা যাবে না। আপনি একই অবস্থা অ্যাক্সেস করতে উভয় ব্যবহার করার চেষ্টা করলে একটি ব্যতিক্রম নিক্ষেপ করা হবে। ( I04a4f , b/375408415 )
সংস্করণ 2.9.0-alpha06
30 অক্টোবর, 2024
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.eventFlow
এখন সঠিকভাবে সম্পূর্ণ হয় যখনLifecycle
DESTROYED
( I293b2 , b/374043130 )
সংস্করণ 2.9.0-alpha05
অক্টোবর 16, 2024
androidx.lifecycle:lifecycle-*:2.9.0-alpha05
কোনো উল্লেখযোগ্য পরিবর্তন ছাড়াই প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha05-এ এই কমিট রয়েছে।
সংস্করণ 2.9.0-alpha04
2 অক্টোবর, 2024
androidx.lifecycle:lifecycle-*:2.9.0-alpha04
প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha04-এ এই কমিট রয়েছে।
কোটলিন মাল্টিপ্ল্যাটফর্ম
-
lifecycle-viewmodel-savedstate
মডিউলটি এখনSavedStateHandle
মতো API-এর প্রস্তুতির জন্য KMP সামঞ্জস্যপূর্ণ হওয়ার জন্য কনফিগার করা হয়েছে যা ভবিষ্যতের রিলিজে সাধারণ উত্স সেটে উপলব্ধ করা হবে। ( I503ed , I48764 , b/334076622 )
সংস্করণ 2.9.0-alpha03
সেপ্টেম্বর 18, 2024
androidx.lifecycle:lifecycle-*:2.9.0-alpha03
প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha03-এ এই কমিট রয়েছে।
বাগ ফিক্স
- লাইফসাইকেল
2.8.6
থেকে :NullSafeMutableLiveData
Lint ত্রুটি স্মার্ট কাস্টের জন্য সমর্থন উন্নত করেছে, মিথ্যা ইতিবাচক এড়িয়ে গেছে। ( 85fed6 , b/181042665 )
নির্ভরতা আপডেট
- লাইফসাইকেল
2.8.6
থেকে : লাইফসাইকেল রানটাইম কম্পোজ এখন কম্পোজ রানটাইম1.7.1
উপর নির্ভর করে - লাইফসাইকেল রানটাইম এখন প্রোফাইলইনস্টলার
1.4.0
এর উপর নির্ভর করে
সংস্করণ 2.9.0-alpha02
4 সেপ্টেম্বর, 2024
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 থেকে ইভান Matkov ধন্যবাদ. ( 8cd5d03 ) - লাইফসাইকেল
2.8.5
থেকে : SavedStateHandle.saveable` এক্সটেনশন প্রতিনিধি এখন বাতিলযোগ্য মান সমর্থন করে। অবদানের জন্য ধন্যবাদ রোমান Kalukiewicz. ( 0d78ea6 )
সংস্করণ 2.9.0-alpha01
7 আগস্ট, 2024
androidx.lifecycle:lifecycle-*:2.9.0-alpha01
প্রকাশিত হয়েছে। সংস্করণ 2.9.0-alpha01-এ এই কমিট রয়েছে।
কোটলিন মাল্টিপ্ল্যাটফর্ম
-
lifecycle-testing
এখন KMP সামঞ্জস্যপূর্ণ। ( IEA41e ) -
linuxArm64
kotlin মাল্টিপ্ল্যাটফর্ম টার্গেটের জন্য সমর্থন যোগ করুন ( I139d3 , b/338268719 )
নতুন বৈশিষ্ট্য
- একটি নতুন
androidx.lifecycle:lifecycle-viewmodel-testing
KMP আর্টিফ্যাক্ট উপলব্ধ রয়েছে যাonCleared
(সমস্ত প্ল্যাটফর্ম) এবংSavedStateHandle
(শুধুমাত্র অ্যান্ড্রয়েড) এর জন্য সমর্থন সহ, বিচ্ছিন্নভাবে ViewModels পরীক্ষা করার জন্য একটিViewModelScenario
ক্লাস প্রদান করে। ( 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 ) - কোটলিন ভাষা সংস্করণ 2.0 ( I39df2 ) এ অন্তর্নিহিত অ্যাপ্লিকেশনটি নিরাপদে প্রকাশ করতে ইনলাইন এক্সটেনশন সম্পত্তি
বাগ ফিক্স
- নতুন প্ল্যাটফর্ম API-এ অ্যাক্সেসের ম্যানুয়াল রূপরেখা সরানো হয়েছে যেহেতু AGP 7.3 বা তার পরে (যেমন R8 সংস্করণ 3.3) এবং AGP 8.1 বা তার পরবর্তী (যেমন D8 সংস্করণ 8.1) ব্যবহার করার সময় R8 ব্যবহার করার সময় এটি স্বয়ংক্রিয়ভাবে API মডেলিংয়ের মাধ্যমে ঘটে। যে সকল ক্লায়েন্ট AGP ব্যবহার করছেন না তাদের D8 সংস্করণ 8.1 বা তার পরবর্তী সংস্করণে আপডেট করার পরামর্শ দেওয়া হচ্ছে। আরো বিস্তারিত জানার জন্য এই নিবন্ধটি দেখুন. ( if6b4c , b/345472586 )
সংস্করণ 2.8
সংস্করণ 2.8.7
30 অক্টোবর, 2024
androidx.lifecycle:lifecycle-*:2.8.7
প্রকাশিত হয়েছে। সংস্করণ 2.8.7-এ এই কমিটগুলি রয়েছে।
এপিআই পরিবর্তন
-
androidx.compose.ui.platform.LocalLifecycleOwner
এখন সাধারণ উৎস সেটে (KMP) উপলব্ধ। ( 6a3f5b3 ) -
lifecycle-runtime-compose
:desktop
আর্টিফ্যাক্টগুলি সরানো হয়েছিল এবং-jvmStubs
এবং-linuxx64Stubs
আর্টিফ্যাক্টগুলি যোগ করা হয়েছিল। এই লক্ষ্যগুলির কোনটিই ব্যবহার করার জন্য নয়, তারা জেটব্রেইন রচনার প্রচেষ্টাকে সাহায্য করার জন্য স্থানধারক। ( 6a3f5b3 )
সংস্করণ 2.8.6
সেপ্টেম্বর 18, 2024
androidx.lifecycle:lifecycle-*:2.8.6
প্রকাশিত হয়েছে। সংস্করণ 2.8.6-এ এই কমিট রয়েছে।
বাগ ফিক্স
-
NullSafeMutableLiveData
Lint ত্রুটি মিথ্যা ইতিবাচক এড়িয়ে স্মার্ট কাস্টের জন্য সমর্থন উন্নত করেছে। ( 85fed6 , b/181042665 )
নির্ভরতা আপডেট
- লাইফসাইকেল রানটাইম কম্পোজ এখন কম্পোজ রানটাইম
1.7.1
এর উপর নির্ভর করে
সংস্করণ 2.8.5
4 সেপ্টেম্বর, 2024
androidx.lifecycle:lifecycle-*:2.8.5
প্রকাশিত হয়েছে। সংস্করণ 2.8.5-এ এই কমিটগুলি রয়েছে।
বাগ ফিক্স
- অস্পষ্টতার অনুমতি দিতে
androidx.lifecycle.ReportFragment
ProGuard নিয়ম আপডেট করুন। ( ff898e1 )
বাহ্যিক অবদান
-
SavedStateHandle.saveable
এক্সটেনশন প্রতিনিধি এখন বাতিলযোগ্য মান সমর্থন করে। অবদানের জন্য ধন্যবাদ রোমান Kalukiewicz. ( 0d78ea6 )
সংস্করণ 2.8.4
জুলাই 24, 2024
androidx.lifecycle:lifecycle-*:2.8.4
প্রকাশিত হয়েছে। সংস্করণ 2.8.4-এ এই কমিটগুলি রয়েছে।
বাগ ফিক্স
-
LiveData.asFlow()
এখন সঠিকভাবে এমন ক্ষেত্রে পরিচালনা করে যেখানেLiveData
ইতিমধ্যেই সেট করা একটি মান পাওয়ার পরে প্রত্যাবর্তিত ফ্লো অবিলম্বে সম্পন্ন হয় (উদাহরণস্বরূপ,take(1)
ব্যবহার করার সময়)। ( I9c566 ) -
Lifecycle*Effect
কমপ্লিশন এখন ইমপোটেন্ট (অর্থাৎ, যদি লাইফসাইকেল বন্ধ হওয়ার কারণেonStopOrDispose
কল করা হয়, তাহলে লাইফসাইকেল আবারSTARTED
এ ফিরে না যাওয়া পর্যন্ত নিষ্পত্তির পরে এটিকে দ্বিতীয়বার বলা হবে না)। ( I5f607 , b/352364595 )
সংস্করণ 2.8.3
জুলাই 1, 2024
androidx.lifecycle:lifecycle-*:2.8.3
প্রকাশিত হয়েছে। সংস্করণ 2.8.3-এ এই কমিটগুলি রয়েছে।
বাগ ফিক্স
- লাইফসাইকেল 2.8 এর কম্পোজ 1.6.0 এর সাথে পিছিয়ে থাকা সামঞ্জস্যের সাথে একটি সমস্যা সমাধান করা হয়েছে এবং কোড সঙ্কুচিত করার সময় কম ব্যবহার করা হয়েছে। ( aosp/3133056 , b/346808608 )
সংস্করণ 2.8.2
জুন 12, 2024
androidx.lifecycle:lifecycle-*:2.8.2
প্রকাশিত হয়েছে। সংস্করণ 2.8.2-এ এই কমিটগুলি রয়েছে।
বাগ ফিক্স
- Fixed
CompositionLocal LocalLifecycleOwner not present
- আপনি এখন লাইফসাইকেল 2.8.2 ব্যবহার করতে পারেন কম্পোজের যেকোনো সংস্করণের সাথে কোনো সমাধানের প্রয়োজন ছাড়াই। ( aosp/3105647 , b/336842920 ) -
compileOnly
লাইফসাইকেল নির্ভরতাগুলির পূর্ববর্তী সংস্করণগুলিকে 2.8+ সংস্করণের সাথে মিশ্রিত করার সময়ViewModelProvider
আর ক্র্যাশ হবে না, LeakCanary এর মতো লাইব্রেরিগুলির সমস্যাগুলি সমাধান করে৷ ( I80383 , b/341792251 )
সংস্করণ 2.8.1
29 মে, 2024
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 )
সংস্করণ 2.8.0
14 মে, 2024
androidx.lifecycle:lifecycle-*:2.8.0
প্রকাশিত হয়েছে। সংস্করণ 2.8.0-এ এই কমিট রয়েছে।
2.7.0 থেকে গুরুত্বপূর্ণ পরিবর্তন
-
LocalLifecycleOwner
কম্পোজ UI থেকেlifecycle-runtime-compose
স্থানান্তরিত করা হয়েছে যাতে এর কম্পোজ-ভিত্তিক হেল্পার APIগুলি রচনা UI এর বাইরে ব্যবহার করা যেতে পারে। -
lifecycle-runtime-compose
আর্টিফ্যাক্টে এখনdropUnlessResumed
এবংdropUnlessStarted
API রয়েছে যা আপনাকে ক্লিক বা অন্যান্য ইভেন্টগুলি ড্রপ করার অনুমতি দেয় যাLifecycleOwner
প্রদত্তLifecycle.State
নীচে নেমে যাওয়ার পরেও ঘটে। উদাহরণস্বরূপ, অন্য স্ক্রিনে পরিবর্তন শুরু হওয়ার পরে ক্লিক ইভেন্টগুলি পরিচালনা করা এড়াতে এটি নেভিগেশন রচনার সাথে ব্যবহার করা যেতে পারে: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()
মাধ্যমে সেগুলি পুনরুদ্ধার করতে দেয়।একটি কী ছাড়া
LifecycleStartEffect
এবংLifecycleResumeEffect
কল করা এখন একটি ত্রুটি,DisposableEffect
API-এর মতো একই নিয়ম অনুসরণ করে যা এই APIগুলি মিরর করে৷LiveDataReactiveStreams.toPublisher(lifecycleOwner, liveData)
LiveData.toPublisher(lifecycleOwner)
এর পক্ষে অবহেলিত।lifecycle-livedata-core-ktx
কোটলিন এক্সটেনশনগুলি এখনlifecycle-livedata-core
মডিউলে সরানো হয়েছে।অনেক মিথ্যা ইতিবাচক এড়াতে
NullSafeMutableLiveData
রিফ্যাক্টর করা হয়েছে।
লাইফসাইকেল কোটলিন মাল্টিপ্ল্যাটফর্ম সামঞ্জস্য
Lifecycle
, LifecycleOwner
, LifecycleObserver
, Lifecycle.State
, Lifecycle.Event
, এবং LifecycleRegistry
এর মূল লাইফসাইকেল APIগুলি এখন কোটলিন মাল্টিপ্ল্যাটফর্মের সাথে সামঞ্জস্যপূর্ণ আর্টিফ্যাক্টগুলিতে পাঠানো হয়েছে৷
শিল্পকর্ম প্রভাবিত:
-
lifecycle-common
বেশিরভাগ API-কেcommon
নিয়ে যায় এবং অ্যান্ড্রয়েড ছাড়াও jvm এবং iOS সমর্থন করে। -
lifecycle-runtime
বেশিরভাগ API-কেcommon
দিকে নিয়ে যায় এবং অ্যান্ড্রয়েড ছাড়াও jvm এবং iOS সমর্থন করে। -
lifecycle-runtime-ktx
এখন খালি, সমস্ত API গুলিকেlifecycle-runtime
সরানো হয়েছে। -
lifecycle-runtime-compose
সমস্ত API-কেcommon
-এ নিয়ে যায় এবংandroidx.compose
এর মাল্টিপ্ল্যাটফর্ম সমর্থনের সাথে মিলে একটি Android আর্টিফ্যাক্ট পাঠায়।
ভিউ মডেল কোটলিন মাল্টিপ্ল্যাটফর্ম সামঞ্জস্য
lifecycle-viewmodel
আর্টিফ্যাক্ট এবং এপিআই যেমন ViewModel
, ViewModelStore
, ViewModelStoreOwner
, এবং ViewModelProvider
এখন কোটলিন মাল্টিপ্ল্যাটফর্মের সাথে সামঞ্জস্যপূর্ণ আর্টিফ্যাক্টগুলিতে পাঠানো হয়েছে৷
এই পরিবর্তনকে সামঞ্জস্য করার জন্য, ViewModelProvider
এ যে পদ্ধতিগুলি একটি java.lang.Class<T>
নিয়েছিল সেগুলির এখন একটি সমতুল্য পদ্ধতি রয়েছে যা একটি kotlin.reflect.KClass<T>
নেয়।
অ্যান্ড্রয়েডে বাইনারি সামঞ্জস্য বজায় রাখা হয়েছে, তবে সাধারণ API পৃষ্ঠের সাথে অ্যান্ড্রয়েড এপিআই পৃষ্ঠের তুলনা করার সময় কয়েকটি উল্লেখযোগ্য পরিবর্তন রয়েছে:
- একটি
ViewModelProvider
ইন্সট্যান্স তৈরি করা এখনViewModelProvider.create()
পদ্ধতির মাধ্যমে সরাসরি এর কনস্ট্রাক্টরকে কল করার পরিবর্তে করা হয়। -
ViewModelProvider.NewInstanceFactory
এবংViewModelProvider.AndroidViewModelFactory
শুধুমাত্র Android এ উপলব্ধ৷- কাস্টম ফ্যাক্টরিগুলিকে
ViewModelProvider.Factory
থেকে প্রসারিত করার জন্য সুপারিশ করা হয় এবং একটিCreationExtras
লাগে বাviewModelFactory
কোটলিন ডিএসএল ব্যবহার করেcreate
পদ্ধতি ব্যবহার করুন৷
- কাস্টম ফ্যাক্টরিগুলিকে
- নন-JVM প্ল্যাটফর্মে কাস্টম ফ্যাক্টরি ছাড়া
ViewModelProvider
ব্যবহার করলে একটিUnsupportedOperationException
হবে। JVM প্ল্যাটফর্মগুলিতে, নো-আর্গস ভিউমডেল কনস্ট্রাক্টর ব্যবহার করে সামঞ্জস্য রক্ষা করা হয় যদি একটি কাস্টম কারখানা সরবরাহ করা না হয়। -
viewModelScope
প্ল্যাটফর্মের একটিEmptyCoroutineContext
এ পড়বে যেখানেDispatchers.Main
উপলব্ধ নেই (যেমন, Linux)।
শিল্পকর্ম প্রভাবিত:
-
lifecycle-viewmodel
বেশিরভাগ এপিআইকেcommon
নিয়ে যায় এবং অ্যান্ড্রয়েড ছাড়াও jvm এবং iOS সমর্থন করে। -
lifecycle-viewmodel-ktx
এখন খালি, সমস্ত API গুলিকেlifecycle-viewmodel
স্থানান্তরিত করা হয়েছে। -
lifecycle-viewmodel-compose
সমস্ত API-কেcommon
-এ নিয়ে যায় এবংandroidx.compose
এর মাল্টিপ্ল্যাটফর্ম সমর্থনের সাথে মিলে একটি Android আর্টিফ্যাক্ট পাঠায়।
আচরণ পরিবর্তন
-
InitializerViewModelFactory
(viewModelFactory
বিল্ডার ফাংশন সহ) এখন একটিIllegalArgumentException
নিক্ষেপ করবে যদি একই ক্ল্যাজ সহ একটিinitializer
clazz: KClass<VM : ViewModel>
ইতিমধ্যেই যোগ করা হয়ে থাকে। ( IC3a36 )
পরিচিত সমস্যা
-
lifecycle-*:2.8.0
জন্য ন্যূনতম 1.7.0-alpha05 ( b/336842920 ) এর কম্পোজ সংস্করণ প্রয়োজন।
সংস্করণ 2.8.0-rc01
1 মে, 2024
androidx.lifecycle:lifecycle-*:2.8.0-rc01
প্রকাশিত হয়েছে। সংস্করণ 2.8.0-rc01-এ এই কমিট রয়েছে।
বাগ ফিক্স
- একটি সমস্যা সমাধান করা হয়েছে যেখানে
lifecycle-common
ক্লাসের জন্য বেসলাইন প্রোফাইল সঠিকভাবে প্যাকেজ করা হয়নি। এগুলি এখনlifecycle-runtime
AAR-এ প্যাকেজ করা হয়েছে৷ ( aosp/3038274 , b/322382422 ) - একটি ভিউমডেলের সাথে সংযুক্ত
AutoCloseable
দৃষ্টান্তগুলি কীভাবে সাফ করা হয় তাতে একটি অনিচ্ছাকৃত ক্রম পরিবর্তনের স্থির করা হয়েছে -addCloseable(String, AutoCloseable)
এর আগের ক্রম , তারপরaddClosable(AutoCloseable)
, তারপরonCleared()
পুনরুদ্ধার করা হয়েছে৷ ( aosp/3041632 ) - নেটিভ এবং JVM ডেস্কটপ পরিবেশের জন্য
viewModelScope
জন্য ডিফল্ট সৃষ্টি আচরণ উন্নত করুন। ( aosp/3039221 )
বাহ্যিক অবদান
- ধন্যবাদ ভিক্টর ক্রপ JVM ডেস্কটপে প্রধান থ্রেডের জন্য চেকিং উন্নত করার জন্য। ( aosp/3037116 )
সংস্করণ 2.8.0-beta01
এপ্রিল 17, 2024
androidx.lifecycle:lifecycle-*:2.8.0-beta01
প্রকাশিত হয়েছে। সংস্করণ 2.8.0-beta01-এ এই কমিট রয়েছে।
নতুন বৈশিষ্ট্য
-
lifecycle-runtime-compose
আর্টিফ্যাক্টটি এখন কোটলিন মাল্টিপ্ল্যাটফর্মের সাথে সামঞ্জস্যপূর্ণ, এটির কোডকেcommon
-এ স্থানান্তরিত করে এবংandroidx.compose
এর মাল্টিপ্ল্যাটফর্ম সমর্থনের সাথে মিলে একটি Android আর্টিফ্যাক্ট পাঠায়। ( if7a71 , I4f4a0 , b/331769623 )
সংস্করণ 2.8.0-alpha04
3 এপ্রিল, 2024
androidx.lifecycle:lifecycle-*:2.8.0-alpha04
প্রকাশিত হয়েছে। সংস্করণ 2.8.0-alpha04-এ এই কমিট রয়েছে।
নতুন বৈশিষ্ট্য
-
lifecycle-viewmodel-compose
আর্টিফ্যাক্টটি এখন কোটলিন মাল্টিপ্ল্যাটফর্মের সাথে সামঞ্জস্যপূর্ণ, এটির কোডকেcommon
-এ স্থানান্তরিত করে এবংandroidx.compose
এর মাল্টিপ্ল্যাটফর্ম সমর্থনের সাথে মিলে একটি Android আর্টিফ্যাক্ট পাঠায়। এই পরিবর্তনকে সামঞ্জস্য করার জন্য, কম্পোজেবলviewModel
পদ্ধতিটি এখন একটিjava.lang.Class
ছাড়াও একটিKClass
গ্রহণ করে। ( b/330323282 )
বাগ ফিক্স
- অনেক মিথ্যা ইতিবাচক এড়াতে
NullSafeMutableLiveData
রিফ্যাক্টর করা হয়েছে। ( I2d8c1 , Iafb18 , I03463 , I7ecef )
নির্ভরতা আপডেট
-
lifecycle-viewmodel-compose
আর্টিফ্যাক্ট এখন কম্পোজ 1.6.0 এর উপর নির্ভর করে। - লাইফসাইকেল এখন প্রোফাইল ইনস্টলার 1.3.1 এর উপর নির্ভর করে।
সংস্করণ 2.8.0-alpha03
20 মার্চ, 2024
androidx.lifecycle:lifecycle-*:2.8.0-alpha03
প্রকাশিত হয়েছে। সংস্করণ 2.8.0-alpha03-এ এই কমিট রয়েছে।
নতুন বৈশিষ্ট্য
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) }
কোটলিন মাল্টিপ্ল্যাটফর্ম সামঞ্জস্য
lifecycle-viewmodel
আর্টিফ্যাক্ট এবং এপিআই যেমন ViewModel
, ViewModelStore
, ViewModelStoreOwner
, এবং ViewModelProvider
এখন কোটলিন মাল্টিপ্ল্যাটফর্মের সাথে সামঞ্জস্যপূর্ণ আর্টিফ্যাক্টগুলিতে পাঠানো হয়েছে৷ ( b/214568825 )
এই পরিবর্তনকে সামঞ্জস্য করার জন্য, ViewModelProvider
এ যে পদ্ধতিগুলি একটি java.lang.Class<T>
নিয়েছিল সেগুলির এখন একটি সমতুল্য পদ্ধতি রয়েছে যা একটি kotlin.reflect.KClass<T>
নেয়।
অ্যান্ড্রয়েডে বাইনারি সামঞ্জস্য বজায় রাখা হয়েছে, তবে সাধারণ API পৃষ্ঠের সাথে অ্যান্ড্রয়েড এপিআই পৃষ্ঠের তুলনা করার সময় কয়েকটি উল্লেখযোগ্য পরিবর্তন রয়েছে:
- একটি
ViewModelProvider
ইন্সট্যান্স তৈরি করা এখনViewModelProvider.create()
পদ্ধতির মাধ্যমে সরাসরি এর কনস্ট্রাক্টরকে কল করার পরিবর্তে করা হয়। -
ViewModelProvider.NewInstanceFactory
এবংViewModelProvider.AndroidViewModelFactory
শুধুমাত্র Android এ উপলব্ধ৷- কাস্টম ফ্যাক্টরিগুলিকে
ViewModelProvider.Factory
থেকে প্রসারিত করার জন্য সুপারিশ করা হয় এবং একটিCreationExtras
লাগে বাviewModelFactory
কোটলিন ডিএসএল ব্যবহার করেcreate
পদ্ধতি ব্যবহার করুন৷
- কাস্টম ফ্যাক্টরিগুলিকে
- নন-JVM প্ল্যাটফর্মে কাস্টম ফ্যাক্টরি ছাড়া
ViewModelProvider
ব্যবহার করলে একটিUnsupportedOperationException
হবে। JVM প্ল্যাটফর্মগুলিতে, নো-আর্গস ভিউমডেল কনস্ট্রাক্টর ব্যবহার করে সামঞ্জস্য রক্ষা করা হয় যদি একটি কাস্টম কারখানা সরবরাহ করা না হয়। -
viewModelScope
প্ল্যাটফর্মের একটিEmptyCoroutineContext
এ পড়বে যেখানেDispatchers.Main
উপলব্ধ নেই (যেমন, Linux)।
আচরণ পরিবর্তন
-
InitializerViewModelFactory
(viewModelFactory
বিল্ডার ফাংশন সহ) এখন একটিIllegalArgumentException
নিক্ষেপ করবে যদি একই ক্ল্যাজ সহ একটিinitializer
clazz: KClass<VM : ViewModel>
ইতিমধ্যেই যোগ করা হয়ে থাকে। ( IC3a36 )
বাগ ফিক্স
-
ViewModel.getCloseable
এখন সদৃশ কীগুলি পরিচালনা করে: যদিkey
সাথে ইতিমধ্যেই একটিAutoCloseable
সংস্থান যুক্ত থাকে, তবে পুরানো সংস্থানটি প্রতিস্থাপন করা হবে এবং অবিলম্বে বন্ধ করা হবে৷ ( Ibeb67 ) - একটি
ViewModel
এরviewModelScope
অ্যাক্সেস করা এখন থ্রেড নিরাপদ। ( if4766 , b/322407038 )
বাহ্যিক অবদান
-
LocalLifecycleOwner
কম্পোজ UI থেকে লাইফসাইকেল-রানটাইম-কম্পোজে স্থানান্তরিত হয়েছে যাতে এর রচনা-ভিত্তিক সহায়ক APIগুলি রচনা UI এর বাইরে ব্যবহার করা যেতে পারে। অবদানের জন্য ধন্যবাদ Jake Wharton. ( I6c41b , b/328263448 )
সংস্করণ 2.8.0-alpha02
21 ফেব্রুয়ারি, 2024
androidx.lifecycle:lifecycle-*:2.8.0-alpha02
প্রকাশিত হয়েছে। সংস্করণ 2.8.0-alpha02 এই কমিট ধারণ করে।
নতুন বৈশিষ্ট্য
-
dropUnlessResumed
এবংdropUnlessStarted
API যোগ করা হয়েছে যা আপনাকে ক্লিক বা অন্যান্য ইভেন্টগুলি ড্রপ করতে দেয় যাLifecycleOwner
প্রদত্তLifecycle.State
এর নীচে নেমে যাওয়ার পরেও ঘটে। উদাহরণস্বরূপ, অন্য স্ক্রিনে পরিবর্তন শুরু হওয়ার পরে ক্লিক ইভেন্টগুলি পরিচালনা এড়াতে এটি নেভিগেশন রচনার সাথে ব্যবহার করা যেতে পারে:onClick: () -> Unit = dropUnlessResumed { navController.navigate(NEW_SCREEN) }
( Icba83 , b/317230685 )
কোটলিন রূপান্তর
-
ViewModel
এখন কোটলিনে লেখা হয়েছে ( I16f26 , b/214568825 ) -
lifecycle-viewmodel-ktx
kotlin এক্সটেনশনগুলি এখন বেস লাইফসাইকেল মডিউলে সরানো হয়েছে। ( Id787b , b/274800183 ) -
lifecycle-runtime-ktx
কোটলিন এক্সটেনশনগুলি এখন বেস লাইফসাইকেল মডিউলে সরানো হয়েছে। ( Ic3686 , b/274800183 ) -
lifecycle-livedata-core-ktx
কোটলিন এক্সটেনশনগুলি এখন বেস লাইফসাইকেল মডিউলে সরানো হয়েছে। ( I54a3d , b/274800183 )
কোটলিন মাল্টিপ্ল্যাটফর্ম সামঞ্জস্য
-
Lifecycle
,LifecycleOwner
,LifecycleObserver
,Lifecycle.State
,Lifecycle.Event
, এবংLifecycleRegistry
এর মূল লাইফসাইকেল APIগুলি এখন কোটলিন মাল্টিপ্ল্যাটফর্মের সাথে সামঞ্জস্যপূর্ণ আর্টিফ্যাক্টগুলিতে পাঠানো হয়েছে৷ ( b/317249252 )
এপিআই পরিবর্তন
- একটি কী ছাড়া
LifecycleStartEffect
এবংLifecycleResumeEffect
কল করা এখন একটি ত্রুটি,DisposableEffect
API-এর মতো একই নিয়ম অনুসরণ করে যা এই APIগুলি মিরর করে৷ ( Ib0e0c , b/323518079 ) -
ViewModel
এখনCloseable
এর পরিবর্তেAutoCloseable
ব্যবহার করে। এটি একটি পশ্চাদমুখী সামঞ্জস্যপূর্ণ পরিবর্তন। ( I27f8e , b/214568825 ) -
LiveDataReactiveStreams.toPublisher(lifecycleOwner, liveData)
LiveData.toPublisher(lifecycleOwner)
এর পক্ষে অবহেলিত। ( Iabe29 , b/262623005 )
বাহ্যিক অবদান
- লাইফসাইকেলকে কোটলিন মাল্টিপ্ল্যাটফর্মে নিয়ে যাওয়ার জন্য Jetbrains থেকে Ivan Matkov কে ধন্যবাদ। ( aosp/2926690 , I0c5ac , If445d )
সংস্করণ 2.8.0-alpha01
24 জানুয়ারী, 2024
androidx.lifecycle:lifecycle-*:2.8.0-alpha01
প্রকাশিত হয়েছে। সংস্করণ 2.8.0-alpha01 এই কমিট ধারণ করে।
নতুন বৈশিষ্ট্য
-
ViewModel
এখন একটিkey
দিয়েCloseable
অবজেক্ট যোগ করা সমর্থন করে যাgetCloseable()
মাধ্যমে সেগুলি পুনরুদ্ধার করতে দেয়। ( I3cf63 )
সংস্করণ 2.7
সংস্করণ 2.7.0
জানুয়ারী 10, 2024
androidx.lifecycle:lifecycle-*:2.7.0
প্রকাশিত হয়েছে। সংস্করণ 2.7.0 এই কমিট ধারণ করে.
2.6.0 থেকে গুরুত্বপূর্ণ পরিবর্তন
-
TestLifecycleOwner
এখন একটি স্থগিত ফাংশনsetCurrentState()
অন্তর্ভুক্ত করে যা নিশ্চিত করে যে রাজ্যের পরিবর্তন এবং সমস্তLifecycleObserver
কলব্যাক ফিরে আসার আগে সম্পূর্ণ হয়েছে। উল্লেখযোগ্যভাবে,currentState
প্রপার্টি সরাসরি সেট করার বিপরীতে, এটিrunBlocking
ব্যবহার করে না, এটিrunTest
দ্বারা প্রদত্ত একটি কোরোটিনের মধ্যে ব্যবহার করা নিরাপদ করে তোলে। -
map
এবংswitchMap
LiveData
এক্সটেনশনগুলি এখনdistinctUntilChanged
এর আচরণকে মিরর করে - যদিLiveData
একটিvalue
সেট থাকে, তাহলেmap
/switchMap
ফাংশনটি অবিলম্বে ফিরে আসাLiveData
এরvalue
পূরণ করতে কল করা হবে। এটি নিশ্চিত করে যে প্রাথমিক মানটি প্রথম রচনার অংশ হিসাবে সেট করা হবে (যখনobserveAsState()
এর সাথে ব্যবহার করা হয়), তবে পর্যবেক্ষণ আচরণ পরিবর্তন করে না - আপনিLiveData
পর্যবেক্ষণ করা শুরু করলেই উৎসLiveData
থেকে আপডেট মানগুলি এখনও প্রযোজ্য হবে। - এই রিলিজটি একটি সমস্যার সমাধান করে যেখানে
SavedStateHandle
প্রক্রিয়া মৃত্যু এবং বিনোদনের পরে কাস্টমParcelable
ক্লাসগুলি সঠিকভাবে পুনরুদ্ধার করবে না। Android ফ্রেমওয়ার্ক দ্বারা হারিয়ে যাওয়া টাইপ তথ্যের কারণে, কাস্টম পার্সেবলের অ্যারেগুলির জন্য অতিরিক্ত কাজ প্রয়োজন (ম্যানুয়ালি সঠিক ধরণের একটি টাইপ করা অ্যারে তৈরি করা) এবংget
,getLiveData
, এবংgetStateFlow
এর ডকুমেন্টেশন এখন এই সীমাবদ্ধতাটিকে বিশেষভাবে আউট করে৷ -
LifecycleObserver
এর সাথে যুক্ত প্রোগার্ড রাখার নিয়মগুলি সরিয়ে দেওয়া হয়েছে। এর মানে হল যে প্রগার্ডেড কোড যেগুলি প্রতিফলনের মাধ্যমে API ব্যবহার করতে চায় (যেমন দীর্ঘদিন থেকে অবহেলিত@OnLifecycleEvent
টীকা ব্যবহার করে) তাদের নির্দিষ্ট ব্যবহারের ক্ষেত্রে তাদের নিজস্ব রাখার নিয়ম প্রদান করতে হবে।
জীবনচক্র ইভেন্ট পর্যবেক্ষণযোগ্যতা
- একটি
LifecycleEventObserver
ব্যবহার করার বিকল্প হিসেবে, আপনি এখনLifecycle.asFlow()
এক্সটেনশন পদ্ধতির মাধ্যমেLifecycle.Event
এর একটিFlow
পর্যবেক্ষণ করতে পারেন। - Jetpack রচনা ব্যবহারকারীরা এখন
LifecycleEventEffect
ব্যবহার করেLifecycle.Event
এর উপর ভিত্তি করে কম্পোজ পার্শ্বপ্রতিক্রিয়া চালাতে পারবেন।
@Composable
fun HomeScreen(viewModel: HomeViewModel = viewModel()) {
LifecycleEventEffect(Lifecycle.Event.ON_RESUME) {
viewModel.refreshData()
}
// …
}
- Jetpack Compose ব্যবহারকারীরা
LifecycleStartEffect
এবংLifecycleResumeEffect
ব্যবহার করে জোড়া ইভেন্টগুলি পরিচালনা করতে পারে - যথাক্রমে থামানো এবং বিরতিতে পুনরায় শুরু করা হয়েছে। এই এপিআইDisposableEffect
পাওয়া একটিকে মিরর করে এবং সেই ক্ষেত্রে উপযুক্ত যেখানে অবস্থার উপরে যাওয়ার সময় যে পরিবর্তন করা হচ্ছে তা নিচের দিকে যাওয়ার সময় বিপরীত করা প্রয়োজন।
fun HomeScreen(viewModel: HomeViewModel = viewModel()) {
LifecycleStartEffect(viewModel) {
val timeTracking = viewModel.startTrackingTimeOnScreen()
onStopOrDispose {
timeTracking.stopTrackingTimeOnScreen()
}
}
// …
}
আরও তথ্যের জন্য জীবনচক্র ইভেন্টগুলিতে রান কোড দেখুন।
জীবনচক্র রাষ্ট্র পর্যবেক্ষণযোগ্যতা
- বর্তমান
Lifecycle.State
এখনLifecycle.currentStateFlow
প্রপার্টির মাধ্যমে পর্যবেক্ষণ করা যেতে পারে, যা একটিStateFlow
প্রদান করে যেখানেvalue
বর্তমানLifecycle.State
। - Jetpack রচনা ব্যবহারকারীরা
Lifecycle.currentStateAsState()
এক্সটেনশনটি সরাসরিLifecycle.State
কে ComposeState
হিসাবে প্রকাশ করতে ব্যবহার করতে পারেন। এটিlifecycle.currentStateFlow.collectAsState()
এর সমতুল্য (এবং একটি ছোট বিকল্প)।
আরও তথ্যের জন্য প্রবাহ সহ জীবনচক্রের অবস্থা সংগ্রহ করুন দেখুন।
সংস্করণ 2.7.0-rc02
13 ডিসেম্বর, 2023
androidx.lifecycle:lifecycle-*:2.7.0-rc02
প্রকাশিত হয়েছে। সংস্করণ 2.7.0-rc02 এই কমিট ধারণ করে।
বাগ ফিক্স
- একটি সমস্যা সমাধান করা হয়েছে যেখানে
SavedStateHandle
প্রক্রিয়া মৃত্যু এবং বিনোদনের পরে কাস্টমParcelable
ক্লাসগুলি সঠিকভাবে পুনরুদ্ধার করবে না। Android ফ্রেমওয়ার্ক দ্বারা হারিয়ে যাওয়া টাইপ তথ্যের কারণে, কাস্টম পার্সেবলের অ্যারেগুলির জন্য অতিরিক্ত কাজ প্রয়োজন (ম্যানুয়ালি সঠিক ধরণের একটি টাইপ করা অ্যারে তৈরি করা) এবংget
,getLiveData
, এবংgetStateFlow
এর ডকুমেন্টেশন এখন এই সীমাবদ্ধতাটিকে বিশেষভাবে আউট করে৷ ( I0b55a )
সংস্করণ 2.7.0-rc01
15 নভেম্বর, 2023
androidx.lifecycle:lifecycle-*:2.7.0-rc01
প্রকাশিত হয়েছে। সংস্করণ 2.7.0-rc01-এ এই কমিট রয়েছে।
বাগ ফিক্স
-
LifecycleStartEffect
এবংLifecycleResumeEffect
এখন সঠিকভাবে নিষ্পত্তি করুন এবং যদিLifecycleOwner
পরিবর্তন করা হয় তাহলে প্রভাব ব্লকটি পুনরায় তৈরি করুন। ( IA25c6 )
সংস্করণ 2.7.0-beta01
নভেম্বর 1, 2023
androidx.lifecycle:lifecycle-*:2.7.0-beta01
কোনো পরিবর্তন ছাড়াই প্রকাশ করা হয়েছে। সংস্করণ 2.7.0-beta01-এ এই কমিট রয়েছে।
- একটি বিটা সংস্করণ বাম্প, এই রিলিজ সংস্করণে কোন বড় পরিবর্তন নেই।
সংস্করণ 2.7.0-alpha03
18 অক্টোবর, 2023
androidx.lifecycle:lifecycle-*:2.7.0-alpha03
প্রকাশিত হয়েছে। সংস্করণ 2.7.0-alpha03 এই কমিট ধারণ করে।
নতুন বৈশিষ্ট্য
-
lifecycle-runtime-testing
এখন একটি নতুন লিন্ট চেক রয়েছে যাতেLifecycle.State
সেট করা না হয়।TestLifecycleOwner
মালিকের অবস্থা একটি করুটিনের ভিতরে থাকা অবস্থায়currentState
ফিল্ড ব্যবহার করে। লিন্ট চেক এখন সাসপেন্ডিংsetCurrentState
পরামর্শ দেয় যা অবরুদ্ধ না করেইLifecycle.State
সেট করার অনুমতি দেয়। ( Icf728 , b/297880630 )
বাগ ফিক্স
-
LiveData.switchMap
এর সাথে একটি সমস্যা সমাধান করা হয়েছে যেখানে প্রাথমিক কল এবং পরবর্তী কল উভয় ক্ষেত্রেই একইLiveData
দৃষ্টান্ত ফেরত দিলেLiveData
দৃষ্টান্তকে উৎস হিসেবে যোগ করা থেকে বাধা দেবে। ( Ibedcba7 )
সংস্করণ 2.7.0-alpha02
6 সেপ্টেম্বর, 2023
androidx.lifecycle:lifecycle-*:2.7.0-alpha02
প্রকাশিত হয়েছে। সংস্করণ 2.7.0-alpha02 এই কমিট ধারণ করে।
নতুন বৈশিষ্ট্য
-
TestLifecycleOwner
এখন সাসপেন্ডিং ফাংশনsetCurrentState()
অন্তর্ভুক্ত রয়েছে যাতে ব্যবহারকারীদেরrunTest
দ্বারা প্রদত্ত একটি কর্উটিনের মধ্যে থেকেTestLifecycleOwner
ব্যবহার করার বিকল্প দেয়৷ ( I329de , b/259344129 )
এপিআই পরিবর্তন
-
lifecycle-livedata-ktx
মডিউল থেকে সমস্ত ফাইল প্রধানlifecycle-livedata
মডিউলে সরানো হয়েছে। ( I10c6f , b/274800183 )
আচরণ পরিবর্তন
-
LiveData.map()
এবংLiveData.switchMap()
এক্সটেনশনগুলি এখন প্রত্যাবর্তিতLiveData
value
সেট করে যদি পূর্ববর্তীLiveData
একটি মান সেট করা থাকে, এটি নিশ্চিত করে যে জেটপ্যাক কম্পোজে ফলস্বরূপ লাইভডেটা ব্যবহার করে প্রাথমিক রচনায় সঠিক অবস্থা রয়েছে। ( I91d2b , b/269479952 ) -
ViewModel
এরaddCloseable()
এখন অবিলম্বেCloseable
বন্ধ করে দেয় যদিViewModel
ইতিমধ্যেইonCleared()
এ একটি কল পেয়ে থাকে। ( I4712e , b/280294730 )
বাগ ফিক্স
- লাইফসাইকেল
2.6.2
থেকে: একটি সমস্যা সমাধান করা হয়েছে যেখানে স্টেট পুনরুদ্ধার করা হলে প্রক্রিয়া মৃত্যুর পরেSavedStateHandle
সঠিকভাবে পুনরুদ্ধার করা হবে না,save()
প্রকৃতপক্ষে প্যারেন্টSavedStateRegistry
এ স্টেট সেভ না করেই কল করা হয়েছিল, এবং তারপর স্টেট আবার পুনরুদ্ধার করা হয়েছিল। এটিrememberSaveable
এবং নেভিগেশন রচনারNavHost
এর মধ্যে মিথস্ক্রিয়া ঠিক করে। ( aosp/2729289 )
সংস্করণ 2.7.0-alpha01
জুলাই 26, 2023
androidx.lifecycle:lifecycle-*:2.7.0-alpha01
প্রকাশিত হয়েছে। সংস্করণ 2.7.0-alpha01-এ এই কমিট রয়েছে।
এপিআই পরিবর্তন
-
Lifecycle.State
এখনLifecycle.currentStateFlow
এর মাধ্যমে রচনা-পর্যবেক্ষণযোগ্য, যা একটিStateFlow
প্রদান করে যেখানেvalue
বর্তমানLifecycle.State
। ( Ib212d , b/209684871 ) -
Lifecycle.Event
s এখনLifecycle.asFlow().
এর সাথে একটিFlow
হিসাবে পর্যবেক্ষণ করা যেতে পারে। ( if2c0f , b/176311030 ) -
Lifecycle.Event.ON_RESUME
এবংLifecycle.Event.ON_PAUSE
ইভেন্ট কলব্যাক উভয়ের উপর ভিত্তি করে ComposeSideEffect
চালানোর জন্যLifecycleResumeEffect
API যোগ করা হয়েছে। ( I60386 , b/235529345 ) -
LifecycleStartEffect
API যোগ করা হয়েছেLifecycle.Event.ON_START
এবংLifecycle.Event.ON_STOP
ইভেন্ট কলব্যাকের উপর ভিত্তি করে কম্পোজSideEffect
চালানোর জন্য। ( I5a8d1 , b/235529345 ) -
Lifecycle.Event
এর উপর ভিত্তি করে ComposeSideEffect
চালানোর জন্যLifecycleEventEffect
API যোগ করা হয়েছে। ( Ic9794 , b/235529345 ) -
Lifecycle.collectAsState()
এক্সটেনশন যোগ করা হয়েছে সরাসরিLifecycle.State
কে ComposeState
হিসেবে প্রকাশ করতে। এটিlifecycle.currentStateFlow.collectAsState()
এর সমতুল্য (এবং একটি ছোট বিকল্প)। ( I11015 , b/235529345 )
বাগ ফিক্স
-
LiveData.distinctUntilChanged()
এক্সটেনশনটি এখন প্রত্যাবর্তিতLiveData
এরvalue
সেট করে যদি পূর্ববর্তীLiveData
এর উপর একটি মান সেট করা থাকে। এটি পর্যবেক্ষণ আচরণ পরিবর্তন করে না - উৎসLiveData
থেকে আপডেট করা মানগুলি এখনও প্রযোজ্য হবে যখন আপনিdistinctUntilChanged()
থেকে ফিরে আসাLiveData
পর্যবেক্ষণ করা শুরু করবেন। ( Ib482f ) -
LifecycleObserver
এর সাথে যুক্ত প্রোগার্ড রাখার নিয়মগুলি সরিয়ে দেওয়া হয়েছে। এর মানে হল যে প্রগার্ডেড কোড যা প্রতিফলনের মাধ্যমে API ব্যবহার করতে চায় তাদের নির্দিষ্ট ব্যবহারের ক্ষেত্রে তাদের নিজস্ব রাখা নিয়ম প্রদান করতে হবে। ( IA12fd )
সংস্করণ 2.6
সংস্করণ 2.6.2
6 সেপ্টেম্বর, 2023
androidx.lifecycle:lifecycle-*:2.6.2
প্রকাশিত হয়েছে। সংস্করণ 2.6.2-এ এই কমিট রয়েছে।
বাগ ফিক্স
- একটি সমস্যা সমাধান করা হয়েছে যেখানে
SavedStateHandle
সঠিকভাবে প্রক্রিয়া মৃত্যুর পরে পুনরুদ্ধার করা হবে না যদি স্টেট পুনরুদ্ধার করা হয়,save()
প্রকৃতপক্ষে প্যারেন্টSavedStateRegistry
এ স্টেট সেভ না করেই কল করা হয়েছিল, এবং তারপর স্টেট আবার পুনরুদ্ধার করা হয়েছিল। এটিrememberSaveable
এবং নেভিগেশন রচনারNavHost
এর মধ্যে মিথস্ক্রিয়া ঠিক করে। ( aosp/2729289 )
সংস্করণ 2.6.1
22 মার্চ, 2023
androidx.lifecycle:lifecycle-*:2.6.1
প্রকাশিত হয়েছে। সংস্করণ 2.6.1-এ এই কমিট রয়েছে।
নির্ভরতা আপডেট
-
lifecycle-viewmodel-savedstate
এখন SavedState1.2.1
উপর নির্ভর করে। ( cd7251 ) - জীবনচক্র এখন প্রোফাইলইনস্টলার
1.3.0
এর উপর নির্ভর করে। ( f9d30b )
সংস্করণ 2.6.0
8 মার্চ, 2023
androidx.lifecycle:lifecycle-*:2.6.0
প্রকাশিত হয়েছে। সংস্করণ 2.6.0 এই কমিট ধারণ করে.
2.5.0 থেকে গুরুত্বপূর্ণ পরিবর্তন
-
LiveData
এখন একটি নতুনisInitialized
প্রপার্টি রয়েছে যা নির্দেশ করে যেLiveData
এ কখনও একটি সুস্পষ্ট মান সেট করা হয়েছে কিনা, আপনাকেliveData.value
রিটার্নিংnull
এর মধ্যে পার্থক্য করতে দেয় কারণ কোনো মান কখনও সেট করা হয়নি বা একটি সুস্পষ্টnull
মান। -
MediatorLiveData
এখন একটি প্রাথমিক মান সেট করার জন্য একটি কন্সট্রাক্টর অন্তর্ভুক্ত করে। -
StateFlow
এবংcollectAsStateWithLifecycle()
এরFlow
একটি নতুন এক্সটেনশন যোগ করা হয়েছে যা ফ্লো থেকে সংগ্রহ করে এবং লাইফসাইকেল-সচেতন পদ্ধতিতে কম্পোজ স্টেট হিসাবে এর সর্বশেষ মান উপস্থাপন করে। -
Lifecycle.launchWhenX
পদ্ধতি এবংLifecycle.whenX
পদ্ধতিগুলিকে অবমূল্যায়ন করা হয়েছে কারণ একটি পজিং ডিসপ্যাচার ব্যবহার কিছু ক্ষেত্রে সম্পদ নষ্ট করতে পারে৷Lifecycle.repeatOnLifecycle
ব্যবহার করার পরামর্শ দেওয়া হয়। এককালীন স্থগিত করা কাজ সম্পর্কে আরও তথ্যের জন্য, অনুগ্রহ করে এই ব্যাখ্যাটি দেখুন কেন এটি সহজাতভাবে অনিরাপদ। - কোটলিন রূপান্তর - প্রচুর সংখ্যক লাইফসাইকেল ক্লাস কোটলিনে রূপান্তরিত হয়েছে। সমস্ত রূপান্তরিত ক্লাস এখনও পূর্ববর্তী সংস্করণগুলির সাথে তাদের বাইনারি সামঞ্জস্য বজায় রাখে। কোটলিনে লেখা ক্লাসগুলির জন্য নিম্নোক্ত ক্লাসগুলির উৎস বেমানান পরিবর্তন রয়েছে:
ViewTreeLifecycleOwner
,LiveDataReactiveStreams
,HasDefaultViewModelProviderFactory
,ViewTreeViewModelStoreOwner
,Transformations
,ViewModelStoreOwner
,LifecycleOwner
নিচের সারণীটি জীবনচক্রের নতুন সংস্করণের জন্য উৎস রূপান্তর প্রদান করে।
জীবনচক্র 2.5 | জীবনচক্র 2.5 (KTX) | জীবনচক্র 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 |
- কোটলিনে তৈরি একটি
Observer
onChanged
পদ্ধতির শূন্যতা এখন জেনেরিক টাইপের শূন্যতার সাথে মেলে। আপনি যদিObserver.onChanged()
একটি বাতিলযোগ্য টাইপ গ্রহণ করতে চান তবে আপনাকে অবশ্যই একটি বাতিলযোগ্য টাইপ দিয়েObserver
ইনস্ট্যান্টিয়েট করতে হবে। - এই ক্লাসগুলিও Kotlin-এ রূপান্তরিত হয়েছিল, কিন্তু উৎসের সাথে সামঞ্জস্যপূর্ণ থাকে:
DefaultLifecycleObserver
,LifecycleEventObserver
,Lifecycle
,LifecycleRegistry
,LifecycleObserver
,ViewModelStore
,AndroidViewModel
,AbstractSavedStateViewModelFactory
,LifecycleService
Service ,ServiceLifecycleDispatcher
,ProcessLifecycleOwner
সংস্করণ 2.6.0-rc01
22 ফেব্রুয়ারি, 2023
androidx.lifecycle:lifecycle-*:2.6.0-rc01
প্রকাশিত হয়েছে। সংস্করণ 2.6.0-rc01-এ এই কমিট রয়েছে।
বাগ ফিক্স
-
LiveData.distinctUntilChanged()
এক্সটেনশনটি এখন প্রত্যাবর্তিতLiveData
এরvalue
সেট করে যদি পূর্ববর্তীLiveData
এর উপর একটি মান সেট করা থাকে। এটি পর্যবেক্ষণ আচরণ পরিবর্তন করে না - উৎসLiveData
থেকে আপডেট করা মানগুলি এখনও প্রযোজ্য হবে যখন আপনিdistinctUntilChanged()
থেকে ফিরে আসাLiveData
পর্যবেক্ষণ করা শুরু করবেন। ( Ib482f )
সংস্করণ 2.6.0-beta01
ফেব্রুয়ারী 8, 2023
androidx.lifecycle:lifecycle-*:2.6.0-beta01
প্রকাশিত হয়েছে। সংস্করণ 2.6.0-beta01-এ এই কমিট রয়েছে।
কোটলিন রূপান্তর
-
LifecycleOwner
এখন কোটলিনে লেখা আছে। এটি কোটলিনে লিখিত ক্লাসগুলির জন্য একটি উত্স বেমানান পরিবর্তন - তাদের অবশ্যই পূর্ববর্তীgetLifecycle()
ফাংশনটি বাস্তবায়নের পরিবর্তেlifecycle
সম্পত্তিটিকে ওভাররাইড করতে হবে। ( I75b4b , খ/240298691 ) -
ViewModelStoreOwner
এখন কোটলিনে রয়েছেন। এটি কোটলিনে রচিত ক্লাসগুলির জন্য একটি উত্স বেমানান পরিবর্তন - তাদের অবশ্যই পূর্ববর্তীgetViewModelStore()
ফাংশনটি বাস্তবায়নের পরিবর্তেviewModelStore
সম্পত্তিটিকে ওভাররাইড করতে হবে। ( I86409 , বি/240298691 ) -
lifecycleScope
ক্ষেত্র সরবরাহ করে এমনLifecycleOwner
উপর কোটলিন এক্সটেনশনটিlifecycle-runtime-ktx
থেকেlifecycle-common
নিদর্শনটিতে স্থানান্তরিত হয়েছে। ( আই 41 ডি 78 , বি/240298691 ) -
Lifecycle
কোটলিন এক্সটেনশন যাcoroutineScope
ক্ষেত্র সরবরাহ করে তাlifecycle-runtime-ktx
থেকেlifecycle-common
আর্টিক্টে স্থানান্তরিত করা হয়েছে। ( আইএবিবি 91 , বি/240298691 )
সংস্করণ 2.6.0-Alpha05
25 জানুয়ারী, 2023
androidx.lifecycle:lifecycle-*:2.6.0-alpha05
প্রকাশিত হয়েছে। সংস্করণ 2.6.0-ALPHA05 এর মধ্যে এই কমিট রয়েছে।
কোটলিন রূপান্তর
-
Transformations
এখন কোটলিনে লেখা আছে। এটি কোটলিনে রচিত সেই ক্লাসগুলিরlifecycle-livedata-ktx
একটি উত্স বেমানান পরিবর্তন যা সরাসরিTransformations.map
মতো সিনট্যাক্স ব্যবহার করে । জাভা প্রোগ্রামিং ভাষা ব্যবহার করার সময়, এই পদ্ধতিগুলির সংস্করণগুলি যাandroidx.arch.core.util.Function
পদ্ধতি গ্রহণ করে এবং কোটলিনFunction1
গ্রহণ করে এমন সংস্করণগুলির সাথে প্রতিস্থাপন করা হয়। এই পরিবর্তনটি বাইনারি সামঞ্জস্যতা বজায় রাখে। ( I8e14f ) -
ViewTreeViewModelStoreOwner
এখন কোটলিনে রচিত। এটি কোটলিনে লিখিত সেই ক্লাসগুলিরView
একটি উত্স বেমানান পরিবর্তন - আপনাকে এখন সরাসরি কোটলিন এক্সটেনশন পদ্ধতিগুলিandroidx.lifecycle.setViewTreeViewModelStoreOwner
মালিক এবংandroidx.lifecycle.findViewTreeViewModelStoreOwner
মালিকদের পূর্বে সেট করার জন্য সেট করতে ও সন্ধান করতে হবে। এটি বাইনারি সামঞ্জস্যপূর্ণ এবং জাভা প্রোগ্রামিং ভাষায় লিখিত বাস্তবায়নের জন্য উপযুক্ত উত্স হিসাবে রয়ে গেছে। ( আইএ 06 ডি 8 , আইবি 22 ডি 8 , বি/240298691 ) -
HasDefaultViewModelProviderFactory
ইন্টারফেসটি এখন কোটলিনে লেখা হয়েছে। এটি কোটলিনে রচিত ক্লাসগুলির জন্য একটি উত্স বেমানান পরিবর্তন - তাদের অবশ্যই পূর্ববর্তী সংশ্লিষ্ট ফাংশনগুলি বাস্তবায়নের পরিবর্তেdefaultViewModelProviderFactory
এবংdefaultViewModelCreationExtras
বৈশিষ্ট্যগুলি ওভাররাইড করতে হবে। ( আইএইডি 9 সি , বি/240298691 ) -
Observer
এখন কোটলিনে রচিত। এরonChanged()
পদ্ধতিটি এখন এর প্যারামিটারের জন্য নামvalue
ব্যবহার করে। ( Iffef2 , i4995e , খ/240298691 ) -
AndroidViewModel
,AbstractSavedStateViewModelFactory
,LifecycleService
,ServiceLifecycleDispatcher
এবংProcessLifecycleOwner
এখন কোটলিনে লেখা হয়েছে ( আই 2 ই 771 , আইবিএ 40 , আই 160 ডি 7, আই 08884, আই 1 সিডিএ 7, আই 1 সিডিএ 7 , আই 1 সিডিএ 7, আই 1 সিডিএ 7, আই 1 সিডিএ 7
সংস্করণ 2.6.0-Alpha04
11 জানুয়ারী, 2023
androidx.lifecycle:lifecycle-*:2.6.0-alpha04
প্রকাশিত হয়েছে। সংস্করণ 2.6.0-ALPHA04 এ এই কমিটস রয়েছে।
নতুন বৈশিষ্ট্য
-
LiveData
এখন একটি নতুনisInitialized
সম্পত্তি অন্তর্ভুক্ত করে যা ইঙ্গিত করে যেLiveData
কোনও সুস্পষ্ট মান সেট করা হয়েছে কিনা, আপনাকেliveData.value
মধ্যে পার্থক্য করতে দেয় val ভ্যালু রিটার্নিংnull
কারণ কারণ কোনও মান কখনও সেট করা হয়নি বা একটি সুস্পষ্টnull
মান। ( আইবিডি 018 )
এপিআই পরিবর্তন
-
lifecycle-runtime-compose
collectAsStateWithLifecycle()
সংগ্রহের স্ট্যাটাসে আর নেই। ( I09d42 , খ/258835424 ) -
Lifecycle.launchWhenX
পদ্ধতি এবংLifecycle.whenX
এটিLifecycle.repeatOnLifecycle
ব্যবহার করার পরামর্শ দেওয়া হয়। ( আইএএফসি 54 , বি/248302832 )
কোটলিন রূপান্তর
-
ViewTreeLifecycleOwner
এখন কোটলিনে রচিত। এটি কোটলিনে লিখিত সেই শ্রেণীরView
একটি উত্স বেমানান পরিবর্তন - আপনাকে এখন অবশ্যই সরাসরি কোটলিন এক্সটেনশন পদ্ধতিগুলিandroidx.lifecycle.setViewTreeLifecycleOwner
এবংandroidx.lifecycle.findViewTreeLifecycleOwner
সেট করার জন্য একটি পূর্বে সেট করার জন্য সেট করতে হবে এবং ব্যবহার করতে হবে। এটি পূর্ববর্তী কোটলিন এক্সটেনশনকেlifecycle-runtime-ktx
প্রতিস্থাপন করে। এটি বাইনারি সামঞ্জস্যপূর্ণ এবং জাভা প্রোগ্রামিং ভাষায় লিখিত বাস্তবায়নের জন্য উপযুক্ত উত্স হিসাবে রয়ে গেছে। ( I8a77a , i5234e , খ/240298691 ) -
LiveDataReactiveStreams
এখন কোটলিনে লেখা আছে। পূর্বেlifecycle-reactivestreams-ktx
এ কোটলিন এক্সটেনশনগুলিlifecycle-reactivestreams
মডিউলটিতে স্থানান্তরিত করা হয়েছে এবং কোটলিনে লেখা কোডের প্রাথমিক পৃষ্ঠে পরিণত হয়েছে। আপনি যদি ইতিমধ্যে কোটলিন এক্সটেনশন পদ্ধতি এপিআই ব্যবহার না করে থাকেন তবে কোটলিনে লিখিত কোডের জন্য এটি একটি উত্স বেমানান পরিবর্তন । ( আই 2 বি 1 বি 9, আই 95 ডি 22 , বি/240298691 ) -
DefaultLifecycleObserver
,LifecycleEventObserver
,Lifecycle
,LifecycleRegistry
,LifecycleObserver
এবংViewModelStore
এখন কোটলিনে লেখা হয়েছে ( আইএডিএফএফডি , ( আই 60034 , আই 60034 , আই 8 সি 52 সি, আই 9593 ডি, আই 09593 ডি, আই 01FE11, আই 01FE1, আই 01FE11, i01fe1, i01fe1, i01fe1, i01fe1 , i01fe1, i01fe1 , i01fe1, i01fe1, i01fe1 , i খ/240298691 )
বাগ ফিক্স
- ভুল শ্রেণীর ধরণের সাথে
get()
কল করার সময়SavedStateHandle
ClassCastException
দিয়ে ক্র্যাশ করে না। ( I6ae7c )
সংস্করণ 2.6.0-Alpha03
24 অক্টোবর, 2022
androidx.lifecycle:lifecycle-*:2.6.0-alpha03
প্রকাশিত হয়েছে। সংস্করণ 2.6.0-ALPHA03 এ এই কমিটগুলি রয়েছে।
বাগ ফিক্স
- বিভিন্ন লাইফসাইকেল মডিউলগুলির মধ্যে সীমাবদ্ধতার সাথে একটি সমস্যা স্থির করেছে যা উদ্দেশ্য হিসাবে কাজ করছে না। ( I18d0d , খ/249686765 )
-
LifecycleRegistry.moveToState()
এখন আরও সহায়ক ত্রুটি মেসেজিং অন্তর্ভুক্ত করে যা ত্রুটির কারণ হিসাবে উপাদানগুলির বিকাশকারীদের অবহিত করে। ( আইডিএফ 4 বি 2 , বি/244910446 )
সংস্করণ 2.6.0-Alpha02
7 সেপ্টেম্বর, 2022
androidx.lifecycle:lifecycle-*:2.6.0-alpha02
প্রকাশিত হয়েছে। সংস্করণ 2.6.0-ALPHA02 এর মধ্যে এই কমিট রয়েছে।
এপিআই পরিবর্তন
-
MediatorLiveData
এখন প্রাথমিক মান নির্ধারণের জন্য একজন নির্মাতা অন্তর্ভুক্ত। ( আইবি 6 সিসি 5 , বি/151244085 )
বাগ ফিক্স
-
Lifecycle
শিল্পকর্মগুলিতে এখন এমন সীমাবদ্ধতা অন্তর্ভুক্ত রয়েছে যা নিশ্চিত করে যে সমস্ত আন্তঃনির্ভর জীবনচক্রের নিদর্শনগুলি একই সংস্করণটি ব্যবহার করে, যখন একটি আপগ্রেড করা হয় তখন স্বয়ংক্রিয়ভাবে অন্যান্য নির্ভরতাগুলি আপগ্রেড করে। বি/242871265 -
FlowLiveData.asFlow()
এখন থ্রেড-সুরক্ষা এবং প্রসঙ্গ সংরক্ষণ নিশ্চিত করতে নিজস্বChannel
বাস্তবায়ন ব্যবহার না করে একটিcallbackFlow
তৈরি করে। ( আই 4 এ 8 বি 2 , বি/200596935 ) - নতুন
LiveData
অবজেক্ট তৈরি করার সময়FlowLiveData
asLiveData
ফাংশনটি এখন একটিStateFlow
প্রাথমিক মান সংরক্ষণ করবে। ( I3f530 , খ/157380488 ) - লাইফসাইকেল
2.5.1
থেকে:AndroidViewModelFactory
কাস্টম বাস্তবায়নগুলি এখনLifecycle
২.৪+ ( আই 5 বি 315 , বি/238011621 ) সহ রাষ্ট্রীয় কনস্ট্রাক্টর ব্যবহার করার সময়create(modelClass)
ফাংশনটিকে সঠিকভাবে কল করে
সংস্করণ 2.6.0-Alpha01
জুন 29, 2022
androidx.lifecycle:lifecycle-*:2.6.0-alpha01
প্রকাশিত হয়েছে। সংস্করণ 2.6.0-ALPHA01 এর মধ্যে এই কমিট রয়েছে।
নতুন বৈশিষ্ট্য
-
StateFlow
এবংcollectAsStateWithLifecycle
Flow
উপর একটি নতুন এক্সটেনশন যুক্ত করা হয়েছে যা প্রবাহ থেকে সংগ্রহ করে এবং লাইফসাইকেল-সচেতন পদ্ধতিতে তার সর্বশেষ মানকে রচনা রাষ্ট্র হিসাবে উপস্থাপন করে। প্রবাহটি সংগ্রহ করা হয় এবং যখন জীবনচক্রটি কমপক্ষে একটি নির্দিষ্টLifecycle.State
মধ্যে থাকে তখন নতুন নির্গমন রাষ্ট্রের মান হিসাবে সেট করা হয়। যখন লাইফসাইকেলটি সেইLifecycle.State
নীচে নেমে যায় rete ( I1856e , খ/230557927 )
সংস্করণ 2.5
সংস্করণ 2.5.1
জুলাই 27, 2022
androidx.lifecycle:lifecycle-*:2.5.1
প্রকাশিত হয়েছে। সংস্করণ 2.5.1 এ এই কমিটস রয়েছে।
বাগ ফিক্স
-
AndroidViewModelFactory
কাস্টম বাস্তবায়নগুলি এখনLifecycle
২.৪+ সহ রাষ্ট্রীয়AndroidViewModelFactory
কনস্ট্রাক্টর ব্যবহার করার সময়create(modelClass)
ফাংশনটি সঠিকভাবে কল করুন। ( I5b315 , খ/238011621 )
সংস্করণ 2.5.0
জুন 29, 2022
androidx.lifecycle:lifecycle-*:2.5.0
প্রকাশিত হয়েছে। সংস্করণ 2.5.0 এ এই কমিটস রয়েছে।
2.4.0 সাল থেকে গুরুত্বপূর্ণ পরিবর্তন
SavedStateHandle
এখন একটিgetStateFlow()
এপিআই সরবরাহ করে যাLiveData
ব্যবহারের বিকল্প হিসাবে মান পরিবর্তনগুলি পর্যবেক্ষণের জন্য একটি কোটলিনStateFlow
দেয়।ভিউমোডেল ক্রিয়েটিনেক্সট্রা - যখন কাস্টম
ViewModelProvider.Factory
লেখার সময়, যথাক্রমে কোনওApplication
বাSavedStateHandle
অ্যাক্সেস পেতেAndroidViewModelFactory
বাAbstractSavedStateViewModelFactory
প্রসারিত করার প্রয়োজন হয় না। পরিবর্তে, এই ক্ষেত্রগুলি প্রতিটিViewModelProvider.Factory
সাবক্লাসকে ক্রিয়েটিনেক্সট্রাস হিসাবেCreationExtras
হিসাবে সরবরাহ করা হয়:create
:create(Class<T>, CreationExtras)
। এই অতিরিক্তগুলি যথাক্রমে1.5.0
এবং খণ্ড1.5.0
ব্যবহার করার সময় আপনার ক্রিয়াকলাপ বা খণ্ড দ্বারা স্বয়ংক্রিয়ভাবে সরবরাহ করা হয়।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
ViewModel
CreationExtras
viewModelFactory
কোটলিন ডিএসএল সরবরাহ করে যা আপনাকে আপনারViewModelProvider.Factory
সংজ্ঞায়িত করতে দেয় oneval 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
এখন একটিviewModel()
এপিআই সরবরাহ করে যা কাস্টমViewModelProvider.Factory
তৈরি করার প্রয়োজন ছাড়াই একটিViewModel
উদাহরণ তৈরি করার জন্য একটি ল্যাম্বডা কারখানা গ্রহণ করে।// 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) }
সেভডস্টেটহ্যান্ডল কমপোজ সেভার ইন্টিগ্রেশন -লাইফসাইকেল
rememberSaveable
lifecycle-viewmodel-compose
আর্টিফ্যাক্টটিতেSavedStateHandle
SavedStateHandle.saveable
নতুন পরীক্ষামূলক এপিআই রয়েছে sclass ListScreenViewModel(handle: SavedStateHandle): ViewModel() { // This value survives both configuration changes and process death and recreation val editMode by handle.saveable { mutableStateOf(false) } }
একটি
addCloseable()
এপিআই এবং একটি নতুন কনস্ট্রাক্টর ওভারলোড যুক্ত করা হয়েছে যা আপনাকেViewModel
এক বা একাধিকCloseable
অবজেক্ট যুক্ত করতে দেয় যাViewModel
onCleared()
এর কোনও ম্যানুয়াল কাজের প্রয়োজন ছাড়াই সাফ হয়ে গেলে বন্ধ হয়ে যাবে।উদাহরণস্বরূপ, আপনি একটি ভিউমোডেলে ইনজেকশন করতে পারেন এমন একটি করুটাইন স্কোপ তৈরি করতে, তবে পরীক্ষার মাধ্যমে নিয়ন্ত্রণ করুন, আপনি একটি
CoroutineScope
তৈরি করতে পারেন যাCloseable
কার্যকর করে:class CloseableCoroutineScope( context: CoroutineContext = SupervisorJob() + Dispatchers.Main.immediate ) : Closeable, CoroutineScope { override val coroutineContext: CoroutineContext = context override fun close() { coroutineContext.cancel() } }
যা
viewModelScope
মতো একই জীবনকাল বজায় রেখে আপনারViewModel
কনস্ট্রাক্টারে ব্যবহার করা যেতে পারে:class TestScopeViewModel( val customScope: CloseableCoroutineScope = CloseableCoroutineScope() ) : ViewModel(customScope) { // You can now use customScope in the same way as viewModelScope }
আচরণ পরিবর্তন
-
Lifecycle.State
INITIALIZED
থেকেDESTROYED
সরানোর চেষ্টা করা এখনLifecycle
কোনও সংযুক্ত পর্যবেক্ষক আছে কিনা তা নির্বিশেষে সর্বদা একটিIllegalStateException
নিক্ষেপ করবে। -
LifecycleRegistry
এখনDESTROYED
অবস্থায় পৌঁছে তাদের পর্যবেক্ষকদের সাফ করবে।
সংস্করণ 2.5.0-আরসি 02
15 জুন, 2022
androidx.lifecycle:lifecycle-*:2.5.0-rc02
প্রকাশিত হয়েছে। সংস্করণ 2.5.0-আরসি 02 এ এই কমিটগুলি রয়েছে।
বাগ ফিক্স
- 2.5+ সংস্করণগুলির সাথে সংকলন লাইফসাইকেল নির্ভরতার পূর্ববর্তী সংস্করণগুলি মিশ্রিত করার সময়
ViewModelProvider
আর ক্র্যাশ হবে না। ( I81a66 , বি/230454566 )
সংস্করণ 2.5.0-আরসি 01
11 মে, 2022
androidx.lifecycle:lifecycle-*:2.5.0-rc01
প্রকাশিত হয়েছে। সংস্করণ 2.5.0-আরসি 01 এ এই কমিটগুলি রয়েছে।
বাগ ফিক্স
সংস্করণ 2.5.0-BETA01
20 এপ্রিল, 2022
androidx.lifecycle:lifecycle-*:2.5.0-beta01
প্রকাশিত হয়েছে। সংস্করণ 2.5.0-BETA01 এর মধ্যে এই কমিট রয়েছে।
এপিআই পরিবর্তন
-
SavedStateHandle.saveable
সম্পত্তি প্রতিনিধিদের সংরক্ষণের জন্য কী হিসাবে সম্পত্তির নামগুলি ব্যবহার করার জন্যSavedStateHandle
অবিচ্ছিন্নভাবে ব্যবহার করার জন্য ( I8BB86 , B/225014345 )
বাগ ফিক্স
- এমন একটি সমস্যা স্থির করা হয়েছে যেখানে একটি নন-প্রাথমিক নীচের নেভিগেশন ট্যাবে অন্য
NavHost
মধ্যে একটিNavHost
বাসা বেঁধে একাধিক ব্যাক স্ট্যাক ব্যবহার করার সময় একটিIllegalStateException
হতে পারে। ( আই 11 বিডি 5 , বি/228865698 )
সংস্করণ 2.5.0-আলফা 06
6 এপ্রিল, 2022
androidx.lifecycle:lifecycle-*:2.5.0-alpha06
প্রকাশিত হয়েছে। সংস্করণ 2.5.0-ALPHA06 এর মধ্যে এই কমিটগুলি রয়েছে।
নতুন বৈশিষ্ট্য
এপিআই পরিবর্তন
-
CreationExtras
এখন সিল করার পরিবর্তে বিমূর্ত। ( আইবি 8 এ 7 এ )
বাগ ফিক্স
- একটি
IllegalStateException: Already attached to lifecycleOwner
SavedStateHandleController
দ্বারা সৃষ্ট লাইফসাইকেল মালিকের ত্রুটির সাথে সংযুক্ত। ( I7ea47 , বি/215406268 )
সংস্করণ 2.5.0-আলফা 05
23 মার্চ, 2022
androidx.lifecycle:lifecycle-*:2.5.0-alpha05
প্রকাশিত হয়েছে। সংস্করণ 2.5.0-ALPHA05 এর মধ্যে এই কমিট রয়েছে।
নতুন বৈশিষ্ট্য
-
lifecycle-viewmodel-compose
মডিউলটি এখনSavedStateHandleSaver
সরবরাহ করে, একটি পরীক্ষামূলক এপিআই যা একটিSavedStateHandle
মানগুলি নিশ্চিত করে যে একই সংরক্ষিত উদাহরণগুলির সাথে সঠিকভাবে সংহত করা হয়েছে যাrememberSaveable
ব্যবহারগুলি স্মরণ করে। ( আইএ 88 বি 7 , বি/195689777 )
এপিআই পরিবর্তন
- জাভাতে লাইফসাইকেল ২.৩ এবং নতুন লাইফসাইকেল সংস্করণগুলির সাথে একটি সামঞ্জস্যতা সমস্যা স্থির করে। ( I52c8a , খ/219545060 )
বাগ ফিক্স
-
SavedStateViewFactory
এখনCreationExtras
ব্যবহার করে সমর্থন করে এমনকি যখন এটি কোনওSavedStateRegistryOwner
সাথে শুরু করা হয়েছিল। যদি অতিরিক্ত সরবরাহ করা হয় তবে প্রাথমিক যুক্তিগুলি উপেক্ষা করা হয়। ( I6c43 বি, বি/224844583 )
সংস্করণ 2.5.0-আলফা 04
9 মার্চ, 2022
androidx.lifecycle:lifecycle-*:2.5.0-alpha04
প্রকাশিত হয়েছে। সংস্করণ 2.5.0-ALPHA04 এর মধ্যে এই কমিট রয়েছে।
এপিআই পরিবর্তন
-
SavedStateHandle
এখন একটিgetStateFlow()
এপিআই সরবরাহ করে যাLiveData
ব্যবহারের বিকল্প হিসাবে মান পরিবর্তনগুলি পর্যবেক্ষণের জন্য একটি কোটলিনStateFlow
দেয়। ( আইএডি 3 অ্যাব , বি/178037961 )
সংস্করণ 2.5.0-Alpha03
23 ফেব্রুয়ারি, 2022
androidx.lifecycle:lifecycle-*:2.5.0-alpha03
প্রকাশিত হয়েছে। সংস্করণ 2.5.0-ALPHA03 এ এই কমিটগুলি রয়েছে।
নতুন বৈশিষ্ট্য
- একটি
addCloseable()
এপিআই এবং একটি নতুন কনস্ট্রাক্টর ওভারলোড যুক্ত করা হয়েছে যা আপনাকেViewModel
এক বা একাধিকCloseable
অবজেক্ট যুক্ত করতে দেয় যাViewModel
onCleared()
এর কোনও ম্যানুয়াল কাজের প্রয়োজন ছাড়াই সাফ হয়ে গেলে বন্ধ হয়ে যাবে। ( I55ea0 ) -
lifecycle-viewmodel
এখন একটিInitializerViewModelFactory
সরবরাহ করে যা আপনাকে প্রাথমিক ডেটা উত্স হিসাবেCreationExtras
ব্যবহার করে নির্দিষ্টViewModel
ক্লাসগুলি পরিচালনা করার জন্য ল্যাম্বডা যুক্ত করতে দেয়। ( আইএফ 58 এফসি , বি/216687549 ) -
lifecycle-viewmodel-compose
এখন একটিviewModel()
এপিআই সরবরাহ করে যা কাস্টমViewModelProvider.Factory
তৈরি করার প্রয়োজন ছাড়াই একটিViewModel
উদাহরণ তৈরি করার জন্য একটি ল্যাম্বডা কারখানা গ্রহণ করে। ( I97fbb , খ/216688927 )
এপিআই পরিবর্তন
- আপনি এখন
lifecycle-viewmodel-compose
মাধ্যমেCreationExtras
সাথে একটিViewModel
তৈরি করতে পারেন। ( I08887 , বি/216688927 )
আচরণ পরিবর্তন
-
Lifecycle.State
INITIALIZED
থেকেDESTROYED
সরানোর চেষ্টা করা এখনLifecycle
কোনও সংযুক্ত পর্যবেক্ষক আছে কিনা তা নির্বিশেষে সর্বদা একটিIllegalStateException
নিক্ষেপ করবে। ( I7c390 , বি/177924329 ) -
LifecycleRegistry
এখনDESTROYED
অবস্থায় পৌঁছে তাদের পর্যবেক্ষকদের সাফ করবে। ( আই 4 এফ 8 ডিডি , বি/142925860 )
সংস্করণ 2.5.0-আলফা 02
ফেব্রুয়ারী 9, 2022
androidx.lifecycle:lifecycle-*:2.5.0-alpha02
প্রকাশিত হয়েছে। সংস্করণ 2.5.0-ALPHA02 এর মধ্যে এই কমিট রয়েছে।
এপিআই পরিবর্তন
-
SavedStateHandle
এবংSavedStateViewModelFactory
কোটলিনে রূপান্তরিত হয়েছে। এটি উভয় শ্রেণিতে জেনেরিকদের নালিবিলিটি উন্নত করেছে। ( আইবি 6ce2 , বি/216168263 , আই 9647 এ , বি/177667711 ) -
LiveData
switchMap
ফাংশন প্যারামিটারটিতে এখন একটি বাতিল আউটপুট থাকতে পারে। ( I40396 , বি/1329236666 ) -
LiveData
-কেটিএক্স এক্সটেনশানগুলি এখন এই ফাংশনগুলি কল করার সময় ফলাফলটি ব্যবহৃত হয় তা প্রয়োগ করার জন্য@CheckResult
সাথে টীকা দেওয়া হয়। ( আইএ 0 এফ 05 , বি/207325134 )
আচরণ পরিবর্তন
- নির্দিষ্ট কীটির কোনও মান বিদ্যমান না থাকলে
SavedStateHandle
এখন যথাযথভাবে ডিফল্টভ্যালু সঞ্চয় করে। ( I1c6ce , খ/178510877 )
বাগ ফিক্স
- লাইফসাইকেল থেকে
2.4.1
থেকে: আপডেট হওয়াlifecycle-process
স্টার্টআপ ১.১.১ এর উপর নির্ভর করে যাতে নিশ্চিত হয় যে প্রক্রিয়াগুলি যেProcessLifecycleInitializer
StartupException
করা থেকে বিরত রোধ করে তা ডিফল্টরূপে পাওয়া যায়। ( আইবি 01 ডিএফ , বি/216490724 ) - কাস্টম
AndroidViewModel
ক্লাসগুলিতে ভুল ক্রমে পরামিতি থাকে এবং একটিViewModel
তৈরি করার চেষ্টা করা হয় তখন এখন একটি উন্নত ত্রুটি বার্তা রয়েছে। ( I340f7 , বি/177667711 ) - আপনি এখন অ্যাপ্লিকেশন সেট না করে
AndroidViewModelFactory
ব্যবহার করেCreationExtras
মাধ্যমে একটি ভিউ মডেল তৈরি করতে পারেন। ( I6ebef , খ/217271656 )
সংস্করণ 2.5.0-আলফা 01
জানুয়ারী 26, 2022
androidx.lifecycle:lifecycle-*:2.5.0-alpha01
প্রকাশিত হয়েছে। সংস্করণ 2.5.0-ALPHA01 এর মধ্যে এই কমিটগুলি রয়েছে।
ভিউমোডেল ক্রিয়েটিনেক্সট্রা
এই প্রকাশের সাথে, আমরা কীভাবে একটি ViewModel
নির্মিত হয় তা পুনর্গঠনের জন্য ভিত্তি তৈরি করছি। ViewModelProvider.Factory
সাবক্লাসের একটি অনমনীয় সেটের পরিবর্তে প্রতিটি অতিরিক্ত কার্যকারিতা যুক্ত করে ( AndroidViewModelFactory
মাধ্যমে একটি Application
কনস্ট্রাক্টর প্যারামিটারকে AbstractSavedStateViewModelFactory
দেয়, SavedStateHandle
, ইত্যাদি SavedStateViewModelFactory
একটি নতুন ধারণার উপর নির্ভর করুন, CreationExtras
। ( আইএ 7343 , বি/188691010 , বি/188541057 )
এই পরিবর্তনের সাথে সাথে, ViewModelProvider
ViewModelProvider.Factory
পূর্ববর্তী create(Class<T>)
পদ্ধতিতে সরাসরি কল করে না। পরিবর্তে, এটি create
একটি নতুন ওভারলোডে কল করে: create(Class<T>, CreationExtras)
। এর অর্থ হ'ল ViewModelProvider.Factory
উদাহরণের যে কোনও সরাসরি বাস্তবায়ন এখন এই নতুন CreationExtras
প্রত্যেকটিতে অ্যাক্সেস রয়েছে:
-
ViewModelProvider.NewInstanceFactory.VIEW_MODEL_KEY
: এইString
আপনিViewModelProvider.get()
এ পাস করা কাস্টম কীটিতে অ্যাক্সেস সরবরাহ করে। -
ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY
Application
শ্রেণিতে অ্যাক্সেস সরবরাহ করে। -
SavedStateHandleSupport.SAVED_STATE_REGISTRY_OWNER_KEY
এই ভিউমোডেলটি নির্মাণের জন্য ব্যবহৃত হচ্ছেSavedStateRegistryOwner
মালিককে অ্যাক্সেস সরবরাহ করে। -
SavedStateHandleSupport.VIEW_MODEL_STORE_OWNER_KEY
এই ভিউমোডেলটি তৈরি করতে ব্যবহৃতViewModelStoreOwner
মালিককে অ্যাক্সেস সরবরাহ করে। -
SavedStateHandleSupport.DEFAULT_ARGS_KEY
যুক্তিগুলিরBundle
অ্যাক্সেস সরবরাহ করে যা একটিSavedStateHandle
নির্মাণের জন্য ব্যবহার করা উচিত।
ক্রিয়াকলাপ 1.5.0-alpha01
, খণ্ড 1.5.0-alpha01
এবং নেভিগেশন 2.5.0-alpha01
ব্যবহার করার সময় এই অতিরিক্তগুলি ডিফল্টরূপে সরবরাহ করা হয়। আপনি যদি এই গ্রন্থাগারগুলির পূর্ববর্তী সংস্করণটি ব্যবহার করেন তবে CreationExtras
CreationExtras
খালি থাকবে - ViewModelProvider.Factory
সমস্ত বিদ্যমান সাবক্লাসগুলি।
এই CreationExtras
আপনাকে একটি ViewModelProvider.Factory
তৈরি করার অনুমতি দেয় যা কারখানার সাবক্লাসগুলির কঠোর শ্রেণিবিন্যাসের উপর নির্ভর না করে প্রতিটি ViewModel
আপনার প্রয়োজনীয় তথ্যগুলি পাস করে:
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
}
}
আমরা কেবল একটি ভিউমোডেলের জন্য একটি SavedStateHandle
তৈরি করতে SavedStateHandleSupport
থেকে CreationExtras
createSavedStateHandle()
কোটলিন এক্সটেনশন ফাংশনটি ব্যবহার করি। ( আইএ 6654 , বি/188541057 )
কাস্টম CreationExtras
আপনার ComponentActivity
বা Fragment
getDefaultViewModelCreationExtras()
ওভাররাইড করে সরবরাহ করা যেতে পারে, এইভাবে এগুলি আপনার কাস্টম ViewModelProvider.Factory
সহায়তা করা ইনজেকশন আকারে অন্তর্নির্মিত হিসাবে উপলব্ধ করে তোলে। এই অতিরিক্তগুলি স্বয়ংক্রিয়ভাবে আপনার কাস্টম কারখানায় যখন সরাসরি ViewModelProvider
সাথে ব্যবহার করা হয় বা by viewModels()
এবং by activityViewModels()
ব্যবহার করার সময় উপলব্ধ করা হবে। ( I79f2b , বি/207012584 , বি/207012585 , বি/207012490 )
বাগ ফিক্স
- এমন একটি সমস্যা স্থির করা হয়েছে যেখানে কোনও
SavedStateHandle
সরবরাহ করা ডিফল্ট মান প্রক্রিয়া মৃত্যু এবং বিনোদন দেওয়ার পরে আবার উপস্থিত হবে, এমনকি যদি এটিSavedStateHandle
থেকে নির্দিষ্টভাবে সরানো হয়েছিল। এর ফলস্বরূপ,SavedStateHandle
আর ডিফল্ট মানগুলিকে মার্জ করবে না এবং মানগুলি একসাথে পুনরুদ্ধার করবে না, পরিবর্তে কেবল সত্যের উত্স হিসাবে পুনরুদ্ধার করা মানগুলি ব্যবহার করে। ( I53a4b )
সংস্করণ 2.4
সংস্করণ 2.4.1
ফেব্রুয়ারী 9, 2022
androidx.lifecycle:lifecycle-*:2.4.1
প্রকাশিত হয়েছে। সংস্করণ 2.4.1 এ এই কমিটস রয়েছে।
বাগ ফিক্স
- লাইফসাইকেল
2.5.0-alpha01
থেকে ব্যাকপোর্ট করা: একটি সমস্যা স্থির করা হয়েছে যেখানে একটিSavedStateHandle
সরবরাহ করা ডিফল্ট মান প্রক্রিয়া মৃত্যু এবং বিনোদনের পরে পুনরায় উপস্থিত হবে, এমনকি যদি এটিSavedStateHandle
থেকে বিশেষভাবে অপসারণ করা হয়েছিল। এর ফলস্বরূপ,SavedStateHandle
আর ডিফল্ট মানগুলিকে মার্জ করবে না এবং মানগুলি একসাথে পুনরুদ্ধার করবে না, পরিবর্তে কেবল সত্যের উত্স হিসাবে পুনরুদ্ধার করা মানগুলি ব্যবহার করে। ( I53a4b ) -
lifecycle-process
এখন অ্যান্ড্রয়েডএক্স স্টার্টআপ 1.1.1 এর উপর নির্ভর করে যাProcessLifecycleInitializer
ব্যবহার করার ফলে একটিStartupException
ঘটায় সেখানে একটি রিগ্রেশন স্থির করে। ( বি/216490724 )
সংস্করণ 2.4.0
27 অক্টোবর, 2021
androidx.lifecycle:lifecycle-*:2.4.0
প্রকাশিত হয়েছে। সংস্করণ 2.4.0 এ এই কমিটস রয়েছে।
2.3.0 সাল থেকে গুরুত্বপূর্ণ পরিবর্তন
-
@OnLifecycleEvent
অবমূল্যায়ন করা হয়েছিল।LifecycleEventObserver
বাDefaultLifecycleObserver
পরিবর্তে ব্যবহার করা উচিত। -
androidx.lifecycle:lifecycle-viewmodel-compose
লাইব্রেরি যুক্ত করা হয়েছিল। এটিviewModel()
কমপোজেবল এবংLocalViewModelStoreOwner
সরবরাহ করে।- উত্স-ব্রেকিং পরিবর্তন :
ViewModelProvider
কোটলিনে পুনরায় লেখা হয়েছে।ViewModelProvider.Factory.create
পদ্ধতি আর নালযোগ্য জেনেরিককে অনুমতি দেয় না।
- উত্স-ব্রেকিং পরিবর্তন :
- নতুন করুটাইন এপিআই
androidx.lifecycle:lifecycle-runtime-ktx
: এ যুক্ত করা হয়েছিল: -
Lifecycle.repeatOnLifecycle
, এপিআই যা লাইফসাইকেলটি কমপক্ষে একটি নির্দিষ্ট অবস্থায় থাকে যখন একটি করুটিনে কোডের একটি ব্লক কার্যকর করে। লাইফসাইকেলটি লক্ষ্য রাজ্যের ভিতরে এবং বাইরে চলে যাওয়ার সাথে সাথে ব্লকটি বাতিল এবং পুনরায় চালু হবে; -
Flow.flowWithLifecycle
, এপিআই যা লাইফসাইকেলটি কমপক্ষে একটি নির্দিষ্ট অবস্থায় থাকে যখন প্রবাহের প্রবাহ থেকে মানগুলি নির্গত করে। -
DefaultLifecycleObserver
লাইফসাইকেল থেকে সরানোlifecycle.lifecycle-common
lifecycle.lifecycle-common-java8
lifecycle.lifecycle-common-java8
লাইফসাইকেলের শীর্ষে আর কোনও অতিরিক্ত কার্যকারিতা সরবরাহ করে নাlifecycle.lifecycle-common
, সুতরাং এটির উপর নির্ভরতাlifecycle.lifecycle-common
-
lifecycle-viewmodel-ktx
থেকে নন করুটাইন এপিআইlifecycle-viewmodel
মডিউলটিতে স্থানান্তরিত হয়েছে। lifecycle-process
এখনProcessLifecycleOwner
আরম্ভ করতেandroidx.startup
ব্যবহার করে।পূর্বে, এটি
androidx.lifecycle.ProcessLifecycleOwnerInitializer
দ্বারা সম্পন্ন করা হয়েছিল।আপনি যদি
tools:node="remove"
অতীতে প্রক্রিয়া জীবনচক্রের সূচনা করতে ব্যবহৃতContentProvider
"সরান", তবে আপনাকে পরিবর্তে নিম্নলিখিতগুলি করতে হবে।<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>
সংস্করণ 2.4.0-আরসি 01
29 সেপ্টেম্বর, 2021
androidx.lifecycle:lifecycle-*:2.4.0-rc01
লাইফসাইকেল 2.4.0-BETA01 থেকে কোনও পরিবর্তন ছাড়াই প্রকাশিত হয়। সংস্করণ 2.4.0-আরসি 01 এ এই কমিটগুলি রয়েছে।
সংস্করণ 2.4.0-BETA01
15 সেপ্টেম্বর, 2021
androidx.lifecycle:lifecycle-*:2.4.0-beta01
প্রকাশিত হয়েছে। সংস্করণ 2.4.0-BETA01 এর মধ্যে এই কমিট রয়েছে।
এপিআই পরিবর্তন
-
@OnLifecycleEvent
অবমূল্যায়ন করা হয়েছিল।LifecycleEventObserver
বাDefaultLifecycleObserver
পরিবর্তে ব্যবহার করা উচিত। ( I5a8fa ) - ডিফল্টলিফেসাইক্লোবসার্ভার
androidx.lifecycle.lifecycle-common-java8
থেকেandroidx.lifecycle.lifecycle-common
থেকে সরানো হয়েছিল।androidx.lifecycle.lifecycle-common-java8
androidx.lifecycle.lifecycle-common
এর শীর্ষে কোনও অতিরিক্ত কার্যকারিতা সরবরাহ করে না, সুতরাং এর উপর নির্ভরতাandroidx.lifecycle.lifecycle-common
দ্বারা প্রতিস্থাপন করা যেতে পারে। ( I021aa ) -
lifecycle-viewmodel-ktx
থেকে নন করুটাইন এপিআইlifecycle-viewmodel
মডিউলটিতে স্থানান্তরিত হয়েছে। ( I6d5b2 )
বাহ্যিক অবদান
-
ViewModel
ডকুমেন্টেশনে কোনও ধরণের ঠিক করার জন্য ধন্যবাদ ডিমিট্রিলক ! ( #221 )
সংস্করণ 2.4.0-আলফা 03
4 আগস্ট, 2021
androidx.lifecycle:lifecycle-*:2.4.0-alpha03
প্রকাশিত হয়েছে। সংস্করণ 2.4.0-ALPHA03 এ এই কমিটগুলি রয়েছে।
এপিআই পরিবর্তন
- উত্স-ব্রেকিং পরিবর্তন : ভিউমোডেলপ্রোভাইডার কোটলিনে পুনরায় লেখা হয়েছে।
ViewModelProvider.Factory.create
পদ্ধতি আর নালযোগ্য জেনেরিককে অনুমতি দেয় না। ( I9b9f6 )
আচরণ পরিবর্তন
-
Lifecycle.repeatOnLifecycle
: এক্সিকিউশন পুনরাবৃত্তি করার সময়block
এখন সর্বদা ক্রমিকভাবে আহ্বান করা হয়। ( আইবিএবি 33 )
বাহ্যিক অবদান
-
repeatOnLifecycle
ডকুমেন্টেশনে কোড স্নিপেটগুলি ঠিক করার জন্য চাও 2 জ্যাংকে ধন্যবাদ। #205 ।
সংস্করণ 2.4.0-আলফা 02
16 জুন, 2021
androidx.lifecycle:lifecycle-*:2.4.0-alpha02
প্রকাশিত হয়েছে। সংস্করণ 2.4.0-ALPHA02 এ এই কমিটগুলি রয়েছে।
নতুন বৈশিষ্ট্য
-
lifecycle-runtime-ktx
-এ একটি নতুনRepeatOnLifecycleWrongUsage
লিন্ট চেক যুক্ত করা হয়েছে যা সনাক্ত করে যখনrepeateOnLifecycle
ভুলভাবেonStart()
বাonResume()
এ ব্যবহৃত হয়। ( 706078 , বি/187887400 )
এপিআই পরিবর্তন
-
LifecycleOwner.addRepeatingJob
এপিআইLifecycle.repeatOnLifecycle
পক্ষে সরানো হয়েছে rep ( I4a3a8 ) -
ProcessLifecycleInitializer
সর্বজনীন করুন যাতে অন্যান্যandroidx.startup.Initializer
গুলি এগুলি নির্ভরতা হিসাবে ব্যবহার করতে পারে। ( I94c31 )
বাগ ফিক্স
- যখন ক্ষেত্রের সংশোধনকারী থাকে তখন
NullSafeMutableLiveData
লিন্ট চেকের সাথে একটি সমস্যা স্থির করে। ( #147 , খ/183696616 ) - জেনেরিকগুলি ব্যবহার করার সময়
NullSafeMutableLiveData
লিন্ট চেকের সাথে আরও একটি সমস্যা স্থির করে। ( #161 , বি/184830263 )
বাহ্যিক অবদান
-
NullSafeMutableLiveData
লিন্ট চেকটি উন্নত করার জন্য ম্যাক্সসভকে ধন্যবাদ। ( #147 , খ/183696616 ) -
NullSafeMutableLiveData
লিন্ট চেকটি উন্নত করার জন্য কোজাক্সিনানকে ধন্যবাদ। ( #161 , বি/184830263 )
সংস্করণ 2.4.0-আলফা 01
24 মার্চ, 2021
androidx.lifecycle:lifecycle-*:2.4.0-alpha01
প্রকাশিত হয়েছে। সংস্করণ 2.4.0-ALPHA01 এর মধ্যে এই কমিট রয়েছে।
আচরণ পরিবর্তন
lifecycle-process
এখনProcessLifecycleOwner
আরম্ভ করতেandroidx.startup
ব্যবহার করে।পূর্বে, এটি
androidx.lifecycle.ProcessLifecycleOwnerInitializer
দ্বারা সম্পন্ন করা হয়েছিল।আপনি যদি
tools:node="remove"
অতীতে প্রক্রিয়া জীবনচক্রের সূচনা করতে ব্যবহৃতContentProvider
"সরান", তবে আপনাকে পরিবর্তে নিম্নলিখিতগুলি করতে হবে।<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>
এপিআই পরিবর্তন
- একটি
Flow.flowWithLifecycle
যুক্ত করা হয়েছেLifecycle.repeatOnLifecycle
এটি নতুনLifecycleOwner.addRepeatinJob
বিকল্প। ( I0f4cd )
বাগ ফিক্স
- লাইফসাইকেল থেকে ২.৩.১ থেকে:
NonNullableMutableLiveData
লিন্ট বিধি এখন বিভিন্ন নালিবিলিটি সহ ক্ষেত্রের ভেরিয়েবলের মধ্যে সঠিকভাবে পার্থক্য করতে পারে। ( খ/169249668 )
লাইফসাইকেল ভিউমোডেল রচনা সংস্করণ 1.0.0
সংস্করণ 1.0.0-alpha07
16 জুন, 2021
androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07
প্রকাশিত হয়েছে। সংস্করণ 1.0.0-ALPHA07 এর মধ্যে এই কমিটগুলি রয়েছে।
ব্রেকিং এপিআই পরিবর্তন
-
viewModel()
এখন একটি al চ্ছিকViewModelStoreOwner
নেয়, এটিLocalViewModelStoreOwner
মালিক ব্যতীত অন্য মালিকদের সাথে কাজ করা সহজ করে তোলে। উদাহরণস্বরূপ, আপনি এখন নির্দিষ্ট নেভিগেশন গ্রাফের সাথে সম্পর্কিত ভিউমোডেল পুনরুদ্ধার করতেviewModel(navBackStackEntry)
ব্যবহার করতে পারেন। ( আই 2628 ডি , বি/188693123 )
সংস্করণ 1.0.0-Alpha06
2 জুন, 2021
androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha06
প্রকাশিত হয়েছে। সংস্করণ 1.0.0-ALPHA06 এর মধ্যে এই কমিট রয়েছে।
রচনা সংস্করণ 1.0.0-beta08
এর সাথে সামঞ্জস্যপূর্ণ হতে আপডেট হয়েছে।
সংস্করণ 1.0.0-Alpha05
18 মে, 2021
androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha05
প্রকাশিত হয়েছে। সংস্করণ 1.0.0-ALPHA05 এর মধ্যে এই কমিট রয়েছে।
নতুন বৈশিষ্ট্য
- রচনা সংস্করণ
1.0.0-beta07
এর সাথে সামঞ্জস্যপূর্ণ হতে আপডেট হয়েছে।
বাগ ফিক্স
- ইউআই-টেস্ট-ম্যানিফেস্ট এবং ইউআই-টুলিং-ডেটা থেকে অ্যান্ড্রয়েডম্যানিফেস্ট ফাইলগুলি এখন অ্যান্ড্রয়েড 12 এর সাথে সামঞ্জস্যপূর্ণ ( i6f9de , বি/184718994 )
সংস্করণ 1.0.0-Alpha04
7 এপ্রিল, 2021
androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha04
প্রকাশিত হয়েছে। সংস্করণ 1.0.0-ALPHA04 এ এই কমিটগুলি রয়েছে।
নির্ভরতা পরিবর্তন
- This version allows
androidx.hilt:hilt-navigation-compose
andandroidx.navigation:navigation-compose
to sync dependencies onandroidx.compose.compiler:compiler:1.0.0-beta04
andandroidx.compose.runtime:runtime:1.0.0-beta04
. 1.0.0 এর জন্য, এটি সংকলক এবং রানটাইম ম্যাচটি প্রয়োজন।
সংস্করণ 1.0.0-Alpha03
10 মার্চ, 2021
androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha03
প্রকাশিত হয়েছে। সংস্করণ 1.0.0-ALPHA03 এ এই কমিটগুলি রয়েছে।
এপিআই পরিবর্তন
-
LocalViewModelStoreOwner.current
এখন কোনওViewModelStoreOwner
বর্তমান রচনায় উপলব্ধ কিনা তা আরও ভালভাবে নির্ধারণ করার জন্য একটি বাতিলযোগ্যViewModelStoreOwner
প্রদান করে।viewModel()
এবংNavHost
মতোViewModelStoreOwner
প্রয়োজন এমন এপিআইগুলি যদি কোনওViewModelStoreOwner
সেট না করা থাকে তবে এখনও একটি ব্যতিক্রম নিক্ষেপ করুন। ( আইডিএফ 39 এ )
লাইফসাইকেল-ভিউমোডেল-কমপোজ সংস্করণ 1.0.0-আলফা 02
24 ফেব্রুয়ারি, 2021
androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha02
প্রকাশিত হয়েছে। সংস্করণ 1.0.0-ALPHA02 এ এই কমিটগুলি রয়েছে।
এপিআই পরিবর্তন
-
LocalViewModelStoreOwner
কাছে এখন একটি ফাংশনprovides
যাCompositionLocalProvider
সাথে ব্যবহার করা যেতে পারে,asProvidableCompositionLocal()
এপিআই প্রতিস্থাপন করে। ( I45d24 )
লাইফসাইকেল-ভিউমোডেল-কমপোজ সংস্করণ 1.0.0-আলফা 01
ফেব্রুয়ারী 10, 2021
androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha01
প্রকাশিত হয়েছে। সংস্করণ 1.0.0-alpha01-এ এই কমিট রয়েছে।
নতুন বৈশিষ্ট্য
-
viewModel()
কমপোজেবল এবংLocalViewModelStoreOwner
androidx.compose.ui.viewinterop
থেকেandroidx.lifecycle.viewmodel.compose
প্যাকেজে এই নিদর্শনটিতে স্থানান্তরিত করা হয়েছিল। ( I7a374 )
সংস্করণ 2.3.1
লাইফসাইকেল সংস্করণ 2.3.1
24 মার্চ, 2021
androidx.lifecycle:lifecycle-*:2.3.1
প্রকাশিত হয়েছে। সংস্করণ 2.3.1 এ এই কমিটস রয়েছে।
বাগ ফিক্স
-
NonNullableMutableLiveData
লিন্ট নিয়মটি এখন বিভিন্ন বাতিলতার সাথে ক্ষেত্রের ভেরিয়েবলের মধ্যে সঠিকভাবে পার্থক্য করতে পারে। ( খ/169249668 )
সংস্করণ 2.3.0
সংস্করণ 2.3.0
ফেব্রুয়ারী 10, 2021
androidx.lifecycle:lifecycle-*:2.3.0
প্রকাশিত হয়েছে। সংস্করণ 2.3.0 এ এই কমিটস রয়েছে।
২.২.০ সাল থেকে বড় পরিবর্তন
- অ-পার্সেলেবল ক্লাসগুলির জন্য
SavedStateHandle
সমর্থন :SavedStateHandle
এখন আপনাকে একটি প্রদত্ত কীটির জন্যsetSavedStateProvider()
কল করার অনুমতি দিয়ে অলস সিরিয়ালাইজেশনকে সমর্থন করে, যখনsaveState()
তার রাজ্য সংরক্ষণের জন্য জিজ্ঞাসা করাSavedStateHandle
তখনSavedStateProvider
সরবরাহ করে। নন-পার্সেলেবল ক্লাসগুলি সংরক্ষণ করা দেখুন। - লাইফসাইকেল আচরণ প্রয়োগ :
- লাইফসাইক্লারেজিস্ট্রি এখন একটি টার্মিনাল রাষ্ট্র হিসাবে
DESTROYED
প্রয়োগ করে। -
LifecycleRegistry
এখন যাচাই করে যে এর পদ্ধতিগুলি মূল থ্রেডে ডাকা হয়। এটি সর্বদা ক্রিয়াকলাপ, খণ্ডসমূহ ইত্যাদির লাইফসাইকেলগুলির জন্য প্রয়োজনীয়তা ছিল, নন-মেইন থ্রেডগুলি থেকে পর্যবেক্ষকদের একটি সংযোজনের ফলে রানটাইমে ক্র্যাশগুলি ধরা শক্ত হয়ে যায়। আপনার নিজস্ব উপাদানগুলির মালিকানাধীনLifecycleRegistry
অবজেক্টগুলিরLifecycleRegistry
, আপনিLifecycleRegistry.createUnsafe(...)
- লাইফসাইক্লারেজিস্ট্রি এখন একটি টার্মিনাল রাষ্ট্র হিসাবে
- লাইফসাইকেল স্টেট এবং ইভেন্ট হেল্পার্স :
downFrom(State)
,State
downTo(State)
,Event
upFrom(State)
,Lifecycle.Event
upTo(State)
যুক্ত স্ট্যাটিক হেল্পার পদ্ধতিগুলি যুক্ত করা হয়েছে।getTargetState()
পদ্ধতি যুক্ত করা হয়েছে যাState
সরবরাহ করে যে লাইফাইসাইকেলটি সরাসরিEvent
অনুসরণ করে স্থানান্তরিত করবে। -
withStateAtLeast
: যুক্তLifecycle.withStateAtLeast
এই এপিআইগুলি বিদ্যমানগুলির থেকে পৃথক হয়when*
পদ্ধতিগুলি তারা স্থগিতকরণ কোড চালানোর অনুমতি দেয় না এবং কাস্টম প্রেরণকারীকে নিয়োগ দেয় না। ( এওএসপি/1326081 ) -
ViewTree
এপিআইএস : একটি নতুনViewTreeLifecycleOwner.get(View)
এবংViewTreeViewModelStoreOwner.get(View)
এপিআই আপনাকে যথাক্রমে একটিView
উদাহরণ দেওয়াLifecycleOwner
এবংViewModelStoreOwner
পুনরুদ্ধার করতে দেয়। এটিকে সঠিকভাবে পপুলেট করতে আপনাকে অবশ্যই ক্রিয়াকলাপ1.2.0
এবং খণ্ড1.3.0
এবং অ্যাপকম্প্যাট 1.3.0-আলফা 01 বা তার বেশি উচ্চতর আপগ্রেড করতে হবে।findViewTreeLifecycleOwner
এবংfindViewTreeViewModelStoreOwner
কোটলিন এক্সটেনশনগুলি যথাক্রমেlifecycle-runtime-ktx
এবংlifecycle-viewmodel-ktx
পাওয়া যায়। -
LiveData.observe()
LiveData.observe()
কোটলিন এক্সটেনশন অবমূল্যায়ন : ল্যাম্বডা সিনট্যাক্স ব্যবহারের জন্য প্রয়োজনীয় কোটলিন এক্সটেনশনটি এখন কোটলিন 1.4 ব্যবহার করার সময় প্রয়োজনীয় নয় বলে কোটলিন এক্সটেনশনটি এখন হ্রাস করা হয়েছে।
সংস্করণ 2.3.0-আরসি 01
16 ডিসেম্বর, 2020
androidx.lifecycle:lifecycle-*:2.3.0-rc01
প্রকাশিত হয়েছে। সংস্করণ 2.3.0-আরসি 01 এ এই কমিটগুলি রয়েছে।
বাগ ফিক্স
-
SavedStateHandle
keys()
পদ্ধতিটি এখন রাজ্য সংরক্ষণের আগে এবং পরে সামঞ্জস্যপূর্ণ - এটি এখনset()
এবংgetLiveData()
এর সাথে ব্যবহৃত কীগুলি ছাড়াওsetSavedStateProvider()
এর সাথে পূর্বে ব্যবহৃত কীগুলি অন্তর্ভুক্ত করে। ( এওএসপি/1517919 , বি/174713653 )
বাহ্যিক অবদান
- লাইফসাইকেল-সচেতন করুটাইনগুলি স্থগিত করার এপিআইগুলি এখন আরও ভাল কল
yield()
কলগুলি পরিচালনা করে। ধন্যবাদ নিক্লাস অ্যানসম্যান গিয়ার্টজ! ( এওএসপি/1430830 , বি/168777346 )
সংস্করণ 2.3.0-BETA01
অক্টোবর 1, 2020
androidx.lifecycle:lifecycle-*:2.3.0-beta01
প্রকাশিত হয়েছে। সংস্করণ 2.3.0-BETA01 এর মধ্যে এই কমিট রয়েছে।
এপিআই পরিবর্তন
-
LiveData.observe()
সিনট্যাক্স ব্যবহারের জন্য প্রয়োজনীয় কোটলিন এক্সটেনশনটি এখন কোটলিন ১.৪ ব্যবহার করার সময় প্রয়োজনীয় নয় বলে এখন অবমূল্যায়ন করা হয়েছে। ( I40d3f )
বাগ ফিক্স
- কোটলিন 1.4 ( আইডি 6471 , বি/165307851 , বি/165300826 ) ব্যবহার করতে অ্যান্ড্রয়েডএক্স আপগ্রেড করুন
ডকুমেন্টেশন পরিবর্তন
- প্রদত্ত সময়সীমা মানগুলি পরিবর্তন করার বিষয়ে বিশদ অন্তর্ভুক্ত করার জন্য
liveData
বিল্ডার এবংasLiveData()
ডক্স আপডেট করা হয়েছে। ( এওএসপি/1122324 )
সংস্করণ 2.3.0-Alpha07
আগস্ট 19, 2020
androidx.lifecycle:lifecycle-*:2.3.0-alpha07
প্রকাশিত হয়েছে। সংস্করণ 2.3.0-ALPHA07 এর মধ্যে এই কমিট রয়েছে।
বাগ ফিক্স
-
NullSafeMutableLiveData
লিন্ট চেকটিতে একটি ক্র্যাশ ইস্যু স্থির করে। ( এওএসপি/1395367 )
সংস্করণ 2.3.0-Alpha06
22 জুলাই, 2020
androidx.lifecycle:lifecycle-*:2.3.0-alpha06
প্রকাশিত হয়েছে। সংস্করণ 2.3.0-ALPHA06 এর মধ্যে এই কমিট রয়েছে।
নতুন বৈশিষ্ট্য
-
downFrom(State)
,downTo(State)
,upFrom(State)
,Lifecycle.Event
পর্যন্তupTo(State)
এর স্ট্যাটিক হেল্পার পদ্ধতি যুক্ত করা হয়েছে। একটিState
এবং পরিবর্তনের দিকনির্দেশনা প্রদত্তEvent
উত্পন্ন করার জন্য।getTargetState()
পদ্ধতি যুক্ত করা হয়েছে যাState
সরবরাহ করে যে লাইফাইসাইকেলটি সরাসরিEvent
অনুসরণ করে স্থানান্তরিত করবে। ( I00887 ) -
Lifecycle.withStateAtLeast
যুক্ত করা হয়েছে। এই এপিআইগুলি বিদ্যমানগুলির থেকে পৃথক হয়when*
পদ্ধতিগুলি তারা স্থগিতকরণ কোড চালানোর অনুমতি দেয় না এবং কাস্টম প্রেরণকারীকে নিয়োগ দেয় না। ( এওএসপি/1326081 )
আচরণ পরিবর্তন
- লাইফসাইক্লারেজিস্ট্রি এখন একটি টার্মিনাল রাষ্ট্র হিসাবে
DESTROYED
প্রয়োগ করে। ( 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. ForLifecycleRegistry
objects that owned by your own components, you can explicitly opt out from checks by usingLifecycleRegistry.createUnsafe(...)
, but then you have to ensure that a proper synchronization is in place when thisLifecycleRegistry
is accessed from different threads ( Ie7280 , b/137392809 )
বাগ ফিক্স
- Fixed a crash in
NullSafeMutableLiveData
. ( b/159987480 ) - Fixed an
ObsoleteLintCustomCheck
for Lint checks bundled withlifecycle-livedata-core-ktx
(and specificallyNullSafeMutableLiveData
). ( b/158699265 )
Version 2.3.0-alpha05
জুন 24, 2020
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 toonActive()
oronInactive()
. ( 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
জুন 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 anull
value was set on aMutableLiveData
with a non-null type parameter. ( b/156002218 )
Version 2.3.0-alpha03
20 মে, 2020
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 callsetSavedStateProvider()
for a given key, providing aSavedStateProvider
that will get a callback tosaveState()
when theSavedStateHandle
is asked to save its state. ( b/155106862 ) - A new
ViewTreeViewModelStoreOwner.get(View)
API allows you to retrieve the containingViewModelStoreOwner
given aView
instance. You must upgrade to Activity1.2.0-alpha05
, Fragment1.3.0-alpha05
, and AppCompat1.3.0-alpha01
to populate this correctly. AfindViewModelStoreOwner()
Kotlin extension has been added tolifecycle-viewmodel-ktx
. ( aosp/1295522 )
বাগ ফিক্স
- Fixed an issue that caused the
MutableLiveData
Lint checks released in Lifecycle2.3.0-alpha01
from being published alongside thelifecycle-livedata-core-ktx
artifact. ( b/155323109 )
Version 2.3.0-alpha02
এপ্রিল 29, 2020
androidx.lifecycle:lifecycle-*:2.3.0-alpha02
is released. Version 2.3.0-alpha02 contains these commits.
এপিআই পরিবর্তন
-
SavedStateViewModelFactory
now allows you to pass a nullApplication
to its constructor to better support cases where one is not readily available and support forAndroidViewModel
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
4 মার্চ, 2020
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 containingLifecycleOwner
given aView
instance. You must upgrade to Activity1.2.0-alpha01
and Fragment1.3.0-alpha01
to populate this correctly. AfindViewTreeLifecycleOwner
Kotlin extension is available inlifecycle-runtime-ktx
. ( aosp/1182361 , aosp/1182956 ) - Added a new Lint check that warns you when setting a
null
value on aMutableLiveData
that has been defined in Kotlin as non-null. This is available when using thelivedata-core-ktx
orlivedata-ktx
artifacts. ( aosp/1154723 , aosp/1159092 ) - A new
lifecycle-runtime-testing
artifact is available that provides aTestLifecycleOwner
that implementsLifecycleOwner
and provides a thread safe mutableLifecycle
. ( aosp/1242438 )
বাগ ফিক্স
- The
lifecycle-runtime
artifact now has a unique package name. ( aosp/1187196 )
সংস্করণ 2.2.0
ViewModel-Savedstate Version 2.2.0
ফেব্রুয়ারি 5, 2020
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
.
সংস্করণ 2.2.0
জানুয়ারী 22, 2020
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. Thelifecycle-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 aFragment
orFragmentActivity
to the newViewModelProvider(ViewModelStoreOwner)
constructor to achieve the same functionality when using Fragment1.2.0
. -
lifecycle-extensions
Artifact Deprecation : With the above deprecation ofViewModelProviders.of()
, this release marks the deprecation of the last API inlifecycle-extensions
and this artifact should now be considered deprecated in its entirety. We strongly recommend depending on the specific Lifecycle artifacts you need (such aslifecycle-service
if you're usingLifecycleService
andlifecycle-process
if you're usingProcessLifecycleOwner
) rather thanlifecycle-extensions
as there will not be a future2.3.0
release oflifecycle-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 useLifecycleEventObserver
.
Version 2.2.0-rc03
4 ডিসেম্বর, 2019
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 inViewModelStore
and queried later with default factory. - Fix a usage of
Dispatchers.Main.immediate
inlaunchWhenCreated
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
নভেম্বর 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
23 অক্টোবর, 2019
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 ofDispatchers.Main
instead ofDispatchers.Main.immediate
. ( aosp/1145596 )
External contributions
- Thanks to Nicklas Ansman for contributing the fix! ( aosp/1145596 )
Version 2.2.0-beta01
9 অক্টোবর, 2019
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'sLifecycleOwner
moving to started and resumed on Android 10 devices. ( aosp/1128132 ) - Fixed a regression introduced in Lifecycle
2.2.0-alpha05
which would cause aNullPointerException
when using version2.0.0
or2.1.0
oflifecycle-process
. ( b/141536990 )
Version 2.2.0-alpha05
সেপ্টেম্বর 18, 2019
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
5 সেপ্টেম্বর, 2019
androidx.lifecycle:lifecycle-*:2.2.0-alpha04
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
নতুন বৈশিষ্ট্য
-
lifecycleScope
,whenCreated
,whenStarted
,whenResumed
,viewModelScope
, and the underlying implementation ofliveData
now useDispatchers.Main.immediate
instead ofDispatchers.Main
. ( b/139740492 )
External contributions
- Thanks to Nicklas Ansman for contributing the move to
Dispatchers.Main.immediate
! ( aosp/1106073 )
Version 2.2.0-alpha03
7 আগস্ট, 2019
androidx.lifecycle:lifecycle-*:2.2.0-alpha03
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
নতুন বৈশিষ্ট্য
- Implementations of
ViewModelStoreOwner
can now optionally implementHasDefaultViewModelProviderFactory
to provide a defaultViewModelProvider.Factory
. This has been done for Activity1.1.0-alpha02
, Fragment1.2.0-alpha02
, and Navigation2.2.0-alpha01
. ( aosp/1092370 , b/135716331 )
এপিআই পরিবর্তন
-
ViewModelProviders.of()
has been deprecated. You can pass aFragment
orFragmentActivity
to the newViewModelProvider(ViewModelStoreOwner)
constructor to achieve the same functionality. ( aosp/1009889 )
Version 2.2.0-alpha02
জুলাই 2, 2019
androidx.lifecycle:*:2.2.0-alpha02
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
এপিআই পরিবর্তন
- Replaced
LiveDataScope.initialValue
withLiveDataScope.latestValue
which will track the current emitted value of theliveData
block. - Added a new overload to the
liveData
builder that receivestimeout
parameter as typeDuration
Version 2.2.0-alpha01
7 মে, 2019
androidx.lifecycle:*:2.2.0-alpha01
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
নতুন বৈশিষ্ট্য
- 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
সংস্করণ 1.0.0
জানুয়ারী 22, 2020
androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0
is released. সংস্করণ 1.0.0 এ এই কমিটগুলি রয়েছে ।
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 ofViewModel
class and factories provided by default by Fragments and AppCompatActivity will injectSavedStateHandle
automatically. - AbstractSavedStateViewModelFactory was added. It allows you to create custom factories for your
ViewModel
and provide them access toSavedStateHandle
.
ViewModel-Savedstate Version 1.0.0-rc03
4 ডিসেম্বর, 2019
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
নভেম্বর 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
23 অক্টোবর, 2019
androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-rc01
is released with no changes from 1.0.0-beta01
. সংস্করণ 1.0.0-rc01-এ এই কমিট রয়েছে ।
ViewModel-Savedstate Version 1.0.0-beta01
9 অক্টোবর, 2019
androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-beta01
is released. সংস্করণ 1.0.0-beta01-এ এই কমিট রয়েছে ।
বাগ ফিক্স
- Fixed an issue where accessing a SavedState ViewModel for the first time in
Activity.onActivityResult()
would result in anIllegalStateException
. ( b/139093676 ) - Fixed an
IllegalStateException
when usingAbstractSavedStateViewModelFactory
. ( b/141225984 )
ViewModel-SavedState Version 1.0.0-alpha05
সেপ্টেম্বর 18, 2019
androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha05
is released. Version 1.0.0-alpha05 contains these commits .
এপিআই পরিবর্তন
-
SavedStateViewModelFactory
no longer extendsAbstractSavedStateViewModelFactory
andSavedStateHandle
is created only for ViewModels that requested have it ( aosp/1113593 )
ViewModel-SavedState Version 1.0.0-alpha03
7 আগস্ট, 2019
androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha03
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
ব্রেকিং পরিবর্তন
-
lifecycle-viewmodel-savedstate
no longer depends onfragment
and the relatedSavedStateViewModelFactory(Fragment)
andSavedStateViewModelFactory(FragmentActivity)
constructors have been removed. Instead,SavedStateViewModelFactory
is now the default factory for Activity1.1.0-alpha02
, Fragment1.2.0-alpha02
, and Navigation2.2.0-alpha01
. ( b/135716331 )
ViewModel-SavedState Version 1.0.0-alpha02
জুলাই 2, 2019
androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha02
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
নতুন বৈশিষ্ট্য
- Added
SavedStateHandle.getLiveData()
overload which accepts a default value.
এপিআই পরিবর্তন
-
SavedStateVMFactory
is renamed toSavedStateViewModelFactory
. -
AbstractSavedStateVMFactory
is renamed toAbstractSavedStateViewModelFactory
.
ViewModel-Savedstate Version 1.0.0-alpha01
13 মার্চ, 2019
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 factorySavedStateVMFactory
and your ViewModel should have a constructor that receivesSavedStateHandle
object as a parameter.
সংস্করণ 2.1.0
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 hiddenGenericLifecycleObserver
class. - Added ktx extensions for
LiveData.observe
methods andTransformations.*
methods. - Added
Transformations.distinctUntilChanged
, which creates a new LiveData object that does not emit a value until the sourceLiveData
value has been changed. - Added coroutine support in ViewModels by adding the extension property
ViewModel.viewModelScope
.
সংস্করণ 2.1.0
5 সেপ্টেম্বর, 2019
androidx.lifecycle:lifecycle-*:2.1.0
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
সংস্করণ 2.1.0-rc01
জুলাই 2, 2019
androidx.lifecycle:*:2.1.0-rc01
is released with no changes from androidx.lifecycle:*:2.1.0-beta01
. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
সংস্করণ 2.1.0-beta01
7 মে, 2019
androidx.lifecycle:*:2.1.0-beta01
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
নতুন বৈশিষ্ট্য
- 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
3 এপ্রিল, 2019
androidx.lifecycle:*:2.1.0-alpha04
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
এপিআই পরিবর্তন
- Breaking change: the underlying API behind
by viewModels()
andby activityViewModels()
has been changed to support aViewModelStore
directly, rather than only aViewModelStoreOwner
. ( aosp/932932 )
Version 2.1.0-alpha03
13 মার্চ, 2019
androidx.lifecycle:*:2.1.0-alpha03
is released. এই সংস্করণে অন্তর্ভুক্ত প্রতিশ্রুতির সম্পূর্ণ তালিকা এখানে পাওয়া যাবে।
এপিআই পরিবর্তন
-
ViewModelProvider.KeyedFactory
was removed. Second interface in addition toViewModelProvider.Factory
didn't compose well with new features as property delegation in Kotlinby viewmodels {}
. ( aosp/914133 )
সংস্করণ 2.1.0-alpha02
30 জানুয়ারী, 2019
androidx.lifecycle 2.1.0-alpha02
is released.
এপিআই পরিবর্তন
-
LifecycleRegistry
now contains asetCurrentState()
method that replaces the now deprecatedsetState()
method. ( aosp/880715 )
বাগ ফিক্স
- Fixed an issue where mock
ViewModel
instances would crash when the containingViewModelStore
was cleared. b/122273087
সংস্করণ 2.1.0-alpha01
ডিসেম্বর 17, 2018
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 hiddenGenericLifecycleObserver
class. - Added ktx extensions for
LiveData.observe
methods andTransformations.*
methods. - Method
Transformations.distinctUntilChanged
was added. It creates a newLiveData
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 receiveskey
andClass
increate
method.
সংস্করণ 2.0.0
সংস্করণ 2.0.0
সেপ্টেম্বর 21, 2018
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
সংস্করণ 2.0.0-beta01
জুলাই 2, 2018
বাগ ফিক্স
- 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"
}
সংস্করণ 1.1.1
21 মার্চ, 2018
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.
সংস্করণ 1.1.0
জানুয়ারী 22, 2018
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
andLifecycleFragment
have now been removed - please useFragmentActivity
,AppCompatActivity
or supportFragment
. -
@NonNull
annotations have been added toViewModelProviders
andViewModelStores
-
ViewModelProviders
constructor has been deprecated - please use its static methods directly -
ViewModelProviders.DefaultFactory
has been deprecated - please useViewModelProvider.AndroidViewModelFactory
- The static
ViewModelProvider.AndroidViewModelFactory.getInstance(Application)
method has been added to retrieve a staticFactory
suitable for creatingViewModel
andAndroidViewModel
instances.
জীবনচক্র
This table lists all the artifacts in the androidx.lifecycle
group.
আর্টিফ্যাক্ট | স্থিতিশীল রিলিজ | প্রার্থী মুক্তি | বিটা রিলিজ | আলফা রিলিজ |
---|---|---|---|---|
lifecycle-* | 2.8.7 | - | - | 2.9.0-alpha10 |
lifecycle-viewmodel-compose | 2.8.7 | - | - | 2.9.0-alpha10 |
নির্ভরতা ঘোষণা করা
To add a dependency on Lifecycle, you must add the Google Maven repository to your project. আরও তথ্যের জন্য Google এর Maven সংগ্রহস্থল পড়ুন।
আপনার অ্যাপ বা মডিউলের জন্য build.gradle
ফাইলে আপনার প্রয়োজনীয় আর্টিফ্যাক্টগুলির জন্য নির্ভরতা যোগ করুন:
কোটলিন
গ্রোভি
dependencies { def lifecycle_version = "2.8.7" 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" // 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.8.7" 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") // 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.8.7" 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.8.7" 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") }
For more information about dependencies, see Add Build Dependencies .
প্রতিক্রিয়া
আপনার প্রতিক্রিয়া জেটপ্যাককে আরও ভাল করতে সাহায্য করে। আপনি যদি নতুন সমস্যা আবিষ্কার করেন বা এই লাইব্রেরির উন্নতির জন্য ধারনা পান তাহলে আমাদের জানান। আপনি একটি নতুন তৈরি করার আগে অনুগ্রহ করে এই লাইব্রেরিতে বিদ্যমান সমস্যাগুলি দেখুন৷ আপনি তারকা বোতামে ক্লিক করে একটি বিদ্যমান সমস্যায় আপনার ভোট যোগ করতে পারেন।
আরও তথ্যের জন্য ইস্যু ট্র্যাকার ডকুমেন্টেশন দেখুন।
Version 2.9
Version 2.9.0-alpha10
ফেব্রুয়ারি 12, 2025
androidx.lifecycle:lifecycle-*:2.9.0-alpha10
is released. Version 2.9.0-alpha10 contains these commits .
এপিআই পরিবর্তন
- Move
MutableStateSerializer
tosavedstate-compose
fromlifecycle-viewmodel-compose
. ( I4f690 , b/378895074 )
বাহ্যিক অবদান
- Adds a new Lint issue for calling
Lifecycle::currentState
in composition, instead suggesting usingcurrentStateAsalue().value
to ensure that changes in the Lifecycle state correctly cause recomposition. Thanks Steven Schoen! ( Iad484 )
Version 2.9.0-alpha09
জানুয়ারী 29, 2025
androidx.lifecycle:lifecycle-*:2.9.0-alpha09
is released. Version 2.9.0-alpha09 contains these commits .
নতুন বৈশিষ্ট্য
- Add
MutableStateSerializer
for serializingandroidx.compose.runtime.MutableState
. ( Idfc48 , b/378895074 )
এপিআই পরিবর্তন
- Replace overloaded
SavedStateHandle.saved()
delegate functions with default parameters ( Icd1c1 ) -
AbstractSavedStateViewModelFactory
is deprecated as it creates aSavedStateHandle
for everyViewModel
, causing unnecessary overhead. UseViewModelProvider.Factory
withCreationExtras.createSavedStateHandle
instead for more efficientViewModel
creation. ( Ia920b , b/388590327 )
Version 2.9.0-alpha08
11 ডিসেম্বর, 2024
androidx.lifecycle:lifecycle-*:2.9.0-alpha08
is released. Version 2.9.0-alpha08 contains these commits .
নতুন বৈশিষ্ট্য
- Add
ViewModelScenario.recreate
to simulate a System Process Death recreating theViewModel
under test and all associated components. ( Id6a69 , b/381063087 ) -
LifecycleOwner
andViewModelStoreOwner
instances retrieved via their respectivefindViewTree
APIs can now be resolved through disjoint parents of a view, such as aViewOverlay
. See the release notes of core or the documentation inViewTree.setViewTreeDisjointParent
for more information on disjoint view parents. ( I800f4 )
এপিআই পরিবর্তন
- Make the namings and package organization more consistent with
SavedStateRegistryOwnerDelegate
( I8c135 , b/376026744 )
বাগ ফিক্স
- এই লাইব্রেরিটি এখন JSpecify nullness টীকা ব্যবহার করে, যা টাইপ-ব্যবহার। Kotlin developers should use the following compiler arguments to enforce correct usage:
-Xjspecify-annotations=strict, -Xtype-enhancement-improvements-strict-mode
( Ie4340 , b/326456246 ) - Document
ViewModel.onCleared
clearing sequence. ( I586c7 , b/363984116 )
Version 2.9.0-alpha07
13 নভেম্বর, 2024
androidx.lifecycle:lifecycle-*:2.9.0-alpha07
is released. Version 2.9.0-alpha07 contains these commits .
Kotlin Multiplatform Compatibility
- Lifecycle
ViewModel SavedState
is now KMP compatible. This allows you to useSavedStateHandle
in common code. ( Ib6394 , b/334076622 )
KotlinX Serialization Support
With the support of KotlinX Serialization added in SavedState
1.3.0-alpha05
, we have introducedsaved
, a lazy property delegate, to make it easy to store@Serializable
classes in aSavedStateHandle
and have those classes automatically be restored across process death and recreation. Please note thesaved
delegate is lazy and will not call theinit
lambda or save anything into theSavedStateHandle
until it is accessed. ( 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 } }
এপিআই পরিবর্তন
- Add
getMutableStateFlow
toSavedStateHandle
to return aMutableStateFlow
. This new function is key-exclusive and cannot be used withgetLiveData
. An exception will be thrown if you try to use both to access the same state. ( I04a4f , b/375408415 )
Version 2.9.0-alpha06
30 অক্টোবর, 2024
androidx.lifecycle:lifecycle-*:2.9.0-alpha06
is released. Version 2.9.0-alpha06 contains these commits .
আচরণ পরিবর্তন
- The
Lifecycle.DESTROYED
state is terminal, and any attempt to move aLifecycle
from it to any other state will now result in anIllegalStateException
. ( I116c4 , b/370577987 ) -
SavedStateHandle
no longer includes anySavedStateProvider.saveState()
where the returnedBundle
is empty. ( I910b5 , b/370577987 )
বাগ ফিক্স
-
Lifecycle.eventFlow
now correctly complete whenLifecycle
isDESTROYED
( I293b2 , b/374043130 )
Version 2.9.0-alpha05
অক্টোবর 16, 2024
androidx.lifecycle:lifecycle-*:2.9.0-alpha05
is released with no notable changes. Version 2.9.0-alpha05 contains these commits .
Version 2.9.0-alpha04
2 অক্টোবর, 2024
androidx.lifecycle:lifecycle-*:2.9.0-alpha04
is released. Version 2.9.0-alpha04 contains these commits .
কোটলিন মাল্টিপ্ল্যাটফর্ম
- The
lifecycle-viewmodel-savedstate
module is now configured to be KMP compatible in preparation for APIs likeSavedStateHandle
being made available in the common source set in a future release. ( I503ed , I48764 , b/334076622 )
Version 2.9.0-alpha03
সেপ্টেম্বর 18, 2024
androidx.lifecycle:lifecycle-*:2.9.0-alpha03
is released. Version 2.9.0-alpha03 contains these commits .
বাগ ফিক্স
- From Lifecycle
2.8.6
: TheNullSafeMutableLiveData
Lint error has improved support for smart casts, avoiding false positives. ( 85fed6 , b/181042665 )
নির্ভরতা আপডেট
- From Lifecycle
2.8.6
: Lifecycle Runtime Compose now depends on Compose Runtime1.7.1
- Lifecycle Runtime now depends on ProfileInstaller
1.4.0
Version 2.9.0-alpha02
4 সেপ্টেম্বর, 2024
androidx.lifecycle:lifecycle-*:2.9.0-alpha02
is released. Version 2.9.0-alpha02 contains these commits .
বাগ ফিক্স
- From Lifecycle
2.8.5
: Update theandroidx.lifecycle.ReportFragment
ProGuard rules to allow obfuscation . ( ff898e1 )
বাহ্যিক অবদান
- Move
androidx.compose.ui.platform.LocalLifecycleOwner
to common source set (KMP). Thanks Ivan Matkov from JetBrains for the contribution. ( 8cd5d03 ) - From Lifecycle
2.8.5
: SavedStateHandle.saveable` extension delegate now supports nullable values. Thanks Roman Kalukiewicz for the contribution. ( 0d78ea6 )
Version 2.9.0-alpha01
7 আগস্ট, 2024
androidx.lifecycle:lifecycle-*:2.9.0-alpha01
is released. Version 2.9.0-alpha01 contains these commits .
কোটলিন মাল্টিপ্ল্যাটফর্ম
-
lifecycle-testing
is now KMP compatible. ( Iea41e ) - Add support for
linuxArm64
kotlin multiplatform target ( I139d3 , b/338268719 )
নতুন বৈশিষ্ট্য
- A new
androidx.lifecycle:lifecycle-viewmodel-testing
KMP artifact is available that provides aViewModelScenario
class for testing ViewModels in isolation, with support foronCleared
(all platforms) andSavedStateHandle
(Android only). ( 337f68d , c9b3409 , 9799a95c , b/264602919 ) - Creating a
ViewModel
withViewModelProvider
is now thread safe;@MainThread
annotations have been removed. ( Ifd978 , b/237006831 )
এপিআই পরিবর্তন
- Add the
CreationExtras.Key()
factory function to simplify the creation of anonymousCreationExtras.Key
objects. ( I970ee ) -
CreationExtras
now includes map-like operator overloads to enable idiomatic manipulation of content in Kotlin. It allows the use ofin
,+=
, and+
withCreationExtras
. ( Ib4353 ) -
CreationExtras
now implementsequals
,hashCode
, andtoString
methods. ( Ib4353 ) -
NewInstanceFactory
is now available on JVM Desktop and Android targets. ( d3d0892 ) - Inline extension property to expose underlying Application safely in Kotlin language version 2.0 ( I39df2 )
বাগ ফিক্স
- নতুন প্ল্যাটফর্ম API-এ অ্যাক্সেসের ম্যানুয়াল রূপরেখা সরানো হয়েছে যেহেতু AGP 7.3 বা তার পরে (যেমন R8 সংস্করণ 3.3) এবং AGP 8.1 বা তার পরবর্তী (যেমন D8 সংস্করণ 8.1) ব্যবহার করার সময় R8 ব্যবহার করার সময় এটি স্বয়ংক্রিয়ভাবে API মডেলিংয়ের মাধ্যমে ঘটে। যে সকল ক্লায়েন্ট AGP ব্যবহার করছেন না তাদের D8 সংস্করণ 8.1 বা তার পরবর্তী সংস্করণে আপডেট করার পরামর্শ দেওয়া হচ্ছে। আরো বিস্তারিত জানার জন্য এই নিবন্ধটি দেখুন. ( if6b4c , b/345472586 )
সংস্করণ 2.8
Version 2.8.7
30 অক্টোবর, 2024
androidx.lifecycle:lifecycle-*:2.8.7
is released. Version 2.8.7 contains these commits .
এপিআই পরিবর্তন
-
androidx.compose.ui.platform.LocalLifecycleOwner
is now available in the common source set (KMP). ( 6a3f5b3 ) -
lifecycle-runtime-compose
:desktop
artifacts were removed and-jvmStubs
and-linuxx64Stubs
artifacts were added. এই লক্ষ্যগুলির কোনটিই ব্যবহার করার জন্য নয়, তারা জেটব্রেইন রচনার প্রচেষ্টাকে সাহায্য করার জন্য স্থানধারক। ( 6a3f5b3 )
সংস্করণ 2.8.6
সেপ্টেম্বর 18, 2024
androidx.lifecycle:lifecycle-*:2.8.6
is released. Version 2.8.6 contains these commits .
বাগ ফিক্স
- The
NullSafeMutableLiveData
Lint error has improved support for smart casts, avoiding false positives. ( 85fed6 , b/181042665 )
নির্ভরতা আপডেট
- Lifecycle Runtime Compose now depends on Compose Runtime
1.7.1
সংস্করণ 2.8.5
4 সেপ্টেম্বর, 2024
androidx.lifecycle:lifecycle-*:2.8.5
is released. Version 2.8.5 contains these commits .
বাগ ফিক্স
- Update the
androidx.lifecycle.ReportFragment
ProGuard rules to allow obfuscation . ( ff898e1 )
বাহ্যিক অবদান
-
SavedStateHandle.saveable
extension delegate now supports nullable values. Thanks Roman Kalukiewicz for the contribution. ( 0d78ea6 )
Version 2.8.4
জুলাই 24, 2024
androidx.lifecycle:lifecycle-*:2.8.4
is released. Version 2.8.4 contains these commits .
বাগ ফিক্স
-
LiveData.asFlow()
now correctly handles cases where the returned Flow is immediately completed after receiving a value already set on theLiveData
(for example, when usingtake(1)
). ( I9c566 ) -
Lifecycle*Effect
completion is now idempotent (ie, if theonStopOrDispose
was called because of the Lifecycle being stopped, it won't be called a second time upon disposal unless the Lifecycle goes back up toSTARTED
again). ( I5f607 , b/352364595 )
সংস্করণ 2.8.3
জুলাই 1, 2024
androidx.lifecycle:lifecycle-*:2.8.3
is released. Version 2.8.3 contains these commits .
বাগ ফিক্স
- Fixed an issue with Lifecycle 2.8's backward compatibility with Compose 1.6.0 and lower when using code shrinking. ( aosp/3133056 , b/346808608 )
সংস্করণ 2.8.2
জুন 12, 2024
androidx.lifecycle:lifecycle-*:2.8.2
is released. Version 2.8.2 contains these commits .
বাগ ফিক্স
- Fixed
CompositionLocal LocalLifecycleOwner not present
errors when using Lifecycle 2.8.X with Compose 1.6.X or earlier - you can now use Lifecycle 2.8.2 with any version of Compose without any workarounds required. ( aosp/3105647 , b/336842920 ) -
ViewModelProvider
will no longer crash when mixing previous versions ofcompileOnly
Lifecycle dependencies with versions 2.8+, fixing issues with libraries such as LeakCanary. ( I80383 , b/341792251 )
সংস্করণ 2.8.1
29 মে, 2024
androidx.lifecycle:lifecycle-*:2.8.1
is released. Version 2.8.1 contains these commits .
বাগ ফিক্স
-
lifecycle-viewmodel-compose
now only has a common dependency oncompose-runtime
, removing its common dependency oncompose-ui
. The Android artifact retains itscompose-ui
for compatibility. ( aosp/3079334 , b/339562627 ) -
ViewModel
'ssaveable
integration using property delegates now uses the class name as part of the auto-generated key, avoiding conflicts if multiple classes use the sameSavedStateHandle
. ( aosp/3063463 )
সংস্করণ 2.8.0
14 মে, 2024
androidx.lifecycle:lifecycle-*:2.8.0
is released. Version 2.8.0 contains these commits .
Important changes since 2.7.0
-
LocalLifecycleOwner
has been moved from Compose UI tolifecycle-runtime-compose
so that its Compose-based helper APIs can be used outside of Compose UI. - The
lifecycle-runtime-compose
artifact now contains thedropUnlessResumed
anddropUnlessStarted
APIs which allow you to drop click or other events that occur even after theLifecycleOwner
has dropped below the givenLifecycle.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) }
ViewModel.viewModelScope
is now an overridable constructor parameter, allowing you to inject your own dispatcher andSupervisorJob()
or to override the default by using thebackgroundScope
available withinrunTest
. ( 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
has been rewritten in Kotlin and now usesAutoClosable
instead ofCloseable
. It now supports addingAutoCloseable
objects with akey
that allows retrieving them viagetCloseable()
.Calling
LifecycleStartEffect
andLifecycleResumeEffect
without a key is now an error, following the same convention as theDisposableEffect
API that these APIs mirror.Deprecated
LiveDataReactiveStreams.toPublisher(lifecycleOwner, liveData)
in favor ofLiveData.toPublisher(lifecycleOwner)
.The
lifecycle-livedata-core-ktx
kotlin extensions have now been moved to thelifecycle-livedata-core
module.The
NullSafeMutableLiveData
has been refactored to avoid many false positives.
Lifecycle 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.
Artifacts impacted:
-
lifecycle-common
moves most APIs tocommon
and supports jvm and iOS in addition to Android. -
lifecycle-runtime
moves most APIs tocommon
and supports jvm and iOS in addition to Android. -
lifecycle-runtime-ktx
is now empty, with all APIs being moved intolifecycle-runtime
. -
lifecycle-runtime-compose
moves all APIs tocommon
and ships an Android artifact, matching the multiplatform support ofandroidx.compose
.
ViewModel Kotlin Multiplatform Compatibility
The lifecycle-viewmodel
artifact and APIs like ViewModel
, ViewModelStore
, ViewModelStoreOwner
, and ViewModelProvider
are now shipped in artifacts compatible with Kotlin Multiplatform.
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 theViewModelProvider.create()
methods rather than directly calling its constructor. -
ViewModelProvider.NewInstanceFactory
andViewModelProvider.AndroidViewModelFactory
are only available on Android.- Custom Factories are recommended to extend from
ViewModelProvider.Factory
and use thecreate
method that takes aCreationExtras
or use theviewModelFactory
Kotlin DSL.
- Custom Factories are recommended to extend from
- Using
ViewModelProvider
without a custom factory on non-JVM platforms will result in anUnsupportedOperationException
. On JVM platforms, compatibility is preserved by using the no-args ViewModel constructor if a custom factory is not provided. -
viewModelScope
will fallback to anEmptyCoroutineContext
in platforms whereDispatchers.Main
is not available (eg, Linux).
Artifacts impacted:
-
lifecycle-viewmodel
moves most APIs tocommon
and supports jvm and iOS in addition to Android. -
lifecycle-viewmodel-ktx
is now empty, with all APIs being moved intolifecycle-viewmodel
. -
lifecycle-viewmodel-compose
moves all APIs tocommon
and ships an Android artifact, matching the multiplatform support ofandroidx.compose
.
আচরণ পরিবর্তন
-
InitializerViewModelFactory
(includingviewModelFactory
builder function) will now throw anIllegalArgumentException
if ainitializer
with the sameclazz: KClass<VM : ViewModel>
has already been added. ( Ic3a36 )
পরিচিত সমস্যা
-
lifecycle-*:2.8.0
requires a minimum Compose version of 1.7.0-alpha05 ( b/336842920 ).
Version 2.8.0-rc01
1 মে, 2024
androidx.lifecycle:lifecycle-*:2.8.0-rc01
is released. Version 2.8.0-rc01 contains these commits .
বাগ ফিক্স
- Fixed an issue where the Baseline Profile for
lifecycle-common
classes was not properly packaged. These are now packaged in thelifecycle-runtime
AAR. ( aosp/3038274 , b/322382422 ) - Fixed an unintentional ordering change in how
AutoCloseable
instances attached to a ViewModel are cleared - the previous order ofaddCloseable(String, AutoCloseable)
, thenaddClosable(AutoCloseable)
, thenonCleared()
has been restored. ( aosp/3041632 ) - Improve the default creation behavior for
viewModelScope
for native and JVM Desktop environments. ( aosp/3039221 )
বাহ্যিক অবদান
- Thanks Victor Kropp for improving the checking for the main thread on JVM Desktop. ( aosp/3037116 )
Version 2.8.0-beta01
এপ্রিল 17, 2024
androidx.lifecycle:lifecycle-*:2.8.0-beta01
is released. Version 2.8.0-beta01 contains these commits .
নতুন বৈশিষ্ট্য
- The
lifecycle-runtime-compose
artifact is now compatible with Kotlin Multiplatform, moving its code tocommon
and ships an Android artifact, matching the multiplatform support forandroidx.compose
. ( If7a71 , I4f4a0 , b/331769623 )
Version 2.8.0-alpha04
3 এপ্রিল, 2024
androidx.lifecycle:lifecycle-*:2.8.0-alpha04
is released. Version 2.8.0-alpha04 contains these commits .
নতুন বৈশিষ্ট্য
- The
lifecycle-viewmodel-compose
artifact is now compatible with Kotlin Multiplatform, moving its code tocommon
and ships an Android artifact, matching the multiplatform support ofandroidx.compose
. The accommodate this change, the ComposableviewModel
method now accepts aKClass
in addition to ajava.lang.Class
. ( b/330323282 )
বাগ ফিক্স
- The
NullSafeMutableLiveData
has been refactored to avoid many false positives. ( I2d8c1 , Iafb18 , I03463 , I7ecef )
Dependency update
- The
lifecycle-viewmodel-compose
artifact now depends on Compose 1.6.0. - Lifecycle now depends on Profile Installer 1.3.1 .
Version 2.8.0-alpha03
20 মার্চ, 2024
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 andSupervisorJob()
or to override the default by using thebackgroundScope
available withinrunTest
. ( 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 theViewModelProvider.create()
methods rather than directly calling its constructor. -
ViewModelProvider.NewInstanceFactory
andViewModelProvider.AndroidViewModelFactory
are only available on Android.- Custom Factories are recommended to extend from
ViewModelProvider.Factory
and use thecreate
method that takes aCreationExtras
or use theviewModelFactory
Kotlin DSL.
- Custom Factories are recommended to extend from
- Using
ViewModelProvider
without a custom factory on non-JVM platforms will result in anUnsupportedOperationException
. On JVM platforms, compatibility is preserved by using the no-args ViewModel constructor if a custom factory is not provided. -
viewModelScope
will fallback to anEmptyCoroutineContext
in platforms whereDispatchers.Main
is not available (eg, Linux).
আচরণ পরিবর্তন
-
InitializerViewModelFactory
(includingviewModelFactory
builder function) will now throw anIllegalArgumentException
if ainitializer
with the sameclazz: KClass<VM : ViewModel>
has already been added. ( Ic3a36 )
বাগ ফিক্স
-
ViewModel.getCloseable
now handles duplicated keys: if thekey
already has anAutoCloseable
resource associated with it, the old resource will be replaced and closed immediately. ( Ibeb67 ) - Accessing the
viewModelScope
of aViewModel
is now thread safe. ( If4766 , b/322407038 )
বাহ্যিক অবদান
-
LocalLifecycleOwner
কম্পোজ UI থেকে লাইফসাইকেল-রানটাইম-কম্পোজে স্থানান্তরিত হয়েছে যাতে এর রচনা-ভিত্তিক সহায়ক APIগুলি রচনা UI এর বাইরে ব্যবহার করা যেতে পারে। অবদানের জন্য ধন্যবাদ Jake Wharton. ( I6c41b , b/328263448 )
Version 2.8.0-alpha02
21 ফেব্রুয়ারি, 2024
androidx.lifecycle:lifecycle-*:2.8.0-alpha02
is released. Version 2.8.0-alpha02 contains these commits.
নতুন বৈশিষ্ট্য
- The
dropUnlessResumed
anddropUnlessStarted
APIs have been added which allow you to drop click or other events that occur even after theLifecycleOwner
has dropped below the givenLifecycle.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 )
কোটলিন রূপান্তর
-
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
, andLifecycleRegistry
are now shipped in artifacts compatible with Kotlin Multiplatform. ( b/317249252 )
এপিআই পরিবর্তন
- Calling
LifecycleStartEffect
andLifecycleResumeEffect
without a key is now an error, following the same convention as theDisposableEffect
API that these APIs mirror. ( Ib0e0c , b/323518079 ) -
ViewModel
now usesAutoCloseable
instead ofCloseable
. That is a backward compatible change. ( I27f8e , b/214568825 ) - Deprecated
LiveDataReactiveStreams.toPublisher(lifecycleOwner, liveData)
in favor ofLiveData.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
24 জানুয়ারী, 2024
androidx.lifecycle:lifecycle-*:2.8.0-alpha01
is released. Version 2.8.0-alpha01 contains these commits.
নতুন বৈশিষ্ট্য
-
ViewModel
now supports addingCloseable
objects with akey
that allows retrieving them viagetCloseable()
. ( I3cf63 )
সংস্করণ 2.7
সংস্করণ 2.7.0
জানুয়ারী 10, 2024
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 functionsetCurrentState()
which ensures that the state change and allLifecycleObserver
callbacks are completed before returning. Notably, unlike setting thecurrentState
property directly, this does not userunBlocking
, making it safe to use within a coroutine such as one provided byrunTest
. - The
LiveData
extensions ofmap
andswitchMap
now mirror the behavior ofdistinctUntilChanged
- if theLiveData
has avalue
set, themap
/switchMap
function will be immediately called to populate thevalue
of the returnedLiveData
. This ensures that the initial value will be set as part of the first composition (when used withobserveAsState()
), but does not change the observation behavior - updates values from the sourceLiveData
will still only apply once you start observing theLiveData
. - This release fixes an issue where
SavedStateHandle
would not properly restore customParcelable
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 onget
,getLiveData
, andgetStateFlow
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 aFlow
ofLifecycle.Event
via theLifecycle.asFlow()
extension method. - Jetpack Compose users can now use
LifecycleEventEffect
to run Compose side effects based onLifecycle.Event
.
@Composable
fun HomeScreen(viewModel: HomeViewModel = viewModel()) {
LifecycleEventEffect(Lifecycle.Event.ON_RESUME) {
viewModel.refreshData()
}
// …
}
- Jetpack Compose users can use
LifecycleStartEffect
andLifecycleResumeEffect
to handle pairs of events - started to stopped and resumed to paused, respectively. This API mirrors the one found inDisposableEffect
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 theLifecycle.currentStateFlow
property, which returns aStateFlow
where thevalue
is the currentLifecycle.State
. - Jetpack Compose users can use the
Lifecycle.currentStateAsState()
extension to directly exposeLifecycle.State
as ComposeState
. This is equivalent (and a shorter alternative) tolifecycle.currentStateFlow.collectAsState()
.
See Collect lifecycle state with flows for more information.
Version 2.7.0-rc02
13 ডিসেম্বর, 2023
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 customParcelable
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 onget
,getLiveData
, andgetStateFlow
now specifically calls this limitation out. ( I0b55a )
Version 2.7.0-rc01
15 নভেম্বর, 2023
androidx.lifecycle:lifecycle-*:2.7.0-rc01
is released. Version 2.7.0-rc01 contains these commits.
বাগ ফিক্স
-
LifecycleStartEffect
andLifecycleResumeEffect
now correctly dispose and recreate the effect block if theLifecycleOwner
is changed. ( Ia25c6 )
Version 2.7.0-beta01
নভেম্বর 1, 2023
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
18 অক্টোবর, 2023
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 theLifecycle.State
of theTestLifecycleOwner
by using thecurrentState
field when inside of a coroutine. The Lint check now suggests the suspendingsetCurrentState
which allows setting theLifecycle.State
without blocking. ( Icf728 , b/297880630 )
বাগ ফিক্স
- Fixed an issue with
LiveData.switchMap
where returning the sameLiveData
instance both on the initial call and a subsequent call would prevent theLiveData
instance from being added as a source. ( Ibedcba7 )
Version 2.7.0-alpha02
6 সেপ্টেম্বর, 2023
androidx.lifecycle:lifecycle-*:2.7.0-alpha02
is released. Version 2.7.0-alpha02 contains these commits.
নতুন বৈশিষ্ট্য
-
TestLifecycleOwner
now includes the suspending functionsetCurrentState()
to give users the option of usingTestLifecycleOwner
from within a coroutine such as one provided byrunTest
. ( I329de , b/259344129 )
এপিআই পরিবর্তন
- All files from the
lifecycle-livedata-ktx
modules have been moved into the mainlifecycle-livedata
module. ( I10c6f , b/274800183 )
আচরণ পরিবর্তন
- The
LiveData.map()
andLiveData.switchMap()
extensions now sets thevalue
of the returnedLiveData
if the previousLiveData
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
'saddCloseable()
now immediately closes theCloseable
if theViewModel
has already received a call toonCleared()
. ( I4712e , b/280294730 )
বাগ ফিক্স
- From Lifecycle
2.6.2
: Fixed an issue whereSavedStateHandle
would not correctly be restored after process death if the state was restored,save()
was called without actually saving the state in the parentSavedStateRegistry
, and then the state was restored again. This fixes the interaction betweenrememberSaveable
and Navigation Compose'sNavHost
. ( aosp/2729289 )
Version 2.7.0-alpha01
জুলাই 26, 2023
androidx.lifecycle:lifecycle-*:2.7.0-alpha01
is released. Version 2.7.0-alpha01 contains these commits.
এপিআই পরিবর্তন
-
Lifecycle.State
is now Compose-observable viaLifecycle.currentStateFlow
, which returns aStateFlow
where thevalue
is the currentLifecycle.State
. ( Ib212d , b/209684871 ) -
Lifecycle.Event
s can now able to be observed as aFlow
withLifecycle.asFlow().
( If2c0f , b/176311030 ) -
LifecycleResumeEffect
API has been added to run ComposeSideEffect
s based on bothLifecycle.Event.ON_RESUME
andLifecycle.Event.ON_PAUSE
event callbacks. ( I60386 , b/235529345 ) -
LifecycleStartEffect
API has been added to run ComposeSideEffect
s based onLifecycle.Event.ON_START
andLifecycle.Event.ON_STOP
event callbacks. ( I5a8d1 , b/235529345 ) -
LifecycleEventEffect
API has been added to run ComposeSideEffect
s based onLifecycle.Event
. ( Ic9794 , b/235529345 ) -
Lifecycle.collectAsState()
extension has been added to directly exposeLifecycle.State
as ComposeState
. This is equivalent (and a shorter alternative) tolifecycle.currentStateFlow.collectAsState()
. ( I11015 , b/235529345 )
বাগ ফিক্স
- The
LiveData.distinctUntilChanged()
extension now sets thevalue
of the returnedLiveData
if the previousLiveData
has had a value set on it. This does not change the observation behavior - updated values from the sourceLiveData
will still only apply once you start observing theLiveData
returned fromdistinctUntilChanged()
. ( 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 )
সংস্করণ 2.6
সংস্করণ 2.6.2
6 সেপ্টেম্বর, 2023
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 parentSavedStateRegistry
, and then the state was restored again. This fixes the interaction betweenrememberSaveable
and Navigation Compose'sNavHost
. ( aosp/2729289 )
সংস্করণ 2.6.1
22 মার্চ, 2023
androidx.lifecycle:lifecycle-*:2.6.1
is released. Version 2.6.1 contains these commits.
নির্ভরতা আপডেট
-
lifecycle-viewmodel-savedstate
now depends on SavedState1.2.1
. ( cd7251 ) - Lifecycle now depends on ProfileInstaller
1.3.0
. ( f9d30b )
সংস্করণ 2.6.0
8 মার্চ, 2023
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 newisInitialized
property that indicates whether an explicit value has ever been set on theLiveData
, allowing you to distinguish betweenliveData.value
returningnull
because no value has ever been set or an explicitnull
value. -
MediatorLiveData
now includes a constructor to set an initial value. - Added a new extension on
StateFlow
andFlow
ofcollectAsStateWithLifecycle()
that collect from flows and represents its latest value as Compose State in a lifecycle-aware manner. -
Lifecycle.launchWhenX
methods andLifecycle.whenX
methods have been deprecated as the use of a pausing dispatcher can lead to wasted resources in some cases. It is recommended to useLifecycle.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 aObserver
created in Kotlin now matches the nullability of the generic type. If you wantObserver.onChanged()
to accept a nullable type, you must instantiate theObserver
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
, andProcessLifecycleOwner
Version 2.6.0-rc01
22 ফেব্রুয়ারি, 2023
androidx.lifecycle:lifecycle-*:2.6.0-rc01
is released. Version 2.6.0-rc01 contains these commits.
বাগ ফিক্স
- The
LiveData.distinctUntilChanged()
extension now sets thevalue
of the returnedLiveData
if the previousLiveData
has had a value set on it. This does not change the observation behavior - updated values from the sourceLiveData
will still only apply once you start observing theLiveData
returned fromdistinctUntilChanged()
. ( Ib482f )
Version 2.6.0-beta01
ফেব্রুয়ারী 8, 2023
androidx.lifecycle:lifecycle-*:2.6.0-beta01
is released. Version 2.6.0-beta01 contains these commits.
কোটলিন রূপান্তর
-
LifecycleOwner
is now written in Kotlin. This is a source incompatible change for classes written in Kotlin - they must now override thelifecycle
property rather than implementing the previousgetLifecycle()
function. ( I75b4b , b/240298691 ) -
ViewModelStoreOwner
is now in Kotlin. This is a source incompatible change for classes written in Kotlin - they must now override theviewModelStore
property rather than implementing the previousgetViewModelStore()
function. ( I86409 , b/240298691 ) - The Kotlin extension on
LifecycleOwner
that provides thelifecycleScope
field has been moved to thelifecycle-common
artifact fromlifecycle-runtime-ktx
. ( I41d78 , b/240298691 ) - The Kotlin extension on
Lifecycle
that provides thecoroutineScope
field has been moved to thelifecycle-common
artifact fromlifecycle-runtime-ktx
. ( Iabb91 , b/240298691 )
Version 2.6.0-alpha05
25 জানুয়ারী, 2023
androidx.lifecycle:lifecycle-*:2.6.0-alpha05
is released. Version 2.6.0-alpha05 contains these commits.
কোটলিন রূপান্তর
-
Transformations
is now written in Kotlin. This is a source incompatible change for those classes written in Kotlin that were directly using syntax such asTransformations.map
- Kotlin code must now use the Kotlin extension method syntax that was previously only available when usinglifecycle-livedata-ktx
. When using the Java programming language, the versions of these methods that take anandroidx.arch.core.util.Function
method are deprecated and replaced with the versions that take a KotlinFunction1
. 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 onView
ofandroidx.lifecycle.setViewTreeViewModelStoreOwner
andandroidx.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 thedefaultViewModelProviderFactory
anddefaultViewModelCreationExtras
properties rather than implementing the previous corresponding functions. ( Iaed9c , b/240298691 ) -
Observer
is now written in Kotlin. ItsonChanged()
method now uses the namevalue
for its parameter. ( Iffef2 , I4995e , b/240298691 ) -
AndroidViewModel
,AbstractSavedStateViewModelFactory
,LifecycleService
,ServiceLifecycleDispatcher
, andProcessLifecycleOwner
are now written in Kotlin ( I2e771 , Ibae40 , I160d7 , I08884 , I1cda7 , b/240298691 )
Version 2.6.0-alpha04
11 জানুয়ারী, 2023
androidx.lifecycle:lifecycle-*:2.6.0-alpha04
is released. Version 2.6.0-alpha04 contains these commits.
নতুন বৈশিষ্ট্য
-
LiveData
now includes a newisInitialized
property that indicates whether an explicit value has ever been set on theLiveData
, allowing you to distinguish betweenliveData.value
returningnull
because no value has ever been set or an explicitnull
value. ( Ibd018 )
এপিআই পরিবর্তন
- The
collectAsStateWithLifecycle()
APIs oflifecycle-runtime-compose
are no longer in experimental status. ( I09d42 , b/258835424 ) -
Lifecycle.launchWhenX
methods andLifecycle.whenX
methods have been deprecated as the use of a pausing dispatcher can lead to wasted resources in some cases. It is recommended to useLifecycle.repeatOnLifecycle
. ( Iafc54 , b/248302832 )
কোটলিন রূপান্তর
-
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 onView
ofandroidx.lifecycle.setViewTreeLifecycleOwner
andandroidx.lifecycle.findViewTreeLifecycleOwner
to set and find a previously set owner. This replaces the previous Kotlin extension inlifecycle-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 inlifecycle-reactivestreams-ktx
have been moved into thelifecycle-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
, andViewModelStore
are now written in Kotlin ( Iadffd , ( I60034 , I8c52c , I9593d , I01fe1 , I59a23 , b/240298691 )
বাগ ফিক্স
-
SavedStateHandle
no longer crashes with aClassCastException
when callingget()
with the incorrect class type. ( I6ae7c )
Version 2.6.0-alpha03
24 অক্টোবর, 2022
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
7 সেপ্টেম্বর, 2022
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 acallbackFlow
rather than using its ownChannel
implementation to ensure thread-safety and context preservation. ( I4a8b2 , b/200596935 ) -
FlowLiveData
'sasLiveData
function will now preserve the initial value of aStateFlow
when creating the newLiveData
object. ( I3f530 , b/157380488 ) - From Lifecycle
2.5.1
: Custom implementations ofAndroidViewModelFactory
now correctly calls thecreate(modelClass)
function when using the stateful constructor withLifecycle
2.4+ ( I5b315 , b/238011621 )
Version 2.6.0-alpha01
জুন 29, 2022
androidx.lifecycle:lifecycle-*:2.6.0-alpha01
is released. Version 2.6.0-alpha01 contains these commits.
নতুন বৈশিষ্ট্য
- Added a new extension on
StateFlow
andFlow
ofcollectAsStateWithLifecycle
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 certainLifecycle.State
. When the lifecycle falls below thatLifecycle.State
, the flow collection stops and the State's value is not updated. ( I1856e , b/230557927 )
সংস্করণ 2.5
সংস্করণ 2.5.1
জুলাই 27, 2022
androidx.lifecycle:lifecycle-*:2.5.1
is released. Version 2.5.1 contains these commits.
বাগ ফিক্স
- Custom implementations of
AndroidViewModelFactory
now correctly call thecreate(modelClass)
function when using the statefulAndroidViewModelFactory
constructor withLifecycle
2.4+. ( I5b315 , b/238011621 )
সংস্করণ 2.5.0
জুন 29, 2022
androidx.lifecycle:lifecycle-*:2.5.0
is released. Version 2.5.0 contains these commits.
Important changes since 2.4.0
SavedStateHandle
now offers agetStateFlow()
API that returns a KotlinStateFlow
for monitoring value changes as an alternative to usingLiveData
.ViewModel CreationExtras - when writing a custom
ViewModelProvider.Factory
, it is no longer required to extendAndroidViewModelFactory
orAbstractSavedStateViewModelFactory
to gain access to anApplication
orSavedStateHandle
, respectively. Instead, these fields are provided to everyViewModelProvider.Factory
subclass asCreationExtras
via the new overload ofcreate
:create(Class<T>, CreationExtras)
. These extras are provided automatically by your Activity or Fragment when using Activity1.5.0
and Fragment1.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 aviewModelFactory
Kotlin DSL that allows you define yourViewModelProvider.Factory
in terms of one or more lambda initializers, one for each particularViewModel
class your custom factory supports, usingCreationExtras
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 aviewModel()
API that takes a lambda factory for creating aViewModel
instance without requiring the creation of a customViewModelProvider.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 inSavedStateHandle.saveable
that allowrememberSaveable
like behavior backed by theSavedStateHandle
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 moreCloseable
objects to theViewModel
that will be closed when theViewModel
is cleared without requiring any manual work inonCleared()
.For instance, to create a coroutine scope that you can inject into a ViewModel, but control via testing, you can create a
CoroutineScope
that implementsCloseable
: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 asviewModelScope
: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
fromINITIALIZED
toDESTROYED
will now always throw anIllegalStateException
regardless of whether theLifecycle
has an attached observer. -
LifecycleRegistry
will now clear their observers when they reach theDESTROYED
state.
Version 2.5.0-rc02
15 জুন, 2022
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
11 মে, 2022
androidx.lifecycle:lifecycle-*:2.5.0-rc01
is released. Version 2.5.0-rc01 contains these commits.
বাগ ফিক্স
-
MediatorLiveData.addSource()
now throws aNullPointerException
when passed anull
source instead of propagating thenull
source to observers.( Ibd0fb , b/123085232 )
Version 2.5.0-beta01
20 এপ্রিল, 2022
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 theSavedStateHandle
( I8bb86 , b/225014345 )
বাগ ফিক্স
- Fixed an issue where nesting one
NavHost
within anotherNavHost
in a non-primary bottom navigation tab would lead to anIllegalStateException
when using multiple back stacks. ( I11bd5 , b/228865698 )
Version 2.5.0-alpha06
6 এপ্রিল, 2022
androidx.lifecycle:lifecycle-*:2.5.0-alpha06
is released. Version 2.5.0-alpha06 contains these commits.
নতুন বৈশিষ্ট্য
- Add experimental
MutableState
overload toSavedStateHandle.saveable
for parity withrememberSaveable
( I38cfe , b/224565154 )
এপিআই পরিবর্তন
-
CreationExtras
is now abstract instead of sealed. ( Ib8a7a )
বাগ ফিক্স
- Fixed an
IllegalStateException: Already attached to lifecycleOwner
error caused bySavedStateHandleController
. ( I7ea47 , b/215406268 )
Version 2.5.0-alpha05
23 মার্চ, 2022
androidx.lifecycle:lifecycle-*:2.5.0-alpha05
is released. Version 2.5.0-alpha05 contains these commits.
নতুন বৈশিষ্ট্য
- The
lifecycle-viewmodel-compose
module now providesSavedStateHandleSaver
, an experimental API that ensures values in aSavedStateHandle
are integrated correctly with the same saved instance state thatrememberSaveable
uses. ( Ia88b7 , b/195689777 )
এপিআই পরিবর্তন
- Fixed a compatibility issue with Lifecycle 2.3 and newer Lifecycle versions in Java. ( I52c8a , b/219545060 )
বাগ ফিক্স
-
SavedStateViewFactory
now supports usingCreationExtras
even when it was initialized with aSavedStateRegistryOwner
. If extras are provided, the initialized arguments are ignored. ( I6c43b , b/224844583 )
Version 2.5.0-alpha04
9 মার্চ, 2022
androidx.lifecycle:lifecycle-*:2.5.0-alpha04
is released. Version 2.5.0-alpha04 contains these commits.
এপিআই পরিবর্তন
-
SavedStateHandle
now offers agetStateFlow()
API that returns a KotlinStateFlow
for monitoring value changes as an alternative to usingLiveData
. ( Iad3ab , b/178037961 )
Version 2.5.0-alpha03
23 ফেব্রুয়ারি, 2022
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 moreCloseable
objects to theViewModel
that will be closed when theViewModel
is cleared without requiring any manual work inonCleared()
. ( I55ea0 ) -
lifecycle-viewmodel
now provides anInitializerViewModelFactory
that allows you to add lambda for handling particularViewModel
classes, usingCreationExtras
as the primary data source. ( If58fc , b/216687549 ) -
lifecycle-viewmodel-compose
now offers aviewModel()
API that takes a lambda factory for creating aViewModel
instance without requiring the creation of a customViewModelProvider.Factory
. ( I97fbb , b/216688927 )
এপিআই পরিবর্তন
- You can now create a
ViewModel
withCreationExtras
vialifecycle-viewmodel-compose
. ( I08887 , b/216688927 )
আচরণ পরিবর্তন
- Attempting to move the
Lifecycle.State
fromINITIALIZED
toDESTROYED
will now always throw anIllegalStateException
regardless of whether theLifecycle
has an attached observer. ( I7c390 , b/177924329 ) -
LifecycleRegistry
will now clear their observers when they reach theDESTROYED
state. ( I4f8dd , b/142925860 )
Version 2.5.0-alpha02
ফেব্রুয়ারী 9, 2022
androidx.lifecycle:lifecycle-*:2.5.0-alpha02
is released. Version 2.5.0-alpha02 contains these commits.
এপিআই পরিবর্তন
-
SavedStateHandle
andSavedStateViewModelFactory
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
: Updatedlifecycle-process
to depend on Startup 1.1.1 to ensure that fixes that preventProcessLifecycleInitializer
from throwing aStartupException
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 aViewModel
. ( I340f7 , b/177667711 ) - You can now create a view model via
CreationExtras
using theAndroidViewModelFactory
without setting an application. ( I6ebef , b/217271656 )
Version 2.5.0-alpha01
জানুয়ারী 26, 2022
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
: thisString
provides access to the custom key you passed toViewModelProvider.get()
. -
ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY
provides access to theApplication
class. -
SavedStateHandleSupport.SAVED_STATE_REGISTRY_OWNER_KEY
provides access to theSavedStateRegistryOwner
that is being used to construct this ViewModel. -
SavedStateHandleSupport.VIEW_MODEL_STORE_OWNER_KEY
provides access to theViewModelStoreOwner
that is being used to construct this ViewModel. -
SavedStateHandleSupport.DEFAULT_ARGS_KEY
provides access to theBundle
of arguments that should be used to construct aSavedStateHandle
.
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 theSavedStateHandle
. 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 )
সংস্করণ 2.4
সংস্করণ 2.4.1
ফেব্রুয়ারী 9, 2022
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 aSavedStateHandle
would re-appear after process death and recreation, even if it was specifically removed from theSavedStateHandle
. 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 usingProcessLifecycleInitializer
would cause anStartupException
. ( b/216490724 )
সংস্করণ 2.4.0
27 অক্টোবর, 2021
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
orDefaultLifecycleObserver
should be used instead. -
androidx.lifecycle:lifecycle-viewmodel-compose
library was added. It providesviewModel()
composable andLocalViewModelStoreOwner
.- Source-breaking change :
ViewModelProvider
has been rewritten in Kotlin.ViewModelProvider.Factory.create
method no longer allows nullable generic.
- Source-breaking change :
- 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 fromlifecycle.lifecycle-common-java8
tolifecycle.lifecycle-common
.lifecycle.lifecycle-common-java8
doesn't provide anymore any additional functionality on top oflifecycle.lifecycle-common
, so dependency on it can be replaced bylifecycle.lifecycle-common
. - Non coroutines API from
lifecycle-viewmodel-ktx
have been moved to thelifecycle-viewmodel
module. lifecycle-process
now usesandroidx.startup
to initialize theProcessLifecycleOwner
.Previously, this was being done by
androidx.lifecycle.ProcessLifecycleOwnerInitializer
.If you used
tools:node="remove"
theContentProvider
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
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
15 সেপ্টেম্বর, 2021
androidx.lifecycle:lifecycle-*:2.4.0-beta01
is released. Version 2.4.0-beta01 contains these commits.
এপিআই পরিবর্তন
-
@OnLifecycleEvent
was deprecated.LifecycleEventObserver
orDefaultLifecycleObserver
should be used instead. ( I5a8fa ) - DefaultLifecycleObserver was moved from
androidx.lifecycle.lifecycle-common-java8
toandroidx.lifecycle.lifecycle-common
.androidx.lifecycle.lifecycle-common-java8
doesn't provide anymore any additional functionality on top ofandroidx.lifecycle.lifecycle-common
, so dependency on it can be replaced byandroidx.lifecycle.lifecycle-common
. ( I021aa ) - Non coroutines API from
lifecycle-viewmodel-ktx
have been moved to thelifecycle-viewmodel
module. ( I6d5b2 )
বাহ্যিক অবদান
Version 2.4.0-alpha03
4 আগস্ট, 2021
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
16 জুন, 2021
androidx.lifecycle:lifecycle-*:2.4.0-alpha02
is released. Version 2.4.0-alpha02 contains these commits.
নতুন বৈশিষ্ট্য
- Added a new
RepeatOnLifecycleWrongUsage
lint check tolifecycle-runtime-ktx
that detects whenrepeateOnLifecycle
is incorrectly used inonStart()
oronResume()
. ( 706078 , b/187887400 )
এপিআই পরিবর্তন
- The
LifecycleOwner.addRepeatingJob
API is removed in favor ofLifecycle.repeatOnLifecycle
that respects structured concurrency and is easier to reason about. ( I4a3a8 ) - Make
ProcessLifecycleInitializer
public so otherandroidx.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 )
বাহ্যিক অবদান
- Thanks maxsav for improving the
NullSafeMutableLiveData
lint check. ( #147 , b/183696616 ) - Thanks kozaxinan for improving the
NullSafeMutableLiveData
lint check. ( #161 , b/184830263 )
Version 2.4.0-alpha01
24 মার্চ, 2021
androidx.lifecycle:lifecycle-*:2.4.0-alpha01
is released. Version 2.4.0-alpha01 contains these commits.
আচরণ পরিবর্তন
lifecycle-process
now usesandroidx.startup
to initialize theProcessLifecycleOwner
.Previously, this was being done by
androidx.lifecycle.ProcessLifecycleOwnerInitializer
.If you used
tools:node="remove"
theContentProvider
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 theLifecycle.repeatOnLifecycle
API. This is an alternative to the also newLifecycleOwner.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
16 জুন, 2021
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 optionalViewModelStoreOwner
, making it easier to work with owners other than theLocalViewModelStoreOwner
. For example, you can now useviewModel(navBackStackEntry)
to retrieve a ViewModel associated with a particular navigation graph. ( I2628d , b/188693123 )
Version 1.0.0-alpha06
2 জুন, 2021
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
.
Version 1.0.0-alpha05
18 মে, 2021
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 )
Version 1.0.0-alpha04
7 এপ্রিল, 2021
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
andandroidx.navigation:navigation-compose
to sync dependencies onandroidx.compose.compiler:compiler:1.0.0-beta04
andandroidx.compose.runtime:runtime:1.0.0-beta04
. For 1.0.0, it is required that the compiler and runtime match.
Version 1.0.0-alpha03
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 nullableViewModelStoreOwner
to better determine whether aViewModelStoreOwner
is available in the current composition. APIs that require aViewModelStoreOwner
, such asviewModel()
andNavHost
, still throw an exception if aViewModelStoreOwner
is not set. ( Idf39a )
Lifecycle-Viewmodel-Compose Version 1.0.0-alpha02
24 ফেব্রুয়ারি, 2021
androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha02
is released. Version 1.0.0-alpha02 contains these commits.
এপিআই পরিবর্তন
-
LocalViewModelStoreOwner
now has aprovides
functions that can be used withCompositionLocalProvider
, replacing theasProvidableCompositionLocal()
API. ( I45d24 )
Lifecycle-Viewmodel-Compose Version 1.0.0-alpha01
ফেব্রুয়ারী 10, 2021
androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha01
is released. সংস্করণ 1.0.0-alpha01-এ এই কমিট রয়েছে।
নতুন বৈশিষ্ট্য
- The
viewModel()
composable andLocalViewModelStoreOwner
were moved fromandroidx.compose.ui.viewinterop
to this artifact in theandroidx.lifecycle.viewmodel.compose
package. ( I7a374 )
সংস্করণ 2.3.1
Lifecycle Version 2.3.1
24 মার্চ, 2021
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 )
সংস্করণ 2.3.0
সংস্করণ 2.3.0
ফেব্রুয়ারী 10, 2021
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 callsetSavedStateProvider()
for a given key, providing aSavedStateProvider
that will get a callback tosaveState()
when theSavedStateHandle
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. ForLifecycleRegistry
objects that owned by your own components, you can explicitly opt out from checks by usingLifecycleRegistry.createUnsafe(...)
, but then you have to ensure that a proper synchronization is in place when thisLifecycleRegistry
is accessed from different threads.
- LifecycleRegistry now enforces
- Lifecycle State and Event Helpers : Added static helper methods of
downFrom(State)
,downTo(State)
,upFrom(State)
,upTo(State)
toLifecycle.Event
for generating theEvent
given aState
and transition direction. Added thegetTargetState()
method that provides theState
that the Lifecycle will transition to directly following theEvent
. -
withStateAtLeast
: AddedLifecycle.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 existingwhen*
methods as they do not permit running suspending code and do not employ a custom dispatcher. ( aosp/1326081 ) -
ViewTree
APIs : A newViewTreeLifecycleOwner.get(View)
andViewTreeViewModelStoreOwner.get(View)
API allows you to retrieve the containingLifecycleOwner
andViewModelStoreOwner
, respectively, given aView
instance. You must upgrade to Activity1.2.0
and Fragment1.3.0
, and AppCompat 1.3.0-alpha01 or higher to populate this correctly. ThefindViewTreeLifecycleOwner
andfindViewTreeViewModelStoreOwner
Kotlin extensions are available inlifecycle-runtime-ktx
andlifecycle-viewmodel-ktx
, respectively. -
LiveData.observe()
Kotlin extension deprecation : TheLiveData.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
16 ডিসেম্বর, 2020
androidx.lifecycle:lifecycle-*:2.3.0-rc01
is released. Version 2.3.0-rc01 contains these commits.
বাগ ফিক্স
- The
keys()
method ofSavedStateHandle
is now consistent before and after the state is saved - it now includes keys previously used withsetSavedStateProvider()
in addition to the keys used withset()
andgetLiveData()
. ( aosp/1517919 , b/174713653 )
বাহ্যিক অবদান
- The APIs to suspend Lifecycle-aware coroutines now better handle calls to
yield()
. Thanks Nicklas Ansman Giertz! ( aosp/1430830 , b/168777346 )
Version 2.3.0-beta01
অক্টোবর 1, 2020
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 )
বাগ ফিক্স
- Upgrade androidx to use Kotlin 1.4 ( Id6471 , b/165307851 , b/165300826 )
ডকুমেন্টেশন পরিবর্তন
- The
liveData
builder andasLiveData()
docs have been updated to include details about changing the given timeout values. ( aosp/1122324 )
Version 2.3.0-alpha07
আগস্ট 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
22 জুলাই, 2020
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)
toLifecycle.Event
for generating theEvent
given aState
and transition direction. Added thegetTargetState()
method that provides theState
that the Lifecycle will transition to directly following theEvent
. ( 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 existingwhen*
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. ForLifecycleRegistry
objects that owned by your own components, you can explicitly opt out from checks by usingLifecycleRegistry.createUnsafe(...)
, but then you have to ensure that a proper synchronization is in place when thisLifecycleRegistry
is accessed from different threads ( Ie7280 , b/137392809 )
বাগ ফিক্স
- Fixed a crash in
NullSafeMutableLiveData
. ( b/159987480 ) - Fixed an
ObsoleteLintCustomCheck
for Lint checks bundled withlifecycle-livedata-core-ktx
(and specificallyNullSafeMutableLiveData
). ( b/158699265 )
Version 2.3.0-alpha05
জুন 24, 2020
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 toonActive()
oronInactive()
. ( 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
জুন 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 anull
value was set on aMutableLiveData
with a non-null type parameter. ( b/156002218 )
Version 2.3.0-alpha03
20 মে, 2020
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 callsetSavedStateProvider()
for a given key, providing aSavedStateProvider
that will get a callback tosaveState()
when theSavedStateHandle
is asked to save its state. ( b/155106862 ) - A new
ViewTreeViewModelStoreOwner.get(View)
API allows you to retrieve the containingViewModelStoreOwner
given aView
instance. You must upgrade to Activity1.2.0-alpha05
, Fragment1.3.0-alpha05
, and AppCompat1.3.0-alpha01
to populate this correctly. AfindViewModelStoreOwner()
Kotlin extension has been added tolifecycle-viewmodel-ktx
. ( aosp/1295522 )
বাগ ফিক্স
- Fixed an issue that caused the
MutableLiveData
Lint checks released in Lifecycle2.3.0-alpha01
from being published alongside thelifecycle-livedata-core-ktx
artifact. ( b/155323109 )
Version 2.3.0-alpha02
এপ্রিল 29, 2020
androidx.lifecycle:lifecycle-*:2.3.0-alpha02
is released. Version 2.3.0-alpha02 contains these commits.
এপিআই পরিবর্তন
-
SavedStateViewModelFactory
now allows you to pass a nullApplication
to its constructor to better support cases where one is not readily available and support forAndroidViewModel
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
4 মার্চ, 2020
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 containingLifecycleOwner
given aView
instance. You must upgrade to Activity1.2.0-alpha01
and Fragment1.3.0-alpha01
to populate this correctly. AfindViewTreeLifecycleOwner
Kotlin extension is available inlifecycle-runtime-ktx
. ( aosp/1182361 , aosp/1182956 ) - Added a new Lint check that warns you when setting a
null
value on aMutableLiveData
that has been defined in Kotlin as non-null. This is available when using thelivedata-core-ktx
orlivedata-ktx
artifacts. ( aosp/1154723 , aosp/1159092 ) - A new
lifecycle-runtime-testing
artifact is available that provides aTestLifecycleOwner
that implementsLifecycleOwner
and provides a thread safe mutableLifecycle
. ( aosp/1242438 )
বাগ ফিক্স
- The
lifecycle-runtime
artifact now has a unique package name. ( aosp/1187196 )
সংস্করণ 2.2.0
ViewModel-Savedstate Version 2.2.0
ফেব্রুয়ারি 5, 2020
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
.
সংস্করণ 2.2.0
জানুয়ারী 22, 2020
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. Thelifecycle-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 aFragment
orFragmentActivity
to the newViewModelProvider(ViewModelStoreOwner)
constructor to achieve the same functionality when using Fragment1.2.0
. -
lifecycle-extensions
Artifact Deprecation : With the above deprecation ofViewModelProviders.of()
, this release marks the deprecation of the last API inlifecycle-extensions
and this artifact should now be considered deprecated in its entirety. We strongly recommend depending on the specific Lifecycle artifacts you need (such aslifecycle-service
if you're usingLifecycleService
andlifecycle-process
if you're usingProcessLifecycleOwner
) rather thanlifecycle-extensions
as there will not be a future2.3.0
release oflifecycle-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 useLifecycleEventObserver
.
Version 2.2.0-rc03
4 ডিসেম্বর, 2019
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 inViewModelStore
and queried later with default factory. - Fix a usage of
Dispatchers.Main.immediate
inlaunchWhenCreated
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
নভেম্বর 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
23 অক্টোবর, 2019
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 ofDispatchers.Main
instead ofDispatchers.Main.immediate
. ( aosp/1145596 )
External contributions
- Thanks to Nicklas Ansman for contributing the fix! ( aosp/1145596 )
Version 2.2.0-beta01
9 অক্টোবর, 2019
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'sLifecycleOwner
moving to started and resumed on Android 10 devices. ( aosp/1128132 ) - Fixed a regression introduced in Lifecycle
2.2.0-alpha05
which would cause aNullPointerException
when using version2.0.0
or2.1.0
oflifecycle-process
. ( b/141536990 )
Version 2.2.0-alpha05
সেপ্টেম্বর 18, 2019
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
5 সেপ্টেম্বর, 2019
androidx.lifecycle:lifecycle-*:2.2.0-alpha04
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
নতুন বৈশিষ্ট্য
-
lifecycleScope
,whenCreated
,whenStarted
,whenResumed
,viewModelScope
, and the underlying implementation ofliveData
now useDispatchers.Main.immediate
instead ofDispatchers.Main
. ( b/139740492 )
External contributions
- Thanks to Nicklas Ansman for contributing the move to
Dispatchers.Main.immediate
! ( aosp/1106073 )
Version 2.2.0-alpha03
7 আগস্ট, 2019
androidx.lifecycle:lifecycle-*:2.2.0-alpha03
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
নতুন বৈশিষ্ট্য
- Implementations of
ViewModelStoreOwner
can now optionally implementHasDefaultViewModelProviderFactory
to provide a defaultViewModelProvider.Factory
. This has been done for Activity1.1.0-alpha02
, Fragment1.2.0-alpha02
, and Navigation2.2.0-alpha01
. ( aosp/1092370 , b/135716331 )
এপিআই পরিবর্তন
-
ViewModelProviders.of()
has been deprecated. You can pass aFragment
orFragmentActivity
to the newViewModelProvider(ViewModelStoreOwner)
constructor to achieve the same functionality. ( aosp/1009889 )
Version 2.2.0-alpha02
জুলাই 2, 2019
androidx.lifecycle:*:2.2.0-alpha02
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
এপিআই পরিবর্তন
- Replaced
LiveDataScope.initialValue
withLiveDataScope.latestValue
which will track the current emitted value of theliveData
block. - Added a new overload to the
liveData
builder that receivestimeout
parameter as typeDuration
Version 2.2.0-alpha01
7 মে, 2019
androidx.lifecycle:*:2.2.0-alpha01
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
নতুন বৈশিষ্ট্য
- 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
সংস্করণ 1.0.0
জানুয়ারী 22, 2020
androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0
is released. সংস্করণ 1.0.0 এ এই কমিটগুলি রয়েছে ।
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 ofViewModel
class and factories provided by default by Fragments and AppCompatActivity will injectSavedStateHandle
automatically. - AbstractSavedStateViewModelFactory was added. It allows you to create custom factories for your
ViewModel
and provide them access toSavedStateHandle
.
ViewModel-Savedstate Version 1.0.0-rc03
4 ডিসেম্বর, 2019
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
নভেম্বর 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
23 অক্টোবর, 2019
androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-rc01
is released with no changes from 1.0.0-beta01
. সংস্করণ 1.0.0-rc01-এ এই কমিট রয়েছে ।
ViewModel-Savedstate Version 1.0.0-beta01
9 অক্টোবর, 2019
androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-beta01
is released. সংস্করণ 1.0.0-beta01-এ এই কমিট রয়েছে ।
বাগ ফিক্স
- Fixed an issue where accessing a SavedState ViewModel for the first time in
Activity.onActivityResult()
would result in anIllegalStateException
. ( b/139093676 ) - Fixed an
IllegalStateException
when usingAbstractSavedStateViewModelFactory
. ( b/141225984 )
ViewModel-SavedState Version 1.0.0-alpha05
সেপ্টেম্বর 18, 2019
androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha05
is released. Version 1.0.0-alpha05 contains these commits .
এপিআই পরিবর্তন
-
SavedStateViewModelFactory
no longer extendsAbstractSavedStateViewModelFactory
andSavedStateHandle
is created only for ViewModels that requested have it ( aosp/1113593 )
ViewModel-SavedState Version 1.0.0-alpha03
7 আগস্ট, 2019
androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha03
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
ব্রেকিং পরিবর্তন
-
lifecycle-viewmodel-savedstate
no longer depends onfragment
and the relatedSavedStateViewModelFactory(Fragment)
andSavedStateViewModelFactory(FragmentActivity)
constructors have been removed. Instead,SavedStateViewModelFactory
is now the default factory for Activity1.1.0-alpha02
, Fragment1.2.0-alpha02
, and Navigation2.2.0-alpha01
. ( b/135716331 )
ViewModel-SavedState Version 1.0.0-alpha02
জুলাই 2, 2019
androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha02
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
নতুন বৈশিষ্ট্য
- Added
SavedStateHandle.getLiveData()
overload which accepts a default value.
এপিআই পরিবর্তন
-
SavedStateVMFactory
is renamed toSavedStateViewModelFactory
. -
AbstractSavedStateVMFactory
is renamed toAbstractSavedStateViewModelFactory
.
ViewModel-Savedstate Version 1.0.0-alpha01
13 মার্চ, 2019
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 factorySavedStateVMFactory
and your ViewModel should have a constructor that receivesSavedStateHandle
object as a parameter.
সংস্করণ 2.1.0
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 hiddenGenericLifecycleObserver
class. - Added ktx extensions for
LiveData.observe
methods andTransformations.*
methods. - Added
Transformations.distinctUntilChanged
, which creates a new LiveData object that does not emit a value until the sourceLiveData
value has been changed. - Added coroutine support in ViewModels by adding the extension property
ViewModel.viewModelScope
.
সংস্করণ 2.1.0
5 সেপ্টেম্বর, 2019
androidx.lifecycle:lifecycle-*:2.1.0
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
সংস্করণ 2.1.0-rc01
জুলাই 2, 2019
androidx.lifecycle:*:2.1.0-rc01
is released with no changes from androidx.lifecycle:*:2.1.0-beta01
. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
সংস্করণ 2.1.0-beta01
7 মে, 2019
androidx.lifecycle:*:2.1.0-beta01
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
নতুন বৈশিষ্ট্য
- 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
3 এপ্রিল, 2019
androidx.lifecycle:*:2.1.0-alpha04
is released. এই সংস্করণে অন্তর্ভুক্ত কমিটগুলি এখানে পাওয়া যাবে।
এপিআই পরিবর্তন
- Breaking change: the underlying API behind
by viewModels()
andby activityViewModels()
has been changed to support aViewModelStore
directly, rather than only aViewModelStoreOwner
. ( aosp/932932 )
Version 2.1.0-alpha03
13 মার্চ, 2019
androidx.lifecycle:*:2.1.0-alpha03
is released. এই সংস্করণে অন্তর্ভুক্ত প্রতিশ্রুতির সম্পূর্ণ তালিকা এখানে পাওয়া যাবে।
এপিআই পরিবর্তন
-
ViewModelProvider.KeyedFactory
was removed. Second interface in addition toViewModelProvider.Factory
didn't compose well with new features as property delegation in Kotlinby viewmodels {}
. ( aosp/914133 )
সংস্করণ 2.1.0-alpha02
30 জানুয়ারী, 2019
androidx.lifecycle 2.1.0-alpha02
is released.
এপিআই পরিবর্তন
-
LifecycleRegistry
now contains asetCurrentState()
method that replaces the now deprecatedsetState()
method. ( aosp/880715 )
বাগ ফিক্স
- Fixed an issue where mock
ViewModel
instances would crash when the containingViewModelStore
was cleared. b/122273087
সংস্করণ 2.1.0-alpha01
ডিসেম্বর 17, 2018
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 hiddenGenericLifecycleObserver
class. - Added ktx extensions for
LiveData.observe
methods andTransformations.*
methods. - Method
Transformations.distinctUntilChanged
was added. It creates a newLiveData
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 receiveskey
andClass
increate
method.
সংস্করণ 2.0.0
সংস্করণ 2.0.0
সেপ্টেম্বর 21, 2018
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
সংস্করণ 2.0.0-beta01
জুলাই 2, 2018
বাগ ফিক্স
- 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"
}
সংস্করণ 1.1.1
21 মার্চ, 2018
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.
সংস্করণ 1.1.0
জানুয়ারী 22, 2018
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
andLifecycleFragment
have now been removed - please useFragmentActivity
,AppCompatActivity
or supportFragment
. -
@NonNull
annotations have been added toViewModelProviders
andViewModelStores
-
ViewModelProviders
constructor has been deprecated - please use its static methods directly -
ViewModelProviders.DefaultFactory
has been deprecated - please useViewModelProvider.AndroidViewModelFactory
- The static
ViewModelProvider.AndroidViewModelFactory.getInstance(Application)
method has been added to retrieve a staticFactory
suitable for creatingViewModel
andAndroidViewModel
instances.