Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Commit 3879b4b

Browse files
committed
1.添加Toast重载
1 parent 8f62dc2 commit 3879b4b

File tree

3 files changed

+52
-6
lines changed

3 files changed

+52
-6
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
<a href="http://www.methodscount.com/?lib=com.github.Ayvytr%3AAndroidEasyDeveloper%3A1.0.0"><img src="https://img.shields.io/badge/Methods and size-core: 15 | deps: 19163 | 20 KB-e91e63.svg"/></a>
88

9+
#
910
#EasyAndroid Library
1011

1112
#[Chinese][README_CN.md]
@@ -52,9 +53,9 @@
5253
SeekBarPressure: double Thumb SeekBar
5354

5455
###Tool classes with out Context
55-
Convert: Type conversion class, modeled on the C# Convert class (for this
56-
kind of love have alone bell)
57-
Provides most of the basic types to bool, int, byte conversion, and isZero method
56+
Convert Type conversion class, modeled on the C# Convert class (for this
57+
kind of love have alone bell)
58+
Provides most of the basic types to bool, int, byte conversion, and isZero methods
5859
toBool
5960
izZero
6061
toInt
@@ -298,7 +299,7 @@
298299
###TODO:
299300
1. Complements Convert class
300301
2. Create my PrettyVideoPlayer
301-
3. Complements my library
302+
3. Complements my library, Add more useful features
302303
4. Personal website
303-
5. Separate Android and Java code
304+
5. Separate Android and Java code, Packaged into different libraries
304305
6. Publish to JCenter

README_CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
<a href="http://www.methodscount.com/?lib=com.github.Ayvytr%3AAndroidEasyDeveloper%3A1.0.0"><img src="https://img.shields.io/badge/Methods and size-core: 15 | deps: 19163 | 20 KB-e91e63.svg"/></a>
88

9+
#
910
#EasyAndroid 库
1011

1112
#[English][README.md]

easyAndroidLibrary/src/main/java/com/ayvytr/easyandroidlibrary/tools/withcontext/ToastTool.java

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
package com.ayvytr.easyandroidlibrary.tools.withcontext;
22

3+
import android.support.annotation.StringRes;
34
import android.widget.Toast;
45

56
import com.ayvytr.easyandroidlibrary.Easy;
67
import com.ayvytr.easyandroidlibrary.exception.UnsupportedInitializationException;
78

89
/**
910
* Toast工具类,提供简便的Toast创建和输出功能.
10-
* @see Toast
11+
*
1112
* @author Ayvytr <a href="https://github.com/Ayvytr" target="_blank">'s GitHub</a>
13+
* @see Toast
1214
* @since 1.0.0
1315
*/
1416

@@ -60,4 +62,46 @@ public static void showLong(String text)
6062
{
6163
makeLong(text).show();
6264
}
65+
66+
/**
67+
* 创建Toast并返回
68+
*
69+
* @param id string id
70+
* @return Toast
71+
*/
72+
public static Toast make(@StringRes int id)
73+
{
74+
return Toast.makeText(Easy.getContext(), id, Toast.LENGTH_SHORT);
75+
}
76+
77+
/**
78+
* 创建LENGTH_LONG Toast并返回
79+
*
80+
* @param id string id
81+
* @return Toast
82+
*/
83+
public static Toast makeLong(@StringRes int id)
84+
{
85+
return Toast.makeText(Easy.getContext(), id, Toast.LENGTH_LONG);
86+
}
87+
88+
/**
89+
* 显示Toast
90+
*
91+
* @param id string id
92+
*/
93+
public static void show(@StringRes int id)
94+
{
95+
make(id).show();
96+
}
97+
98+
/**
99+
* 显示LENGTH_LONG Toast
100+
*
101+
* @param id string id
102+
*/
103+
public static void showLong(@StringRes int id)
104+
{
105+
makeLong(id).show();
106+
}
63107
}

0 commit comments

Comments
 (0)