管灌系统巡查员智能手机App
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.dayu.pipirrapp.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 (!TextUtils.isEmpty(s)) {
            if (context != null) {
                if (!TextUtils.isEmpty(context.getPackageName())) {
                    makeText(context, s, Toast.LENGTH_SHORT).show();
                }
            }
        }
 
    }
 
    public static void showToastLong(Context context, String s) {
        if (!TextUtils.isEmpty(s)) {
            if (context != null) {
                if (!TextUtils.isEmpty(context.getPackageName())) {
                    makeText(context, s, Toast.LENGTH_LONG).show();
                }
            }
        }
    }
 
    public static void showToast(Context context, String s) {
        if (s != null) {
            if (context != null) {
                if (!TextUtils.isEmpty(context.getPackageName())) {
                    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));
    }
 
 
}