Skip to content

Commit

Permalink
Merge pull request #68 from trello/dlew/prep-0.4.0
Browse files Browse the repository at this point in the history
Prepared 0.4.0 release
  • Loading branch information
dlew committed Dec 10, 2015
2 parents d37bb24 + 1d227a1 commit 7a6b2da
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 9 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.4.0 (2015-12-10)

* [#62](https://github.com/trello/RxLifecycle/pull/62), [#67](https://github.com/trello/RxLifecycle/pull/67): Added
[Navi](https://github.com/trello/navi/)-based implementation of providers.
* [#61](https://github.com/trello/RxLifecycle/pull/61): Moved `ActivityLifecycleProvider` and
`FragmentLifecycleProvider` into the core library so that multiple implementations can share them easily. The package
name changed so you may need to re-import them in your code.
* [#60](https://github.com/trello/RxLifecycle/pull/60): Reverted generic parameters back to `Transformer<T, T>`

## 0.3.1 (2015-11-27)

* [#46](https://github.com/trello/RxLifecycle/pull/46): Updated generic parameters of `Transformer<T, T>` to support Kotlin type inference.
Expand Down
39 changes: 32 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ It assumes you want to end the sequence in the opposing lifecycle event - e.g.,
terminate on `STOP`. If you subscribe after `PAUSE`, it will terminate at the next destruction event (e.g.,
`PAUSE` will terminate in `STOP`).

## Components
## Providers

Where do the sequences of `ActivityEvent` or `FragmentEvent` come from? You can either write it yourself, or you can
include rxlifecycle-components, which comes with pre-built `Activity` and `Fragment` implementations with lifecycles.
Where do the sequences of `ActivityEvent` or `FragmentEvent` come from? Generally, they are provided by
`ActivityLifecycleProvider` and `FragmentLifecycleProvider`. But where are those implemented?

You have a few options for that:

1. Use rxlifecycle-components and subclass the provided `RxActivity`, `RxFragment`, etc. classes.
1. Use [Navi](https://github.com/trello/navi/) + rxlifecycle-navi to generate providers.
1. Write the implementation yourself.

If you use rxlifecycle-components, just extend the appropriate class, then use the built-in `bindToLifecycle()` (or `bindUntilEvent()`) methods:

Expand All @@ -47,8 +53,22 @@ public class MyActivity extends RxActivity {
}
```

In addition, these components come with `lifecycle()`, which allows you to do your own logic based on the `Activity`
or `Fragment` lifecycle.
If you use rxlifecycle-navi, then you just pass your `NaviComponent` to `NaviLifecycle` to generate a provider:

```java
public class MyActivity extends NaviActivity {
private final ActivityLifecycleProvider provider
= NaviLifecycle.createActivityLifecycleProvider(this);

@Override
public void onResume() {
super.onResume();
myObservable
.compose(provider.bindToLifecycle())
.subscribe();
}
}
```

## Unsubscription

Expand All @@ -64,8 +84,13 @@ yourself and call `unsubscribe()` when appropriate.
## Installation

```gradle
compile 'com.trello:rxlifecycle:0.3.1'
compile 'com.trello:rxlifecycle-components:0.3.1'
compile 'com.trello:rxlifecycle:0.4.0'
// If you want pre-written Activities and Fragments you can subclass as providers
compile 'com.trello:rxlifecycle-components:0.4.0'
// If you want to use Navi for providers
compile 'com.trello:rxlifecycle-navi:0.4.0'
```

## License
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GROUP=com.trello
VERSION_NAME=0.3.1-SNAPSHOT
VERSION_CODE=4
VERSION_NAME=0.4.0-SNAPSHOT
VERSION_CODE=5

POM_URL=https://github.com/trello/RxLifecycle
POM_SCM_URL=https://github.com/trello/RxLifecycle
Expand Down

0 comments on commit 7a6b2da

Please sign in to comment.