package com.zhaohaoting.framework.utils;

import android.os.Looper;
import android.view.Gravity;
import android.widget.Toast;

import com.zhaohaoting.framework.application.ZhtApplication;

/**
 * author：Created by ZHT on 2016/8/23 14:55
 * email：526309416@qq.com
 * desc： Toast工具类
 */
public class ToastUtils {

    public static void show(final String msg) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                Looper.prepare();
                Toast toast = Toast.makeText(ZhtApplication.getContext(), msg, Toast.LENGTH_SHORT);
                toast.setGravity(Gravity.CENTER, 0, 0);
                toast.show();
                Looper.loop();
            }
        }).start();
    }
    public static void show(final int msg) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                Looper.prepare();
                Toast toast = Toast.makeText(ZhtApplication.getContext(), msg, Toast.LENGTH_SHORT);
                toast.setGravity(Gravity.CENTER, 0, 0);
                toast.show();
                Looper.loop();
            }
        }).start();
    }
}
