Android Jetpack Joyride Android Jetpack Joyride What is Android Jetpack AJ What is Android Jetpack Jetpack AJ What is Jetpack Jetpack is a collection of Android software components to make it easier for you to develop great Android apps Source: d.android.com/jetpack Who uses Jetpack smartly Benefits of Jetpack d.android.com/jetpack Gandhinagar Gandhinagar Gandhinagar - Accelerate development - Eliminate boilerplate code - Build high quality, robust apps Data Binding Life Cycles LiveData Navigation Paging Room ViewModel WorkManager AppCompat Android KTX Multidex Test Animations & Transitions Auto TV & Wear Emoji Fragment Layout Palette Download Manager Media & Playback Permissions Notifications Sharing Slices Navigation Navigation Let’s start with code Let’s start with code //app.gradle dependencies { implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha06' implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0-alpha06' } Navigation //activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <fragment android:id="@+id/my_nav_host_fragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" android:layout_height="match_parent" app:defaultNavHost="true" app:navGraph="@navigation/nav_graph" /> </android.support.constraint.ConstraintLayout> Navigation Navigation //MainActivity.kt myButton.setOnClickListener { view.findNavController().navigate(R.id.action_first_to_second) } Navigation //nav_graph.xml <?xml version="1.0" encoding="utf-8"?> <navigation xmlns:android="http://schemas.android.com/apk/res/android"> </navigation> Navigation Navigation enterAnim : the animation for the target fragment/activity when we navigate to it exitAnim : the animation for the source fragment/activity when we navigate away from it popEnterAnim : the animation for the target fragment/activity when we press back popExitAnim : the animation for the source fragment/activity when we press back End Main components of Room End Let’s start with code Let’s start with code //app.gradle implementation "android.arch.persistence.room:runtime:1.1.1" annotationProcessor "android.arch.persistence.room:compiler:1.1.1" // Lifecyles, LiveData and ViewModel implementation "android.arch.lifecycle:runtime:1.1.1" implementation "android.arch.lifecycle:extensions:1.1.1" annotationProcessor "android.arch.lifecycle:compiler:1.1.1" Room //Movie.kt @Entity(tableName = TABLE_MOVIE) data class Movie(@PrimaryKey val id: Long, val title: String, val popularity: Int, val voteAverage: Int, val posterUrl: String, val description: String) //MoviesDao @Dao interface MoviesDao { @Insert(onConflict = OnConflictStrategy.REPLACE) fun insert(movieList: List<Movie>) @Query(SELECT_MOVIE) fun allMovies(): DataSource.Factory<Int, Movie> } Room