Martial arts related literary works commonly used in the "40-year-old do not lag in the material, grass and bamboo stone can be swords." Since then, gradually into a sword-free environment. "Describe a man's martial arts skills, has been sublimation." And our IT engineers have reached a certain level of technical proficiency, will also be in this "uncensored win has the code" realm. But what does that mean? Is it that we no longer write code, lying on the bed every day and shining white the ceiling without words to look at it?
No. What I want to say to you is that every line of code you write should add a unique value to your app, rather than adding a line of complicated, uninteresting template code to your app. Android provides a support library for the original purpose: Let Android developers focus more on the logic implementation than on writing business code.
The newly released Android Support Library has, as always, added a number of useful components and made changes to the internal implementation logic of support V4, AppCompat, Leanback, Recyclerview, Palette, and renderscript libraries. From new appcompatactivity and Appcompatdialog to Android TV, we can see that the new library really brings a lot of surprises to us.
Support V4
The Support V4 Library, which is the foundation of many Android libraries, contains many backwards-compatible classes, greatly simplifying the implementation of backwards compatibility.
Drawablecompat now makes the drawable coloring drawing backwards compatible with API 4: Now simply encapsulate your drawable through the Drawablecompat.wrap (drawable) method, you can use Settint (), Settintlist (), Settintmode () finish rendering, no need to create and maintain several different drawable files in order to support multiple colors!
In addition, we are doing some Palette internals for all usage scenarios through the Colorutils class, providing developers with pre-built tools to simplify handling of various colors. Colorutils can easily calculate the contrast between colors, determine the minimum transparency value that maintains the minimum contrast (perfect for the reading experience of the text), or convert the color to the corresponding HSL value.
The interpolator is an important part of all animation systems and is responsible for controlling the rate at which a value changes in an animation, such as acceleration, deceleration, and so on. Android in the Lollipop. The R.interpolator package incorporates many interpolator, such as fast_out_linear_in, fast_out_slow_in, and linear_out_slow_in for creating real-world actions. But now we can call the Fastoutlinearininterpolator, Fastoutslowininterpolator, linearoutslowininterpolator classes to add these interpolator to the animation in code. In addition to those pre-built interpolator, we also created a Pathinterpolatorcompat class that allows you to create two-square or three-cubic Bezier curves.
This version of the support library also moves the space control from the GridLayout library to the supporting V4, making it unnecessary to add separate dependencies to the project. The space control is a lightweight, invisible control that you can use to create a gap effect between controls.
AppCompat
The AppCompat support library began to be very low-key, but it was a very important start: a consistent action Bar was provided for the devices of API 7 and above. In revision 21, it assumed new responsibilities: it brought material color palette, control coloring, toolbar support, and more devices that supported all API 7+. From the actionbaractivity name alone is not reflected in its full function.
In this release, Actionbaractivity is obsolete, and the new replacement is appcompatactivity. However, this is not just a rename. In fact, the intrinsic logic of AppCompat can now be achieved through appcompatdelegate-a class that can be included in all activity, linked to an appropriate life-cycle approach, and subject to a consistent theme, coloring, etc. Without the need to use appcompatactivity (although this is still the simplest way to start).
With the help of the new Appcompatdelegate class, we provide a dialog box that conforms to the Material Design specification through the Appcompatdialog class. If you've used Alertdialog before, you'll be happy because we've added a new Support.v7.app.AlertDialog class in the library, allowing you to enjoy the convenience of Appcompatdialog with the same API.
The ability to automatically color controls when using AppCompat is an important guarantee of maintaining brand branding and a consistent experience in your app. Because AppCompat automatically replaces the traditional controls, such as Button, TextView, with new controls such as Appcompatbutton, Appcompattextview, and so on, when the layout is populated, to ensure that each control within the layout can support shading. In the new support library, the color-aware control is now exposed, allowing the control class to extend support for automatic coloring to subclasses.
This list contains all the current color-aware controls:
Appcompatautocompletetextview
Appcompatbutton
Appcompatcheckbox
Appcompatcheckedtextview
Appcompatedittext
Appcompatmultiautocompletetextview
Appcompatradiobutton
Appcompatratingbar
Appcompatspinner
Appcompattextview
Lollipop is able to rewrite the theme of the app in the view layer by using the Android:theme property in XML, which is very helpful for implementing many cool app UIs, such as: we need to use the dark style actionba in the Activity of the bright theme R. But now AppCompat allows you to customize Toolbar with Android:theme on all APIs over 11 devices.
If you're not familiar with the AppCompat library, take a look at this video and discover how simple it is to provide users with a consistent experience on Android:
Leanback
Even though the Leanback library is already the best template for Android TV apps, if you've seen the latest 22.1 support libraries, you'll find that the boot process created with the latest Leanback library brings 10 times times better experience than in the past.
In the latest Leanback library, these classes and themes can create a cool boot process on Android TV: The boot view on the left and the boot step on the right. Each step of the boot process can be defined by inheriting from the Theme.Leanback.GuidedStep Theme, and if you want higher custom degrees of freedom, you can pass Guidancestylist and guidedactionsstylist To meet your needs.
In addition, Android Support Library 22.1 fixes many bugs in Leanback, optimizes performance, and claims that the ultimate experience for users and developers through the Leanback library is the goal of Google to develop, optimize leanback libraries !
Recyclerview
In addition to fixing a series of bugs, this version adds a new SortedList data structure. This collection makes it easier to hold an ordered custom object than in the past, allowing Recyclerview.adapter to correctly distribute the changed events as the data changes, maintaining the animation of the child Item as it increases/deletes/moves/changes.
In addition, SortedList supports batch change of objects, event distribution is just a single collection operation on the adapter, ensuring that a large number of items can be changed to maintain the best user experience.
Palette
If you have used Palette to extract the colors from the image in the app development, you'll be happy because the latest Palette is 6-8 times more efficient than the previous one when it guarantees color accuracy.
Palette now obtains the instance through the constructor pattern, rather than by invoking a method like Palette.generate (Bitmap), which you now need to get Bitmap objects with Palette.from (Palette.builder) To change the maximum number of colors and the maximum picture size that can be generated when running Palette before the Generate () or Generateasync () Gets the color table.
Renderscript
Renderscript provides powerful computing power, and the Android support Library 22.1 makes it possible to use some of the predefined scripts and internal functions that invoke scripts on devices above API 8. An improved image edge detection algorithm ensures that the local renderscript function always chooses the fastest and most reliable implementation, and this version greatly improves the reliability and performance of all devices. Two additional intrinsic functions are also added in this release: Scriptintrinsichistogram and Scriptintrinsicresize, complete acquisition to 10.
Conclusion
There is no better time to start using the Android support library. Today you can start your development with this library and download the Android support library and Android support resources from the Android SDK manager.
To learn more about the Android support library and the API it provides to you, visit the Web page of the Support Library section of the Android developer website.
Android Support 22.1 Released!