From 1a06912a6e14a57112db1204b43f81c43d721732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A3=E7=BA=AC?= Date: Wed, 17 Apr 2019 12:12:50 +0800 Subject: [PATCH] automatic injection support string defaults value. --- .../android/arouter/compiler/processor/AutowiredProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/processor/AutowiredProcessor.java b/arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/processor/AutowiredProcessor.java index 899d5d95..3ea2fb58 100644 --- a/arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/processor/AutowiredProcessor.java +++ b/arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/processor/AutowiredProcessor.java @@ -231,7 +231,7 @@ private String buildStatement(String originalValue, String statement, int type, statement += (isActivity ? ("getDoubleExtra($S, " + originalValue + ")") : ("getDouble($S)")); break; case STRING: - statement += (isActivity ? ("getStringExtra($S)") : ("getString($S)")); + statement += (isActivity ? ("getExtras() == null ? " + originalValue + " : substitute.getIntent().getExtras().getString($S, " + originalValue + ")") : ("getString($S)")); break; case SERIALIZABLE: statement += (isActivity ? ("getSerializableExtra($S)") : ("getSerializable($S)"));