com.alibaba.android.arouter.facade.callback.InterceptorCallback Java Examples

The following examples show how to use com.alibaba.android.arouter.facade.callback.InterceptorCallback. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RouterInterceptor.java    From lifecycle-component with Apache License 2.0 5 votes vote down vote up
@Override
    public void process(Postcard postcard, InterceptorCallback callback) {
        callback.onContinue(postcard);
        //这里示例的意思是, 如果用户没有登录就只能进入登录注册等划分到 ACCOUNT 分组的页面, 用户进入其他页面将全部被拦截
//        if (postcard.getGroup().equals(RouterHub.ACCOUNT.split("/")[1])
//            callback.onContinue(postcard);
//        } else {
//            callback.onInterrupt(new Exception("用户没有登陆"));
//        }
    }
 
Example #2
Source File: RouterInterceptor.java    From TikTok with Apache License 2.0 5 votes vote down vote up
@Override
    public void process(Postcard postcard, InterceptorCallback callback) {
        callback.onContinue(postcard);
        //这里示例的意思是, 如果用户没有登录就只能进入登录注册等划分到 ACCOUNT 分组的页面, 用户进入其他页面将全部被拦截
//        if (postcard.getGroup().equals(RouterHub.ACCOUNT.split("/")[1])
//            callback.onContinue(postcard);
//        } else {
//            callback.onInterrupt(new Exception("用户没有登陆"));
//        }
    }
 
Example #3
Source File: RouterInterceptor.java    From Hands-Chopping with Apache License 2.0 5 votes vote down vote up
@Override
    public void process(Postcard postcard, InterceptorCallback callback) {
        callback.onContinue(postcard);
        //这里示例的意思是, 如果用户没有登录就只能进入登录注册等划分到 ACCOUNT 分组的页面, 用户进入其他页面将全部被拦截
//        if (postcard.getGroup().equals(RouterHub.ACCOUNT.split("/")[1])
//            callback.onContinue(postcard);
//        } else {
//            callback.onInterrupt(new Exception("用户没有登陆"));
//        }
    }
 
Example #4
Source File: LoginInterceptor.java    From JD-Test with Apache License 2.0 5 votes vote down vote up
@Override
public void process(Postcard postcard, InterceptorCallback callback) {
    if(!CommonConfig.LOGIN){
        callback.onInterrupt(null);
        ARouter.getInstance().build("/test/login").greenChannel().navigation();
    }
    else{
        callback.onContinue(postcard);
    }
}
 
Example #5
Source File: ActivityInterceptor.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void process(Postcard postcard, InterceptorCallback interceptorCallback) {

    if (UserManagerImpl.getInstance().getActiveUser() == null) {
        String path = postcard.getPath();
        for (String activity : ARouterConstants.ACTIVITY_NEED_LOGIN) {
            if (activity.equals(path)) {
                interceptorCallback.onInterrupt(new Exception("未登录"));
                ARouter.getInstance().build(ARouterConstants.ACTIVITY_LOGIN).navigation();
                return;
            }
        }
    }
    interceptorCallback.onContinue(postcard);
}