How to Build Android Apps with Kotlin: A hands-on guide to developing, testing and publishing your first apps with Android [1 ed.] 1838984119, 9781838984113

Master the fundamentals of Android programming and apply your skills to create scalable and reliable apps using industry

1,328 355 21MB

English Pages 750 [795] Year 2021

Report DMCA / Copyright

DOWNLOAD FILE

How to Build Android Apps with Kotlin: A hands-on guide to developing, testing and publishing your first apps with Android [1 ed.]
 1838984119, 9781838984113

  • Commentary
  • Vector PDF

Table of contents :
Cover
FM
Copyright
Table of Contents
Preface
Chapter 1: Creating Your First App
Introduction
Creating an Android Project with Android Studio
Exercise 1.01: Creating an Android Studio Project for Your App
Setting Up a Virtual Device and Running Your App
Exercise 1.02: Setting Up a Virtual Device and Running Your App on It
The Android Manifest
Exercise 1.03: Configuring the Android Manifest Internet Permission
Using Gradle to Build, Configure, and Manage App Dependencies
Project-Level build.gradle file
App-Level build.gradle
Exercise 1.04: Exploring how Material Design is used to theme an app
Android Application Structure
Exercise 1.05: Adding Interactive UI Elements to Display a Bespoke Greeting to the User
Accessing Views in layout files
Further Input Validation
Activity 1.01: Producing an App to Create RGB Colors
Summary
Chapter 2: Building User Screen Flows
Introduction
The Activity Lifecycle
Exercise 2.01: Logging the Activity Callbacks
Saving and Restoring the Activity State
Exercise 2.02: Saving and Restoring the State in Layouts
Exercise 2.03: Saving and Restoring the State with Callbacks
Activity Interaction with Intents
Exercise 2.04: An Introduction to Intents
Exercise 2.05: Retrieving a Result from an Activity
Intents, Tasks, and Launch Modes
Exercise 2.06: Setting the Launch Mode of an Activity
Activity 2.01: Creating a Login Form
Summary
Chapter 3: Developing the UI with Fragments
Introduction
The Fragment Lifecycle
onAttach
onCreate
onCreateView
onViewCreated
onActivityCreated
onStart
onResume
onPause
onStop
onDestroyView
onDestroy
onDetach
Exercise 3.01: Adding a Basic Fragment and the Fragment Lifecycle
Exercise 3.02: Adding Fragments Statically to an Activity
Static Fragments and Dual-Pane Layouts
Exercise 3.03: Dual-Pane Layouts with Static Fragments
Dynamic Fragments
Exercise 3.04: Adding Fragments Dynamically to an Activity
Jetpack Navigation
Exercise 3.05: Adding a Jetpack Navigation Graph
Activity 3.01: Creating a Quiz on the Planets
Summary
Chapter 4: Building App Navigation
Introduction
Navigation Overview
Navigation Drawer
Exercise 4.01: Creating an App with a Navigation Drawer
Bottom Navigation
Exercise 4.02: Adding Bottom Navigation to Your App
Tabbed Navigation
Exercise 4.03: Using Tabs for App Navigation
Activity 4.01: Building Primary and Secondary App Navigation
Summary
Chapter 5: Essential Libraries: Retrofit, Moshi, and Glide
Introduction
Fetching Data from a Network Endpoint
Exercise 5.01: Reading Data from an API
Parsing a JSON Response
Exercise 5.02: Extracting the Image URL from the API Response
Loading Images from a Remote URL
Exercise 5.03: Loading the Image from the Obtained URL
Activity 5.01: Displaying the Current Weather
Summary
Chapter 6: RecyclerView
Introduction
Adding RecyclerView to Our Layout
Exercise 6.01: Adding an Empty RecyclerView to Your Main Activity
Populating the RecyclerView
Exercise 6.02: Populating Your RecyclerView
Responding to Clicks in RecyclerView
Exercise 6.03: Responding to Clicks
Supporting Different Item Types
Exercise 6.04: Adding Titles to RecyclerView
Swiping to Remove Items
Exercise 6.05: Adding Swipe to Delete Functionality
Adding Items Interactively
Exercise 6.06: Implementing an "Add A Cat" Button
Activity 6.01: Managing a List of Items
Summary
Chapter 7: Android Permissions and Google Maps
Introduction
Requesting Permissions from the User
Exercise 7.01: Requesting the Location Permission
Showing a Map of the User's Location
Exercise 7.02: Obtaining the User's Current Location
Map Clicks and Custom Markers
Exercise 7.03: Adding a Custom Marker Where the Map Was Clicked
Activity 7.01: Creating an App to Find the Location of a Parked Car
Summary
Chapter 8: Services, WorkManager, and Notifications
Introduction
Starting a Background Task Using WorkManager
Exercise 8.01: Executing Background Work with the WorkManager Class
Background Operations Noticeable to the User – Using a Foreground Service
Exercise 8.02: Tracking Your SCA's Work with a Foreground Service
Activity 8.01: Reminder to Drink Water
Summary
Chapter 9: Unit Tests and Integration Tests with JUnit, Mockito, and Espresso
Introduction
JUnit
Android Studio Testing Tips
Mockito
mockito-kotlin
Exercise 9.01: Testing the Sum of Numbers
Integration Tests
Robolectric
Espresso
Exercise 9.02: Double Integration
UI Tests
Exercise 9.03: Random Waiting Times
Test-Driven Development
Exercise 9.04: Using TDD to Calculate the Sum of Numbers
Activity 9.01: Developing with TDD
Summary
Chapter 10: Android Architecture Components
Introduction
ViewModel and LiveData
ViewModel
LiveData
Exercise 10.01: Creating a Layout with Configuration Changes
Exercise 10.02: Adding a ViewModel
Exercise 10.03: Sharing our ViewModel between the Fragments
Exercise 10.04: Adding LiveData
Room
Entities
DAO
Setting Up the Database
Third-Party Frameworks
Exercise 10.05: Making a Little Room
Customizing Life Cycles
Exercise 10.06: Reinventing the Wheel
Activity 10.01: Shopping Notes App
Summary
Chapter 11: Persisting Data
Introduction
Repository
Exercise 11.01: Creating a Repository
Exercise 11.02: Adding Error Handling
Preferences
SharedPreferences
Exercise 11.03: Wrapping SharedPreferences
PreferenceFragment
Exercise 11.04: Customized Settings
Files
Internal Storage
External Storage
FileProvider
Storage Access Framework (SAF)
Asset Files
Exercise 11.05: Copying Files
Scoped Storage
Camera and Media Storage
Exercise 11.06: Taking Photos
Activity 11.01: Dog Downloader
Summary
Chapter 12: Dependency Injection with Dagger and Koin
Introduction
Manual DI
Exercise 12.01: Manual Injection
Dagger
Consumers
Providers
Connectors
Qualifiers
Scopes
Subcomponents
Exercise 12.02: Dagger Injection
Dagger Android
Exercise 12.03: Changing Injectors
Koin
Exercise 12.04: Koin Injection
Activity 12.01: Injected Repositories
Activity 12.02: Koin-Injected Repositories
Summary
Chapter 13: RxJava and Coroutines
Introduction
RxJava
Observables, Observers, and Operators
Schedulers
Adding RxJava to Your Project
Using RxJava in an Android Project
Exercise 13.01: Using RxJava in an Android Project
Modifying Data with RxJava Operators
Exercise 13.02: Using RxJava Operators
Coroutines
Creating Coroutines
Adding Coroutines to Your Project
Exercise 13.03: Using Coroutines in an Android App
Transforming LiveData
Exercise 13.04: LiveData Transformations
Coroutines Channels and Flows
RxJava versus Coroutines
Activity 13.01: Creating a TV Guide App
Summary
Chapter 14: Architecture Patterns
Introduction
MVVM
Data Binding
Exercise 14.01: Using Data Binding in an Android Project
Retrofit and Moshi
The Repository Pattern
Exercise 14.02: Using Repository with Room in an Android Project
WorkManager
Exercise 14.03: Adding WorkManager to an Android Project
Activity 14.01: Revisiting the TV Guide App
Summary
Chapter 15: Animations and Transitions with CoordinatorLayout and MotionLayout
Introduction
Activity Transitions
Adding Activity Transitions through XML
Adding Activity Transitions through Code
Starting an Activity with an Activity Transition
Exercise 15.01: Creating Activity Transitions in an App
Adding a Shared Element Transition
Starting an Activity with the Shared Element Transition
Exercise 15.02: Creating the Shared Element Transition
Animations with CoordinatorLayout
Animations with MotionLayout
Adding MotionLayout
Creating Animations with MotionLayout
Exercise 15.03: Adding Animations with MotionLayout
The Motion Editor
Debugging MotionLayout
Modifying the MotionLayout Path
Exercise 15.04: Modifying the Animation Path with Keyframes
Activity 15.01: Password Generator
Summary
Chapter 16: Launching Your App on Google Play
Introduction
Preparing Your Apps for Release
Versioning Apps
Creating a Keystore
Exercise 16.01: Creating a Keystore in Android Studio
Storing the Keystore and Passwords
Signing Your Apps for Release
Exercise 16.02: Creating a Signed APK
Android App Bundle
Exercise 16.03: Creating a Signed App Bundle
App Signing by Google Play
Creating a Developer Account
Uploading an App to Google Play
Creating a Store Listing
App Details
Graphic Assets
Preparing the Release
APK/App Bundle
Rolling Out a Release
Managing App Releases
Release Tracks
Feedback Channel and Opt-in Link
Internal Testing
Closed Testing
Open Testing
Staged Rollouts
Managed Publishing
Activity 16.01: Publishing an App
Summary
Index

Polecaj historie