mirror of
https://github.com/fankes/ColorOSNotifyIcon.git
synced 2025-09-07 03:05:44 +08:00
Changed FunctionFactory.kt
This commit is contained in:
@@ -370,15 +370,11 @@ fun toast(msg: String) = Toast.makeText(appContext, msg, Toast.LENGTH_SHORT).sho
|
|||||||
*
|
*
|
||||||
* [T] 为指定的 [Activity]
|
* [T] 为指定的 [Activity]
|
||||||
*/
|
*/
|
||||||
inline fun <reified T : Activity> Context.navigate() = runInSafe { startActivity(Intent(this, T::class.java)) }
|
inline fun <reified T : Activity> Context.navigate() = runInSafe {
|
||||||
|
startActivity(Intent(if (this is Service) applicationContext else this, T::class.java).apply {
|
||||||
/**
|
if (this@navigate !is Activity) flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
* 跳转到指定页面
|
})
|
||||||
*
|
}
|
||||||
* [T] 为指定的 [Activity]
|
|
||||||
*/
|
|
||||||
inline fun <reified T : Activity> Service.navigate() =
|
|
||||||
runInSafe { startActivity(Intent(this, T::class.java).apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK }) }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 弹出 [Snackbar]
|
* 弹出 [Snackbar]
|
||||||
|
Reference in New Issue
Block a user