/** * Divide screen width to grid. * * @param ctx * @param gridWidth * @param skipWidth * @param gridHeight * @param skipHeight * @param spacing * @return */ public static int divideScreenWidth( Context ctx, int gridWidth, int skipWidth, int gridHeight, int skipHeight, int spacing) { MyLogger.showLogWithLineNum(2, "Screen: " + getScreenWidth(ctx) + "X" + getScreenHeight(ctx)); int result = (int) Math.round(getScreenWidth(ctx) / gridWidth) * (int) Math.round((getScreenHeight(ctx) - skipHeight) / gridHeight); MyLogger.showLogWithLineNum( 2, "Cols: " + Math.round(getScreenWidth(ctx) / gridWidth) + ", Rows: " + (int) Math.round((getScreenHeight(ctx) - skipHeight) / gridHeight)); return result; }