Android Jetpack Weekly #10
News in Android Jetpack October 21–27, 2019
Last week was the week of Android Dev Summit (October 22–23). On the first day were announced many RC updates. The updates give us
- More integrations with Kotlin Coroutines
- Save state in View Model
- Improved animations support
- ViewPager 2 — ViewPager on top of RecyclerView
- Improved nested scroll
- Possibility to benchmark your Android App in the right way
and all updates in the status of release candidate.
A full list of changes can be found here
Bug fixes in stable release
Room 2.2.1
- Fixed work when expandProjection turned on
- Improved verifying quieries at compile time
RCe of next major releases
Activity 1.1.0-rc01
- Support of saved state for ViewModels by default
- New SavedStateRegistry that allows saving state into Activity Bundle from any components. Save state in ViewModel based on that API.
Benchmark 1.0.0-rc01
Now it’s possible to measure the performance of Android code and detect regressions or performance issues.
Biometric 1.0.0-rc02
Backport of Biometric API that includes:
CoordinatorLayout 1.1.0-rc01
- Improved nested scroll support
Fragment 1.2.0-rc01
Fragment
now more correctly support windows insets- New
FragmentContainerView
that needs to be used as a container for dynamically addedFragment
s. It fixes animation issues and handles windows insets dispatching toFragment
s - New
FragmentManager.findFragment(View)
that retrievesFragment
from view - Add the possibility to
add
/replace
Fragments without instance byClass<out Fragment>
. The methods useFragmentFactory
to instantiateFragment
. - The breadcrumb title related APIs have been deprecated
- FragmentTransactio.setTransitionStyle(int) has been deprecated
SavedStateViewModelFactory
is a default factory for instantiating ViewModel fromFragment
. That’s mean all ViewModels are instantiated from Fragment can save/restore state.Fragment.getFragmentManager()
have been replaced withFragment.getParentFragmentManager()
. The old method was deprecated.- Android Lint check that ensures you are using correct LifecycleOwner from Fragment. A
Fragment
has 2 lifecycles: common and view. - Bug fixes
Lifecycle 2.2.0-rc01
LifecycleScope
is defined for eachLifecycle
object. Coroutine scope that is canceled whenLifecycle
will be destroyed. More details
viewLifecycleOwner.lifecycleScope.launch {
...
}
- Suspend Lifecycle-aware coroutines: support suspend execution of a code block unless the Leficycle is in certain state. More details
lifecycleScope.launch {
whenCreated {
...
}
whenStarted {
...
}
whenResumed {
...
}
}
- Use coroutines from
LiveData
with new liveData() function
val user: LiveData<User> = liveData {
val data = database.loadUser() // loadUser is a suspend fun
emit(data)
}
ViewModelStoreOwner
can implementsHasDefaultViewModelProviderFactory
to provide a defaultViewModelProvider.Factory
ViewModelProviders.of()
has been replaced withViewModelProvider(ViewModelStoreOwner)
constructor
Navigation 2.2.0-rc01
- Support of reordered query parameters when using deep links. Arguments that have a default value or nullable are now optional
- Possibility to get information about back state entry
NavBackStackEntry
by destination id - Improved speed of parsing navigation graph
- Classes from Navigation library override toString() and provide more helpful information for debugging
- Bug fixes
RecyclerView 1.1.0-rc01
- Improved support of nested scroll
- Call of
RecyclerView.setLayoutTransition(LayoutTransition)
throwIllegalArgumentException
. The method is formally deprecated. RecyclerView.setLayoutFrozen(boolean)
/isLayoutFrozen()
are replaced withRecyclerView.suppressLayout(boolean)
/isLayoutSuppressed()
- Improved scroll bear dimension estimation when use
GridLayoutManager
- Added possibility to
LinearLayoutManager
to customize how much extra layout space should be added to either size of the associatedRecyclerView
. LinearLayout.getExtraLayoutSpace(RecyclerVew.State)
was deprecated in favor ofLinearLayout.calculateExtraLayoutSpace(RecyclerView.state, int[])
- Added possibility to specify the duration of
RecyclerView
smooth scroll - Added theme attribute
recyclerViewStyle
that set the default style in your theme - Bug fixes
Transition 1.3.0-rc01
- Improvements in integration with
Fragment
s
ViewPager2 1.0.0-rc01
- New ViewPager that based on RecyclerView
- All new features will be added only in ViewPager 2
- Support of horizontal and vertical orientations
- Support of RecyclerView animations
ViewModel-SavedState 1.0.0-rc01
It’s now possible to save state inside ViewModel. Use SavedStateHandle
class SampleViewModel(savedState: SavedStateHandle) : ViewModel()
androidx.activity 1.2.0
andandroidx.fragment 1.1.0
use ViewModel factories that supportViewModels
withSavedStatehandle
from the box
New alphas
Media 1.2.0-alpha01
- Start of work of new major version of Media library
Work Manager 2.3.0-alpha03
- Added possibility to cancel
WorkRequest
from Notification withWorkManager.createCancelPendingIntent()
If you now Russian and want to know more about Android development you can subscribe to Android Broadcast Telegram Channel