Skip to content

Commit

Permalink
Add a new api.
Browse files Browse the repository at this point in the history
  • Loading branch information
chenenyu committed Jun 21, 2018
1 parent b5f3786 commit 05ad019
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions router/src/main/java/com/chenenyu/router/AbsRouter.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.os.Parcelable;
import android.os.PersistableBundle;
import android.support.annotation.AnimRes;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.util.SparseArray;

Expand All @@ -34,6 +35,18 @@ public IRouter build(Uri uri) {
return this;
}

@Override
public IRouter build(@NonNull RouteRequest request) {
mRouteRequest = request;
Bundle bundle = mRouteRequest.getExtras();
if (bundle == null) {
bundle = new Bundle();
}
bundle.putString(Router.RAW_URI, request.getUri().toString());
mRouteRequest.setExtras(bundle);
return this;
}

@Override
public IRouter callback(RouteCallback callback) {
mRouteRequest.setRouteCallback(callback);
Expand Down
2 changes: 2 additions & 0 deletions router/src/main/java/com/chenenyu/router/IRouter.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public interface IRouter {
*/
IRouter build(Uri uri);

IRouter build(@NonNull RouteRequest request);

/**
* Route request callback.
*/
Expand Down

0 comments on commit 05ad019

Please sign in to comment.