@@ -425,7 +425,7 @@ public static synchronized EasyWindow<?> getWindowInstanceByTag(@Nullable String
425425 */
426426 @ SuppressWarnings ("deprecation" )
427427 public EasyWindow (@ NonNull Activity activity ) {
428- this (( Context ) activity );
428+ initWindow ( activity );
429429
430430 Window window = activity .getWindow ();
431431 View decorView = window .getDecorView ();
@@ -461,7 +461,7 @@ public EasyWindow(@NonNull Activity activity) {
461461 */
462462 @ SuppressWarnings ("deprecation" )
463463 public EasyWindow (@ NonNull Application application ) {
464- this (( Context ) application );
464+ initWindow ( application );
465465
466466 // 设置成全局的悬浮窗,注意需要先申请悬浮窗权限,推荐使用:https://github.com/getActivity/XXPermissions
467467 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
@@ -476,7 +476,7 @@ public EasyWindow(@NonNull Application application) {
476476 */
477477 @ SuppressWarnings ("deprecation" )
478478 public EasyWindow (@ NonNull AccessibilityService service ) {
479- this (( Context ) service );
479+ initWindow ( service );
480480
481481 if (VERSION .SDK_INT >= VERSION_CODES .LOLLIPOP_MR1 ) {
482482 setWindowType (WindowManager .LayoutParams .TYPE_ACCESSIBILITY_OVERLAY );
@@ -485,7 +485,7 @@ public EasyWindow(@NonNull AccessibilityService service) {
485485 }
486486 }
487487
488- private EasyWindow (@ NonNull Context context ) {
488+ protected void initWindow (@ NonNull Context context ) {
489489 mContext = context ;
490490 mWindowRootLayout = new WindowRootLayout (context );
491491 mWindowManager = ((WindowManager ) context .getSystemService (Context .WINDOW_SERVICE ));
0 commit comments