package com.zkjc.common.utils;

import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;

public class ToastUtil {

	@Deprecated
	public static void showToast(Context context,String msg) {
//		ToastUtils.show(msg);
         Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
	}

	@Deprecated
	public static void showToast(Context context,int resId) {
        Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
	}
	//这里使用到了一个Toast工具类，用户判断当前线程是否是主线程，是的话则直接弹出Toast，否则利用runOnUiThread来弹出Toast
	@Deprecated
	public static void showToast1(final Activity activity, final String message) {
		if ("main".equals(Thread.currentThread().getName())) {
			Log.e("ToastUtil", "在主线程");
			Toast.makeText(activity, message, Toast.LENGTH_SHORT).show();
		} else {
			activity.runOnUiThread(new Runnable() {
				@Override
				public void run() {
					Log.e("ToastUtil", "不在主线程");
					Toast.makeText(activity, message, Toast.LENGTH_SHORT).show();
				}
			});
		}
	}

}
