Jetpack component (1) Introduction to Jetpack component

      What is Jetpack? I believe that students who do Android development have heard or used Jetpack more or less. Even if you think you have never used it, you may have used it unconsciously. Because the Jetpack component library is very large, it contains many excellent components. This article does not introduce one or some components of the Jetpack component library in detail, but only makes an introduction. A series of articles will be used to introduce the common components of the Jetpack component library in detail.   

Next article in Jetpack series

Jetpack component (2) DataBinding_heart poisoned blog - CSDN blog has been hesitant to write a series of articles on Jetpack components. To be honest, I rarely use some libraries of Jetpack in my own projects. So before writing the article, I still have to actually write the demo. Prepare to write in the order of Architecture (architecture), Foundation (basic), Behavior (behavior) and UI (interface). This article first summarizes the use of DataBinding. https://blog.csdn.net/qq_21154101/article/details/128111485 directory

1. What is Jetpack

2. Features of Jetpack components

Three, Jetpack component composition

1. Architecture

2. Foundation

3. Behavior

4. UI (interface)


1. What is Jetpack

Quoting Google's official statement: Jetpack is a suite of multiple libraries that helps developers follow best practices, reduce boilerplate code and write code that can run consistently in various Android versions and devices, allowing developers to focus on Write important code. Jetpack is Google's strategic plan to solve the fragmentation of Android development and create a mature and healthy ecosystem. It is Google's development direction for Android in the future. It is also a collection of many excellent Android components.   

2. Features of Jetpack components

Simply put, it is the following three points:

1. Composition: Jetpack components are composed of several excellent Android components

2. Purpose: To solve the fragmentation of Android development

3. Advantages: Improve development quality and development efficiency

Three, Jetpack component composition

    According to the official statement, Android Jetpack components are divided into four categories, Architecture (architecture), Foundation (basic), Behavior (behavior) and UI (interface):

insert image description here

1. Architecture

    Architecture components mainly include components related to app architecture construction, which can help developers design a robust and easy-to-maintain application architecture, including the following component libraries:

(1) Data Binding (data binding): The data binding library is a support library, with which the interface components in the layout can be bound to the data sources in the application using a declarative style.

(2) Lifecycles: It is convenient to manage the life cycle of Activity and Fragment, helping developers to write lighter and easier-to-maintain code.

(3) LiveData: It is an observable data holder class. Unlike regular observables, LiveData is lifecycle aware.

(4) Navigation: Handles everything needed for in-app navigation.

(5) Paging: Help developers load and display small pieces of data at a time. Loading portions of data on demand reduces network bandwidth and system resource usage.

(6) Room: The Room persistence library provides an abstraction layer on SQLite to help developers access the SQLite database more friendly and smoothly.

(7) ViewModel: Store and manage UI-related data in a lifecycle-aware manner.

(8) WorkManager: Easily schedule deferrable asynchronous tasks that are expected to run even if the application exits or the device restarts.

2. Foundation

    Basic components are mainly related to basic functions, such as AppCompat. Provides horizontal features such as backward compatibility, testing, and support for the Kotlin language. It contains the following component libraries:

(1) Android KTX: Android KTX is a set of Kotlin extensions that optimize the APIs of Jetpack and the Android platform for Kotlin. Use Kotlin for Android development in a cleaner, more pleasant, and more idiomatic way.

(2) AppCompat: Provides a series of APIs starting with AppCompat to be compatible with low-version Android development.

(3) Cars(Auto): Components that help develop Android Auto applications without worrying about vehicle-specific hardware differences (such as screen resolution, software interface, knobs, and touch controls).

(4) Benchmark (detection): Quickly benchmark Kotlin or Java-based code from Android Studio. Measure code performance and output benchmarking results to the Android Studio console.

(5) Multidex (Multi-Dex processing): Enable multi-dex files for applications with more than 64K methods.

(6) Security (Security): Follow security best practices to read and write encrypted files and share preferences.

(7) Test (Test): Android testing framework for unit and runtime interface testing.

(8) TV: Build applications that allow users to experience immersive content on a large screen.

(9) Wear OS: Components that help develop Wear applications.

3. Behavior

    Behavior components are responsible for some basic services of Android, such as taking pictures and notifications. Helps developers' apps to integrate with standard Android services like notifications, permissions. It contains the following component libraries:

(1) CameraX: Help developers simplify the development of camera applications. It provides a consistent and easy-to-use API interface that works on most Android devices and is backward compatible up to Android 5.0 (API level 21).

(2) DownloadManager (Download Manager): It can handle long-running HTTP downloads and retry downloads after failures or after connection changes and system restarts.

(3) Media & playback (media & playback): backward compatible API for media playback and routing (including Google Cast).

(4) Notifications (notifications): provide backward compatible notification API, support Wear and Auto.

(5) Permissions: A compatibility API for checking and requesting application permissions.

(6) Preferences (preference settings): Provides users with the ability to change the functions and behaviors of the application.

(7) Sharing: Provide sharing operations suitable for the application operation bar.

(8) Slices (slicing): Create flexible interface elements that can display application data outside the application.

4. UI (interface)

    The interface component should be the most familiar to everyone. It provides various views and simple auxiliary tools, which can enrich the application experience. Contains the following component libraries:

(1) Animation & Transitions (Animation & Transition): Provide various built-in animations, and you can also customize animation effects.

(2) Emoji (emoji): Allow users to use emoji without updating the system version.

(3) Fragment: The basic unit of the componentized interface.

(4) Layout (layout): the interface layout written in xml or the interface completed using Compose.

(5) Palette (palette): Extract useful information from the palette.

    The Jetpack component library is a very large component library, which contains many components that we often use. So, if someone asks again: have you used Jetpack? Your answer is not no, but used. Just saying, we don't have a clear understanding of the component library. As mentioned at the beginning of the article, in the next period of time, a series of related documents and demos of Jetpack components will also be shared.

Guess you like

Origin blog.csdn.net/qq_21154101/article/details/128062843