package com.dayu.qiheonlinelibrary.utils;
|
|
import android.content.Context;
|
import android.text.TextUtils;
|
import android.widget.Toast;
|
|
/**
|
* Toast工具类
|
*/
|
public class ToastUtil {
|
|
|
private static Toast makeText(Context context, CharSequence text, int duration) {
|
return Toast.makeText(context, text, duration);
|
}
|
|
public static void showToastShort(Context context, String s) {
|
if (s != null) {
|
if (!TextUtils.isEmpty(s))
|
makeText(context, s, Toast.LENGTH_SHORT).show();
|
}
|
}
|
|
public static void showToastLong(Context context, String s) {
|
if (!TextUtils.isEmpty(s)) {
|
makeText(context, s, Toast.LENGTH_LONG).show();
|
}
|
}
|
|
public static void showToast(Context context, String s) {
|
if (s != null) {
|
makeText(context, s, Toast.LENGTH_LONG).show();
|
}
|
}
|
|
public static void showToast(Context context, int resId) {
|
showToastLong(context, context.getString(resId));
|
}
|
|
public static void showToastShort(Context context, int resId) {
|
showToastShort(context, context.getString(resId));
|
}
|
|
public static void showToastLong(Context context, int resId) {
|
showToastLong(context, context.getString(resId));
|
}
|
|
|
}
|