-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
131 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
sample/src/main/java/com/lzh/nonview/router/demo/ArgsActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.lzh.nonview.router.demo | ||
|
||
import android.os.Bundle | ||
import android.widget.TextView | ||
import com.lzh.compiler.parceler.annotation.Arg | ||
import com.lzh.nonview.router.anno.RouterRule | ||
import com.lzh.nonview.router.demo.pojo.User | ||
|
||
/** | ||
* 此页面用于介绍如何结合[Parceler](https://github.com/JumeiRdGroup/Parceler)框架的 | ||
* Arg注解进行**自动参数类型解析传递** | ||
* | ||
* DATE: 2018/5/8 | ||
* | ||
* AUTHOR: haoge | ||
*/ | ||
@RouterRule("parceler-args") | ||
class ArgsActivity:BaseActivity() { | ||
|
||
// 基本java数据类型 | ||
@Arg | ||
var mBoolean:Boolean? = null | ||
@Arg | ||
var mInt:Int? = null | ||
@Arg | ||
var mByte:Byte? = null | ||
@Arg | ||
var mShort:Short? = null | ||
@Arg | ||
var mChar:Char? = null | ||
@Arg | ||
var mFloat:Float? = null | ||
@Arg | ||
var mLong:Long? = null | ||
@Arg | ||
var mDouble:Double? = null | ||
// 其他类型 | ||
@Arg | ||
var mString:String? = null | ||
// 非可序列化对象 | ||
@Arg | ||
var mUser: User? = null | ||
@Arg | ||
var mUrl:String? = null | ||
|
||
val mPrinter:TextView by lazy { findViewById(R.id.printer_tv) as TextView } | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_intent_printer) | ||
val message = StringBuilder() | ||
message.append("boolean value is $mBoolean\n") | ||
message.append("int value is $mInt\n") | ||
message.append("byte value is $mByte\n") | ||
message.append("short value is $mShort\n") | ||
message.append("char value is $mChar\n") | ||
message.append("float value is $mFloat\n") | ||
message.append("long value is $mLong\n") | ||
message.append("double value is $mDouble\n") | ||
message.append("string value is $mString\n") | ||
message.append("user value is $mUser\n") | ||
message.append("url value is $mUrl\n") | ||
mPrinter.text = message | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
sample/src/main/java/com/lzh/nonview/router/demo/pojo/User.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.lzh.nonview.router.demo.pojo | ||
|
||
/** | ||
* DATE: 2018/5/8 | ||
* AUTHOR: haoge | ||
*/ | ||
class User() { | ||
var name:String? = null | ||
constructor(name:String?):this() { | ||
this.name = name | ||
} | ||
|
||
override fun toString(): String { | ||
return "User(name=$name)" | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters