Skip to content

Commit e265a2e

Browse files
committed
新增 setWindowViewVisibility 方法来代替 setWindowVisibility 方法
新增 getWindowViewVisibility 方法来代替 getWindowVisibility 方法
1 parent de60b4a commit e265a2e

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ easyWindow.setBlurBehindRadius(@IntRange(from = 0) int blurBehindRadius);
315315
easyWindow.setScreenOrientation(int screenOrientation);
316316

317317
// 设置悬浮窗可见性
318-
easyWindow.setWindowVisibility(int visibility);
318+
easyWindow.setWindowViewVisibility(int visibility);
319319
// 获取悬浮窗可见性
320-
easyWindow.getWindowVisibility();
320+
easyWindow.getWindowViewVisibility();
321321
// 设置悬浮窗根布局(一般情况下推荐使用 {@link #setContentView} 方法来填充布局)
322322
easyWindow.setRootLayout(@NonNull ViewGroup viewGroup);
323323
// 重新设置 WindowManager 参数集

library/src/main/java/com/hjq/window/EasyWindow.java

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ public void delayRecycle() {
11551155
}
11561156

11571157
/**
1158-
* 获取悬浮窗可见性
1158+
* @deprecated 该 API 已经过时,随时会被删除,请尽早迁移到 {@link #getWindowVisibility()}
11591159
*/
11601160
public int getWindowVisibility() {
11611161
if (mRootLayout == null) {
@@ -1165,18 +1165,35 @@ public int getWindowVisibility() {
11651165
}
11661166

11671167
/**
1168-
* 设置悬浮窗可见性
1168+
* 获取窗口视图可见性
1169+
*/
1170+
public int getWindowViewVisibility() {
1171+
if (mRootLayout == null) {
1172+
return View.GONE;
1173+
}
1174+
return mRootLayout.getVisibility();
1175+
}
1176+
1177+
/**
1178+
* @deprecated 该 API 已经过时,随时会被删除,请尽早迁移到 {@link #setWindowViewVisibility(int)}
1179+
*/
1180+
public X setWindowVisibility(int visibility) {
1181+
return setWindowViewVisibility(visibility);
1182+
}
1183+
1184+
/**
1185+
* 设置窗口视图的可见性
11691186
*
1170-
* @param visibility 窗口可见性类型,有三种类型:
1187+
* @param visibility 可见性类型,有三种类型:
11711188
* {@link View#VISIBLE}
11721189
* {@link View#INVISIBLE}
11731190
* {@link View#GONE}
11741191
*/
1175-
public X setWindowVisibility(int visibility) {
1192+
public X setWindowViewVisibility(int visibility) {
11761193
if (mRootLayout == null) {
11771194
return (X) this;
11781195
}
1179-
if (getWindowVisibility() == visibility) {
1196+
if (mRootLayout.getVisibility() == visibility) {
11801197
return (X) this;
11811198
}
11821199
mRootLayout.setVisibility(visibility);

0 commit comments

Comments
 (0)