package org.stepic.droid.util;

import android.content.Context;
import android.content.res.Resources;

public class DisplayUtils {
    // A method to find height of the status bar
    public static int getStatusBarHeight(Context context) {
        int result = 0;
        int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
        if (resourceId > 0) {
            result = context.getResources().getDimensionPixelSize(resourceId);
        }
        return result;
    }

    public static int getScreenHeight() {
        return Resources.getSystem().getDisplayMetrics().heightPixels;
    }
}

@@ -94,16 +94,72 @@
 sources;
+%0Aimport android.graphics.Rect;%0Aimport android.view.View;
 %0A%0Apublic
@@ -684,11 +684,551 @@
 s;%0A    %7D
+%0A%0A    public static int getScreenWidth() %7B%0A        return Resources.getSystem().getDisplayMetrics().widthPixels;%0A    %7D%0A%0A    public static boolean isVisible(final View view) %7B%0A        if (view == null) %7B%0A            return false;%0A        %7D%0A        if (!view.isShown()) %7B%0A            return false;%0A        %7D%0A        final Rect actualPosition = new Rect();%0A        view.getGlobalVisibleRect(actualPosition);%0A        final Rect screen = new Rect(0, 0, getScreenWidth(), getScreenHeight());%0A        return actualPosition.intersect(screen);%0A    %7D
 %0A%7D%0A

update display utils