Android Jetpack Weekly #10

Kirill Rozov
3 min readOct 27, 2019

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

Benchmark 1.0.0-rc01

Now it’s possible to measure the performance of Android code and detect regressions or performance issues.

Video about the Benchmark Library from Android Dev Summit 2019

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 added Fragments. It fixes animation issues and handles windows insets dispatching to Fragments
  • New FragmentManager.findFragment(View) that retrieves Fragment from view
  • Add the possibility to add/replace Fragments without instance by Class<out Fragment>. The methods use FragmentFactory to instantiate Fragment.
  • The breadcrumb title related APIs have been deprecated
  • FragmentTransactio.setTransitionStyle(int) has been deprecated
  • SavedStateViewModelFactory is a default factory for instantiating ViewModel from Fragment. That’s mean all ViewModels are instantiated from Fragment can save/restore state.
  • Fragment.getFragmentManager() have been replaced with Fragment.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 each Lifecycle object. Coroutine scope that is canceled when Lifecycle 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)
}
Review of Android APIs to simplify work with Kotlin Coroutines

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) throw IllegalArgumentException. The method is formally deprecated.
  • RecyclerView.setLayoutFrozen(boolean)/isLayoutFrozen() are replaced with RecyclerView.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 associated RecyclerView.
  • LinearLayout.getExtraLayoutSpace(RecyclerVew.State) was deprecated in favor of LinearLayout.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 Fragments

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 and androidx.fragment 1.1.0 use ViewModel factories that support ViewModels with SavedStatehandle 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 with WorkManager.createCancelPendingIntent()

If you now Russian and want to know more about Android development you can subscribe to Android Broadcast Telegram Channel

--

--

Kirill Rozov
Kirill Rozov

No responses yet