Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToastUtils在安卓13上的问题 #1789

Open
BreezeAndMoon opened this issue Sep 21, 2023 · 0 comments
Open

ToastUtils在安卓13上的问题 #1789

BreezeAndMoon opened this issue Sep 21, 2023 · 0 comments
Assignees
Labels

Comments

@BreezeAndMoon
Copy link

描述 Bug

安卓13上测试发现Activity退出前调用吐司,会在当前activity弹出吐司,退出当前activity后又重复在上一个activity弹一次,调试发现是因为没有调用SystemToast,走的是ActivityToast,13以下是正常的只弹了一次,因为13以下调用的是SystemToast,至于为什么有这个差异,是因为下面代码中的一个条件判断。

相关代码

private static IToast newToast(ToastUtils toastUtils) {
        if (!toastUtils.isNotUseSystemToast) {
            if (NotificationManagerCompat.from(Utils.getApp()).areNotificationsEnabled()) {//源码中此处13会返回false,13以下返回true
                if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
                    return new SystemToast(toastUtils);
                }
                if (!UtilsBridge.isGrantedDrawOverlays()) {
                    return new SystemToast(toastUtils);
                }
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants