RxJava for Android developers
RxJava for Android Developers begins by inviting you to think about programming and data the reactive way. This engaging, hands-on essential reference introduces you to the central pattern of RxJava for Android, then explains the View Model before exploring highly sought-after app features like chat...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Shelter Island, New York :
Manning Publications
[2019]
|
Edición: | 1st edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009630853706719 |
Tabla de Contenidos:
- Intro
- Copyright
- Brief Table of Contents
- Table of Contents
- Preface
- Acknowledgments
- About this book
- Part 1. Core reactive programming
- Chapter 1. Introduction to reactive programming
- Perhaps you picked up this book because...
- Don't read this book if...
- OOP, Rx, FP, and FRP
- Benefits of Rx
- What you code is what you get
- The reactive landscape
- What do you need to know before you start?
- About this book
- RxJava 2 and Android
- Setting up the Android environment
- Java 8 lambdas
- Deep dive into Rx: Live search
- Conditions for triggering search
- Project setup
- Text input as an emitter of data
- The publish-subscribe pattern
- Text input as an observable
- Filtering observables
- Bending time
- Bending time to your benefit
- Debounce: The bus stop operator
- Putting your code into Android
- Coffee break
- Principles of reactive programming
- Events and marble diagrams
- Summary
- Chapter 2. Networking with observables
- RxJava and event streams
- Subscribers
- RxJava 2 observable types
- Subscribing to and converting different observables
- What happens when you make a normal network request?
- What happens when you make a network request with an observable?
- Network request as an observable
- Example: An RSS feed aggregator
- The feed structure
- Getting the data
- The combineLatest operator
- The Rx code so far
- Coffee break
- Asynchronous data processing chains
- Putting the list in order
- The map operator
- Brief introduction to immutability
- Error handling
- Adding more feeds to the client
- Summary
- Chapter 3. Building data processing chains
- Different roles of observables
- Events vs. reactive state
- Internal state of an observable
- Arrow diagrams and different observable types
- Example: Credit card validation form
- First step: Expiration date.
- Credit card number type and checksum
- CVC code validation
- Putting it all together
- Coffee break
- The abstraction level of reactive programming
- How RxJava works
- Summary
- Chapter 4. Connecting the user interface with networking
- Subscriptions explained
- Terminating subscriptions
- RxJava 2 concepts and subscription management
- Advanced Rx chains example: Flickr search client
- Setting up the Flickr client project
- Overview of the search chain
- Step 1: A simple hardcoded search
- Making it click
- Coffee break
- Implementing the reactive chain
- How switchMap works
- Getting thumbnail information
- Step 1: Expand the list into an observable
- Step 2: Apply operations to each item individually
- Step 3: Collect results
- The complete solution
- Adding a username from another API
- Summary
- Chapter 5. Advanced RxJava
- Observables and subjects in detail
- Example: File browser
- User flow of the File Browser app
- Getting the file listing for a directory
- Threading basics
- Threading in functional programming
- Changing the thread by using getFileListingObservable
- Making the file listing dynamic
- Making the list click
- Different types of subjects
- Using a subject as the FileObservable
- Coffee break
- Adding buttons for Previous and Root
- Expanded graph for Previous and Root
- Improved version with cleaner observables
- The Previous button
- Putting it all together
- The detailed graph
- The full code so far
- Saving and releasing the subscriptions
- A final note on subjects
- Summary
- Part 2. Architectures in RxJava
- Chapter 6. Reactive view models
- The view layer
- Platform containers
- View models
- The blueprint of a view model
- Connecting views and view models
- The whole picture
- View model lifecycle
- Coffee break
- View models and the Android lifecycles.
- The view affinity of the code
- Summary
- Chapter 7. Reactive architectures
- Fundamentals of reactive architectures
- Model-View-View model
- Reactive model
- Retrieving data from the model
- Coffee break
- Revising the file browser
- Constructing the model for the file browser
- Using the model
- Rules of the model and its consumers
- Single source of truth
- Coffee break
- Persisting app state
- BehaviorSubjects and stores
- Simple SharedPreferencesStore
- Summary
- Chapter 8. Developing with view models
- View models and the view
- Example: Tic-tac-toe
- Drawing the game grid
- Making it interactive
- Events vs. reactive state
- Immutable data and the game grid
- Adding the code for interaction
- Coffee break
- Wrapping the logic into a view model
- Click coordinate processing
- Changing turns
- Coffee break
- Filtering illegal moves
- Winning conditions
- One more thing: Restarting the game
- Summary
- Chapter 9. Expanding existing Rx apps
- Working with existing reactive code
- The game of Connect Four
- Updating grid size and assets
- Checking for valid moves
- Coffee break
- Saving and loading the game
- Creating the model
- Sharing the model
- Loaded games activity
- PersistedGameStore
- Saving games
- Loading games
- Summary
- Chapter 10. Testing reactive code
- Reactive architectures and testing
- Test granularity
- The pyramid of dependencies
- Unit-testing basics
- Testing reactive chains
- TestObservable class
- Synchronous or asynchronous
- Coffee break
- Writing tests for view models
- Choosing what to test
- Testing the GameViewModel initial state
- Testing partial observable chains
- Testing Connect Four drop logic
- Summary
- Part 3. Advanced RxJava architectures
- Chapter 11. Advanced architectures: Chat client 1
- Chat client with WebSockets.
- How to transfer messages
- WebSockets
- WebSockets as broadcasters
- Connecting to the server
- ChatMessage structure
- Sending ChatMessages
- Wrapping listeners into observables
- Coffee break
- Basic UI
- Showing messages
- The view model
- Accumulating ChatMessages
- Putting together message processing
- Consuming values from the view model
- View model lifecycle
- Making the view model lifecycle
- Summary
- Chapter 12. Advanced architectures: Chat client 2
- View models, stores, and the model
- Message pending state
- Handling state updates
- Store as an aggregator
- The code for the store
- Coffee break
- Implementing pending messages
- Replacing pending messages with confirmed ones
- Updated store code
- Pending state handling code
- Coffee break
- The model
- The code for the model
- Model lifecycle
- Singleton modules
- Android tools for production use
- Summary
- Chapter 13. Transitions with Rx
- Transitioning between states
- How it should have been
- Animation progress using one number
- Reactive parametrization
- Example: The fan widget
- Setting the transformations for the child views
- Coffee break
- Animating with RxJava and Android
- Code changes to FanView
- The view model
- View model logic
- Animating parametrized values in view models
- animateTo operator
- animateTo operator on Android
- Adding a dimmed background
- Summary
- Chapter 14. Making a maps client
- Maps example
- Getting started with map tiles
- Making an initial view model
- Calculating tiles based on zoom level
- Using the offset to move tiles
- Dragging the map
- The code so far
- Viewport and hiding tiles
- Loading map tiles
- Adding zoom-level controls
- Adding support for map coordinates
- Summary
- Appendix. Tutorial for developing on Android
- Developing on Android.
- Android development environment
- Installing SDK components
- Downloading example projects
- Using Git to check out projects
- Running the project
- Running apps in the virtual device
- Android project structure
- Android platform components
- Summary
- Index.