package com.jiuqi.njt.util; import android.app.Activity; import android.content.Context; import android.content.Intent; import com.jiuqi.util.UIUtil; public class ActivityUtil { public static int width = 0; public static int height = 0; public static int textsize = 0; public static int onemargin = 0; public static int margin = 0; public static int twomargin = 0; public static int Jheight = 0; public static int oneheight = 0; public static int dateheight = 0; public static int twoheight = 0; public static int cententheight = 0; public static int ideaheight = 0; public static int getWindowWidth(Activity activity) { if (0 == width) { width = activity.getResources().getDisplayMetrics().widthPixels; } return width; } public static int getWindowHeight(Activity activity) { if (0 == height) { height = activity.getResources().getDisplayMetrics().heightPixels; } return height; } public static int getWindowWidth(Context activity) { if (0 == width) { width = activity.getResources().getDisplayMetrics().widthPixels; } return width; } public static int getWindowHeight(Context activity) { if (0 == height) { height = activity.getResources().getDisplayMetrics().heightPixels; } return height; } public static int getWindowTextSize(Context activity) { if (0 == textsize) { getWindowWidth(activity); textsize = (int) (width * 0.05); } return textsize; } public static int getWindowOneMargin(Context activity) { if (0 == onemargin) { int width = getWindowWidth(activity); onemargin = (int) (width * 0.02); } return onemargin; } public static int getWindowMargin(Context activity) { if (0 == margin) { int width = getWindowWidth(activity); margin = (int) (width * 0.03); } return margin; } public static int getWindowCententHeight(Context activity) { if (0 == cententheight) { int height = getWindowHeight(activity); cententheight = (int) (height * 0.15); } return cententheight; } public static int getWindowIdeaHeight(Context activity) { if (0 == ideaheight) { int height = getWindowHeight(activity); ideaheight = (int) (height * 0.12); } return ideaheight; } public static int getWindowDateHeight(Context activity) { if (0 == dateheight) { int height = getWindowHeight(activity); dateheight = (int) (height * 0.08); } return dateheight; } public static int getWindowTwoMargin(Context activity) { if (0 == twomargin) { int width = getWindowWidth(activity); twomargin = (int) (width * 0.04); } return twomargin; } public static int getWindowOneHeight(Context activity) { if (0 == oneheight) { int width = getWindowWidth(activity); oneheight = (int) (width * 0.2); } return oneheight; } public static int getWindowTwoHeight(Context activity) { if (0 == twoheight) { int width = getWindowWidth(activity); twoheight = (int) (width * 0.09); } return twoheight; } public static int getWindowJHeight(Context activity) { if (0 == Jheight) { int height = getWindowHeight(activity); Jheight = (int) (height * 0.01); } return Jheight; } }