@@ -0,0 +1,3082 @@
+package de.nenick.espressomacchiato.matchers;%0A%0Aimport android.content.Context;%0Aimport android.graphics.Rect;%0Aimport android.support.test.espresso.matcher.ViewMatchers;%0Aimport android.util.DisplayMetrics;%0Aimport android.util.TypedValue;%0Aimport android.view.View;%0Aimport android.view.WindowManager;%0A%0Aimport org.hamcrest.Description;%0Aimport org.hamcrest.Matcher;%0Aimport org.hamcrest.TypeSafeMatcher;%0A%0Aimport static android.support.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;%0A%0Apublic class EspDisplayedMatchers %7B%0A%0A    /**%0A     * Returns a matcher which accepts a view which is not displayed.%0A     * That means the view would only be visible when you scroll to it.%0A     */%0A    public static Matcher%3CView%3E isNotDisplaying() %7B%0A        return new TypeSafeMatcher%3CView%3E() %7B%0A            @Override%0A            public void describeTo(Description description) %7B%0A                description.appendText(%22No part of the view's area is displayed to the user.%22);%0A            %7D%0A%0A            @Override%0A            public boolean matchesSafely(View view) %7B%0A                Rect visibleParts = new Rect();%0A                boolean visibleAtAll = view.getGlobalVisibleRect(visibleParts);%0A                if (!visibleAtAll) %7B%0A                    return true;%0A                %7D%0A%0A                Rect screen = getScreenWithoutStatusBarActionBar(view);%0A                int viewHeight = (view.getHeight() %3E screen.height()) ? screen.height() : view.getHeight();%0A                int viewWidth = (view.getWidth() %3E screen.width()) ? screen.width() : view.getWidth();%0A%0A                double maxArea = viewHeight * viewWidth;%0A                double visibleArea = visibleParts.height() * visibleParts.width();%0A                int displayedPercentage = (int) ((visibleArea / maxArea) * 100);%0A%0A                return displayedPercentage == 0%0A                        && withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE).matches(view);%0A            %7D%0A%0A            private Rect getScreenWithoutStatusBarActionBar(View view) %7B%0A                DisplayMetrics m = new DisplayMetrics();%0A                ((WindowManager) view.getContext().getSystemService(Context.WINDOW_SERVICE))%0A                        .getDefaultDisplay().getMetrics(m);%0A%0A                // Get status bar height%0A                int resourceId = view.getContext().getResources()%0A                        .getIdentifier(%22status_bar_height%22, %22dimen%22, %22android%22);%0A                int statusBarHeight = (resourceId %3E 0) ? view.getContext().getResources()%0A                        .getDimensionPixelSize(resourceId) : 0;%0A%0A                // Get action bar height%0A                TypedValue tv = new TypedValue();%0A                int actionBarHeight = (view.getContext().getTheme().resolveAttribute(%0A                        android.R.attr.actionBarSize, tv, true)) ? TypedValue.complexToDimensionPixelSize(%0A                        tv.data, view.getContext().getResources().getDisplayMetrics()) : 0;%0A%0A                return new Rect(0, 0, m.widthPixels, m.heightPixels - (statusBarHeight + actionBarHeight));%0A            %7D%0A        %7D;%0A    %7D%0A%7D%0A

extend isHidden assertion and provide swipeUpAction