Coder Social home page Coder Social logo

activityrouter's Issues

Mapping类equals方法错误

 if (o == this) {
            return true;
        }
        if (o instanceof Mapping) {
            Mapping that = (Mapping) o;
              return that.format.equals(((Mapping) o).format);
        }
        return false;

return that.format.equals(((Mapping) o).format);语句有问题,永远为true

每次页面跳转的问题

public class App extends Application implements RouterCallbackProvider {
@OverRide
public RouterCallback provideRouterCallback() {
return new SimpleRouterCallback() {
@OverRide
public void beforeOpen(Context context, Uri uri) {
context.startActivity(new Intent(context, LaunchActivity.class));
}

        @Override
        public void afterOpen(Context context, Uri uri) {
        }

        @Override
        public void notFound(Context context, Uri uri) {
            context.startActivity(new Intent(context, NotFoundActivity.class));
        }

        @Override
        public void error(Context context, Uri uri, Throwable e) {
            context.startActivity(ErrorStackActivity.makeIntent(context, uri, e));
        }
    };
}

}

我发现,每次调用跳转的时候,都会先执行到LaunchActivity里面;
而我希望当我回退的时候不经过这个LaunchActivity;
当我尝试注释掉 beforeOpen 里面的 启动 LaunchActivity 的时候,却发现无法执行;
请问这有好的解决办法么?
我希望,每次执行跳转的时候不去执行到 LaunchActivity,或者回退的时候不经过该页面;

有Library的项目可以使用吗

我项目中有Library,使用ActvityRouter之后只会有一个项目中的配置生效,我看了下几个Library生成的RouterInit和RouterMapping包名类名都是一样的,所以导致了只有一个生效结果。

多工程怎么使用?

项目里很多模块是通过lib工程来实现的,这种情况怎么使用?在每个lib工程都配置会生成相同的类,如果只在主工程里配置那lib工程的Annotation又不生成代码。

Router中的stringParams参数类型忘记写传值方法了?

        addStatement(mapMethod, int.class, router.intParams());
        addStatement(mapMethod, long.class, router.longParams());
        addStatement(mapMethod, boolean.class, router.booleanParams());
        addStatement(mapMethod, short.class, router.shortParams());
        addStatement(mapMethod, float.class, router.floatParams());
        addStatement(mapMethod, double.class, router.doubleParams());
        addStatement(mapMethod, byte.class, router.byteParams());
        addStatement(mapMethod, char.class, router.charParams());

原本没有写传递stringParams类型的方法
需要加上下面这句话:
addStatement(mapMethod, String.class, router.stringParams());

ExtraTypes.class 中需要添加 stringExtra的getter和setter方法

浏览器调用

你好,在手机内置浏览器打开h5页面可以直接打开activity吗?同理,微信里面的内置浏览器可以打开app页面吗?谢谢

url参数的问题

当url中存在“/”符号时,会有解析错误的问题,觉得可以做一个过滤,提供一个encode的方法,然后回传参数的时候decode

很酷的类,提几点建议

1.希望给出string的配置选项
如果仅仅是一个类定义了一个path,传过来的参数虽然可以得到,但是这样在代码维护性方面感觉还是略低,所以希望像int这样给出一个string的配置选项。

@Router(value = {"user_detail/"}, intExtra = {"userId"})

2.建议增加path的命名
注解默认的值是value,这可以缺省,很省事,但是如果当我怎讲了intExtra的配置后,这个value写出来后就没有很好的语义性。所以建议增加path字段来和value并存,在注解解析器中解析value如果没有就解析path,如果还没有,那么才是真正的没有。

if(value == null){
      if(path == null){.......}
}

3.建议给配置选项改名
intExtra知道是和android一致的int参数,但个人认为叫做intParam可能更加合适url的语义。

eg:intParam = {user_id}

4.最好能通过注解将intent的getExtra这些代码进行自动生成,对于每个被注解标识的类产生

XxxArgs args = XxxArgsFromRouter.getArguments(getIntent());
args.username;
args.topicId;
arg.commentId;

配合androidannotation使用的问题

