A fresh version of the Android Support Library is now available to developers. This may be one of the biggest updates in quite a while, as some of the changes demand a few significant internal changes. On the plus side, there aren't very many changes that should break existing code, and most of the new features will make it worth the trouble. Here's a quick introduction to some of the new changes.

Vector Drawables and Animated Vector Drawables

Full vector support was first introduced in Android 5.0 Lollipop, allowing developers to distribute apks with easily resizable vector drawings in place of multiple images at various sizes. Not only could images be scaled to screens of almost any pixel density, the vector drawings were usually much smaller files than even the tiniest of images, which meant apk sizes could drop dramatically. In the case of graphics-heavy applications, this could result in more than a 50% decrease in size. Unfortunately, this capability was limited to API 21 and above.

This is where the AppCompat libraries are great, they can bring many of the new features of Android back to much earlier versions. With the newly implemented VectorDrawable class, developers can now use vector images all the way back to API 7 (Android 2.1 Eclair). Animated vectors are a bit more limited, going only as far back as API 11 (Android 3.0 Honeycomb), but that still encompasses more than 97% of devices in active use today.

It's not hard to set up or use the new vector classes, but it does require a few steps and awareness of a few workarounds. Be sure to check the blog post for details.

DayNight Theme

Waking your phone screen and staring directly into a bunch of bright white pixels can be a little overwhelming after the daylight has faded into night. Some developers have taken it upon themselves to make some adjustments to their designs to account for different ambient light levels or time of day, but AppCompat is now offering to automate a little bit of that. Based on your last known location, the latest version can switch between regular and "night" themes for apps.

No, we totally didN't Notice that hamburger buttoN iN the top left corNer. /s

The DayNight Theme support requires API 14 and above (Android 4.0 Ice Cream Sandwich). The theme will still work with older versions of Android, but it will default to the Light theme automatically, rather than switching based on time and location. Both the color choices and operation should work fairly automatically with just a couple of small changes to an app's themes, but there are a few caveats that should be considered. Again, check out the blog post for details.

While this is an often-requested feature, keep in mind that many developers put a lot of time and effort into customizing a style, and a dark mode may not fit into their designs. In other words, please be polite and considerate when asking developers to spend time and development effort on night themes.

New Control: Bottom Sheets

Elements of Google's Material Design guidelines have produced a number of varied interfaces, but one that has become increasingly popular since its introduction is the "Bottom Sheet." It's a page of content that slides up from the bottom and hovers over the rest of the interface, sort of pushing everything else into the background. It has become a popular element in apps like Google Maps and the Dialer. It can also be used for things like transient dialogs, like the recent change to YouTube's overflow menus in the video player screen. (This change is still on a limited rollout.)

The Design Support Library now includes an implementation of Bottom Sheets for use in third-party apps. If placed inside of a CoordinatorLayout and configured with the BottomSheetBehavior, it can provide events when the sheet is collapsed, dragging, settling, expanded, or hidden.

Updated Control: RecyclerView

Another control-related change comes with the RecyclerView, which now supports auto-measurement. To explain it simply, the RecyclerView can now determine its own size based on the size of its contents. For example, a RecyclerView can be defined with WRAP_CONTENT, and if there aren't enough items in the list to consume the full height (or width) of the available space, the RecyclerView will only consume the necessary space to hold those items. This can allow for some more flexible designs.

Like most of the previous changes and additions, there are some breaking changes associated with this new capability, so be diligent about double checking the details in Google's blog post if your apps use a RecyclerView to be sure everything will continue working as intended.

Custom Buttons for Custom Tabs

Last year at I/O 2015, Google announced Custom Tabs, a way for apps to use a Chrome browser window in their interfaces so users could gain all of the advantages of being signed in with their own accounts. Basic color customizations were possible in early versions, but developers weren't allowed to do very much with the browser window otherwise. The latest compatibility library opens things up a little bit by giving developers a toolbar across the bottom where they can add their own custom actions.

The color of the toolbar is configurable and up to five buttons can be added.

Closing

Quite a few things were added with this release, along with a couple of other additions to the Leanback Library (for Android TV) and Media Browser libraries. If you want to get your hands on the latest version, just open the SDK Manager (or Android Studio) and check for updates. Version 23.2 will appear in the list of Extras.

Source: Android Developers Blog