Navigator

open class Navigator(url: String?, intent: Intent?)

路由导航器。与RouterItem作用类似,允许互转。 RouterItem 用于描述一个静态的路由项 Navigator 用于描述一个路由项的跳转动作

Constructors

Navigator
Link copied to clipboard
fun Navigator(url: String?)
Navigator
Link copied to clipboard
fun Navigator(url: String?, intent: Intent?)

Functions

action
Link copied to clipboard
fun action()
fun action(ctx: Context? = null)

执行导航器Action

addFlags
Link copied to clipboard
fun addFlags(flags: Int): Navigator
createFragment
Link copied to clipboard
fun <T : Fragment?> createFragment(): T?

通过导航器创建Fragment,当TheRouter没有初始化完成时,将返回null 接收方可通过argus或@Autowired获取参数

createFragmentWithCallback
Link copied to clipboard
fun <T : Fragment?> createFragmentWithCallback(callback: (T?) -> Unit)

通过导航器创建Fragment,异步回调 接收方可通过argus或@Autowired获取参数

createIntent
Link copied to clipboard
fun createIntent(ctx: Context?): Intent

通过导航器创建Intent,会自动将Navigator中的参数传入Intent intent.putExtra(KEY_ACTION, routeItem.action) intent.putExtra(KEY_PATH, getUrlWithParams()) intent.putExtra(KEY_DESCRIPTION, routeItem.description)

createIntentWithCallback
Link copied to clipboard
fun createIntentWithCallback(ctx: Context?, callback: (Intent) -> Unit)

通过导航器创建Intent,会自动将Navigator中的参数传入Intent,异步回调返回 intent.putExtra(KEY_ACTION, routeItem.action) intent.putExtra(KEY_PATH, getUrlWithParams()) intent.putExtra(KEY_DESCRIPTION, routeItem.description)

fillParams
Link copied to clipboard
fun fillParams(action: (Bundle) -> Unit): Navigator
getUrlWithParams
Link copied to clipboard
fun getUrlWithParams(): String
fun getUrlWithParams(handle: NavigatorParamsFixHandle): String
fun getUrlWithParams(handle: (String, String) -> String): String
navigation
Link copied to clipboard
fun navigation(context: Context? = getApplicationContext(), callback: NavigationCallback? = null)
fun navigation(fragment: Fragment?, callback: NavigationCallback? = null)
fun navigation(ctx: Context?, requestCode: Int, ncb: NavigationCallback? = null)
fun navigation(fragment: Fragment?, requestCode: Int, ncb: NavigationCallback? = null)

fun navigation(ctx: Context?, fragment: Fragment?, requestCode: Int, ncb: NavigationCallback? = null)

跳转到对应Activity落地页

optObject
Link copied to clipboard
fun optObject(key: String): Any?
pending
Link copied to clipboard
fun pending(): Navigator
setClipData
Link copied to clipboard
fun setClipData(clipData: ClipData?): Navigator
setData
Link copied to clipboard
fun setData(uri: Uri?): Navigator
setIdentifier
Link copied to clipboard
fun setIdentifier(identifier: String?): Navigator
with
Link copied to clipboard
fun with(value: Bundle?): Navigator
withBoolean
Link copied to clipboard
fun withBoolean(key: String?, value: Boolean): Navigator
withBundle
Link copied to clipboard
fun withBundle(key: String?, value: Bundle?): Navigator
withByte
Link copied to clipboard
fun withByte(key: String?, value: Byte): Navigator
withChar
Link copied to clipboard
fun withChar(key: String?, value: Char): Navigator
withDouble
Link copied to clipboard
fun withDouble(key: String?, value: Double): Navigator
withFlags
Link copied to clipboard
fun withFlags(flags: Int): Navigator
withFloat
Link copied to clipboard
fun withFloat(key: String?, value: Float): Navigator
withInAnimation
Link copied to clipboard
fun withInAnimation(id: Int): Navigator
withInt
Link copied to clipboard
fun withInt(key: String?, value: Int): Navigator
withLong
Link copied to clipboard
fun withLong(key: String?, value: Long): Navigator
withObject
Link copied to clipboard
fun withObject(key: String, value: Any): Navigator
withOptionsCompat
Link copied to clipboard
fun withOptionsCompat(options: Bundle?): Navigator
withOutAnimation
Link copied to clipboard
fun withOutAnimation(id: Int): Navigator
withParcelable
Link copied to clipboard
fun withParcelable(key: String?, value: Parcelable?): Navigator
withSerializable
Link copied to clipboard
fun withSerializable(key: String?, value: Serializable?): Navigator
withString
Link copied to clipboard
fun withString(key: String?, value: String?): Navigator

Properties

extras
Link copied to clipboard
val extras: Bundle
intent
Link copied to clipboard
val intent: Intent?
normalUrl
Link copied to clipboard
val normalUrl: String?
simpleUrl
Link copied to clipboard
val simpleUrl: String
url
Link copied to clipboard
var url: String?