因为配合这个框架使用所以它生成的类都带有一个下划线"",但是因为@router是加在原始的类上所以在使用的时候失效了.
我down下来您的代码改动了部分内容
mapMethod.addStatement("com.github.mzule.activityrouter.router.Routers.map($S,$T_.class, null, extraTypes)", format, className);
也就是生成的Activity应该是TestActivity
,而导入包还是TestActivity
这样可以生成带下划线的类了.但是我对生成这块不熟悉.没有办法import对应的类的包.
所以麻烦给点提示.找了半天没有找到相关的代码.
thx
项目很棒

实际参数列表和形式参数列表长度不同

Error:(13, 51) 错误: 无法将类 Routers中的方法 map应用到给定类型;
需要: String,Class<? extends Activity>,MethodInvoker,ExtraTypes
找到: String,Class,ExtraTypes
原因: 实际参数列表和形式参数列表长度不同

stringParam,字符串参数如果使用的时候为空,无法跳转

String accountParam = mEtdAccount.getText().toString().trim();
// accountParam为空字符串的时候,无法跳转,我是做了一个判断加了一个为空串的时候的标识。
if (TextUtils.equals("", accountParam)){
// 帐号参数为空字符串的时候,路由的url路径无法跳转,所以设置一个空的标识来表示
accountParam = "empty";
}
Routers.openForResult(LoginActivity.this,
AppConst.MODIFY_PWD_ROUTER_URL + accountParam,
AppConst.MODIFY_PWD_REQUEST_CODE);

拦截器

不支持拦截器吗,跳转之前拦截做登录绑卡的操作等这样,我看alibaba/ARouter有加

RouterInit.init()

private static void initIfNeed() {
    if (!mappings.isEmpty()) {
        return;
    }
    RouterInit.init();
    sort();
}

大神请教下RouterInit.init();是做了啥操作,源码中好像方法是空的..

为什么我这么写 浏览器打不开呢

@RequiresPresenter(PayPresenter.class)
@router("main")
public class RechargePayActivity extends BaseActivity implements View.OnClickListener, IPayView {}

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:scheme="mzule" /><!--改成自己的scheme-->
        </intent-filter>
    </activity>

为什么我这么写 浏览器打不开呢

ActivityNotFoundException 子工程

按照配置,找不到Activity,为什么会加主工程的前缀?

03-01 19:17:43.365 21676-21676/com.xxx.prototype_1010_2 W/System.err: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.xxx.prototype_1010_2/com.xxx.prototype.TestActivity}; have you declared this activity in your AndroidManifest.xml?

mappings为空,打不开对应的activity

尝试理解源码,并没有直接引用,本地按照你的project进行配置
这是生成的RouterMapping类
// ----------------------------------------------------------

public final class RouterMapping {
public static final void map() {
java.util.Map<String,String> transfer = null;
com.test.routerkit.router.ExtraTypes extraTypes;
transfer = null;
extraTypes = new com.test.routerkit.router.ExtraTypes();
extraTypes.setTransfer(transfer);
com.test.routerkit.router.Routers.map("main/test", MainActivity.class, extraTypes);
com.test.routerkit.router.Routers.sort();
}
}
// ----------------------------------------------------------
但是Routers.map()方法并没有调用, mappings size始终为0,无法打开对应的activity。
请问com.test.routerkit.router.Routers.map()失效的原因是什么

RouterInit这个类不存在

导入的是下面的库
compile 'com.github.mzule.activityrouter:activityrouter:1.2.1'
apt 'com.github.mzule.activityrouter:compiler:1.1.7'
RouterInit这个类不存在,看了源码中还引入了一个“stub”的字库,里面有RouterInit这个类,但是我通过gradle引入就找不到这个类!

多个module 跳转问题

请问我有两个module A 和 B 然而我通过Routers.open();跳转到module A的act是可以跳转过去的,但是module B的act跳转不过去 一直notfound ,act都有通过@router("actA")注解 在主module的AndroidManifest.xml添加了添加了RouterActivity,每个module中也添加了(compile 'com.github.mzule.activityrouter:activityrouter:1.2.2' 和 apt 'com.github.mzule.activityrouter:compiler:1.1.7')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.