Activity Stack
Activity管理任务栈,内部通过Application.registerActivityLifecycleCallbacks实现,可以打开和关闭指定 Activity,关闭所有Activity,关闭除指定Activity外所有Activity,终止进程等功能.
Author
Ayvytr 's GitHub
Since
3.1.6
修改isForeground,适配Android12最后关闭的Activity默认不会onDestroy()的问题
registerCallback增加第二个参数observer,回调判断Activity是否前台可见
适配:不停的按返回很快关闭多个Activity时,Activity关闭/销毁顺序和正常顺序相反的问题
2.5.1
Functions
finish All And Kill App
Link copied to clipboard
关闭所有页面后,终止进程。推荐使用这个方法终止进程.
finish All Except
Link copied to clipboard
关闭除clazz外的所有Activity.
finish All Except Name
Link copied to clipboard
关闭除类名为name外的所有Activity.
finish All Except Simple Name
Link copied to clipboard
关闭除简单类名为name外的所有Activity.
finish By Name
Link copied to clipboard
关闭类名为name的Activity.
finish By Simple Name
Link copied to clipboard
关闭简单类名为name的Activity.
finish Current
Link copied to clipboard
关闭当前Activity.
finish Except Top
Link copied to clipboard
关闭除顶部Activity外的其他所有activity.
get Current Activity
Link copied to clipboard
获取当前Activity.
get Running Activity Count
Link copied to clipboard
返回已启动的Activity数量.
is Foreground
Link copied to clipboard
判断Activity是否在前台
register Callback
Link copied to clipboard
@JvmStatic
Content copied to clipboard
注册Activity Lifecycle callback.
start And Finish Others
Link copied to clipboard
intent方式启动Activity,并且关闭其他所有Activity.
@JvmStatic
Content copied to clipboard
unregister Callback
Link copied to clipboard
取消注册Activity Lifecycle callback.