static float dpToPixel(float dp, Resources resources) {
        DisplayMetrics metrics = resources.getDisplayMetrics();
        return metrics.density * dp;
    }
Converts from device independent pixels (dp or dip) to
device dependent pixels. This method returns the input
multiplied by the display's density. The result is not
rounded nor clamped.

The value returned by this method is well suited for
drawing with the Canvas API but should not be used to
set layout dimensions.

@param dp The value in dp to convert to pixels
@param resources An instances of Resources
blockcanary-android/src/main/java/com/github/moduth/blockcanary/ui/BlockCanaryUi.java