BT

Google libera Android Jetpack

| por Diogo Carleto Seguir 40 Seguidores , traduzido por Diogo Carleto Seguir 40 Seguidores em 05 jun 2018. Tempo estimado de leitura: 2 minutos |

Android Jetpack brings new components, tools and architectural guidance to develop Android apps. The new components are WorkManager, Navigation, Paging, Slices and Android KTX.

The Android Jetpack components bring together the existing Support Library and Architecture Components and arrange them into four categories:

The components of Android Jetpack are provided as "unbundled" libraries that are not part of of the underlying Android platform. This means that developers can adopt each component at their own speed. Furthermore, the unbundled Android Jetpack libraries have all been moved into the new androidx.* namespace (as described in detail in this post).

In addition, an app can run on various versions of the Android platform because Android Jetpack components are built to provide their functionality independently of the underlying Android version, thus providing backwards compatibility.

WorkManager is a new library that provides a solution for constraint-based background jobs replacing the need to use things like jobs or SyncAdapters. WorkManager provides a simplified, modern API, that intends to make it easy to specify asynchronous tasks, to work on devices with or without Google Play Services.

Navigation simplify the implementation of navigation, aiming to make single-activity apps the preferred architecture. With out-of-the-box support for fragments, it is possible to get all  benefits of the Architecture Components such as Lifecycle and ViewModel while Navigation handle the complexity of FragmentTransactions for you. You can visually see and manage navigation properties using Navigation Editor in Android Studio 3.2.

Paging 1.0.0 makes it easy to load and present large data sets with fast, infinite scrolling in your RecyclerView. It can load paged data from local storage, network, or both, and lets you define how your content gets loaded. It works out of the box with Room, LiveData, and RxJava.

Slices are UI templates that can display rich, dynamic, and interactive content from your app from within the Google Search app and in other places like Google Assistant. Slices can help users perform tasks by enabling engagement outside of the fullscreen app experience.

Android KTX is a set of Kotlin extensions. It optimizes Jetpack and Android platform APIs for Kotlin use. Android KTX aims to make Android development with Kotlin more concise, pleasant, and idiomatic. It lets you transform Kotlin code like this:


view.viewTreeObserver.addOnPreDrawListener(
 object : ViewTreeObserver.OnPreDrawListener {
   override fun onPreDraw(): Boolean {
     viewTreeObserver.removeOnPreDrawListener(this)
     actionToBeTriggered()
     return true
   }
});

into more concise Kotlin code like the following:


view.doOnPreDraw { actionToBeTriggered() }

You can get started with Android Jetpack at developer.android.com/jetpack. There is also a YouTube playlist devoted to Android Jetpack, where it is possible to find information about Android Jetpack, components, tools and best practices.

Getting Started with Android Jetpack tells you how to bring Android Jetpack into an existing project or start a new one. Android Studio 3.2 supports Android Jetpack. You can provide feedback for Jetpack.

Avalie esse artigo

Relevância
Estilo/Redação

Olá visitante

Você precisa cadastrar-se no InfoQ Brasil ou para enviar comentários. Há muitas vantagens em se cadastrar.

Obtenha o máximo da experiência do InfoQ Brasil.

Dê sua opinião

HTML é permitido: a,b,br,blockquote,i,li,pre,u,ul,p

Receber mensagens dessa discussão
Comentários da comunidade

HTML é permitido: a,b,br,blockquote,i,li,pre,u,ul,p

Receber mensagens dessa discussão

HTML é permitido: a,b,br,blockquote,i,li,pre,u,ul,p

Receber mensagens dessa discussão

Dê sua opinião

Faça seu login para melhorar sua experiência com o InfoQ e ter acesso a funcionalidades exclusivas


Esqueci minha senha

Follow

Siga seus tópicos e editores favoritos

Acompanhe e seja notificados sobre as mais importantes novidades do mundo do desenvolvimento de software.

Like

Mais interação, mais personalização

Crie seu próprio feed de novidades escolhendo os tópicos e pessoas que você gostaria de acompanhar.

Notifications

Fique por dentro das novidades!

Configure as notificações e acompanhe as novidades relacionada a tópicos, conteúdos e pessoas de seu interesse

BT