Created
January 28, 2020 06:37
-
-
Save Lukmannudin/36ded6ce67c7137723449d10595a1c72 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| public class ToastMatcher extends TypeSafeMatcher<Root> { | |
| @Override | |
| public void describeTo(Description description) { | |
| description.appendText("is toast"); | |
| } | |
| @Override | |
| public boolean matchesSafely(Root root) { | |
| int type = root.getWindowLayoutParams().get().type; | |
| if ((type == WindowManager.LayoutParams.TYPE_TOAST)) { | |
| IBinder windowToken = root.getDecorView().getWindowToken(); | |
| IBinder appToken = root.getDecorView().getApplicationWindowToken(); | |
| return windowToken == appToken; | |
| } | |
| return false; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment