This repository was archived by the owner on Feb 8, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
navigator/src/main/java/com/github/florent37/navigator Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -8,18 +8,38 @@ import kotlin.reflect.KProperty
88
99open class Parameter : Serializable
1010
11+ /* *
12+ * Retrieve a non nullable route Parameter
13+ *
14+ * val args = routeParamValue<MyRoute.MyParam>
15+ */
1116fun <T > Activity.routeParamValue (): T {
1217 return this .intent.getSerializableExtra(ROUTE_ARGS_KEY ) as T
1318}
1419
20+ /* *
21+ * Retrieve a non nullable flavor Parameter
22+ *
23+ * val args = flavorParamValue<MyRoute.MyParam>
24+ */
1525fun <T > Activity.flavorParamValue (): T {
1626 return this .intent.getSerializableExtra(ROUTE_FLAVOR_ARGS_KEY ) as T
1727}
1828
29+ /* *
30+ * Retrieve a nullable route Parameter
31+ *
32+ * val args : MyRoute.MyParam? = optionalRouteParamValue<MyRoute.MyParam>
33+ */
1934fun <T > Activity.optionalRouteParamValue (): T ? {
2035 return this .intent?.getSerializableExtra(ROUTE_ARGS_KEY ) as ? T
2136}
2237
38+ /* *
39+ * Retrieve a nullable flavor Parameter
40+ *
41+ * val args : MyRoute.MyParam? = optionalFlavorParamValue<MyRoute.MyParam>
42+ */
2343fun <T > Activity.optionalFlavorParamValue (): T ? {
2444 return this .intent?.getSerializableExtra(ROUTE_FLAVOR_ARGS_KEY ) as ? T
2545}
You can’t perform that action at this time.
0 commit comments