Skip to content

Commit ea1b7c8

Browse files
committed
fix: 修复携带host形式的URL地址跳转问题
1 parent 1ae88ad commit ea1b7c8

File tree

3 files changed

+5
-19
lines changed

3 files changed

+5
-19
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ siteUrl=https://github.com/wzbos/Android-Rudolph-Router
1818
gitUrl=https://github.com/wzbos/Android-Rudolph-Router.git
1919
licenseName=The Apache Software License, Version 2.0
2020
licenseUrl=http://www.apache.org/licenses/LICENSE-2.0.txt
21-
rudolph_version=2.0.1
21+
rudolph_version=2.0.2
2222
developerId=wzbos
2323
developerName=zongbo.wu
2424
developerEmail=sckoo@163.com

rudolph/src/main/java/cn/wzbos/android/rudolph/Rudolph.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@ object Rudolph {
5454
val tables: MutableList<IRouteTable> = ArrayList()
5555
for (className in list) {
5656
try {
57+
RLog.i(TAG, "init Router: $className")
5758
val clazz = Class.forName("cn.wzbos.android.rudolph.routes.$className")
5859
if (IRouteTable::class.java.isAssignableFrom(clazz)) {
5960
val iRouteTable = clazz.newInstance() as IRouteTable
6061
iRouteTable.register()
6162
tables.add(iRouteTable)
6263
}
63-
} catch (e: ClassNotFoundException) {
64+
} catch (e: Exception) {
6465
RLog.e(TAG, "初始化\"$className\"组件失败,请检查包名是否正确!", e)
6566
}
6667
}

rudolph/src/main/java/cn/wzbos/android/rudolph/router/RouteBuilder.kt

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cn.wzbos.android.rudolph.router
22

3+
import android.net.Uri
34
import android.os.Bundle
45
import android.os.Parcelable
56
import android.text.TextUtils
@@ -251,23 +252,7 @@ abstract class RouteBuilder<B : RouteBuilder<B, R>?, R : Router<*>?> : IRouteBui
251252

252253
val path: String
253254
get() {
254-
val n = rawUrl!!.indexOf("://")
255-
val stx: Int
256-
val etx: Int
257-
if (n > -1) {
258-
stx = n + 3
259-
etx = rawUrl!!.indexOf("?", stx)
260-
} else {
261-
stx = 0
262-
etx = rawUrl!!.indexOf("?")
263-
}
264-
val path: String
265-
path = if (etx > -1) {
266-
rawUrl!!.substring(stx, etx)
267-
} else {
268-
rawUrl!!.substring(stx)
269-
}
270-
return path
255+
return Uri.parse(rawUrl).path
271256
}
272257

273258
private val segments: List<String>

0 commit comments

Comments
 (0)