Android Jetpack Weekly #3
Review of the most interesting updates in Android Jetpack libraries
This week (August 5–11 2019) was very rich for updates in Android Jetpack
Activity
Changes in 1.1.0-alpha02 (compare to 1.1.0-alpha01):
SavedStateViewModelFactory
is now the default factory used when using with aComponentActivity
Ads
The Advertising ID library defines an interface to interact with system-level ad providers across the devices running your app. This interface allows your app to receive consistent advertising ID values.
The library supports Android 4.0+ (API Level 14+)
Browser
Changes in 1.2.0-alpha07 (compare to 1.2.0-alpha06)
- Dark Theme support: provide theme colors to be used when the device is in dark mode
- Dark Theme support: override whether the launched browser should be in dark or light mode
- Trusted Web Activities: the
TrustedWebActivityBuilder
can be used to easily create and launch Trusted Web Activities. - The
TrustedWebActivityService
and related classes can be used to communicate with the provider - accepting web push notifications for the linked website and displaying them from the client app. This part of the API is liable to change. - Custom Tabs sessions can now be created with ids, allowing the merging of two sessions launched by the same application with the same id.
CameraX
Change in 1.0.0-alpha04 (compare to 1.0.0-alpha4)
- Changes to Aspect Ratio and Resolution selection: CameraX’s goal is to successfully initialize a camera session. This means CameraX will compromise on resolution/aspect ratios based on device capability.
- A preview use case is now considered to have a default 4:3 aspect ratio
- When CameraX internally considers changes to requested resolutions and aspect ratios based on device capability, it will first try to maintain the same aspect ratio
- A “Nearest mod16” version of the resolution is considered as the same aspect ratio
- The behavior of
ImageReaderMode.ACQUIRE_LATEST_IMAGE
is now non-blocking - Bug fixes
New libraries were released:
CameraX Extensions 1.0.0-alpha01
was introduced for accessing effects on supported devicesCameraX View 1.0.0-alpha01
was released. The library contains new Camera View class
AndroidX Core
Changes in 1.2.0-alpha03 (compare to 1.2.0-alpha02)
- Added
UriCompat.toSafeString(Uri)
to provide URI escaping that is updatable separately from the platform - Added
Predicate<T>
interface to provide Java 8-style predicates without requiring Java 8 language features - Added
async
,counter
, andisEnabled
toTraceCompat
- Bug fixes
Fragment
Changes in 1.2.0-alpha02 (compare to 1.1.0-alpha01)
SavedStateViewModelFactory
is now the default factory with a Fragment.- The default animations when using
TRANSIT_FRAGMENT_OPEN
,TRANSIT_FRAGMENT_CLOSE
,TRANSIT_FRAGMENT_FADE
withsetTransition
on aFragmentTransaction
have been updated to match the animations used by activities on Android Q devices FragmentContainerView
as a new container for dynamically added Fragments, instead ofFrameLayout
.- Added FragmentManager.findFragment(View) to retrieve the containing Fragment from a view inflated by a fragment
- Added
FragmentTransaction.add()
andFragmentTranscation.replace()
that take containerViewId, a Class of Fragment, optionalBundle
of arguments and Fragment’s tag. These methods use newFragmentFactory
to instantiate Fragment - The breadcrumb title related APIs on
FragmentTransaction
andFragmentManager.BackStackEntry
have been deprecated FragmentTransaction.setTransitionStyle()
has been deprecated- Bug fixes
Changes in 1.1.0-rc04 (compare to 1.1.0-rc03)
- Bug fixes only
Lifecycle
Changes in 2.2.0-alpha03 (compare to 2.2.0-alpha02)
- Implementations of
ViewModelStoreOwner
can now optionally implementHasDefaultViewModelProviderFactory
to provide a defaultViewModelProvider.Factory
ViewModelProviders.of()
is deprecated. Now you need to useViewModelProvider constructor
.
Lifecycle ViewModel SavedState
Changes in 1.0.0-alpha03 (compare to 1.1.0-alpha02)
- The library no longer depends on fragment
RecyclerView
Changes in 1.1.0-beta02 (compare to 1.1.0-beta01)
- RecyclerView now has a default style attribute
recyclerViewStyle
, which allows setting of the default style in your theme
Room
Changes in 2.2.0-alpha02 (compare to 2.2.0-alpha01)
- Kotlin Coroutine Flow support:
@Query
DAO methods can now return typeFlow<T>
. The returned Flow will re-emit a new set of values if the observing tables in the query are invalidated. - Expanding Projections: A new experimental compiler option
room.expandProjection
was added that causes Room to rewrite a query with a star projection to only contain the columns in the returning type POJO. Callback RoomDatabase.Callback.onDestructiveMigration()
was added when Room destructively migrates a database- Bug fixes
If you now Russian and want to know more about Android development you can subscribe to Android Broadcast Telegram Channel