Skip to content

Commit 7606718

Browse files
committed
将静态操作 EasyWindow 对象的方法抽取到单独的类中
1 parent 453790a commit 7606718

4 files changed

Lines changed: 423 additions & 384 deletions

File tree

README.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -370,39 +370,40 @@ easyWindow.cancelAllTask();
370370

371371
```java
372372
// 取消所有正在显示的悬浮窗
373-
EasyWindow.cancelAllWindow();
373+
EasyWindowManager.cancelAllWindow();
374374
// 取消特定类名的悬浮窗
375-
EasyWindow.cancelWindowByClass(@Nullable Class<? extends EasyWindow<?>> clazz);
375+
EasyWindowManager.cancelWindowByClass(@Nullable Class<? extends EasyWindow<?>> clazz);
376376
// 取消特定标记的悬浮窗
377-
EasyWindow.cancelWindowByTag(@Nullable String tag);
377+
EasyWindowManager.cancelWindowByTag(@Nullable String tag);
378378

379379
// 显示所有已取消但未回收的悬浮窗
380-
EasyWindow.showAllWindow();
380+
EasyWindowManager.showAllWindow();
381381
// 显示特定类名已取消但未回收的悬浮窗
382-
EasyWindow.showWindowByClass(@Nullable Class<? extends EasyWindow<?>> clazz);
382+
EasyWindowManager.showWindowByClass(@Nullable Class<? extends EasyWindow<?>> clazz);
383383
// 显示特定标记已取消但未回收的悬浮窗
384-
EasyWindow.showWindowByTag(@Nullable String tag);
384+
EasyWindowManager.showWindowByTag(@Nullable String tag);
385385

386386
// 回收所有正在显示的悬浮窗
387-
EasyWindow.recycleAllWindow();
387+
EasyWindowManager.recycleAllWindow();
388388
// 回收特定类名的悬浮窗
389-
EasyWindow.recycleWindowByClass(@Nullable Class<? extends EasyWindow<?>> clazz);
389+
EasyWindowManager.recycleWindowByClass(@Nullable Class<? extends EasyWindow<?>> clazz);
390390
// 回收特定标记的悬浮窗
391-
EasyWindow.recycleWindowByTag(@Nullable String tag);
391+
EasyWindowManager.recycleWindowByTag(@Nullable String tag);
392392

393393
// 判断当前是否有悬浮窗正在显示
394-
EasyWindow.existAnyWindowShowing();
394+
EasyWindowManager.existAnyWindowShowing();
395395
// 判断当前是否有特定类名的悬浮窗正在显示
396-
EasyWindow.existWindowShowingByClass(@Nullable Class<? extends EasyWindow<?>> clazz);
396+
EasyWindowManager.existWindowShowingByClass(@Nullable Class<? extends EasyWindow<?>> clazz);
397397
// 判断当前是否有特定标记的悬浮窗正在显示
398-
EasyWindow.existWindowShowingByTag(@Nullable String tag);
398+
EasyWindowManager.existWindowShowingByTag(@Nullable String tag);
399+
400+
// 寻找特定类名的悬浮窗
401+
EasyWindowManager.findWindowInstanceByClass(@Nullable Class<? extends EasyWindow<?>> clazz);
402+
// 寻找特定标记的悬浮窗
403+
EasyWindowManager.findWindowInstanceByTag(@Nullable String tag);
399404

400405
// 获取所有的悬浮窗
401-
EasyWindow.getAllWindowInstance();
402-
// 获取特定类名的悬浮窗
403-
EasyWindow.getWindowInstanceByClass(@Nullable Class<? extends EasyWindow<?>> clazz);
404-
// 获取特定标记的悬浮窗
405-
EasyWindow.getWindowInstanceByTag(@Nullable String tag);
406+
EasyWindowManager.getAllWindowInstance();
406407
```
407408

408409
#### 作者的其他开源项目

app/src/main/java/com/hjq/window/demo/MainActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.hjq.permissions.XXPermissions;
3030
import com.hjq.toast.Toaster;
3131
import com.hjq.window.EasyWindow;
32+
import com.hjq.window.EasyWindowManager;
3233
import com.hjq.window.OnWindowLayoutInflateListener;
3334
import com.hjq.window.OnWindowLifecycleCallback;
3435
import com.hjq.window.OnWindowViewClickListener;
@@ -348,7 +349,7 @@ public void onDenied(@NonNull List<String> permissions, boolean doNotAskAgain) {
348349
// 关闭当前正在显示的悬浮窗
349350
// EasyWindow.cancelAll();
350351
// 回收当前正在显示的悬浮窗
351-
EasyWindow.recycleAllWindow();
352+
EasyWindowManager.recycleAllWindow();
352353

353354
} else if (viewId == R.id.btn_main_utils) {
354355

0 commit comments

Comments
 (0)