万本电子书0元读

万本电子书0元读

顶部广告

Reactive Android Programming电子书

售       价:¥

67人正在读 | 0人评论 9.8

作       者:Tadas Subonis

出  版  社:Packt Publishing

出版时间:2017-05-26

字       数:29.0万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:此类商品不支持退换货,不支持下载打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Make the most of asynchronous android programming About This Book ? Install and set up RxJava for Android development ? Implement the Reactive paradigm for Android programming using RxJava ? Create cutting edge real world Android apps with Reactive programming. Who This Book Is For Are you an android developer trying to figure out how to use reactive paradigm for your programming needs? If yes then this is the book for you. No previous knowledge of RxJava is required. What You Will Learn ? Set up an environment for asynchronous that is reactive Android programming ? Write custom observables and higher level abstractions ? Orchestrating multiple calls using Reactive programming principles ? Fetch remote financial data using RxJava ? Integrate and process Twitter streams gracefully ? Utilize Reactive programming to develop interactive and responsive Android apps ? Create your own application to follow financial stock updates in real-time based on selected companies’ symbols ? Integrate updates from the Twitter for those companies. In Detail Writing code on Android is hard. Writing a high quality code that involves concurrent and parallel tasks is even harder. Ensuring that this code will run without unforeseen race conditions is an the order of magnitude harder. RxJava is the tool that can help write code for such tasks. In this book a novice developer will be introduced to a wide variety of tools that RxJava provides to enable them to produce robust and high-quality code for their asynchronous tasks by building a relatively simple(and high quality) application using advanced RxJava techniques to produce a high quality product. Part 1 of the book will lead the developer through RxJava's initial setup in Android environment. In Part 2, the reader will learn RxJava 2.0 step-by-step by starting off with stock data processing and display.The developer will learn to choose appropriate Schedulers and to use Retrofit library for remote requests.In Part 3, the reader will also learn advanced topics such as adding integration to Twitter to process its streaming data by combining it with stock data. Style and approach This book is a step by step practical guide which will essentially teach you to set up, implement, and debug Reactive Android Code with ease.
目录展开

Title Page

Copyright

Credits

About the Author

About the Reviewers

www.PacktPub.com

Customer Feedback

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

Building your First “Hello World” RxJava Application

Creating the application

Dependencies

Core dependencies

UI dependencies

Very first user interface

Adding RecyclerView

Stock data Value objects

Using Retrolambda

Setup

Usage

Updating the existing code

Summary

Understanding the Basics of RxJava

Observables

Hot and Cold Observables

Disposables

Schedulers

Scheduling examples

Investigating the flow of an Observable

Flowable

Dropping items

Preserve latest item

Buffering

Completable, Single, and Maybe types

Completable

Single

Maybe

Summary

Learning to use Retrofit by Fetching Financial Data

Setting up Retrofit

Making HTTP requests

Service interface

Service factory

Creating service

Transforming request data

Parsing JSON

Querying data

Transforming JSON value objects

Unwrapping nested objects

Unwrapping lists

Converting objects

Displaying data on the UI

Regular updates

Handling multiple records on the UI

Summary

Integrating RxJava 1.0 with RxJava 2.0

Differences between the versions

Dependencies and package name

Functional interfaces

Flowable

Gluing different RxJava versions

Setup

Converting RxJava 1.0 Observables

Converting to Flowables

Summary

Writing Data to SQLite and Schedulers

Schedulers

Types of Schedulers

Single

Trampoline

NewThread

IO

Computation

Executor Scheduler

Android Scheduler

Using Schedulers

subscribeOn

observeOn

Rules of thumb

Achieving parallelism

Structuring code for parallelism

Writing data with StorIO

Setting up StorIO

Configuring StorIO

Preparing constants

Creating write resolvers

Creating StorIOSQLite interface

Data persistence flow

Summary

Error Handling and SQLite Data Reading

Exception handling in RxJava

Using subscribe()

Using onExceptionResumeNext()

Using doOnError()

Other error processing methods

onErrorResumeNext()

onErrorReturn

onErrorReturnItem

Showing errors in Android UI

Empty State Screen

Toast notification

Centralized error logging

Central handler

Using RxJava plugins

Reading SQLite data with StorIO

Get resolver

Reading cursor columns

Converting data

Creating the StockUpdate object

Configuring Type Mapping

Offline fallback for StockUpdate entries

StorIO database query

Creating the StorIO Observable

The final onExceptionResumeNext() block

Informing the user about the failure

Missing delete resolver

Summary

Integrating RxJava with Activity Lifecycle

Android Activity Lifecycle

Lifecycle review

Fragment lifecycles

Setting up an activity

Things to know about onCreate() calls

Resource leaks

Memory leaks

Memory leak example

Leaking with Observables

Lost background tasks example

Paying special attention to onCreate()

Cleaning up Subscriptions

Using Disposable

Using CompositeDisposable

Utilizing the RxLifecycle library

Setting up the library

Binding to Activity Lifecycle

Binding to Activity without subclassing

Binding to the Fragment lifecycle

Binding to views

Updating the data fetching flow

Summary

Writing Custom Observables

How to create custom Observables

Integrating with standard Java API

Integrating with Emitter API

Cleaning up

Reading tweets for stocks reactively

Setup

Getting access to Twitter

Custom Observable for Twitter

Configuring Twitter

Listening to status updates

Emitting status updates into Observable

Showing tweets in the UI

Integrating Twitter status updates into the Flow

Updating Value Objects

StockUpdate adjustments

StorIO adjustments

Updating layouts

Other improvements

Summary

Advanced Observable Flows Explained

Unwrapping Observables

Transforming values with Map

FlatMap Observables

More FlatMap variations

SwitchMap

Passing values

Tuples

JavaTuples

Custom classes

Updated flow

Combining items

Zip

Combine latest

Concatenating streams

Concat

Merge

Filtering

Cleaning stock adapter

Advanced filtering with distinct calls

Example of GroupBy

Filtering tweets

Summary

Higher Level Abstractions

Extracting code into methods

Making conditions explicit

Extracting consumers

Using method references

Extracting FlatMap

Creating Factory Methods

Financial stock quote Observable

Tweet retrieval Observable

Offline flow Observable

Resulting flow

Using Transformations

Regular code extractions

A Place where things start getting ugly

Simplifying code with Transformations

Extracting item persistence code

Creating transformer classes

File-based caching example

Using Transformation to track execution time

Using Transformation to debug Observables

Summary

Basics of Subjects and Preference Persistence

Subjects

PublishSubject

Multiple sources

BehaviorSubject

ReplaySubject

AsyncSubject

Using subjects in the application

Using RxPreferences

Setup

Examples with RxPreferences

Subjects for Settings

Connecting subjects to Settings

Creating UI for Settings

Creating Settings activity

Preferences XML

Options menu

Updating flow

Settings for financial stock updates

Settings for monitored tweets

Entire merge block

Fixes for duplicate entries

Summary

Learning to Read Marble Diagrams

Core elements of marble diagrams

Elements of the diagram

RxMarbles tool

Examining operators

Map

FlatMap

onExceptionResumeNext()

GroupBy

SubscribeOn and ObserveOn

BehaviorSubject

Summary

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部