diff --git a/HelpDoc-en.md b/HelpDoc-en.md
index dd4611d..2a454fc 100644
--- a/HelpDoc-en.md
+++ b/HelpDoc-en.md
@@ -144,7 +144,7 @@ public class ToastStrategy {
#### What should I do if the framework cannot meet the scene I am currently using
-* The Toaster framework is intended to solve some toast requirements. If Toaster cannot meet your needs, you can consider using the [XToast](https://github.com/getActivity/XToast) floating window framework to achieve it.
+* The Toaster framework is intended to solve some toast requirements. If Toaster cannot meet your needs, you can consider using the [EasyWindow](https://github.com/getActivity/EasyWindow) floating window framework to achieve it.
#### Why the framework prefers to use window manager to implement toast
diff --git a/HelpDoc-zh.md b/HelpDoc-zh.md
index 3444c02..eedcf6b 100644
--- a/HelpDoc-zh.md
+++ b/HelpDoc-zh.md
@@ -160,7 +160,7 @@ public class ToastStrategy {
#### 框架无法满足我当前使用的场景怎么办
-* Toaster 框架意在解决一些的 Toast 需求,如果 Toaster 无法满足你的需求,你可以考虑使用 [XToast](https://github.com/getActivity/XToast) 悬浮窗框架来实现。
+* Toaster 框架意在解决一些的 Toast 需求,如果 Toaster 无法满足你的需求,你可以考虑使用 [EasyWindow](https://github.com/getActivity/EasyWindow) 悬浮窗框架来实现。
#### 为什么框架优先使用 WindowManager 来实现 Toast
diff --git a/README-en.md b/README-en.md
index 55413dc..1eea6eb 100644
--- a/README-en.md
+++ b/README-en.md
@@ -4,7 +4,7 @@
* Project address: [Github](https://github.com/getActivity/Toaster)
-* [Click here to download demo apk directly](https://github.com/getActivity/Toaster/releases/download/12.2/Toaster.apk)
+* [Click here to download demo apk directly](https://github.com/getActivity/Toaster/releases/download/12.3/Toaster.apk)
![](picture/en/demo_toast_activity.jpg) ![](picture/en/demo_toast_style_white.jpg) ![](picture/en/demo_toast_style_black.jpg)
@@ -49,7 +49,7 @@ android {
dependencies {
// Toast framework:https://github.com/getActivity/Toaster
- implementation 'com.github.getActivity:Toaster:12.2'
+ implementation 'com.github.getActivity:Toaster:12.3'
}
```
@@ -134,7 +134,7 @@ Toaster.getInterceptor();
| Function or detail | [Toaster](https://github.com/getActivity/Toaster) |[ AndroidUtilCode-ToastUtils ](https://github.com/Blankj/AndroidUtilCode)| [Toasty](https://github.com/GrenderG/Toasty) |
| :----: | :------: | :-----: | :-----: |
-| Corresponding version | 12.2 | 1.30.6 | 1.5.0 |
+| Corresponding version | 12.3 | 1.30.6 | 1.5.0 |
| Number of issues | [![](https://img.shields.io/github/issues/getActivity/Toaster.svg)](https://github.com/getActivity/Toaster/issues) |[![](https://img.shields.io/github/issues/Blankj/AndroidUtilCode.svg)](https://github.com/Blankj/AndroidUtilCode/issues)| [![](https://img.shields.io/github/issues/GrenderG/Toasty.svg)](https://github.com/GrenderG/Toasty/issues) |
| Framework pack size | 31 KB | 500 KB | 50 KB |
| Framework maintenance status| 维护中 | 停止维护 | 停止维护 |
@@ -234,7 +234,7 @@ new Toast
* Title bar framework: [TitleBar](https://github.com/getActivity/TitleBar)![](https://img.shields.io/github/stars/getActivity/TitleBar.svg)![](https://img.shields.io/github/forks/getActivity/TitleBar.svg)
-* Floating window framework: [XToast](https://github.com/getActivity/XToast)![](https://img.shields.io/github/stars/getActivity/XToast.svg)![](https://img.shields.io/github/forks/getActivity/XToast.svg)
+* Floating window framework: [EasyWindow](https://github.com/getActivity/EasyWindow)![](https://img.shields.io/github/stars/getActivity/EasyWindow.svg)![](https://img.shields.io/github/forks/getActivity/EasyWindow.svg)
* Shape view framework: [ShapeView](https://github.com/getActivity/ShapeView)![](https://img.shields.io/github/stars/getActivity/ShapeView.svg)![](https://img.shields.io/github/forks/getActivity/ShapeView.svg)
diff --git a/README.md b/README.md
index 85d31a2..8e0b3f1 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
* 博客地址:[只需体验三分钟,你就会跟我一样,爱上这款 Toast](https://www.jianshu.com/p/9b174ee2c571)
-* 可以扫码下载 Demo 进行演示或者测试,如果扫码下载不了的,[点击此处可直接下载](https://github.com/getActivity/Toaster/releases/download/12.2/Toaster.apk)
+* 可以扫码下载 Demo 进行演示或者测试,如果扫码下载不了的,[点击此处可直接下载](https://github.com/getActivity/Toaster/releases/download/12.3/Toaster.apk)
![](picture/zh/download_demo_apk_qr_code.png)
@@ -53,7 +53,7 @@ android {
dependencies {
// 吐司框架:https://github.com/getActivity/Toaster
- implementation 'com.github.getActivity:Toaster:12.2'
+ implementation 'com.github.getActivity:Toaster:12.3'
}
```
@@ -138,7 +138,7 @@ Toaster.getInterceptor();
| 功能或细节 | [Toaster](https://github.com/getActivity/Toaster) | [AndroidUtilCode-ToastUtils](https://github.com/Blankj/AndroidUtilCode) | [Toasty](https://github.com/GrenderG/Toasty) |
| :----: | :------: | :-----: | :-----: |
-| 对应版本 | 12.2 | 1.30.6 | 1.5.0 |
+| 对应版本 | 12.3 | 1.30.6 | 1.5.0 |
| issues 数 | [![](https://img.shields.io/github/issues/getActivity/Toaster.svg)](https://github.com/getActivity/Toaster/issues) | [![](https://img.shields.io/github/issues/Blankj/AndroidUtilCode.svg)](https://github.com/Blankj/AndroidUtilCode/issues) | [![](https://img.shields.io/github/issues/GrenderG/Toasty.svg)](https://github.com/GrenderG/Toasty/issues) |
| 框架体积 | 32 KB | 500 KB | 50 KB |
| 框架维护状态 | 维护中 | 停止维护 | 停止维护 |
@@ -242,7 +242,7 @@ new Toast
* 标题栏框架:[TitleBar](https://github.com/getActivity/TitleBar) ![](https://img.shields.io/github/stars/getActivity/TitleBar.svg) ![](https://img.shields.io/github/forks/getActivity/TitleBar.svg)
-* 悬浮窗框架:[XToast](https://github.com/getActivity/XToast) ![](https://img.shields.io/github/stars/getActivity/XToast.svg) ![](https://img.shields.io/github/forks/getActivity/XToast.svg)
+* 悬浮窗框架:[EasyWindow](https://github.com/getActivity/EasyWindow) ![](https://img.shields.io/github/stars/getActivity/EasyWindow.svg) ![](https://img.shields.io/github/forks/getActivity/EasyWindow.svg)
* Shape 框架:[ShapeView](https://github.com/getActivity/ShapeView) ![](https://img.shields.io/github/stars/getActivity/ShapeView.svg) ![](https://img.shields.io/github/forks/getActivity/ShapeView.svg)
@@ -282,6 +282,18 @@ new Toast
#### [点击查看捐赠列表](https://github.com/getActivity/Donate)
+#### 广告区
+
+* 我现在任腾讯云服务器推广大使,大家如果有购买服务器的需求,可以通过下面的链接购买
+
+[![](https://upload-dianshi-1255598498.file.myqcloud.com/upload/nodir/345X200-9ae456f58874df499adf7c331c02cb0fed12b81d.jpg)](https://curl.qcloud.com/A6cYskvv)
+
+[【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中](https://curl.qcloud.com/A6cYskvv)
+
+[![](https://upload-dianshi-1255598498.file.myqcloud.com/345-200-b28f7dee9552f4241ea6a543f15a9798049701d4.jpg)](https://curl.qcloud.com/up4fQsdn)
+
+[【腾讯云】中小企业福利专场,多款刚需产品,满足企业通用场景需求](https://curl.qcloud.com/up4fQsdn)
+
## License
```text
diff --git a/app/build.gradle b/app/build.gradle
index 6cc663d..f110d64 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,14 +1,14 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 31
+ compileSdkVersion 33
defaultConfig {
applicationId "com.hjq.toast.demo"
minSdkVersion 16
- targetSdkVersion 31
- versionCode 1202
- versionName "12.2"
+ targetSdkVersion 33
+ versionCode 1203
+ versionName "12.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
@@ -62,13 +62,13 @@ dependencies {
implementation 'com.google.android.material:material:1.4.0'
// 标题栏框架:https://github.com/getActivity/TitleBar
- implementation 'com.github.getActivity:TitleBar:10.0'
+ implementation 'com.github.getActivity:TitleBar:10.3'
// 权限请求框架:https://github.com/getActivity/XXPermissions
- implementation 'com.github.getActivity:XXPermissions:16.6'
+ implementation 'com.github.getActivity:XXPermissions:18.0'
- // 悬浮窗框架:https://github.com/getActivity/XToast
- implementation 'com.github.getActivity:XToast:8.9'
+ // 悬浮窗框架:https://github.com/getActivity/EasyWindow
+ implementation 'com.github.getActivity:EasyWindow:10.0'
// 内存泄漏捕捉:https://github.com/square/leakcanary
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'
diff --git a/app/src/main/java/com/hjq/toast/demo/MainActivity.java b/app/src/main/java/com/hjq/toast/demo/MainActivity.java
index a044bfd..1f9d895 100644
--- a/app/src/main/java/com/hjq/toast/demo/MainActivity.java
+++ b/app/src/main/java/com/hjq/toast/demo/MainActivity.java
@@ -21,7 +21,7 @@
import com.hjq.toast.style.BlackToastStyle;
import com.hjq.toast.style.CustomToastStyle;
import com.hjq.toast.style.WhiteToastStyle;
-import com.hjq.xtoast.XToast;
+import com.hjq.window.EasyWindow;
/**
* author : Android 轮子哥
@@ -169,13 +169,13 @@ public void run() {
}, 5000);
}
- public void combinationXToastShow(View v) {
- new XToast<>(this)
+ public void combinationEasyWindowShow(View v) {
+ new EasyWindow<>(this)
.setDuration(1000)
- // 将 Toaster 中的 View 转移给 XToast 来显示
+ // 将 Toaster 中的 View 转移给 EasyWindow 来显示
.setContentView(Toaster.getStyle().createView(getApplication()))
.setAnimStyle(android.R.style.Animation_Translucent)
- .setText(android.R.id.message, R.string.demo_combining_xtoast_use_result)
+ .setText(android.R.id.message, R.string.demo_combining_window_framework_use_result)
.setGravity(Gravity.BOTTOM)
.setYOffset((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, getResources().getDisplayMetrics()))
.show();
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 3e13ead..682735a 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -159,8 +159,8 @@
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
- android:onClick="combinationXToastShow"
- android:text="@string/demo_combining_xtoast_use" />
+ android:onClick="combinationEasyWindowShow"
+ android:text="@string/demo_combining_window_framework_use" />
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index 9abf40b..9e13912 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -16,9 +16,9 @@
切换成 Toast 排队显示策略
点我连续显示 3 个 Toast
在后台状态下显示 Toast
- 搭配 XToast 悬浮窗框架
+ 搭配 EasyWindow 悬浮窗框架
- 我是普通的 Toast
+ 我是普通的 Toast我是普通的 Toast我是普通的 Toast我是普通的 Toast我是普通的 Toast
我是一个短 Toast
我是一个长 Toast
我是延迟 2 秒显示的 Toast
@@ -32,10 +32,10 @@
我是自定义布局的 Toast(全局生效)
切换到排队显示策略成功,请点击下方文本来体验效果
我是第 %d 个 Toast
- 系好安全带,即将跳转到手机桌面
+ 请系好安全带,即将跳转到手机桌面
温馨提示:安卓 10 在后台显示 Toast 需要有通知栏权限或者悬浮窗权限的情况下才可以显示
我是在后台显示的 Toast(有悬浮窗权限真的可以为所欲为)
我是在后台显示的 Toast(安卓 11 及以上在后台显示只能使用系统样式)
我是在后台显示的 Toast
- 就问你溜不溜
+ 就问你溜不溜
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1685a34..ebd3b8f 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -17,7 +17,7 @@
Switch to toast queuing display strategy
Click and I show 3 toast in a row
Show toast in background state
- Combining xtoast suspension window frames
+ Combining EasyWindow suspension window frames
I am an normal toast
I am a short toast
@@ -38,5 +38,5 @@
I display the toast in the background (you can really do whatever you want with the floating window permission)
I am displaying the toast in the background (Android 11 and above can only use the system style in the background display)
I am displaying toast in the background
- Hello Word
+ Hello Word
\ No newline at end of file
diff --git a/library/build.gradle b/library/build.gradle
index e7fac65..1828fe5 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 31
+ compileSdkVersion 33
defaultConfig {
minSdkVersion 14
- versionCode 1202
- versionName "12.2"
+ versionCode 1203
+ versionName "12.3"
}
// 使用 JDK 1.8
diff --git a/library/src/main/java/com/hjq/toast/ApplicationToast.java b/library/src/main/java/com/hjq/toast/GlobalToast.java
similarity index 84%
rename from library/src/main/java/com/hjq/toast/ApplicationToast.java
rename to library/src/main/java/com/hjq/toast/GlobalToast.java
index d8ad1ec..f34ab2b 100644
--- a/library/src/main/java/com/hjq/toast/ApplicationToast.java
+++ b/library/src/main/java/com/hjq/toast/GlobalToast.java
@@ -8,12 +8,12 @@
* time : 2021/11/30
* desc : 利用悬浮窗权限弹出全局 Toast
*/
-public class ApplicationToast extends CustomToast {
+public class GlobalToast extends CustomToast {
/** Toast 实现类 */
private final ToastImpl mToastImpl;
- public ApplicationToast(Application application) {
+ public GlobalToast(Application application) {
mToastImpl = new ToastImpl(application, this);
}
diff --git a/library/src/main/java/com/hjq/toast/ToastImpl.java b/library/src/main/java/com/hjq/toast/ToastImpl.java
index c43a090..7ec2ce3 100644
--- a/library/src/main/java/com/hjq/toast/ToastImpl.java
+++ b/library/src/main/java/com/hjq/toast/ToastImpl.java
@@ -151,6 +151,11 @@ public void run() {
if (mGlobalShow) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
params.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
+ // 在 type 等于 TYPE_APPLICATION_OVERLAY 的时候
+ // 不能添加 WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE 标记
+ // 否则会导致在 Android 13 上面会出现 Toast 布局被半透明化的效果
+ // Github issue 地址:https://github.com/getActivity/Toaster/issues/108
+ params.flags &= ~WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
} else {
params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
}
diff --git a/library/src/main/java/com/hjq/toast/ToastLogInterceptor.java b/library/src/main/java/com/hjq/toast/ToastLogInterceptor.java
index ef5e53e..4634604 100644
--- a/library/src/main/java/com/hjq/toast/ToastLogInterceptor.java
+++ b/library/src/main/java/com/hjq/toast/ToastLogInterceptor.java
@@ -60,11 +60,13 @@ protected void printLog(String msg) {
protected boolean filterClass(Class> clazz) {
// 排查以下几种情况:
- // 1. 排除自身
+ // 1. 排除自身及其子类
// 2. 排除 Toaster 类
// 3. 排除接口类
// 4. 排除抽象类
- return this.getClass().equals(clazz) || Toaster.class.equals(clazz) ||
- clazz.isInterface() || Modifier.isAbstract(clazz.getModifiers());
+ return IToastInterceptor.class.isAssignableFrom(clazz) ||
+ Toaster.class.equals(clazz) ||
+ clazz.isInterface() ||
+ Modifier.isAbstract(clazz.getModifiers());
}
}
\ No newline at end of file
diff --git a/library/src/main/java/com/hjq/toast/ToastStrategy.java b/library/src/main/java/com/hjq/toast/ToastStrategy.java
index 319ce67..0e4d95f 100644
--- a/library/src/main/java/com/hjq/toast/ToastStrategy.java
+++ b/library/src/main/java/com/hjq/toast/ToastStrategy.java
@@ -105,7 +105,7 @@ public IToast createToast(IToastStyle> style) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
Settings.canDrawOverlays(mApplication)) {
// 如果有悬浮窗权限,就开启全局的 Toast
- toast = new ApplicationToast(mApplication);
+ toast = new GlobalToast(mApplication);
} else if (foregroundActivity != null) {
// 如果没有悬浮窗权限,就开启一个依附于 Activity 的 Toast
toast = new ActivityToast(foregroundActivity);
diff --git a/library/src/main/java/com/hjq/toast/Toaster.java b/library/src/main/java/com/hjq/toast/Toaster.java
index 70dd07f..f2dcdfd 100644
--- a/library/src/main/java/com/hjq/toast/Toaster.java
+++ b/library/src/main/java/com/hjq/toast/Toaster.java
@@ -284,7 +284,7 @@ public static IToastStrategy getStrategy() {
/**
* 设置 Toast 拦截器(可以根据显示的内容决定是否拦截这个Toast)
- * 场景:打印 Toast 内容日志、根据 Toast 内容是否包含敏感字来动态切换其他方式显示(这里可以使用我的另外一套框架 XToast)
+ * 场景:打印 Toast 内容日志、根据 Toast 内容是否包含敏感字来动态切换其他方式显示(这里可以使用我的另外一套框架 EasyWindow)
*/
public static void setInterceptor(IToastInterceptor interceptor) {
sToastInterceptor = interceptor;