package com.game.webgame.view;


import com.tsgame.tsgame_niuniu.system.Myapplication;

import android.content.Context;
import android.content.SharedPreferences;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.WindowManager;

public class pmutil {
	static String userid;
	static SharedPreferences sp;
	
	public static int pmw() {
	
		WindowManager manager = (WindowManager) Myapplication.application
				.getSystemService(Context.WINDOW_SERVICE);
		DisplayMetrics dm = new DisplayMetrics();
		manager.getDefaultDisplay().getMetrics(dm);
		int width2 = dm.widthPixels;
		return width2;
	}

	public static int pmh() {
		WindowManager manager = (WindowManager) Myapplication.application
				.getSystemService(Context.WINDOW_SERVICE);
		DisplayMetrics dm = new DisplayMetrics();
		manager.getDefaultDisplay().getMetrics(dm);

		int height2 = dm.heightPixels;
		return height2;
	}
	
	public static String Appname(){
		
		return getAppinfo.getAppName();
	
		
	}
	
	public static boolean isnullorEmpty(String name){
		boolean isflag=false;
		if(name==null||name.trim().length()==0){
			isflag=true;
		}
		return isflag;
		
	}
	
	public  static int dp2px(int dpval,Context context) {
		return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
				dpval, context.getResources().getDisplayMetrics());
	}

	public static int sp2px(int spval,Context context) {

		return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,
				spval, context.getResources().getDisplayMetrics());

	}
}
