At one time in history, building an app that gave a consistent experience across all (or most) versions of Android was nearly impossible without dedicating a lot of time and effort. Thanks to the Android Support Library (a.k.a. AppCompat), it's easy to use some of the most important and commonplace user interface elements on versions of Android going as far back as Donut and Éclair. A fresh update for AppCompat was just released, bringing it to v22.1, and it introduces some really big changes. The ActionBarActivity has been deprecated for a new AppCompatActivity class, several new features from Lollipop were ported back to the Support V4, and some big improvements were made for Leanback, Palette, RecyclerView, and Renderscript.
The major revision for v22.1 is the deprecation of ActionBarActivity. It initially served as a convenient way to bring the ActionBar to the Android 2.1 and above, and would act as a compatibility layer for any version of Android that already included it (starting with Android 3.0 Honeycomb). Taking its place will be AppCompatActivity. On the surface, the new class will offer all of the same functionality, but it's built on top of a new AppCompatDelegate that can be used to enable most of the same features without requiring developers to inherit from AppCompatActivity. This re-engineering effort is also serving as the base for a new AlertDialog class, so every part of the user interface can benefit from the extensive list of theming features that were demonstrated for Lollipop.
Many of Lollipop's native theming capabilities were made possible in older versions of Android by silently substituting widgets with alternate versions that included color tinting support. Unfortunately, this created some complications in subclassing the existing widgets. With v22.1, developers can now extend from 10 AppCompat variants of common widgets like AppCompatButton, AppCompatCheckBox, and AppCompatEditText.
RecyclerView now offers a new SortedList class that can handle changes to the underlying data through the Adapter. This means developers don't have to do as much to handle items that are added, deleted, updated, or moved. SortedList also supports batched changes so performance doesn't lag when a lot of modifications are made quickly.
Quite a few other changes have been made in this release. Theming support has been greatly extended for all devices as far back as Honeycomb (API 11), and several classes were even ported all the way back to support API 4 to give developers color tinting, interpolators, and better ways to calculate colors for readability. The Leanback library and sample have been updated to introduce a new GuidedStep process that can be easily customized with themes. The Palette class is now much more efficient and includes some additional flexibility. Likewise, Renderscript support has been improved to better detect limitations on each device and chose the most efficient implementations.
This article touches lightly on many of the changes in v22.1, but there are quite a few more to discover. To get a full detail of everything that has changed, check out the post on the Android Developer Blog. This is a huge update, and well worth the time to learn about all of the new features. The new version is available now through the Android SDK Manager in the packages named Android Support Library and Android Support Repository.
- Android Developer Blog