protected void calculateSize(Context context, ArrayList<Object> plats) {
    int screenWidth = R.getScreenWidth(context);
    float ratio = ((float) screenWidth) / DESIGN_SCREEN_WIDTH_L;
    int cellWidth = (int) (DESIGN_CELL_WIDTH_L * ratio);
    lineSize = screenWidth / cellWidth;

    sepLineWidth = (int) (DESIGN_SEP_LINE_WIDTH * ratio);
    sepLineWidth = sepLineWidth < 1 ? 1 : sepLineWidth;
    logoHeight = (int) (DESIGN_LOGO_HEIGHT * ratio);
    paddingTop = (int) (DESIGN_PADDING_TOP * ratio);
    bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio);
    cellHeight = (screenWidth - sepLineWidth * 3) / (lineSize - 1);
    panelHeight = cellHeight + sepLineWidth;
  }
Esempio n. 2
0
 private void calPageSize() {
   float scrW = com.mob.tools.utils.R.getScreenWidth(getContext());
   float scrH = com.mob.tools.utils.R.getScreenHeight(getContext());
   float whR = scrW / scrH;
   if (whR < 0.63) {
     COLUMN_PER_LINE = 3;
     LINE_PER_PAGE = 3;
   } else if (whR < 0.75) {
     COLUMN_PER_LINE = 3;
     LINE_PER_PAGE = 2;
   } else {
     LINE_PER_PAGE = 1;
     if (whR >= 1.75) {
       COLUMN_PER_LINE = 6;
     } else if (whR >= 1.5) {
       COLUMN_PER_LINE = 5;
     } else if (whR >= 1.3) {
       COLUMN_PER_LINE = 4;
     } else {
       COLUMN_PER_LINE = 3;
     }
   }
   PAGE_SIZE = COLUMN_PER_LINE * LINE_PER_PAGE;
 }