package com.kfzs.cfyl.media.util;

import android.content.Context;
import android.content.res.Resources;
import android.util.DisplayMetrics;
import android.widget.Toast;

/**
 * Created by realicing on 2018/12/6.
 * realicing@sina.com
 */
public class G {
    public static void showToast(Context context, String msg) {
        if(context != null)
            Toast.makeText(context.getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
    }
    public static void showToast(Context context, int msg) {
        if(context != null)
            Toast.makeText(context.getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
    }

    public static int HEIGHT = 1280;//屏幕高
    public static int WIDTH = 720;//屏幕宽
    public static float DENSITY = 2;//屏幕的Density
    public static int DENSITY_DPI = 320;//屏幕的Density
    public static void init(Resources resources) {
        DisplayMetrics metric = resources.getDisplayMetrics();
        G.DENSITY = metric.density;
        G.DENSITY_DPI = metric.densityDpi;
        WIDTH = metric.widthPixels;
        HEIGHT = metric.heightPixels;
    }
}
