Skip to content

Commit

Permalink
Merge pull request #61 from shaishavgandhi05/sg/prepare-0.2.0
Browse files Browse the repository at this point in the history
Prepare v0.2.0
  • Loading branch information
ShaishavGandhi authored Jun 11, 2018
2 parents 87c594e + 403f15a commit 0e0da4a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,12 @@ Navigator does support binding of arguments passed to the fragment as well as co
#### Get arguments

```java
Navigator.prepareDetailFragment(userList)
Bundle arguments = Navigator.prepareDetailFragment(userList)
.setPoints(points)
.getBundle()
.getBundle();

MyFragment fragment = new MyFragment();
fragment.setArguments(arguments);
```

#### Bind arguments
Expand Down Expand Up @@ -183,6 +186,27 @@ Navigator.prepareDetailActivity(users, source)
.startWithExtras(activity, transitionBundle)
```

#### Supply your own keys

It is easy to transition to Navigator in a large codebase. For example, you can mark a variable
as `@Extra` in an existing class, which already has logic to parse out the Bundle. But you cannot
possibly change the key to that particular variable in every place from which it's called. With
Navigator, you can easily specify your own custom key which will be used to execute the binding
of all the extras. Example:

```java
public final class MyActivity extends Activity {

@Extra(key = FragmentExtras.CUSTOM_KEY) // Custom key that other classes use when invoking MyActivity
String extra;

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Navigator.bind(this);
}
}
```

#### Bundle

In cases where you just want to use the type-safety and implicit contract of Navigator, you can easily use the builder to get the bundle created by Navigator
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ org.gradle.daemon=true
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
VERSION_NAME=0.2.0-SNAPSHOT
VERSION_NAME=0.2.0
GROUP=com.shaishavgandhi.navigator

POM_DESCRIPTION=Annotation processor that eliminates navigation boilerplate
Expand Down

0 comments on commit 0e0da4a

Please sign in to comment.