-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option to subscribe to overlay status: overlay showing or o…
…verlay closed
- Loading branch information
1 parent
2857f75
commit a861816
Showing
5 changed files
with
70 additions
and
30 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
...id/src/main/java/flutter/overlay/window/flutter_overlay_window/CachedMessageChannels.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package flutter.overlay.window.flutter_overlay_window; | ||
|
||
import androidx.annotation.Nullable; | ||
import io.flutter.plugin.common.BasicMessageChannel; | ||
import io.flutter.plugin.common.MethodChannel; | ||
|
||
public abstract class CachedMessageChannels { | ||
@Nullable | ||
public static BasicMessageChannel<Object> mainAppMessageChannel; | ||
public static MethodChannel mainAppMessageChannel; | ||
@Nullable | ||
public static BasicMessageChannel<Object> overlayMessageChannel; | ||
public static MethodChannel overlayMessageChannel; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...oid/src/main/java/flutter/overlay/window/flutter_overlay_window/OverlayStatusEmitter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package flutter.overlay.window.flutter_overlay_window; | ||
|
||
public abstract class OverlayStatusEmitter { | ||
static private final String methodName = "isShowingOverlay"; | ||
static private boolean lastEmittedStatus; | ||
|
||
static void emitIsShowing(boolean isShowing) { | ||
if(isShowing == lastEmittedStatus) return; | ||
lastEmittedStatus = isShowing; | ||
if(CachedMessageChannels.mainAppMessageChannel != null) { | ||
CachedMessageChannels.mainAppMessageChannel.invokeMethod(methodName, isShowing); | ||
} | ||
if(CachedMessageChannels.overlayMessageChannel != null) { | ||
CachedMessageChannels.overlayMessageChannel.invokeMethod(methodName, isShowing); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters