-
Notifications
You must be signed in to change notification settings - Fork 644
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43eae9c
commit c9d41fa
Showing
6 changed files
with
49 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
app/src/main/java/com/sunfusheng/StickyHeaderListView/util/ToastTip.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.sunfusheng.StickyHeaderListView.util; | ||
|
||
import android.content.Context; | ||
import android.text.TextUtils; | ||
import android.widget.Toast; | ||
|
||
/** | ||
* Created by sunfusheng on 15/8/7. | ||
*/ | ||
public class ToastTip { | ||
|
||
private static Toast mToast; | ||
|
||
public static void show(Context context, String message) { | ||
if (TextUtils.isEmpty(message)) return; | ||
int duration; | ||
if (message.length() > 10) { | ||
duration = Toast.LENGTH_LONG; //如果字符串比较长,那么显示的时间也长一些。 | ||
} else { | ||
duration = Toast.LENGTH_SHORT; | ||
} | ||
if (mToast == null) { | ||
mToast = Toast.makeText(context, message, duration); | ||
} else { | ||
mToast.setText(message); | ||
mToast.setDuration(duration); | ||
} | ||
mToast.show(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters