3 changed files with 36 additions and 16 deletions
@ -0,0 +1,29 @@ |
|||||||
|
package cc.niushuai.dididone.util; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.widget.Toast; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
|
||||||
|
public class Toasts { |
||||||
|
|
||||||
|
public static void shortShow(Context context, String msg) { |
||||||
|
shortShow(context, msg, null); |
||||||
|
} |
||||||
|
|
||||||
|
public static void shortShow(Context context, String msg, String... params) { |
||||||
|
show(context, Toast.LENGTH_SHORT, msg, params); |
||||||
|
} |
||||||
|
|
||||||
|
public static void longShow(Context context, String msg) { |
||||||
|
longShow(context, msg, null); |
||||||
|
} |
||||||
|
|
||||||
|
public static void longShow(Context context, String msg, String... params) { |
||||||
|
show(context, Toast.LENGTH_SHORT, msg, params); |
||||||
|
} |
||||||
|
|
||||||
|
public static void show(Context context, int duration, String msg, String... params) { |
||||||
|
Toast.makeText(context, StrUtil.format(msg, params), duration).show(); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue